| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#ifndef KSNIP_CANDISCARDOPERATION_H |
| 21 |
#define KSNIP_CANDISCARDOPERATION_H |
| 22 |
|
| 23 |
#include <QApplication> |
| 24 |
|
| 25 |
#include <utility> |
| 26 |
|
| 27 |
#include "SaveOperation.h" |
| 28 |
#include "NotifyOperation.h" |
| 29 |
#include "src/backend/config/IConfig.h" |
| 30 |
#include "src/backend/recentImages/IRecentImageService.h" |
| 31 |
#include "src/gui/messageBoxService/MessageBoxService.h" |
| 32 |
|
| 33 |
class CanDiscardOperation : public QObject |
| 34 |
{ |
| 35 |
Q_OBJECT |
| 36 |
public: |
| 37 |
CanDiscardOperation(QImage image, |
| 38 |
bool isUnsaved, |
| 39 |
QString pathToImageSource, |
| 40 |
QString filename, |
| 41 |
const QSharedPointer<INotificationService> ¬ificationService, |
| 42 |
const QSharedPointer<IRecentImageService> &recentImageService, |
| 43 |
const QSharedPointer<IMessageBoxService> &messageBoxService, |
| 44 |
const QSharedPointer<IImageSaver> &imageSaver, |
| 45 |
const QSharedPointer<ISavePathProvider> &savePathProvider, |
| 46 |
const QSharedPointer<IFileDialogService> &fileDialogService, |
| 47 |
const QSharedPointer<IConfig> &config, |
| 48 |
QWidget *parent); |
| 49 |
~CanDiscardOperation() override = default; |
| 50 |
bool execute(); |
| 51 |
|
| 52 |
private: |
| 53 |
QSharedPointer<IConfig> mConfig; |
| 54 |
bool mIsUnsaved; |
| 55 |
QWidget *mParent; |
| 56 |
QImage mImage; |
| 57 |
QString mPathToImageSource; |
| 58 |
QString mFilename; |
| 59 |
QSharedPointer<INotificationService> mNotificationService; |
| 60 |
QSharedPointer<IMessageBoxService> mMessageBoxService; |
| 61 |
QSharedPointer<IRecentImageService> mRecentImageService; |
| 62 |
QSharedPointer<IImageSaver> mImageSaver; |
| 63 |
QSharedPointer<ISavePathProvider> mSavePathProvider; |
| 64 |
QSharedPointer<IFileDialogService> mFileDialogService; |
| 65 |
|
| 66 |
MessageBoxResponse getSaveBeforeDiscard() const; |
| 67 |
bool saveImage() const; |
| 68 |
}; |
| 69 |
|
| 70 |
#endif |