diff options
author | Aaron Seigo <aseigo@kde.org> | 2014-12-16 10:01:24 +0100 |
---|---|---|
committer | Aaron Seigo <aseigo@kde.org> | 2014-12-16 10:01:24 +0100 |
commit | 176aa6a74fac3c74f52c580051c80ed19c0b0cfd (patch) | |
tree | 201b2782e2d97e674f2420254de8440687afa307 | |
parent | 8c80b142925840a6ae74ad227f5d7d07cae1fef4 (diff) | |
download | sink-176aa6a74fac3c74f52c580051c80ed19c0b0cfd.tar.gz sink-176aa6a74fac3c74f52c580051c80ed19c0b0cfd.zip |
split out functions that get inlined into a separate file
allowed including the header more than once ;)
-rw-r--r-- | common/CMakeLists.txt | 1 | ||||
-rw-r--r-- | common/clientapi.cpp | 38 | ||||
-rw-r--r-- | common/clientapi.h | 21 |
3 files changed, 42 insertions, 18 deletions
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 3431756..ceec69c 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt | |||
@@ -11,6 +11,7 @@ else (STORAGE_unqlite) | |||
11 | endif (STORAGE_unqlite) | 11 | endif (STORAGE_unqlite) |
12 | 12 | ||
13 | set(command_SRCS | 13 | set(command_SRCS |
14 | clientapi.cpp | ||
14 | commands.cpp | 15 | commands.cpp |
15 | console.cpp | 16 | console.cpp |
16 | resource.cpp | 17 | resource.cpp |
diff --git a/common/clientapi.cpp b/common/clientapi.cpp new file mode 100644 index 0000000..2a4b603 --- /dev/null +++ b/common/clientapi.cpp | |||
@@ -0,0 +1,38 @@ | |||
1 | |||
2 | #include "clientapi.h" | ||
3 | |||
4 | namespace async | ||
5 | { | ||
6 | void run(const std::function<void()> &runner) { | ||
7 | QtConcurrent::run(runner); | ||
8 | |||
9 | // //FIXME we should be using a Job instead of a timer | ||
10 | // auto timer = new QTimer; | ||
11 | // timer->setSingleShot(true); | ||
12 | // QObject::connect(timer, &QTimer::timeout, runner); | ||
13 | // QObject::connect(timer, &QTimer::timeout, timer, &QObject::deleteLater); | ||
14 | // timer->start(0); | ||
15 | }; | ||
16 | } // namespace async | ||
17 | |||
18 | namespace Akonadi2 | ||
19 | { | ||
20 | |||
21 | namespace Domain | ||
22 | { | ||
23 | |||
24 | template<> | ||
25 | QString getTypeName<Event>() | ||
26 | { | ||
27 | return "event"; | ||
28 | } | ||
29 | |||
30 | template<> | ||
31 | QString getTypeName<Todo>() | ||
32 | { | ||
33 | return "todo"; | ||
34 | } | ||
35 | |||
36 | } // namespace Domain | ||
37 | |||
38 | } // namespace Akonadi2 | ||
diff --git a/common/clientapi.h b/common/clientapi.h index 7f01587..2188123 100644 --- a/common/clientapi.h +++ b/common/clientapi.h | |||
@@ -34,16 +34,7 @@ | |||
34 | namespace async { | 34 | namespace async { |
35 | //This should abstract if we execute from eventloop or in thread. | 35 | //This should abstract if we execute from eventloop or in thread. |
36 | //It supposed to allow the caller to finish the current method before executing the runner. | 36 | //It supposed to allow the caller to finish the current method before executing the runner. |
37 | void run(const std::function<void()> &runner) { | 37 | void run(const std::function<void()> &runner); |
38 | QtConcurrent::run(runner); | ||
39 | |||
40 | // //FIXME we should be using a Job instead of a timer | ||
41 | // auto timer = new QTimer; | ||
42 | // timer->setSingleShot(true); | ||
43 | // QObject::connect(timer, &QTimer::timeout, runner); | ||
44 | // QObject::connect(timer, &QTimer::timeout, timer, &QObject::deleteLater); | ||
45 | // timer->start(0); | ||
46 | }; | ||
47 | 38 | ||
48 | /** | 39 | /** |
49 | * Query result set | 40 | * Query result set |
@@ -232,16 +223,10 @@ template<class DomainType> | |||
232 | QString getTypeName(); | 223 | QString getTypeName(); |
233 | 224 | ||
234 | template<> | 225 | template<> |
235 | QString getTypeName<Event>() | 226 | QString getTypeName<Event>(); |
236 | { | ||
237 | return "event"; | ||
238 | } | ||
239 | 227 | ||
240 | template<> | 228 | template<> |
241 | QString getTypeName<Todo>() | 229 | QString getTypeName<Todo>(); |
242 | { | ||
243 | return "todo"; | ||
244 | } | ||
245 | 230 | ||
246 | } | 231 | } |
247 | 232 | ||