Changeset View
Changeset View
Standalone View
Standalone View
src/Gui/SettingsDialog/ShortcutsOptionsPage.cpp
- This file was added.
1 | #include "ShortcutsOptionsPage.h" | ||||
---|---|---|---|---|---|
2 | | ||||
3 | #include "SpectacleConfig.h" | ||||
4 | | ||||
5 | #include <KLocalizedString> | ||||
6 | #include <KShortcutsEditor> | ||||
7 | | ||||
8 | #include <QButtonGroup> | ||||
9 | #include <QRadioButton> | ||||
10 | #include <QVBoxLayout> | ||||
11 | | ||||
12 | ShortcutsOptionsPage::ShortcutsOptionsPage(QWidget* parent) : SettingsPage(parent) | ||||
13 | { | ||||
14 | QVBoxLayout *mainLayout = new QVBoxLayout(this); | ||||
15 | setLayout(mainLayout); | ||||
16 | | ||||
17 | mEditor = new KShortcutsEditor(SpectacleConfig::instance()->shortCutActions, this, KShortcutsEditor::ActionType::GlobalAction); | ||||
18 | mainLayout->addWidget(mEditor); | ||||
19 | connect(mEditor, &KShortcutsEditor::keyChange, this, &ShortcutsOptionsPage::markDirty); | ||||
20 | } | ||||
21 | | ||||
22 | ShortcutsOptionsPage::~ShortcutsOptionsPage() | ||||
23 | { | ||||
24 | mEditor->undoChanges(); | ||||
25 | } | ||||
26 | | ||||
27 | | ||||
28 | void ShortcutsOptionsPage::resetChanges() | ||||
29 | { | ||||
30 | mEditor->undoChanges(); | ||||
31 | mChangesMade = false; | ||||
32 | } | ||||
33 | | ||||
34 | void ShortcutsOptionsPage::saveChanges() | ||||
35 | { | ||||
36 | mEditor->commit(); | ||||
37 | mChangesMade = false; | ||||
38 | } | ||||
39 | | ||||
40 | void ShortcutsOptionsPage::markDirty() | ||||
41 | { | ||||
42 | mChangesMade = true; | ||||
43 | } | ||||
44 | |