Debian Codegraph @

src/bootstrapper/StandAloneBootstrapper.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 Lesser 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 Lesser 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_STANDALONEBOOTSTRAPPER_H
21 #define KSNIP_STANDALONEBOOTSTRAPPER_H
22
23 #include <QApplication>
24
25
26
27 #include "BuildConfig.h"
28 #include "src/bootstrapper/IBootstrapper.h"
29 #include "src/bootstrapper/IImageFromStdInputReader.h"
30 #include "src/gui/MainWindow.h"
31 #include "src/backend/TranslationLoader.h"
32 #include "src/backend/commandLine/CommandLine.h"
33 #include "src/backend/commandLine/ICommandLineCaptureHandler.h"
34 #include "src/backend/commandLine/CommandLineCaptureParameter.h"
35 #include "src/dependencyInjector/DependencyInjectorBootstrapper.h"
36
37 class StandAloneBootstrapper : public QObject, public IBootstrapper
38 {
39 Q_OBJECT
40 public:
41 explicit StandAloneBootstrapper(DependencyInjector *dependencyInjector);
42 ~StandAloneBootstrapper() override;
43
44 int start(const QApplication &app) override;
45
46 protected:
47 MainWindow *mMainWindow;
48 QSharedPointer<ILogger> mLogger;
49
50 void createCommandLineParser(const QApplication &app);
51 static int showVersion();
52 static bool isStartedWithoutArguments();
53 bool isVersionRequested() const;
54 bool isEditRequested() const;
55 CaptureModes getCaptureMode() const;
56 int getDelay() const;
57 QString getImagePath() const;
58 bool getCaptureCursor() const;
59 bool getSave() const;
60 QString getSavePath() const;
61
62 private:
63 DependencyInjector *mDependencyInjector;
64 CommandLine *mCommandLine;
65 QSharedPointer<ICommandLineCaptureHandler> mCommandLineCaptureHandler;
66 QSharedPointer<IImageFromStdInputReader> mImageFromStdInputReader;
67
68 void loadTranslations(const QApplication &app);
69 virtual void createMainWindow();
70 int startKsnip(const QApplication &app);
71 int startKsnipAndEditImage(const QApplication &app);
72 int takeCaptureAndStartKsnip(const QApplication &app);
73 QPixmap getPixmapFromCorrectSource(const QString &pathToImage) const;
74 QPixmap getPixmapFromStdin() const;
75 bool isCommandLineCaptureRequested() const;
76 int takeCaptureAndProcess(const QApplication &app);
77 bool getIsSave() const;
78 bool getIsUpload() const;
79
80 private slots:
81 void openMainWindow(const CaptureDto &captureDto);
82 void close();
83 };
84
85
86 #endif //KSNIP_STANDALONEBOOTSTRAPPER_H