2012-06-10 16:50:54 +00:00
|
|
|
/*
|
2024-09-17 19:00:25 +00:00
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
2025-01-24 00:11:17 +00:00
|
|
|
* SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
|
2026-06-08 20:37:23 +00:00
|
|
|
* SPDX-FileCopyrightText: (C) 2012 - 2016 Synergy App Ltd
|
2025-01-24 00:11:17 +00:00
|
|
|
* SPDX-FileCopyrightText: (C) 2008 Volker Lanz <vl@fidra.de>
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
2012-06-10 16:50:54 +00:00
|
|
|
*/
|
2025-01-24 00:11:17 +00:00
|
|
|
|
2024-10-06 13:03:26 +00:00
|
|
|
#pragma once
|
2012-06-10 16:50:54 +00:00
|
|
|
|
|
|
|
|
#include <QList>
|
2024-07-02 19:07:06 +00:00
|
|
|
#include <QString>
|
2012-06-10 16:50:54 +00:00
|
|
|
#include <QTextStream>
|
|
|
|
|
|
2026-08-21 02:58:17 +00:00
|
|
|
#include "common/Action.h"
|
2026-08-21 02:53:26 +00:00
|
|
|
#include "common/KeySequence.h"
|
2012-06-10 16:50:54 +00:00
|
|
|
|
|
|
|
|
class HotkeyDialog;
|
|
|
|
|
class ServerConfigDialog;
|
|
|
|
|
class QSettings;
|
|
|
|
|
|
2024-10-17 18:04:35 +00:00
|
|
|
class Hotkey
|
|
|
|
|
{
|
2024-07-02 19:07:06 +00:00
|
|
|
friend class HotkeyDialog;
|
|
|
|
|
friend class ServerConfigDialog;
|
|
|
|
|
friend QTextStream &operator<<(QTextStream &outStream, const Hotkey &hotkey);
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
public:
|
2025-05-22 22:22:20 +00:00
|
|
|
Hotkey() = default;
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
QString text() const;
|
2024-10-17 18:04:35 +00:00
|
|
|
const KeySequence &keySequence() const
|
|
|
|
|
{
|
2025-01-05 21:39:07 +00:00
|
|
|
return m_keySequence;
|
2024-10-17 18:04:35 +00:00
|
|
|
}
|
|
|
|
|
const ActionList &actions() const
|
|
|
|
|
{
|
2025-01-05 21:48:41 +00:00
|
|
|
return m_actions;
|
2024-10-17 18:04:35 +00:00
|
|
|
}
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
void loadSettings(QSettings &settings);
|
|
|
|
|
void saveSettings(QSettings &settings) const;
|
2021-08-20 12:22:07 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
bool operator==(const Hotkey &hk) const;
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
protected:
|
2024-10-17 18:04:35 +00:00
|
|
|
KeySequence &keySequence()
|
|
|
|
|
{
|
2025-01-05 21:39:07 +00:00
|
|
|
return m_keySequence;
|
2024-10-17 18:04:35 +00:00
|
|
|
}
|
|
|
|
|
void setKeySequence(const KeySequence &seq)
|
|
|
|
|
{
|
2025-01-05 21:39:07 +00:00
|
|
|
m_keySequence = seq;
|
2024-10-17 18:04:35 +00:00
|
|
|
}
|
|
|
|
|
ActionList &actions()
|
|
|
|
|
{
|
2025-01-05 21:48:41 +00:00
|
|
|
return m_actions;
|
2024-10-17 18:04:35 +00:00
|
|
|
}
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
private:
|
2025-05-22 22:22:20 +00:00
|
|
|
KeySequence m_keySequence = {};
|
|
|
|
|
ActionList m_actions = {};
|
2025-01-05 21:28:47 +00:00
|
|
|
inline static const QString kSectionActions = QStringLiteral("actions");
|
|
|
|
|
inline static const QString kMousebutton = QStringLiteral("mousebutton(%1)");
|
|
|
|
|
inline static const QString kKeystroke = QStringLiteral("keystroke(%1)");
|
2012-06-10 16:50:54 +00:00
|
|
|
};
|
|
|
|
|
|
2024-11-27 16:51:48 +00:00
|
|
|
using HotkeyList = QList<Hotkey>;
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
QTextStream &operator<<(QTextStream &outStream, const Hotkey &hotkey);
|