swift
settingshotkeycomponent.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2015 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_GUI_COMPONENTS_SETTINGSHOTKEYCOMPONENT_H
7 #define SWIFT_GUI_COMPONENTS_SETTINGSHOTKEYCOMPONENT_H
8 
9 #include <QFrame>
10 #include <QObject>
11 #include <QScopedPointer>
12 #include <QWizardPage>
13 
14 #include "core/actionbind.h"
17 #include "gui/swiftguiexport.h"
18 #include "misc/icons.h"
19 #include "misc/identifierlist.h"
20 #include "misc/settingscache.h"
21 
22 namespace Ui
23 {
24  class CSettingsHotkeyComponent;
25 }
26 namespace swift::gui::components
27 {
30  {
31  Q_OBJECT
32 
33  public:
35  CSettingsHotkeyComponent(QWidget *parent = nullptr);
36 
38  virtual ~CSettingsHotkeyComponent() override;
39 
41  void saveSettings();
42 
44  void registerDummyPttEntry();
45 
47  void reloadHotkeysFromSettings();
48 
49  private:
50  void addEntry();
51  void editEntry();
52  void removeEntry();
53  void hotkeySlot(bool keyDown);
54  void addHotkeyToSettings(const swift::misc::input::CActionHotkey &actionHotkey);
55  void updateHotkeyInSettings(const swift::misc::input::CActionHotkey &oldValue,
56  const swift::misc::input::CActionHotkey &newValue);
57  void removeHotkeyFromSettings(const swift::misc::input::CActionHotkey &actionHotkey);
58  bool checkAndConfirmConflicts(const swift::misc::input::CActionHotkey &actionHotkey,
59  const swift::misc::input::CActionHotkeyList &ignore = {});
60  swift::misc::CIdentifierList getAllIdentifiers() const;
61  void resizeView();
62 
63  QScopedPointer<Ui::CSettingsHotkeyComponent> ui;
67  };
68  swift::core::CActionBind m_action { "/Test/Message", swift::misc::CIcons::StandardIconWrench16, this,
69  &CSettingsHotkeyComponent::hotkeySlot };
70  };
71 
75  class CConfigHotkeyWizardPage : public QWizardPage
76  {
77  Q_OBJECT
78 
79  public:
81  using QWizardPage::QWizardPage;
82 
84  void setConfigComponent(CSettingsHotkeyComponent *config) { m_config = config; }
85 
87  virtual bool validatePage() override;
88 
90  virtual void initializePage() override;
91 
92  private:
93  CSettingsHotkeyComponent *m_config = nullptr;
94  };
95 } // namespace swift::gui::components
96 
97 #endif // SWIFT_GUI_COMPONENTS_SETTINGSHOTKEYCOMPONENT_H
CActionBind binds a member function to an action.
Definition: actionbind.h:18
Wizard page for CConfigSimulatorComponent.
void setConfigComponent(CSettingsHotkeyComponent *config)
Set config.
Value object encapsulating a list of object identifiers.
Value object encapsulating a action hotkey.
Definition: actionhotkey.h:25
Value object encapsulating a list of hotkeys.
High level reusable GUI components.
Definition: aboutdialog.cpp:13
#define SWIFT_GUI_EXPORT
Export a class or function from the library.