Reduce database include dependencies
This commit is contained in:
@@ -22,8 +22,8 @@
|
||||
#include <Wt/WTemplate.h>
|
||||
#include <Wt/WText.h>
|
||||
|
||||
#include "database/DbArtist.hpp"
|
||||
#include "database/Setting.hpp"
|
||||
#include "database/Types.hpp"
|
||||
|
||||
#include "utils/Logger.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
@@ -92,7 +92,7 @@ Artist::refresh()
|
||||
|
||||
clear();
|
||||
|
||||
auto artistId = readAs<Database::Artist::id_type>(wApp->internalPathNextPart("/artist/"));
|
||||
auto artistId = readAs<Database::IdType>(wApp->internalPathNextPart("/artist/"));
|
||||
if (!artistId)
|
||||
return;
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include <Wt/WContainerWidget.h>
|
||||
#include <Wt/WSignal.h>
|
||||
|
||||
#include "database/Types.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
|
||||
class Filters;
|
||||
@@ -31,11 +33,11 @@ class Artist : public Wt::WContainerWidget
|
||||
public:
|
||||
Artist(Filters* filters);
|
||||
|
||||
Wt::Signal<Database::id_type> artistAdd;
|
||||
Wt::Signal<Database::id_type> artistPlay;
|
||||
Wt::Signal<Database::IdType> artistAdd;
|
||||
Wt::Signal<Database::IdType> artistPlay;
|
||||
|
||||
Wt::Signal<Database::id_type> releaseAdd;
|
||||
Wt::Signal<Database::id_type> releasePlay;
|
||||
Wt::Signal<Database::IdType> releaseAdd;
|
||||
Wt::Signal<Database::IdType> releasePlay;
|
||||
|
||||
private:
|
||||
void refresh();
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#include <Wt/WTemplate.h>
|
||||
#include <Wt/WLineEdit.h>
|
||||
|
||||
#include "database/DbArtist.hpp"
|
||||
#include "database/Setting.hpp"
|
||||
#include "database/Types.hpp"
|
||||
|
||||
#include "utils/Logger.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include <Wt/WLineEdit.h>
|
||||
#include <Wt/WSignal.h>
|
||||
|
||||
#include "database/Types.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
|
||||
class Filters;
|
||||
@@ -33,8 +35,8 @@ class Artists : public Wt::WTemplate
|
||||
public:
|
||||
Artists(Filters* filters);
|
||||
|
||||
Wt::Signal<Database::id_type> artistAdd;
|
||||
Wt::Signal<Database::id_type> artistPlay;
|
||||
Wt::Signal<Database::IdType> artistAdd;
|
||||
Wt::Signal<Database::IdType> artistPlay;
|
||||
|
||||
private:
|
||||
void refresh();
|
||||
|
||||
@@ -118,7 +118,7 @@ Explore::Explore()
|
||||
}
|
||||
|
||||
// TODO SQL this?
|
||||
static std::vector<Database::Track::pointer> getArtistTracks(Wt::Dbo::Session& session, Database::id_type artistId, std::set<Database::id_type> clusters)
|
||||
static std::vector<Database::Track::pointer> getArtistTracks(Wt::Dbo::Session& session, Database::IdType artistId, std::set<Database::IdType> clusters)
|
||||
{
|
||||
std::vector<Database::Track::pointer> res;
|
||||
|
||||
@@ -140,7 +140,7 @@ static std::vector<Database::Track::pointer> getArtistTracks(Wt::Dbo::Session& s
|
||||
return res;
|
||||
}
|
||||
|
||||
static std::vector<Database::Track::pointer> getReleaseTracks(Wt::Dbo::Session& session, Database::id_type releaseId, std::set<Database::id_type> clusters)
|
||||
static std::vector<Database::Track::pointer> getReleaseTracks(Wt::Dbo::Session& session, Database::IdType releaseId, std::set<Database::IdType> clusters)
|
||||
{
|
||||
std::vector<Database::Track::pointer> res;
|
||||
|
||||
@@ -151,7 +151,7 @@ static std::vector<Database::Track::pointer> getReleaseTracks(Wt::Dbo::Session&
|
||||
return release->getTracks(clusters);
|
||||
}
|
||||
|
||||
static std::vector<Database::Track::pointer> getTrack(Wt::Dbo::Session& session, Database::id_type trackId)
|
||||
static std::vector<Database::Track::pointer> getTrack(Wt::Dbo::Session& session, Database::IdType trackId)
|
||||
{
|
||||
std::vector<Database::Track::pointer> res;
|
||||
|
||||
@@ -163,7 +163,7 @@ static std::vector<Database::Track::pointer> getTrack(Wt::Dbo::Session& session,
|
||||
}
|
||||
|
||||
void
|
||||
Explore::handleArtistAdd(Database::id_type id)
|
||||
Explore::handleArtistAdd(Database::IdType id)
|
||||
{
|
||||
Wt::Dbo::Transaction transaction(LmsApp->getDboSession());
|
||||
|
||||
@@ -171,7 +171,7 @@ Explore::handleArtistAdd(Database::id_type id)
|
||||
}
|
||||
|
||||
void
|
||||
Explore::handleArtistPlay(Database::id_type id)
|
||||
Explore::handleArtistPlay(Database::IdType id)
|
||||
{
|
||||
Wt::Dbo::Transaction transaction(LmsApp->getDboSession());
|
||||
|
||||
@@ -179,7 +179,7 @@ Explore::handleArtistPlay(Database::id_type id)
|
||||
}
|
||||
|
||||
void
|
||||
Explore::handleReleaseAdd(Database::id_type id)
|
||||
Explore::handleReleaseAdd(Database::IdType id)
|
||||
{
|
||||
Wt::Dbo::Transaction transaction(LmsApp->getDboSession());
|
||||
|
||||
@@ -187,7 +187,7 @@ Explore::handleReleaseAdd(Database::id_type id)
|
||||
}
|
||||
|
||||
void
|
||||
Explore::handleReleasePlay(Database::id_type id)
|
||||
Explore::handleReleasePlay(Database::IdType id)
|
||||
{
|
||||
Wt::Dbo::Transaction transaction(LmsApp->getDboSession());
|
||||
|
||||
@@ -195,7 +195,7 @@ Explore::handleReleasePlay(Database::id_type id)
|
||||
}
|
||||
|
||||
void
|
||||
Explore::handleTrackAdd(Database::id_type id)
|
||||
Explore::handleTrackAdd(Database::IdType id)
|
||||
{
|
||||
Wt::Dbo::Transaction transaction(LmsApp->getDboSession());
|
||||
|
||||
@@ -203,7 +203,7 @@ Explore::handleTrackAdd(Database::id_type id)
|
||||
}
|
||||
|
||||
void
|
||||
Explore::handleTrackPlay(Database::id_type id)
|
||||
Explore::handleTrackPlay(Database::IdType id)
|
||||
{
|
||||
Wt::Dbo::Transaction transaction(LmsApp->getDboSession());
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <Wt/WTemplate.h>
|
||||
|
||||
#include "database/Track.hpp"
|
||||
#include "database/Types.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
@@ -37,12 +38,12 @@ class Explore : public Wt::WTemplate
|
||||
|
||||
private:
|
||||
|
||||
void handleArtistAdd(Database::Artist::id_type id);
|
||||
void handleArtistPlay(Database::Artist::id_type id);
|
||||
void handleReleaseAdd(Database::Release::id_type id);
|
||||
void handleReleasePlay(Database::Release::id_type id);
|
||||
void handleTrackAdd(Database::Track::id_type id);
|
||||
void handleTrackPlay(Database::Track::id_type id);
|
||||
void handleArtistAdd(Database::IdType id);
|
||||
void handleArtistPlay(Database::IdType id);
|
||||
void handleReleaseAdd(Database::IdType id);
|
||||
void handleReleasePlay(Database::IdType id);
|
||||
void handleTrackAdd(Database::IdType id);
|
||||
void handleTrackPlay(Database::IdType id);
|
||||
void handleTracksAdd(std::vector<Database::Track::pointer> tracks);
|
||||
void handleTracksPlay(std::vector<Database::Track::pointer> tracks);
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ Filters::showDialog()
|
||||
}
|
||||
|
||||
void
|
||||
Filters::add(Database::Cluster::id_type clusterId)
|
||||
Filters::add(Database::IdType clusterId)
|
||||
{
|
||||
Wt::Dbo::Transaction transaction(LmsApp->getDboSession());
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@ class Filters : public Wt::WTemplate
|
||||
public:
|
||||
Filters();
|
||||
|
||||
void add(Database::Cluster::id_type clusterId);
|
||||
void add(Database::IdType clusterId);
|
||||
|
||||
std::set<Database::Cluster::id_type> getClusterIds() const { return _filterIds; }
|
||||
std::set<Database::IdType> getClusterIds() const { return _filterIds; }
|
||||
|
||||
Wt::Signal<>& updated() { return _sigUpdated; }
|
||||
|
||||
@@ -46,7 +46,7 @@ class Filters : public Wt::WTemplate
|
||||
|
||||
Wt::WContainerWidget *_filters;
|
||||
Wt::Signal<> _sigUpdated;
|
||||
std::set<Database::Cluster::id_type> _filterIds;
|
||||
std::set<Database::IdType> _filterIds;
|
||||
};
|
||||
|
||||
} // namespace UserInterface
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <Wt/WTemplate.h>
|
||||
#include <Wt/WText.h>
|
||||
|
||||
#include "database/Types.hpp"
|
||||
#include "database/Release.hpp"
|
||||
#include "database/Setting.hpp"
|
||||
|
||||
#include "utils/Logger.hpp"
|
||||
@@ -92,7 +92,7 @@ Release::refresh()
|
||||
|
||||
clear();
|
||||
|
||||
auto releaseId = readAs<Database::Release::id_type>(wApp->internalPathNextPart("/release/"));
|
||||
auto releaseId = readAs<Database::IdType>(wApp->internalPathNextPart("/release/"));
|
||||
if (!releaseId)
|
||||
return;
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include <Wt/WSignal.h>
|
||||
|
||||
#include "database/Types.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
|
||||
class Filters;
|
||||
@@ -29,11 +31,11 @@ class Release : public Wt::WContainerWidget
|
||||
public:
|
||||
Release(Filters* filters);
|
||||
|
||||
Wt::Signal<Database::id_type> releaseAdd;
|
||||
Wt::Signal<Database::id_type> releasePlay;
|
||||
Wt::Signal<Database::IdType> releaseAdd;
|
||||
Wt::Signal<Database::IdType> releasePlay;
|
||||
|
||||
Wt::Signal<Database::id_type> trackAdd;
|
||||
Wt::Signal<Database::id_type> trackPlay;
|
||||
Wt::Signal<Database::IdType> trackAdd;
|
||||
Wt::Signal<Database::IdType> trackPlay;
|
||||
|
||||
private:
|
||||
void refresh();
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <Wt/WText.h>
|
||||
#include <Wt/WTemplate.h>
|
||||
|
||||
#include "database/Types.hpp"
|
||||
#include "database/Release.hpp"
|
||||
|
||||
#include "utils/Logger.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include <Wt/WText.h>
|
||||
#include <Wt/WTemplate.h>
|
||||
|
||||
#include "database/Types.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
|
||||
class Filters;
|
||||
@@ -33,8 +35,8 @@ class Releases : public Wt::WTemplate
|
||||
public:
|
||||
Releases(Filters* filters);
|
||||
|
||||
Wt::Signal<Database::id_type> releaseAdd;
|
||||
Wt::Signal<Database::id_type> releasePlay;
|
||||
Wt::Signal<Database::IdType> releaseAdd;
|
||||
Wt::Signal<Database::IdType> releasePlay;
|
||||
|
||||
private:
|
||||
void refresh();
|
||||
|
||||
@@ -22,7 +22,9 @@
|
||||
#include <Wt/WLineEdit.h>
|
||||
#include <Wt/WText.h>
|
||||
|
||||
#include "database/Types.hpp"
|
||||
#include "database/DbArtist.hpp"
|
||||
#include "database/Track.hpp"
|
||||
#include "database/Release.hpp"
|
||||
|
||||
#include "utils/Logger.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
#include <Wt/WLineEdit.h>
|
||||
#include <Wt/WTemplate.h>
|
||||
|
||||
#include "database/Types.hpp"
|
||||
#include "database/Track.hpp"
|
||||
|
||||
namespace UserInterface {
|
||||
|
||||
class Filters;
|
||||
@@ -31,8 +34,8 @@ class Tracks : public Wt::WTemplate
|
||||
public:
|
||||
Tracks(Filters* filters);
|
||||
|
||||
Wt::Signal<Database::id_type> trackAdd;
|
||||
Wt::Signal<Database::id_type> trackPlay;
|
||||
Wt::Signal<Database::IdType> trackAdd;
|
||||
Wt::Signal<Database::IdType> trackPlay;
|
||||
|
||||
Wt::Signal<std::vector<Database::Track::pointer>> tracksAdd;
|
||||
Wt::Signal<std::vector<Database::Track::pointer>> tracksPlay;
|
||||
|
||||
Reference in New Issue
Block a user