1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-17 03:45:56 +01:00

Make it possible to compile out moodbar support

This commit is contained in:
David Sansome 2012-05-27 21:15:58 +01:00
parent e71f436b70
commit b03563f317
6 changed files with 61 additions and 20 deletions

View File

@ -198,13 +198,6 @@ set(SOURCES
library/librarywatcher.cpp
library/sqlrow.cpp
moodbar/moodbarcontroller.cpp
moodbar/moodbaritemdelegate.cpp
moodbar/moodbarloader.cpp
moodbar/moodbarpipeline.cpp
moodbar/moodbarproxystyle.cpp
moodbar/moodbarrenderer.cpp
musicbrainz/acoustidclient.cpp
musicbrainz/chromaprinter.cpp
musicbrainz/musicbrainzclient.cpp
@ -466,12 +459,6 @@ set(HEADERS
library/libraryviewcontainer.h
library/librarywatcher.h
moodbar/moodbarcontroller.h
moodbar/moodbaritemdelegate.h
moodbar/moodbarloader.h
moodbar/moodbarpipeline.h
moodbar/moodbarproxystyle.h
musicbrainz/acoustidclient.h
musicbrainz/musicbrainzclient.h
musicbrainz/tagfetcher.h
@ -991,6 +978,23 @@ optional_source(HAVE_SAC
devices/wmdmloader.h
)
# Moodbar support
optional_source(HAVE_MOODBAR
SOURCES
moodbar/moodbarcontroller.cpp
moodbar/moodbaritemdelegate.cpp
moodbar/moodbarloader.cpp
moodbar/moodbarpipeline.cpp
moodbar/moodbarproxystyle.cpp
moodbar/moodbarrenderer.cpp
HEADERS
moodbar/moodbarcontroller.h
moodbar/moodbaritemdelegate.h
moodbar/moodbarloader.h
moodbar/moodbarpipeline.h
moodbar/moodbarproxystyle.h
)
# Hack to add Clementine to the Unity system tray whitelist
optional_source(LINUX
SOURCES core/ubuntuunityhack.cpp

View File

@ -17,6 +17,7 @@
#include "application.h"
#include "appearance.h"
#include "config.h"
#include "database.h"
#include "player.h"
#include "tagreaderclient.h"
@ -29,8 +30,6 @@
#include "globalsearch/globalsearch.h"
#include "library/library.h"
#include "library/librarybackend.h"
#include "moodbar/moodbarcontroller.h"
#include "moodbar/moodbarloader.h"
#include "playlist/playlistbackend.h"
#include "playlist/playlistmanager.h"
#include "podcasts/gpoddersync.h"
@ -38,6 +37,11 @@
#include "podcasts/podcastdownloader.h"
#include "podcasts/podcastupdater.h"
#ifdef HAVE_MOODBAR
# include "moodbar/moodbarcontroller.h"
# include "moodbar/moodbarloader.h"
#endif
Application::Application(QObject* parent)
: QObject(parent),
tag_reader_client_(NULL),
@ -90,8 +94,11 @@ Application::Application(QObject* parent)
podcast_updater_ = new PodcastUpdater(this, this);
podcast_downloader_ = new PodcastDownloader(this, this);
gpodder_sync_ = new GPodderSync(this, this);
#ifdef HAVE_MOODBAR
moodbar_loader_ = new MoodbarLoader(this);
moodbar_controller_ = new MoodbarController(this, this);
#endif
library_->Init();
library_->StartThreads();

View File

@ -85,6 +85,12 @@ void PlaylistHeader::contextMenuEvent(QContextMenuEvent* e) {
}
void PlaylistHeader::AddColumnAction(int index) {
#ifndef HAVE_MOODBAR
if (index == Playlist::Column_Mood) {
return;
}
#endif
QString title(model()->headerData(index, Qt::Horizontal).toString());
QAction* action = menu_->addAction(title, show_mapper_, SLOT(map()));

View File

@ -15,6 +15,7 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "dynamicplaylistcontrols.h"
#include "playlist.h"
#include "playlistdelegates.h"
@ -24,7 +25,6 @@
#include "core/logging.h"
#include "core/player.h"
#include "covers/currentartloader.h"
#include "moodbar/moodbaritemdelegate.h"
#include <QCleanlooksStyle>
#include <QClipboard>
@ -41,7 +41,11 @@
#include <math.h>
const int PlaylistView::kStateVersion = 4;
#ifdef HAVE_MOODBAR
# include "moodbar/moodbaritemdelegate.h"
#endif
const int PlaylistView::kStateVersion = 5;
const int PlaylistView::kGlowIntensitySteps = 24;
const int PlaylistView::kAutoscrollGraceTimeout = 60; // seconds
const int PlaylistView::kDropIndicatorWidth = 2;
@ -199,7 +203,10 @@ void PlaylistView::SetItemDelegates(LibraryBackend* backend) {
setItemDelegateForColumn(Playlist::Column_Filename, new NativeSeparatorsDelegate(this));
setItemDelegateForColumn(Playlist::Column_Rating, rating_delegate_);
setItemDelegateForColumn(Playlist::Column_LastPlayed, new LastPlayedItemDelegate(this));
#ifdef HAVE_MOODBAR
setItemDelegateForColumn(Playlist::Column_Mood, new MoodbarItemDelegate(app_, this));
#endif
if (app_ && app_->player()) {
setItemDelegateForColumn(Playlist::Column_Source, new SongSourceDelegate(this, app_->player()));
@ -308,6 +315,11 @@ void PlaylistView::LoadGeometry() {
if (state_version < 3) {
header_->HideSection(Playlist::Column_Comment);
}
if (state_version < 5) {
#ifndef HAVE_MOODBAR
header_->HideSection(Playlist::Column_Mood);
#endif
}
// Make sure at least one column is visible
bool all_hidden = true;

View File

@ -55,8 +55,6 @@
#include "library/librarydirectorymodel.h"
#include "library/libraryfilterwidget.h"
#include "library/libraryviewcontainer.h"
#include "moodbar/moodbarcontroller.h"
#include "moodbar/moodbarproxystyle.h"
#include "musicbrainz/tagfetcher.h"
#include "playlist/playlistbackend.h"
#include "playlist/playlist.h"
@ -110,6 +108,11 @@
# include "visualisations/visualisationcontainer.h"
#endif
#ifdef HAVE_MOODBAR
# include "moodbar/moodbarcontroller.h"
# include "moodbar/moodbarproxystyle.h"
#endif
#include <QCloseEvent>
#include <QDir>
#include <QFileDialog>
@ -618,9 +621,11 @@ MainWindow::MainWindow(Application* app,
ui_->status_bar_stack->setCurrentWidget(ui_->playlist_summary_page);
connect(ui_->multi_loading_indicator, SIGNAL(TaskCountChange(int)), SLOT(TaskCountChanged(int)));
#ifdef HAVE_MOODBAR
// Moodbar connections
connect(app_->moodbar_controller(), SIGNAL(CurrentMoodbarDataChanged(QByteArray)),
ui_->track_slider->moodbar_style(), SLOT(SetMoodbarData(QByteArray)));
#endif
// Now playing widget
qLog(Debug) << "Creating now playing widget";

View File

@ -15,13 +15,17 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "trackslider.h"
#include "ui_trackslider.h"
#include "core/utilities.h"
#include "moodbar/moodbarproxystyle.h"
#include <QSettings>
#ifdef HAVE_MOODBAR
# include "moodbar/moodbarproxystyle.h"
#endif
const char* TrackSlider::kSettingsGroup = "MainWindow";
TrackSlider::TrackSlider(QWidget* parent)
@ -33,7 +37,10 @@ TrackSlider::TrackSlider(QWidget* parent)
slider_maximum_value_(0)
{
ui_->setupUi(this);
#ifdef HAVE_MOODBAR
moodbar_style_ = new MoodbarProxyStyle(ui_->slider);
#endif
QFont font("Courier");
ui_->elapsed->setFont(font);