diff options
Diffstat (limited to 'src/config.hpp')
-rw-r--r-- | src/config.hpp | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/config.hpp b/src/config.hpp index 95df6b6..5937a9b 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -129,7 +129,23 @@ struct GetsuyomiConfig { ShortcutMap shortcuts() const; }; +class ShortcutDisplay : public QWidget { + Q_OBJECT +public: + ShortcutDisplay(QWidget* parent, QKeySequence shortcut); + +signals: + void removeClicked(QKeySequence shortcut); +private: + QKeySequence m_binding; +private slots: + void removeOnClicked(); +}; + +constexpr auto foo = sizeof(QKeySequence); + class ShortcutCollector : public QWidget { + Q_OBJECT public: ShortcutCollector(QWidget* parent, ActionType action, Shortcuts& shortcuts); ~ShortcutCollector() = default; @@ -138,19 +154,25 @@ class ShortcutCollector : public QWidget { ShortcutCollector& operator=(const ShortcutCollector&) = delete; ShortcutCollector& operator=(ShortcutCollector&&) = delete; +private: + void createBinding(QKeySequence binding); + private slots: - void removeShortcut(int row, int); + void checkBinding(); + void addBinding(); + void removeBinding(QKeySequence shortcut); private: ActionType m_action; Shortcuts& m_shortcuts; + std::map<QKeySequence, ShortcutDisplay*> m_bindings; QKeySequenceEdit* m_shortcutEditor{nullptr}; - QGridLayout* m_layout{nullptr}; - ShortcutList m_actionList{}; - QTableWidget* m_shortcutTable{nullptr}; + QPushButton* m_acceptButton{nullptr}; + QVBoxLayout* m_layout{nullptr}; }; class Settings : public QDialog { + Q_OBJECT public: Settings(QWidget* parent, Shortcuts&& shortcuts); Settings(const Settings&) = delete; |