refactor: Hotkey, use internal keySequence in place of function calls
This commit is contained in:
parent
ef0d929251
commit
9eb0371a92
2 changed files with 10 additions and 10 deletions
|
|
@ -20,19 +20,19 @@
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
Hotkey::Hotkey() : m_KeySequence(), m_Actions()
|
Hotkey::Hotkey() : m_keySequence{}, m_Actions()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Hotkey::text() const
|
QString Hotkey::text() const
|
||||||
{
|
{
|
||||||
return keySequence().isMouseButton() ? kMousebutton.arg(keySequence().toString())
|
return m_keySequence.isMouseButton() ? kMousebutton.arg(m_keySequence.toString())
|
||||||
: kKeystroke.arg(keySequence().toString());
|
: kKeystroke.arg(m_keySequence.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hotkey::loadSettings(QSettings &settings)
|
void Hotkey::loadSettings(QSettings &settings)
|
||||||
{
|
{
|
||||||
keySequence().loadSettings(settings);
|
m_keySequence.loadSettings(settings);
|
||||||
|
|
||||||
actions().clear();
|
actions().clear();
|
||||||
int num = settings.beginReadArray(kSectionActions);
|
int num = settings.beginReadArray(kSectionActions);
|
||||||
|
|
@ -48,7 +48,7 @@ void Hotkey::loadSettings(QSettings &settings)
|
||||||
|
|
||||||
void Hotkey::saveSettings(QSettings &settings) const
|
void Hotkey::saveSettings(QSettings &settings) const
|
||||||
{
|
{
|
||||||
keySequence().saveSettings(settings);
|
m_keySequence.saveSettings(settings);
|
||||||
|
|
||||||
settings.beginWriteArray(kSectionActions);
|
settings.beginWriteArray(kSectionActions);
|
||||||
for (int i = 0; i < actions().size(); i++) {
|
for (int i = 0; i < actions().size(); i++) {
|
||||||
|
|
@ -60,7 +60,7 @@ void Hotkey::saveSettings(QSettings &settings) const
|
||||||
|
|
||||||
bool Hotkey::operator==(const Hotkey &hk) const
|
bool Hotkey::operator==(const Hotkey &hk) const
|
||||||
{
|
{
|
||||||
return m_KeySequence == hk.m_KeySequence && m_Actions == hk.m_Actions;
|
return m_keySequence == hk.keySequence() && m_Actions == hk.m_Actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextStream &operator<<(QTextStream &outStream, const Hotkey &hotkey)
|
QTextStream &operator<<(QTextStream &outStream, const Hotkey &hotkey)
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ public:
|
||||||
QString text() const;
|
QString text() const;
|
||||||
const KeySequence &keySequence() const
|
const KeySequence &keySequence() const
|
||||||
{
|
{
|
||||||
return m_KeySequence;
|
return m_keySequence;
|
||||||
}
|
}
|
||||||
const ActionList &actions() const
|
const ActionList &actions() const
|
||||||
{
|
{
|
||||||
|
|
@ -56,11 +56,11 @@ public:
|
||||||
protected:
|
protected:
|
||||||
KeySequence &keySequence()
|
KeySequence &keySequence()
|
||||||
{
|
{
|
||||||
return m_KeySequence;
|
return m_keySequence;
|
||||||
}
|
}
|
||||||
void setKeySequence(const KeySequence &seq)
|
void setKeySequence(const KeySequence &seq)
|
||||||
{
|
{
|
||||||
m_KeySequence = seq;
|
m_keySequence = seq;
|
||||||
}
|
}
|
||||||
ActionList &actions()
|
ActionList &actions()
|
||||||
{
|
{
|
||||||
|
|
@ -68,7 +68,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KeySequence m_KeySequence;
|
KeySequence m_keySequence;
|
||||||
ActionList m_Actions;
|
ActionList m_Actions;
|
||||||
inline static const QString kSectionActions = QStringLiteral("actions");
|
inline static const QString kSectionActions = QStringLiteral("actions");
|
||||||
inline static const QString kMousebutton = QStringLiteral("mousebutton(%1)");
|
inline static const QString kMousebutton = QStringLiteral("mousebutton(%1)");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue