Changeset View
Changeset View
Standalone View
Standalone View
libnotificationmanager/jobdetails.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2019 Kai Uwe Broulik <kde@privat.broulik.de> | ||||
3 | * | ||||
4 | * This library is free software; you can redistribute it and/or | ||||
5 | * modify it under the terms of the GNU Lesser General Public | ||||
6 | * License as published by the Free Software Foundation; either | ||||
7 | * version 2.1 of the License, or (at your option) version 3, or any | ||||
8 | * later version accepted by the membership of KDE e.V. (or its | ||||
9 | * successor approved by the membership of KDE e.V.), which shall | ||||
10 | * act as a proxy defined in Section 6 of version 3 of the license. | ||||
11 | * | ||||
12 | * This library is distributed in the hope that it will be useful, | ||||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
15 | * Lesser General Public License for more details. | ||||
16 | * | ||||
17 | * You should have received a copy of the GNU Lesser General Public | ||||
18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | */ | ||||
20 | | ||||
21 | #pragma once | ||||
22 | | ||||
23 | #include <QObject> | ||||
24 | #include <QDateTime> | ||||
25 | #include <QScopedPointer> | ||||
26 | #include <QString> | ||||
27 | #include <QStringList> | ||||
28 | #include <QUrl> | ||||
29 | | ||||
30 | #include "notificationmanager_export.h" | ||||
31 | | ||||
32 | #include "notifications.h" | ||||
33 | | ||||
34 | namespace NotificationManager | ||||
35 | { | ||||
36 | | ||||
37 | /** | ||||
38 | * @short Provides detailed information about a job | ||||
39 | * | ||||
40 | * @author Kai Uwe Broulik <kde@privat.broulik.de> | ||||
41 | **/ | ||||
42 | class NOTIFICATIONMANAGER_EXPORT JobDetails : public QObject | ||||
43 | { | ||||
44 | Q_OBJECT | ||||
45 | | ||||
46 | /** | ||||
47 | * User-friendly compact description text of the job, | ||||
48 | * for example "42 of 1337 files to "~/some/folder", or | ||||
49 | * "SomeFile.txt to Downloads". | ||||
50 | */ | ||||
51 | Q_PROPERTY(QString text READ text NOTIFY textChanged) | ||||
52 | | ||||
53 | /** | ||||
54 | * The destination URL of a job. | ||||
55 | */ | ||||
56 | Q_PROPERTY(QUrl destUrl READ destUrl NOTIFY destUrlChanged) | ||||
57 | | ||||
58 | /** | ||||
59 | * Current transfer rate in Byte/s | ||||
60 | */ | ||||
61 | Q_PROPERTY(qulonglong speed READ speed NOTIFY speedChanged) | ||||
62 | | ||||
63 | Q_PROPERTY(qulonglong processedBytes READ processedBytes NOTIFY processedBytesChanged) | ||||
64 | Q_PROPERTY(qulonglong processedFiles READ processedFiles NOTIFY processedFilesChanged) | ||||
65 | Q_PROPERTY(qulonglong processedDirectories READ processedDirectories NOTIFY processedDirectoriesChanged) | ||||
66 | | ||||
67 | Q_PROPERTY(qulonglong totalBytes READ totalBytes NOTIFY totalBytesChanged) | ||||
68 | Q_PROPERTY(qulonglong totalFiles READ totalFiles NOTIFY totalFilesChanged) | ||||
69 | Q_PROPERTY(qulonglong totalDirectories READ totalDirectories NOTIFY totalDirectoriesChanged) | ||||
70 | | ||||
71 | Q_PROPERTY(QString descriptionLabel1 READ descriptionLabel1 NOTIFY descriptionLabel1Changed) | ||||
72 | Q_PROPERTY(QString descriptionValue1 READ descriptionValue1 NOTIFY descriptionValue1Changed) | ||||
73 | | ||||
74 | Q_PROPERTY(QString descriptionLabel2 READ descriptionLabel2 NOTIFY descriptionLabel2Changed) | ||||
75 | Q_PROPERTY(QString descriptionValue2 READ descriptionValue2 NOTIFY descriptionValue2Changed) | ||||
76 | | ||||
77 | /** | ||||
78 | * This tries to generate a valid URL for a file that's being processed by converting descriptionValue2 | ||||
79 | * (which is assumed to be the Destination) and if that isn't valid, descriptionValue1 to a URL. | ||||
80 | */ | ||||
81 | Q_PROPERTY(QUrl descriptionUrl READ descriptionUrl NOTIFY descriptionUrlChanged) | ||||
82 | | ||||
83 | public: | ||||
84 | explicit JobDetails(QObject *parent = nullptr); | ||||
85 | ~JobDetails() override; | ||||
86 | | ||||
87 | QString text() const; | ||||
88 | | ||||
89 | QUrl destUrl() const; | ||||
90 | | ||||
91 | qulonglong speed() const; | ||||
92 | | ||||
93 | qulonglong processedBytes() const; | ||||
94 | qulonglong processedFiles() const; | ||||
95 | qulonglong processedDirectories() const; | ||||
96 | | ||||
97 | qulonglong totalBytes() const; | ||||
98 | qulonglong totalFiles() const; | ||||
99 | qulonglong totalDirectories() const; | ||||
100 | | ||||
101 | QString descriptionLabel1() const; | ||||
102 | QString descriptionValue1() const; | ||||
103 | | ||||
104 | QString descriptionLabel2() const; | ||||
105 | QString descriptionValue2() const; | ||||
106 | | ||||
107 | QUrl descriptionUrl() const; | ||||
108 | | ||||
109 | signals: | ||||
110 | void textChanged(); | ||||
111 | void destUrlChanged(); | ||||
112 | void speedChanged(); | ||||
113 | void processedBytesChanged(); | ||||
114 | void processedFilesChanged(); | ||||
115 | void processedDirectoriesChanged(); | ||||
116 | void processedAmountChanged(); | ||||
117 | void totalBytesChanged(); | ||||
118 | void totalFilesChanged(); | ||||
119 | void totalDirectoriesChanged(); | ||||
120 | void totalAmountChanged(); | ||||
121 | void descriptionLabel1Changed(); | ||||
122 | void descriptionValue1Changed(); | ||||
123 | void descriptionLabel2Changed(); | ||||
124 | void descriptionValue2Changed(); | ||||
125 | void descriptionUrlChanged(); | ||||
126 | | ||||
127 | private: | ||||
128 | friend class Job; | ||||
129 | | ||||
130 | class Private; | ||||
131 | QScopedPointer<Private> d; | ||||
132 | | ||||
133 | }; | ||||
134 | | ||||
135 | } // namespace NotificationManager |