Debian Codegraph @

src/gui/operations/CopyAsDataUriOperation.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_COPYASDATAURIOPERATION_H
21 #define KSNIP_COPYASDATAURIOPERATION_H
22
23 #include <QBuffer>
24 #include <QImage>
25
26 #include "src/gui/clipboard/IClipboard.h"
27 #include "src/gui/INotificationService.h"
28 #include "src/gui/operations/NotifyOperation.h"
29 #include "src/backend/config/Config.h"
30
31 class CopyAsDataUriOperation : public QObject
32 {
33 Q_OBJECT
34 public:
35 CopyAsDataUriOperation(
36 QImage image,
37 const QSharedPointer<IClipboard> &clipboardService,
38 const QSharedPointer<INotificationService> &notificationService,
39 const QSharedPointer<IConfig> &config);
40 ~CopyAsDataUriOperation() override = default;
41 bool execute();
42
43 private:
44 QImage mImage;
45 QSharedPointer<IClipboard> mClipboardService;
46 QSharedPointer<INotificationService> mNotificationService;
47 QSharedPointer<IConfig> mConfig;
48
49 void notifySuccess() const;
50 void notifyFailure() const;
51 void notify(const QString &title, const QString &message, NotificationTypes type) const;
52 };
53
54 #endif //KSNIP_COPYASDATAURIOPERATION_H