| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#ifndef KSNIP_GLOBALHOTKEYHANDLER_H |
| 21 |
#define KSNIP_GLOBALHOTKEYHANDLER_H |
| 22 |
|
| 23 |
#include <QApplication> |
| 24 |
#include <QList> |
| 25 |
#include <QSharedPointer> |
| 26 |
|
| 27 |
#include "GlobalHotKey.h" |
| 28 |
#include "src/backend/config/IConfig.h" |
| 29 |
#include "src/common/enum/CaptureModes.h" |
| 30 |
#include "src/gui/actions/Action.h" |
| 31 |
|
| 32 |
class GlobalHotKeyHandler : public QObject |
| 33 |
{ |
| 34 |
Q_OBJECT |
| 35 |
public: |
| 36 |
explicit GlobalHotKeyHandler( |
| 37 |
const QList<CaptureModes> &supportedCaptureModes, |
| 38 |
const QSharedPointer<IPlatformChecker> &platformChecker, |
| 39 |
const QSharedPointer<IConfig> &config); |
| 40 |
~GlobalHotKeyHandler() override; |
| 41 |
void setEnabled(bool enabled); |
| 42 |
|
| 43 |
signals: |
| 44 |
void captureTriggered(CaptureModes captureMode) const; |
| 45 |
void actionTriggered(const Action &action) const; |
| 46 |
|
| 47 |
private: |
| 48 |
QSharedPointer<IConfig> mConfig; |
| 49 |
QList<QSharedPointer<GlobalHotKey>> mGlobalHotKeys; |
| 50 |
QList<CaptureModes> mSupportedCaptureModes; |
| 51 |
QSharedPointer<IPlatformChecker> mPlatformChecker; |
| 52 |
|
| 53 |
void removeHotKeys(); |
| 54 |
void createHotKey(const QKeySequence &keySequence, CaptureModes captureMode); |
| 55 |
void createHotKey(const Action &action); |
| 56 |
|
| 57 |
private slots: |
| 58 |
void setupHotKeys(); |
| 59 |
}; |
| 60 |
|
| 61 |
|
| 62 |
#endif |