deskflow/src/lib/gui/Hotkey.h

71 lines
1.6 KiB
C
Raw Normal View History

2012-06-10 16:50:54 +00:00
/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
* SPDX-FileCopyrightText: (C) 2012 - 2016 Synergy App Ltd
* 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
*/
#pragma once
2012-06-10 16:50:54 +00:00
#include <QList>
#include <QString>
2012-06-10 16:50:54 +00:00
#include <QTextStream>
#include "common/Action.h"
#include "common/KeySequence.h"
2012-06-10 16:50:54 +00:00
class HotkeyDialog;
class ServerConfigDialog;
class QSettings;
class Hotkey
{
friend class HotkeyDialog;
friend class ServerConfigDialog;
friend QTextStream &operator<<(QTextStream &outStream, const Hotkey &hotkey);
2012-06-10 16:50:54 +00:00
public:
Hotkey() = default;
2012-06-10 16:50:54 +00:00
QString text() const;
const KeySequence &keySequence() const
{
return m_keySequence;
}
const ActionList &actions() const
{
return m_actions;
}
2012-06-10 16:50:54 +00:00
void loadSettings(QSettings &settings);
void saveSettings(QSettings &settings) const;
bool operator==(const Hotkey &hk) const;
2012-06-10 16:50:54 +00:00
protected:
KeySequence &keySequence()
{
return m_keySequence;
}
void setKeySequence(const KeySequence &seq)
{
m_keySequence = seq;
}
ActionList &actions()
{
return m_actions;
}
2012-06-10 16:50:54 +00:00
private:
KeySequence m_keySequence = {};
ActionList m_actions = {};
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
};
using HotkeyList = QList<Hotkey>;
2012-06-10 16:50:54 +00:00
QTextStream &operator<<(QTextStream &outStream, const Hotkey &hotkey);