Debian Codegraph @

src/bootstrapper/singleInstance/SingleInstanceParameter.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2020 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_SINGLEINSTANCEPARAMETER_H
21 #define KSNIP_SINGLEINSTANCEPARAMETER_H
22
23 #include <QString>
24
25 #include "src/bootstrapper/singleInstance/SingleInstanceStartupModes.h"
26 #include "src/common/enum/CaptureModes.h"
27
28 struct SingleInstanceParameter
29 {
30 SingleInstanceStartupModes startupMode;
31 CaptureModes captureMode;
32 QString imagePath;
33 bool save{};
34 bool captureCursor{};
35 int delay{};
36 QString savePath;
37 QByteArray imageAsByteArray;
38
39 SingleInstanceParameter() {
40 this->startupMode = SingleInstanceStartupModes::Start;
41 }
42
43 explicit SingleInstanceParameter(const QString &path) {
44 this->startupMode = SingleInstanceStartupModes::Edit;
45 this->imagePath = path;
46 }
47
48 explicit SingleInstanceParameter(const QByteArray &imageAsByteArray) {
49 this->startupMode = SingleInstanceStartupModes::Edit;
50 this->imageAsByteArray = imageAsByteArray;
51 }
52
53 SingleInstanceParameter(CaptureModes captureMode, bool save, const QString &savePath, bool captureCursor, int delay) {
54 this->startupMode = SingleInstanceStartupModes::Capture;
55 this->captureMode = captureMode;
56 this->save = save;
57 this->captureCursor = captureCursor;
58 this->savePath = savePath;
59 this->delay = delay;
60 }
61
62 bool isImageAsByteArraySet() const {
63 return !this->imageAsByteArray.isNull() && !this->imageAsByteArray.isEmpty();
64 }
65 };
66
67 #endif //KSNIP_SINGLEINSTANCEPARAMETER_H