| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 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 |