From 99c6c809b961f2eb3c8538bfa50de7f2f98587ea Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Tue, 1 Oct 2024 06:14:36 -0500 Subject: Get configurations to apply when accepting. --- src/config.hpp | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'src/config.hpp') 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 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; -- cgit v1.2.3