gui: Don't use friends to limit access to Hotkey

This commit is contained in:
Povilas Kanapickas 2021-01-10 13:39:37 +02:00
parent a691b31b8e
commit 0579101272
2 changed files with 4 additions and 9 deletions

View File

@ -68,8 +68,8 @@ void Hotkey::saveSettings(QSettings& settings) const
QTextStream& operator<<(QTextStream& outStream, const Hotkey& hotkey) QTextStream& operator<<(QTextStream& outStream, const Hotkey& hotkey)
{ {
for (int i = 0; i < hotkey.m_Actions.size(); i++) for (int i = 0; i < hotkey.actions().size(); i++)
outStream << "\t" << hotkey.text() << " = " << hotkey.m_Actions[i] << endl; outStream << "\t" << hotkey.text() << " = " << hotkey.actions()[i] << endl;
return outStream; return outStream;
} }

View File

@ -33,17 +33,14 @@ class QSettings;
class Hotkey class Hotkey
{ {
friend class HotkeyDialog;
friend QTextStream& operator<<(QTextStream& outStream, const Hotkey& hotkey);
public: public:
Hotkey(); Hotkey();
public:
QString text() const; QString text() const;
const KeySequence& keySequence() const { return m_KeySequence; } const KeySequence& keySequence() const { return m_KeySequence; }
const ActionList& actions() const { return m_Actions; } void setKeySequence(const KeySequence& seq) { m_KeySequence = seq; }
const ActionList& actions() const { return m_Actions; }
void appendAction(const Action& action) { m_Actions.append(action); } void appendAction(const Action& action) { m_Actions.append(action); }
void setAction(int index, const Action& action) { m_Actions[index] = action; } void setAction(int index, const Action& action) { m_Actions[index] = action; }
void removeAction(int index) { m_Actions.removeAt(index); } void removeAction(int index) { m_Actions.removeAt(index); }
@ -51,8 +48,6 @@ class Hotkey
void loadSettings(QSettings& settings); void loadSettings(QSettings& settings);
void saveSettings(QSettings& settings) const; void saveSettings(QSettings& settings) const;
protected:
void setKeySequence(const KeySequence& seq) { m_KeySequence = seq; }
private: private:
KeySequence m_KeySequence; KeySequence m_KeySequence;