Remove the per view tags selection

This commit is contained in:
emeric
2018-05-24 13:22:59 +02:00
parent f1c12ebb4d
commit db24d339c3
9 changed files with 5 additions and 173 deletions
+1 -18
View File
@@ -34,31 +34,14 @@
#include "LmsApplication.hpp"
#include "Filters.hpp"
#include "ExploreUtils.hpp"
using namespace Database;
namespace {
const std::string artistClusterTypesSetting = "artist_cluster_types";
const std::set<std::string> defaultArtistClusterTypes =
{
"GENRE",
"ALBUMGROUPING",
"ALBUMMOOD",
"COMMENT:SONGS-DB_OCCASION",
};
} // namespace
namespace UserInterface {
Artist::Artist(Filters* filters)
: _filters(filters)
{
if (!Setting::exists(LmsApp->getDboSession(), artistClusterTypesSetting))
setClusterTypesToSetting(artistClusterTypesSetting, defaultArtistClusterTypes);
wApp->internalPathChanged().connect(std::bind([=]
{
refresh();
@@ -98,7 +81,7 @@ Artist::refresh()
Wt::WContainerWidget* clusterContainers = t->bindNew<Wt::WContainerWidget>("clusters");
{
auto clusterTypes = getClusterTypesFromSetting(artistClusterTypesSetting);
auto clusterTypes = ScanSettings::get(LmsApp->getDboSession())->getClusterTypes();
auto clusterGroups = artist->getClusterGroups(clusterTypes, 3);
for (auto clusters : clusterGroups)
+1 -17
View File
@@ -31,31 +31,15 @@
#include "LmsApplication.hpp"
#include "Filters.hpp"
#include "ExploreUtils.hpp"
using namespace Database;
namespace {
const std::string artistsClusterTypesSetting = "artists_cluster_types";
const std::set<std::string> defaultArtistsClusterTypes =
{
"ALBUMGROUPING",
"GENRE",
"ALBUMMOOD",
};
}
namespace UserInterface {
Artists::Artists(Filters* filters)
: Wt::WTemplate(Wt::WString::tr("Lms.Explore.Artists.template")),
_filters(filters)
{
if (!Setting::exists(LmsApp->getDboSession(), artistsClusterTypesSetting))
setClusterTypesToSetting(artistsClusterTypesSetting, defaultArtistsClusterTypes);
addFunction("tr", &Wt::WTemplate::Functions::tr);
_search = bindNew<Wt::WLineEdit>("search");
@@ -109,7 +93,7 @@ Artists::addSome()
Wt::WContainerWidget* clusterContainers = entry->bindNew<Wt::WContainerWidget>("clusters");
{
auto clusterTypes = getClusterTypesFromSetting(artistsClusterTypesSetting);
auto clusterTypes = ScanSettings::get(LmsApp->getDboSession())->getClusterTypes();
auto clusterGroups = artist->getClusterGroups(clusterTypes, 1);
for (auto clusters : clusterGroups)
-51
View File
@@ -1,51 +0,0 @@
/*
* Copyright (C) 2018 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ExploreUtils.hpp"
#include "utils/Utils.hpp"
#include "database/Setting.hpp"
#include "LmsApplication.hpp"
namespace UserInterface {
std::vector<Database::ClusterType::pointer> getClusterTypesFromSetting(std::string setting)
{
std::vector<Database::ClusterType::pointer> res;
for (auto clusterTypeName : splitString(Database::Setting::getString(LmsApp->getDboSession(), setting), " "))
{
auto clusterType = Database::ClusterType::getByName(LmsApp->getDboSession(), clusterTypeName);
if (clusterType)
res.push_back(clusterType);
}
return res;
}
void setClusterTypesToSetting(std::string setting, const std::set<std::string>& clusterTypes)
{
std::vector<std::string> vec(clusterTypes.begin(), clusterTypes.end());
Database::Setting::setString(LmsApp->getDboSession(), setting, joinStrings(vec, " "));
}
} // namespace UserInterface
-29
View File
@@ -1,29 +0,0 @@
/*
* Copyright (C) 2018 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#include "database/Cluster.hpp"
namespace UserInterface {
std::vector<Database::ClusterType::pointer> getClusterTypesFromSetting(std::string setting);
void setClusterTypesToSetting(std::string setting, const std::set<std::string>& clusterTypes);
} // namespace UserInterface
+1 -19
View File
@@ -26,7 +26,6 @@
#include <Wt/WText.h>
#include "database/Release.hpp"
#include "database/Setting.hpp"
#include "database/Track.hpp"
#include "utils/Logger.hpp"
@@ -36,31 +35,14 @@
#include "LmsApplication.hpp"
#include "Filters.hpp"
#include "ExploreUtils.hpp"
using namespace Database;
namespace {
const std::string releaseClusterTypesSetting = "release_cluster_types";
const std::set<std::string> defaultReleaseClusterTypes =
{
"GENRE",
"ALBUMGROUPING",
"ALBUMMOOD",
"COMMENT:SONGS-DB_OCCASION",
};
} // namespace
namespace UserInterface {
Release::Release(Filters* filters)
: _filters(filters)
{
if (!Setting::exists(LmsApp->getDboSession(), releaseClusterTypesSetting))
setClusterTypesToSetting(releaseClusterTypesSetting, defaultReleaseClusterTypes);
wApp->internalPathChanged().connect(std::bind([=]
{
refresh();
@@ -131,7 +113,7 @@ Release::refresh()
Wt::WContainerWidget* clusterContainers = t->bindNew<Wt::WContainerWidget>("clusters");
{
auto clusterTypes = getClusterTypesFromSetting(releaseClusterTypesSetting);
auto clusterTypes = ScanSettings::get(LmsApp->getDboSession())->getClusterTypes();
auto clusterGroups = release->getClusterGroups(clusterTypes, 3);
for (auto clusters : clusterGroups)
+1 -17
View File
@@ -26,7 +26,6 @@
#include <Wt/WTemplate.h>
#include "database/Release.hpp"
#include "database/Setting.hpp"
#include "utils/Logger.hpp"
#include "utils/Utils.hpp"
@@ -35,30 +34,15 @@
#include "LmsApplication.hpp"
#include "Filters.hpp"
#include "ExploreUtils.hpp"
using namespace Database;
namespace {
const std::string releasesClusterTypesSetting = "releases_cluster_types";
const std::set<std::string> defaultReleasesClusterTypes =
{
"GENRE",
"ALBUMGROUPING",
};
} // namespace
namespace UserInterface {
Releases::Releases(Filters* filters)
: Wt::WTemplate(Wt::WString::tr("Lms.Explore.Releases.template")),
_filters(filters)
{
if (!Setting::exists(LmsApp->getDboSession(), releasesClusterTypesSetting))
setClusterTypesToSetting(releasesClusterTypesSetting, defaultReleasesClusterTypes);
addFunction("tr", &Wt::WTemplate::Functions::tr);
_search = bindNew<Wt::WLineEdit>("search");
@@ -126,7 +110,7 @@ Releases::addSome()
Wt::WContainerWidget* clusterContainers = entry->bindNew<Wt::WContainerWidget>("clusters");
{
auto clusterTypes = getClusterTypesFromSetting(releasesClusterTypesSetting);
auto clusterTypes = ScanSettings::get(LmsApp->getDboSession())->getClusterTypes();
auto clusterGroups = release->getClusterGroups(clusterTypes, 1);
for (auto clusters : clusterGroups)
+1 -19
View File
@@ -26,7 +26,6 @@
#include "database/Artist.hpp"
#include "database/Release.hpp"
#include "database/Setting.hpp"
#include "database/Track.hpp"
#include "utils/Logger.hpp"
@@ -36,32 +35,15 @@
#include "LmsApplication.hpp"
#include "Filters.hpp"
#include "ExploreUtils.hpp"
using namespace Database;
namespace {
const std::string trackClusterTypesSetting = "track_cluster_types";
const std::set<std::string> defaultTrackClusterTypes =
{
"GENRE",
"ALBUMGROUPING",
"ALBUMMOOD",
"COMMENT:SONGS-DB_OCCASION",
};
} // namespace
namespace UserInterface {
Tracks::Tracks(Filters* filters)
: Wt::WTemplate(Wt::WString::tr("Lms.Explore.Tracks.template")),
_filters(filters)
{
if (!Setting::exists(LmsApp->getDboSession(), trackClusterTypesSetting))
setClusterTypesToSetting(trackClusterTypesSetting, defaultTrackClusterTypes);
addFunction("tr", &Wt::WTemplate::Functions::tr);
_search = bindNew<Wt::WLineEdit>("search");
@@ -154,7 +136,7 @@ Tracks::addSome()
Wt::WContainerWidget* clusterContainers = entry->bindNew<Wt::WContainerWidget>("clusters");
{
auto clusterTypes = getClusterTypesFromSetting(trackClusterTypesSetting);
auto clusterTypes = ScanSettings::get(LmsApp->getDboSession())->getClusterTypes();
auto clusterGroups = track->getClusterGroups(clusterTypes, 1);
for (auto clusters : clusterGroups)