Changeset View
Changeset View
Standalone View
Standalone View
ipfs/ipfswindow.h
- This file was added.
1 | /* ============================================================ | ||||
---|---|---|---|---|---|
2 | * | ||||
3 | * This file is a part of KDE project | ||||
4 | * | ||||
5 | * | ||||
6 | * Date : 2016-06-06 | ||||
7 | * Description : a kipi plugin to export images to the IPFS web service | ||||
8 | * | ||||
9 | * Copyright (C) 2018 by Amar Lakshya <amar dot lakshya at xaviers dot edu dot in> | ||||
10 | * | ||||
11 | * This program is free software; you can redistribute it | ||||
12 | * and/or modify it under the terms of the GNU General | ||||
13 | * Public License as published by the Free Software Foundation; | ||||
14 | * either version 2, or (at your option) any later version. | ||||
15 | * | ||||
16 | * This program is distributed in the hope that it will be useful, | ||||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
19 | * GNU General Public License for more details. | ||||
20 | * | ||||
21 | * ============================================================ */ | ||||
22 | | ||||
23 | #ifndef IMGURWINDOW_H | ||||
24 | #define IMGURWINDOW_H | ||||
25 | | ||||
26 | // Qt includes | ||||
27 | | ||||
28 | #include <QObject> | ||||
29 | #include <QLabel> | ||||
30 | | ||||
31 | // Libkipi includes | ||||
32 | | ||||
33 | #include <KIPI/Interface> | ||||
34 | | ||||
35 | // Local includes | ||||
36 | | ||||
37 | #include "ipfsimageslist.h" | ||||
38 | #include "kptooldialog.h" | ||||
39 | #include "ipfsglobaluploadapi.h" | ||||
40 | | ||||
41 | namespace KIPI | ||||
42 | { | ||||
43 | class Interface; | ||||
44 | } | ||||
45 | | ||||
46 | using namespace KIPI; | ||||
47 | using namespace KIPIPlugins; | ||||
48 | | ||||
49 | namespace KIPIIPFSPlugin | ||||
50 | { | ||||
51 | | ||||
52 | class IPFSWindow : public KPToolDialog | ||||
53 | { | ||||
54 | Q_OBJECT | ||||
55 | | ||||
56 | public: | ||||
57 | IPFSWindow(QWidget* const parent = 0); | ||||
58 | ~IPFSWindow(); | ||||
59 | | ||||
60 | void reactivate(); | ||||
61 | | ||||
62 | public Q_SLOTS: | ||||
63 | /* UI callbacks */ | ||||
64 | void slotUpload(); | ||||
65 | void slotFinished(); | ||||
66 | void slotCancel(); | ||||
67 | | ||||
68 | /* IPFSGLOBALUPLOADAPI callbacks */ | ||||
69 | /* void apiAuthorized(bool success, const QString& username); */ | ||||
70 | /* void apiAuthError(const QString& msg); */ | ||||
71 | void apiProgress(unsigned int percent, const IPFSGLOBALUPLOADAPIAction& action); | ||||
72 | void apiRequestPin(const QUrl& url); | ||||
73 | void apiSuccess(const IPFSGLOBALUPLOADAPIResult& result); | ||||
74 | void apiError(const QString &msg, const IPFSGLOBALUPLOADAPIAction& action); | ||||
75 | void apiBusy(bool busy); | ||||
76 | | ||||
77 | private: | ||||
78 | void closeEvent(QCloseEvent* e) Q_DECL_OVERRIDE; | ||||
79 | void setContinueUpload(bool state); | ||||
80 | void readSettings(); | ||||
81 | void saveSettings(); | ||||
82 | | ||||
83 | private: | ||||
84 | IPFSImagesList* list = nullptr; | ||||
85 | IPFSGLOBALUPLOADAPI* api = nullptr; | ||||
86 | /* Contains the ipfs username if API authorized. | ||||
87 | * If not, username is null. */ | ||||
88 | QString username; | ||||
89 | }; | ||||
90 | | ||||
91 | } // namespace KIPIIPFSPlugin | ||||
92 | | ||||
93 | #endif /* IMGURWINDOW_H */ |