Debian Codegraph @

src/widgets/CaptureModePicker.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2018 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_CAPTUREMODEPICKER_H
21 #define KSNIP_CAPTUREMODEPICKER_H
22
23 #include <QAction>
24
25 #include "src/widgets/CustomToolButton.h"
26 #include "src/common/loader/IIconLoader.h"
27 #include "src/common/enum/CaptureModes.h"
28 #include "src/common/helper/EnumTranslator.h"
29
30 class CaptureModePicker : public CustomToolButton
31 {
32 Q_OBJECT
33 public:
34 explicit CaptureModePicker(const QList<CaptureModes> &captureModes, const QSharedPointer<IIconLoader> &iconLoader);
35 ~CaptureModePicker() override = default;
36 void setCaptureMode(CaptureModes mode);
37 CaptureModes captureMode() const;
38 QList<QAction*> captureActions() const;
39
40 signals:
41 void captureModeSelected(CaptureModes mode) const;
42
43 private:
44 CaptureModes mSelectedCaptureMode;
45 QList<QAction*> mCaptureActions;
46
47 void init(const QList<CaptureModes> &captureModes, const QSharedPointer<IIconLoader> &iconLoader);
48 void selectCaptureMode(CaptureModes mode);
49
50 QAction *createAction(const QString &text, const QString &tooltip, const QIcon &icon, CaptureModes captureMode, const QKeySequence &shortcut);
51 static bool isCaptureModeSupported(const QList<CaptureModes> &captureModes, CaptureModes captureMode) ;
52 };
53
54 #endif //KSNIP_CAPTUREMODEPICKER_H