summarylogtreecommitdiffstats
path: root/qtservice.patch
blob: 2a0675c24398548f7d1ba605b3a33ee1a7ef829c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
diff --git a/daemon/conflipservice.cpp b/daemon/conflipservice.cpp
index feef18f..1ecb91a 100644
--- a/daemon/conflipservice.cpp
+++ b/daemon/conflipservice.cpp
@@ -16,7 +16,7 @@ void ConflipService::setSlice(const QString &slice)
 	QCoreApplication::setApplicationName(QStringLiteral(TARGET "@%1").arg(slice));
 }
 
-QtService::Service::CommandMode ConflipService::onStart()
+QtService::Service::CommandResult ConflipService::onStart()
 {
 	QCommandLineParser parser;
 	parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
@@ -31,8 +31,7 @@ QtService::Service::CommandMode ConflipService::onStart()
 #endif
 	if(!parser.parse(QCoreApplication::arguments())) {
 		qCritical().noquote() << parser.errorText();
-		qApp->exit(EXIT_FAILURE);
-		return Synchronous;
+		return CommandResult::Failed;
 	}
 
 	QString logStr;
@@ -56,32 +55,33 @@ QtService::Service::CommandMode ConflipService::onStart()
 	QLoggingCategory::setFilterRules(logStr);
 
 	_engine = new SyncEngine{this};
-	if(!_engine->start())
-		qApp->exit(EXIT_FAILURE);
-	return Synchronous;
+	if(_engine->start())
+		return CommandResult::Completed;
+	else
+		return CommandResult::Failed;
 }
 
-QtService::Service::CommandMode ConflipService::onStop(int &exitCode)
+QtService::Service::CommandResult ConflipService::onStop(int &exitCode)
 {
 	_engine->pause();
 	exitCode = EXIT_SUCCESS;
-	return Synchronous;
+	return CommandResult::Completed;
 }
 
-QtService::Service::CommandMode ConflipService::onReload()
+QtService::Service::CommandResult ConflipService::onReload()
 {
 	_engine->reload();
-	return Synchronous;
+	return CommandResult::Completed;
 }
 
-QtService::Service::CommandMode ConflipService::onPause()
+QtService::Service::CommandResult ConflipService::onPause()
 {
 	_engine->pause();
-	return Synchronous;
+	return CommandResult::Completed;
 }
 
-QtService::Service::CommandMode ConflipService::onResume()
+QtService::Service::CommandResult ConflipService::onResume()
 {
 	_engine->resume();
-	return Synchronous;
+	return CommandResult::Completed;
 }
diff --git a/daemon/conflipservice.h b/daemon/conflipservice.h
index 57066fa..32c8221 100644
--- a/daemon/conflipservice.h
+++ b/daemon/conflipservice.h
@@ -14,11 +14,11 @@ public:
 	void setSlice(const QString &slice);
 
 protected:
-	CommandMode onStart() override;
-	CommandMode onStop(int &exitCode) override;
-	CommandMode onReload() override;
-	CommandMode onPause() override;
-	CommandMode onResume() override;
+	CommandResult onStart() override;
+	CommandResult onStop(int &exitCode) override;
+	CommandResult onReload() override;
+	CommandResult onPause() override;
+	CommandResult onResume() override;
 
 private:
 	SyncEngine *_engine = nullptr;
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index 895acc6..69c61c1 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -227,8 +227,8 @@ void MainWindow::reload()
 
 		if(_svcControl->serviceExists()) {
 			switch(_svcControl->status()) {
-			case QtService::ServiceControl::ServiceStopped:
-			case QtService::ServiceControl::ServiceErrored:
+			case QtService::ServiceControl::Status::Stopped:
+			case QtService::ServiceControl::Status::Errored:
 				if(!_svcControl->start()) {
 					DialogMaster::critical(this,
 										   tr("Failed to start %1 service with error: %2")
@@ -236,7 +236,7 @@ void MainWindow::reload()
 										   tr("Service Error"));
 				}
 				break;
-			case QtService::ServiceControl::ServicePaused:
+			case QtService::ServiceControl::Status::Paused:
 				if(!_svcControl->resume()) {
 					DialogMaster::critical(this,
 										   tr("Failed to resume %1 service with error: %2")
@@ -245,18 +245,18 @@ void MainWindow::reload()
 					break;
 				}
 				Q_FALLTHROUGH();
-			case QtService::ServiceControl::ServiceRunning:
+			case QtService::ServiceControl::Status::Running:
 				on_action_Reload_Daemon_triggered();
 				break;
-			case QtService::ServiceControl::ServiceStatusUnknown:
+			case QtService::ServiceControl::Status::Unknown:
 				if(!_svcControl->start())
 					on_action_Reload_Daemon_triggered();
 				break;
-			case QtService::ServiceControl::ServiceStarting:
-			case QtService::ServiceControl::ServiceResuming:
-			case QtService::ServiceControl::ServiceReloading:
-			case QtService::ServiceControl::ServiceStopping:
-			case QtService::ServiceControl::ServicePausing:
+			case QtService::ServiceControl::Status::Starting:
+			case QtService::ServiceControl::Status::Resuming:
+			case QtService::ServiceControl::Status::Reloading:
+			case QtService::ServiceControl::Status::Stopping:
+			case QtService::ServiceControl::Status::Pausing:
 				break;
 			default:
 				Q_UNREACHABLE();
diff --git a/lib/conflip.cpp b/lib/conflip.cpp
index 8c7d38e..3821d2f 100644
--- a/lib/conflip.cpp
+++ b/lib/conflip.cpp
@@ -3,6 +3,7 @@
 #include <QJsonSerializer>
 #include <QLibraryInfo>
 #include <QTranslator>
+#include <QQueue>
 #include <qpluginfactory.h>
 #include "syncentry.h"
 #include "synchelperplugin.h"
diff --git a/plugins/dconfsync/dconfsynchelper.cpp b/plugins/dconfsync/dconfsynchelper.cpp
index c149e28..da17de3 100644
--- a/plugins/dconfsync/dconfsynchelper.cpp
+++ b/plugins/dconfsync/dconfsynchelper.cpp
@@ -249,6 +249,13 @@ void DConfSyncTask::writeSyncConf(const QFileInfo &file, const DConfSyncTask::DC
 
 
 
+bool DConfEntry::operator==(const DConfEntry &other) const
+{
+	return type == other.type &&
+			data == other.data &&
+			lastModified == other.lastModified;
+}
+
 QString DConfEntry::getType() const
 {
 	return QString::fromUtf8(type);
@@ -258,3 +265,12 @@ void DConfEntry::setType(const QString &value)
 {
 	type = value.toUtf8();
 }
+
+
+
+uint qHash(const DConfEntry &entry, uint seed)
+{
+	return qHash(entry.type, seed) ^
+			qHash(entry.data, seed) ^
+			qHash(entry.lastModified, seed);
+}
diff --git a/plugins/dconfsync/dconfsynchelper.h b/plugins/dconfsync/dconfsynchelper.h
index 361cb71..c08e67f 100644
--- a/plugins/dconfsync/dconfsynchelper.h
+++ b/plugins/dconfsync/dconfsynchelper.h
@@ -5,6 +5,7 @@
 #include <QJsonSerializer>
 #include <QObject>
 #include <QSettings>
+#include <QHash>
 #include <synchelper.h>
 
 class DConfEntry
@@ -20,11 +21,15 @@ public:
 	QByteArray data;
 	QDateTime lastModified;
 
+	bool operator==(const DConfEntry &other) const;
+
 private:
 	QString getType() const;
 	void setType(const QString &value);
 };
 
+uint qHash(const DConfEntry &entry, uint seed);
+
 class DConfSyncHelper;
 class DConfSyncTask : public SyncTask
 {
diff --git a/plugins/dconfsync/dconfsynchelperplugin.cpp b/plugins/dconfsync/dconfsynchelperplugin.cpp
index ce8753a..b0ede4f 100644
--- a/plugins/dconfsync/dconfsynchelperplugin.cpp
+++ b/plugins/dconfsync/dconfsynchelperplugin.cpp
@@ -1,5 +1,6 @@
 #include "dconfsynchelperplugin.h"
 #include "dconfsynchelper.h"
+#include <QQueue>
 
 DConfSyncHelperPlugin::DConfSyncHelperPlugin(QObject *parent) :
 	QObject(parent)