Debian Codegraph @

src/gui/operations/CanDiscardOperation.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2019 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_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> &notificationService,
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 //KSNIP_CANDISCARDOPERATION_H