From 176aa6a74fac3c74f52c580051c80ed19c0b0cfd Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Tue, 16 Dec 2014 10:01:24 +0100 Subject: split out functions that get inlined into a separate file allowed including the header more than once ;) --- common/CMakeLists.txt | 1 + common/clientapi.cpp | 38 ++++++++++++++++++++++++++++++++++++++ common/clientapi.h | 21 +++------------------ 3 files changed, 42 insertions(+), 18 deletions(-) create mode 100644 common/clientapi.cpp 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) endif (STORAGE_unqlite) set(command_SRCS + clientapi.cpp commands.cpp console.cpp 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 @@ + +#include "clientapi.h" + +namespace async +{ + void run(const std::function &runner) { + QtConcurrent::run(runner); + + // //FIXME we should be using a Job instead of a timer + // auto timer = new QTimer; + // timer->setSingleShot(true); + // QObject::connect(timer, &QTimer::timeout, runner); + // QObject::connect(timer, &QTimer::timeout, timer, &QObject::deleteLater); + // timer->start(0); + }; +} // namespace async + +namespace Akonadi2 +{ + +namespace Domain +{ + +template<> +QString getTypeName() +{ + return "event"; +} + +template<> +QString getTypeName() +{ + return "todo"; +} + +} // namespace Domain + +} // 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 @@ namespace async { //This should abstract if we execute from eventloop or in thread. //It supposed to allow the caller to finish the current method before executing the runner. - void run(const std::function &runner) { - QtConcurrent::run(runner); - - // //FIXME we should be using a Job instead of a timer - // auto timer = new QTimer; - // timer->setSingleShot(true); - // QObject::connect(timer, &QTimer::timeout, runner); - // QObject::connect(timer, &QTimer::timeout, timer, &QObject::deleteLater); - // timer->start(0); - }; + void run(const std::function &runner); /** * Query result set @@ -232,16 +223,10 @@ template QString getTypeName(); template<> -QString getTypeName() -{ - return "event"; -} +QString getTypeName(); template<> -QString getTypeName() -{ - return "todo"; -} +QString getTypeName(); } -- cgit v1.2.3