libqutim  0.3.1.0
shortcut.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** qutIM - instant messenger
4 **
5 ** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru>
6 **
7 *****************************************************************************
8 **
9 ** $QUTIM_BEGIN_LICENSE$
10 ** This program is free software: you can redistribute it and/or modify
11 ** it under the terms of the GNU General Public License as published by
12 ** the Free Software Foundation, either version 3 of the License, or
13 ** (at your option) any later version.
14 **
15 ** This program is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 ** See the GNU General Public License for more details.
19 **
20 ** You should have received a copy of the GNU General Public License
21 ** along with this program. If not, see http://www.gnu.org/licenses/.
22 ** $QUTIM_END_LICENSE$
23 **
24 ****************************************************************************/
25 
26 #ifndef SHORTCUT_H
27 #define SHORTCUT_H
28 
29 #include <QShortcut>
30 #include "localizedstring.h"
31 
32 namespace qutim_sdk_0_3
33 {
34 class ShortcutPrivate;
35 class GlobalShortcutPrivate;
36 
37 // REMOVE ME, it's ugly
39 {
40  QString id;
43  QKeySequence key;
44  Qt::ShortcutContext context;
45 };
46 
47 class LIBQUTIM_EXPORT Shortcut : public QShortcut
48 {
49  Q_OBJECT
50  Q_DECLARE_PRIVATE(Shortcut)
51 public:
52  explicit Shortcut(const QString &id, QWidget *parent);
53  virtual ~Shortcut();
54 
55  static bool registerSequence(const QString &id, const LocalizedString &name,
56  const LocalizedString &group, const QKeySequence &key,
57  Qt::ShortcutContext context = Qt::WindowShortcut);
58  static QStringList ids();
59  static KeySequence getSequence(const QString &id);
60  static void setSequence(const QString &id,const QKeySequence &key);
61 protected:
62  QScopedPointer<ShortcutPrivate> d_ptr;
63 };
64 
65 class LIBQUTIM_EXPORT GlobalShortcut : public QObject
66 {
67  Q_OBJECT
68  Q_DECLARE_PRIVATE(GlobalShortcut)
69 public:
70  explicit GlobalShortcut(const QString &id, QObject *parent = 0);
71  virtual ~GlobalShortcut();
72 
73  static bool registerSequence(const QString &id, const LocalizedString &name,
74  const LocalizedString &group, const QKeySequence &key);
75  static QStringList ids();
76  static KeySequence getSequence(const QString &id);
77  static void setSequence(const QString &id,const QKeySequence &key);
78 signals:
79  void activated();
80 private slots:
81  void onHotKeyPressed(quint32);
82 protected:
83  QScopedPointer<GlobalShortcutPrivate> d_ptr;
84 };
85 }
86 
87 #endif // SHORTCUT_H
88 

Generated by Doxygen