Debian Codegraph @

src/gui/settingsDialog/actions/ActionSettingTab.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2021 Damir Porobic <[email protected]>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #ifndef KSNIP_ACTIONSETTINGTAB_H
21 #define KSNIP_ACTIONSETTINGTAB_H
22
23 #include <QWidget>
24 #include <QGridLayout>
25 #include <QCheckBox>
26 #include <QComboBox>
27 #include <QLabel>
28 #include <QLineEdit>
29 #include <QPushButton>
30
31 #include "src/common/helper/EnumTranslator.h"
32 #include "src/widgets/CustomSpinBox.h"
33 #include "src/widgets/CustomLineEdit.h"
34 #include "src/widgets/KeySequenceLineEdit.h"
35 #include "src/gui/actions/Action.h"
36 #include "src/gui/globalHotKeys/HotKeyMap.h"
37
38 class ActionSettingTab : public QWidget
39 {
40 Q_OBJECT
41 public:
42 explicit ActionSettingTab(const QString &name, const QList<CaptureModes> &captureModes, const QSharedPointer<IPlatformChecker> &platformChecker);
43 explicit ActionSettingTab(const Action &action, const QList<CaptureModes> &captureModes, const QSharedPointer<IPlatformChecker> &platformChecker);
44 ~ActionSettingTab() override;
45 Action action() const;
46
47 signals:
48 void nameChanged(const QString &name);
49
50 protected:
51 explicit ActionSettingTab(const QList<CaptureModes> &captureModes, const QSharedPointer<IPlatformChecker> &platformChecker);
52 void setAction(const Action &action) const;
53
54 private:
55 QComboBox *mCaptureModeComboBox;
56 QCheckBox *mCaptureEnabledCheckBox;
57 QCheckBox *mIncludeCursorCheckBox;
58 QCheckBox *mShowPinWindowCheckBox;
59 QCheckBox *mUploadCheckBox;
60 QCheckBox *mSaveCheckBox;
61 QCheckBox *mCopyToClipboardCheckBox;
62 QCheckBox *mOpenDirectoryCheckBox;
63 QCheckBox *mHideMainWindowCheckBox;
64 QCheckBox *mIsGlobalShortcutCheckBox;
65 QLabel *mCaptureModeLabel;
66 QLabel *mDelayLabel;
67 QLabel *mNameLabel;
68 QLabel *mShortcutLabel;
69 CustomSpinBox *mDelaySpinBox;
70 CustomLineEdit *mNameLineEdit;
71 KeySequenceLineEdit *mShortcutLineEdit;
72 QPushButton *mShortcutClearButton;
73 QGridLayout *mLayout;
74
75 void initGui(const QList<CaptureModes> &captureModes);
76 void populateCaptureModeCombobox(const QList<CaptureModes> &captureModes);
77 int indexOfSelectedCaptureMode(CaptureModes modes) const;
78 static QString getTextWithEscapedAmpersand(const QString &text);
79 static QString getTextWithoutEscapedAmpersand(const QString &text);
80
81 private slots:
82 void captureEnabledChanged();
83 void nameEditingFinished();
84 };
85
86 #endif //KSNIP_ACTIONSETTINGTAB_H