summaryrefslogtreecommitdiff
path: root/src/config.hpp
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2024-10-01 06:14:36 -0500
committerDominick Allen <djallen@librehumanitas.org>2024-10-01 06:14:36 -0500
commit99c6c809b961f2eb3c8538bfa50de7f2f98587ea (patch)
tree29f27cc33d08b5fc158a3ddbb885114ce4e00493 /src/config.hpp
parenta6b4485ac5ea0673e0ce35dab14e2df26c27823e (diff)
Get configurations to apply when accepting.
Diffstat (limited to 'src/config.hpp')
-rw-r--r--src/config.hpp30
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;