Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
Hotkey.h
Go to the documentation of this file.
1/*
2 * Deskflow -- mouse and keyboard sharing utility
3 * SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
4 * SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
5 * SPDX-FileCopyrightText: (C) 2008 Volker Lanz <vl@fidra.de>
6 * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
7 */
8
9#pragma once
10
11#include <QList>
12#include <QString>
13#include <QTextStream>
14
15#include "Action.h"
16#include "KeySequence.h"
17
18class HotkeyDialog;
20class QSettings;
21
22class Hotkey
23{
24 friend class HotkeyDialog;
25 friend class ServerConfigDialog;
26 friend QTextStream &operator<<(QTextStream &outStream, const Hotkey &hotkey);
27
28public:
29 Hotkey() = default;
30
31 QString text() const;
32 const KeySequence &keySequence() const
33 {
34 return m_keySequence;
35 }
36 const ActionList &actions() const
37 {
38 return m_actions;
39 }
40
41 void loadSettings(QSettings &settings);
42 void saveSettings(QSettings &settings) const;
43
44 bool operator==(const Hotkey &hk) const;
45
46protected:
48 {
49 return m_keySequence;
50 }
51 void setKeySequence(const KeySequence &seq)
52 {
53 m_keySequence = seq;
54 }
56 {
57 return m_actions;
58 }
59
60private:
61 KeySequence m_keySequence = {};
62 ActionList m_actions = {};
63 inline static const QString kSectionActions = QStringLiteral("actions");
64 inline static const QString kMousebutton = QStringLiteral("mousebutton(%1)");
65 inline static const QString kKeystroke = QStringLiteral("keystroke(%1)");
66};
67
68using HotkeyList = QList<Hotkey>;
69
70QTextStream &operator<<(QTextStream &outStream, const Hotkey &hotkey);
QList< Action > ActionList
Definition Action.h:181
QTextStream & operator<<(QTextStream &outStream, const Hotkey &hotkey)
Definition Hotkey.cpp:52
QList< Hotkey > HotkeyList
Definition Hotkey.h:68
Definition HotkeyDialog.h:21
Definition Hotkey.h:23
friend QTextStream & operator<<(QTextStream &outStream, const Hotkey &hotkey)
Definition Hotkey.cpp:52
const KeySequence & keySequence() const
Definition Hotkey.h:32
const ActionList & actions() const
Definition Hotkey.h:36
friend class ServerConfigDialog
Definition Hotkey.h:25
friend class HotkeyDialog
Definition Hotkey.h:24
KeySequence & keySequence()
Definition Hotkey.h:47
QString text() const
Definition Hotkey.cpp:13
void saveSettings(QSettings &settings) const
Definition Hotkey.cpp:35
bool operator==(const Hotkey &hk) const
Definition Hotkey.cpp:47
Hotkey()=default
void loadSettings(QSettings &settings)
Definition Hotkey.cpp:19
ActionList & actions()
Definition Hotkey.h:55
void setKeySequence(const KeySequence &seq)
Definition Hotkey.h:51
Definition KeySequence.h:16
Definition ServerConfigDialog.h:23