diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 1bc0dbec6..6dda3657f 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -49,9 +49,5 @@ include_directories(
../3rdparty/include/sqlite
)
-add_definitions(
- -D_DEBUG
-)
-
add_library(musikcore STATIC ${CORE_SOURCES})
target_link_libraries(musikcore ${musikbox_LINK_LIBS})
diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj
index e3bd39b30..ce823abea 100755
--- a/src/core/core.vcxproj
+++ b/src/core/core.vcxproj
@@ -156,7 +156,7 @@
-
+
@@ -215,4 +215,4 @@
-
\ No newline at end of file
+
diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filters
index bb666df46..0653d6002 100755
--- a/src/core/core.vcxproj.filters
+++ b/src/core/core.vcxproj.filters
@@ -198,7 +198,7 @@
src\sdk
-
+
src\library\query
@@ -385,4 +385,4 @@
src\library\query\local
-
\ No newline at end of file
+
diff --git a/src/core/library/LocalLibrary.cpp b/src/core/library/LocalLibrary.cpp
index fc9256b34..0c7240e0b 100644
--- a/src/core/library/LocalLibrary.cpp
+++ b/src/core/library/LocalLibrary.cpp
@@ -36,7 +36,7 @@
#include
#include
-#include
+#include
#include
#include
#include
@@ -52,8 +52,6 @@ using namespace musik::core::runtime;
#define VERBOSE_LOGGING 0
#define MESSAGE_QUERY_COMPLETED 5000
-using QueryT = musik::core::db::QueryBase;
-
class QueryCompletedMessage : public Message {
public:
using IQueryPtr = std::shared_ptr;
diff --git a/src/core/library/LocalLibrary.h b/src/core/library/LocalLibrary.h
index cc1031be0..cc697e89c 100644
--- a/src/core/library/LocalLibrary.h
+++ b/src/core/library/LocalLibrary.h
@@ -44,7 +44,7 @@
#include
#include
#include
-#include
+#include
#include
#include
@@ -63,7 +63,7 @@ namespace musik { namespace core { namespace library {
{
public:
using IQueryPtr = std::shared_ptr;
- using LocalQuery = musik::core::db::QueryBase;
+ using LocalQuery = musik::core::db::LocalQueryBase;
using LocalQueryPtr = std::shared_ptr;
static ILibraryPtr Create(std::string name, int id);
diff --git a/src/core/library/query/local/CategoryListQuery.h b/src/core/library/query/local/CategoryListQuery.h
index 1767ee38e..db549daaa 100755
--- a/src/core/library/query/local/CategoryListQuery.h
+++ b/src/core/library/query/local/CategoryListQuery.h
@@ -34,7 +34,7 @@
#pragma once
-#include
+#include
#include
#include
#include
@@ -42,7 +42,7 @@
namespace musik { namespace core { namespace db { namespace local {
- class CategoryListQuery : public musik::core::db::QueryBase {
+ class CategoryListQuery : public musik::core::db::LocalQueryBase {
public:
/* note we implement the SDK's IMetadataValue interface so
we can return data to plugins! */
diff --git a/src/core/library/query/local/CategoryTrackListQuery.h b/src/core/library/query/local/CategoryTrackListQuery.h
index 7e763e498..0d5b48c68 100755
--- a/src/core/library/query/local/CategoryTrackListQuery.h
+++ b/src/core/library/query/local/CategoryTrackListQuery.h
@@ -36,7 +36,7 @@
#include
#include
-#include
+#include
#include "TrackListQueryBase.h"
diff --git a/src/core/library/query/local/DeletePlaylistQuery.h b/src/core/library/query/local/DeletePlaylistQuery.h
index 7ea20247d..d59f71ee6 100644
--- a/src/core/library/query/local/DeletePlaylistQuery.h
+++ b/src/core/library/query/local/DeletePlaylistQuery.h
@@ -34,12 +34,12 @@
#pragma once
-#include
+#include
#include
namespace musik { namespace core { namespace db { namespace local {
- class DeletePlaylistQuery : public musik::core::db::QueryBase {
+ class DeletePlaylistQuery : public musik::core::db::LocalQueryBase {
public:
DeletePlaylistQuery(const DBID playlistId);
virtual ~DeletePlaylistQuery();
diff --git a/src/core/library/query/local/GetPlaylistQuery.h b/src/core/library/query/local/GetPlaylistQuery.h
index d4d0d81fa..ff92e86fa 100644
--- a/src/core/library/query/local/GetPlaylistQuery.h
+++ b/src/core/library/query/local/GetPlaylistQuery.h
@@ -36,7 +36,7 @@
#include
#include
-#include
+#include
#include "TrackListQueryBase.h"
diff --git a/src/core/library/query/QueryBase.h b/src/core/library/query/local/LocalQueryBase.h
similarity index 81%
rename from src/core/library/query/QueryBase.h
rename to src/core/library/query/local/LocalQueryBase.h
index a6cff78ff..189310d97 100644
--- a/src/core/library/query/QueryBase.h
+++ b/src/core/library/query/local/LocalQueryBase.h
@@ -36,6 +36,7 @@
#include
#include
+#include
#include
@@ -44,13 +45,19 @@
namespace musik { namespace core { namespace db {
- template
- class QueryBase : public IQuery, public sigslot::has_slots<> {
+ class LocalQueryBase : public IQuery, public sigslot::has_slots<> {
public:
- QueryBase();
- virtual ~QueryBase();
+ LocalQueryBase()
+ : status(0)
+ , options(0)
+ , queryId(nextId())
+ , cancel(false) {
+ }
- bool Run(ConnectionT &db) {
+ virtual ~LocalQueryBase() {
+ }
+
+ bool Run(musik::core::db::Connection &db) {
this->SetStatus(Running);
try {
if (this->IsCanceled()) {
@@ -83,8 +90,14 @@ namespace musik { namespace core { namespace db {
return this->options;
}
- virtual void Cancel() { this->cancel = true; }
- virtual bool IsCanceled() { return cancel; }
+ virtual void Cancel() {
+ this->cancel = true;
+ }
+
+ virtual bool IsCanceled() {
+ return cancel;
+ }
+
virtual std::string Name() = 0;
protected:
@@ -98,32 +111,19 @@ namespace musik { namespace core { namespace db {
this->options = options;
}
- virtual bool OnRun(ConnectionT& db) = 0;
+ virtual bool OnRun(musik::core::db::Connection& db) = 0;
private:
+ static int nextId() {
+ static std::atomic next(0);
+ return ++next;
+ }
+
unsigned int status;
unsigned int queryId;
unsigned int options;
volatile bool cancel;
std::mutex stateMutex;
-
- static std::atomic nextId;
};
- template
- std::atomic QueryBase::nextId = 0;
-
- template
- QueryBase::QueryBase()
- : status(0)
- , options(0)
- , queryId(0)
- , cancel(false) {
- this->queryId = nextId++;
- }
-
- template
- QueryBase::~QueryBase() {
- }
-
} } }
diff --git a/src/core/library/query/local/NowPlayingTrackListQuery.h b/src/core/library/query/local/NowPlayingTrackListQuery.h
index fab16c488..82aaf2936 100755
--- a/src/core/library/query/local/NowPlayingTrackListQuery.h
+++ b/src/core/library/query/local/NowPlayingTrackListQuery.h
@@ -34,7 +34,7 @@
#pragma once
-#include
+#include
#include
#include "TrackListQueryBase.h"
diff --git a/src/core/library/query/local/SavePlaylistQuery.h b/src/core/library/query/local/SavePlaylistQuery.h
index b6663eaa9..6ce86e722 100644
--- a/src/core/library/query/local/SavePlaylistQuery.h
+++ b/src/core/library/query/local/SavePlaylistQuery.h
@@ -34,14 +34,14 @@
#pragma once
-#include
+#include
#include
#include
#include
namespace musik { namespace core { namespace db { namespace local {
- class SavePlaylistQuery : public musik::core::db::QueryBase {
+ class SavePlaylistQuery : public musik::core::db::LocalQueryBase {
public:
static std::shared_ptr Save(
const std::string& playlistName,
diff --git a/src/core/library/query/local/TrackListQueryBase.h b/src/core/library/query/local/TrackListQueryBase.h
index 047b7f923..922f56759 100755
--- a/src/core/library/query/local/TrackListQueryBase.h
+++ b/src/core/library/query/local/TrackListQueryBase.h
@@ -34,14 +34,14 @@
#pragma once
-#include
+#include
#include
#include
#include
namespace musik { namespace core { namespace db { namespace local {
- class TrackListQueryBase : public musik::core::db::QueryBase {
+ class TrackListQueryBase : public musik::core::db::LocalQueryBase {
public:
typedef std::shared_ptr Result;
typedef std::shared_ptr > Headers;
diff --git a/src/core/library/track/TrackList.cpp b/src/core/library/track/TrackList.cpp
index f0d55ea63..f80a6138f 100755
--- a/src/core/library/track/TrackList.cpp
+++ b/src/core/library/track/TrackList.cpp
@@ -35,7 +35,7 @@
#include "pch.hpp"
#include "TrackList.h"
-#include
+#include
#include
#include
#include
@@ -52,7 +52,7 @@ using namespace musik::core::library;
using namespace musik::core::sdk;
-class TrackMetadataQuery : public QueryBase {
+class TrackMetadataQuery : public LocalQueryBase {
public:
TrackMetadataQuery(DBID trackId, ILibraryPtr library);
virtual ~TrackMetadataQuery() { }