2012-06-10 16:50:54 +00:00
|
|
|
/*
|
2024-09-17 19:00:25 +00:00
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
2025-01-05 21:48:41 +00:00
|
|
|
* Copyright (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
|
2016-09-07 14:24:00 +00:00
|
|
|
* Copyright (C) 2012-2016 Symless Ltd.
|
2012-06-10 16:50:54 +00:00
|
|
|
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
|
2024-07-02 19:07:06 +00:00
|
|
|
*
|
2012-06-10 16:50:54 +00:00
|
|
|
* This package is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
2015-05-03 02:33:52 +00:00
|
|
|
* found in the file LICENSE that should have accompanied this file.
|
2024-07-02 19:07:06 +00:00
|
|
|
*
|
2012-06-10 16:50:54 +00:00
|
|
|
* This package is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
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>
|
|
|
|
|
|
|
|
|
|
#include "Action.h"
|
|
|
|
|
#include "KeySequence.h"
|
|
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
Hotkey();
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
public:
|
|
|
|
|
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-01-05 21:39:07 +00:00
|
|
|
KeySequence m_keySequence;
|
2025-01-05 21:48:41 +00:00
|
|
|
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);
|