Deskflow 1.26.0.418
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 - 2026 Chris Rizzitello <sithlord48@gmail.com>
4 * SPDX-FileCopyrightText: (C) 2012 - 2016 Synergy App 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 "common/Action.h"
16#include "common/KeySequence.h"
17
18class HotkeyDialog;
20class QSettings;
21
22class Hotkey
23{
24public:
25 Hotkey() = default;
26
27 QString text() const;
28 const KeySequence &keySequence() const
29 {
30 return m_keySequence;
31 }
32 void setKeySequence(const KeySequence &seq)
33 {
34 m_keySequence = seq;
35 }
36 const ActionList &actions() const
37 {
38 return m_actions;
39 }
40
41 Action &actionAt(int index);
42 void addAction(const Action &action);
43 void removeActionAt(int index);
44
45 void loadSettings(QSettings &settings);
46 void saveSettings(QSettings &settings) const;
47
48 bool operator==(const Hotkey &hk) const;
49
50private:
51 KeySequence m_keySequence = {};
52 ActionList m_actions = {};
53 inline static const QString kSectionActions = QStringLiteral("actions");
54 inline static const QString kMousebutton = QStringLiteral("mousebutton(%1)");
55 inline static const QString kKeystroke = QStringLiteral("keystroke(%1)");
56};
57
58using HotkeyList = QList<Hotkey>;
59
60QTextStream &operator<<(QTextStream &outStream, const Hotkey &hotkey);
QTextStream & operator<<(QTextStream &outStream, const Action &action)
Definition Action.cpp:205
QList< Action > ActionList
Definition Action.h:139
QList< Hotkey > HotkeyList
Definition Hotkey.h:58
Definition Action.h:34
Definition HotkeyDialog.h:21
Definition Hotkey.h:23
const KeySequence & keySequence() const
Definition Hotkey.h:28
void addAction(const Action &action)
Definition Hotkey.cpp:24
void removeActionAt(int index)
Definition Hotkey.cpp:31
const ActionList & actions() const
Definition Hotkey.h:36
Action & actionAt(int index)
Definition Hotkey.cpp:19
QString text() const
Definition Hotkey.cpp:13
void saveSettings(QSettings &settings) const
Definition Hotkey.cpp:54
bool operator==(const Hotkey &hk) const
Definition Hotkey.cpp:66
Hotkey()=default
void loadSettings(QSettings &settings)
Definition Hotkey.cpp:38
void setKeySequence(const KeySequence &seq)
Definition Hotkey.h:32
Definition KeySequence.h:16
Definition ServerConfigDialog.h:25