Make last.fm optional. Thanks volkov0aa. Fixes issue #49
This commit is contained in:
parent
623ab527ee
commit
28fdb147d8
@ -56,6 +56,10 @@ endif (WIN32)
|
|||||||
find_library(LASTFM_LIBRARIES lastfm)
|
find_library(LASTFM_LIBRARIES lastfm)
|
||||||
find_path(LASTFM_INCLUDE_DIRS lastfm/ws.h)
|
find_path(LASTFM_INCLUDE_DIRS lastfm/ws.h)
|
||||||
|
|
||||||
|
if (LASTFM_LIBRARIES AND LASTFM_INCLUDE_DIRS)
|
||||||
|
set(HAVE_LIBLASTFM ON)
|
||||||
|
endif (LASTFM_LIBRARIES AND LASTFM_INCLUDE_DIRS)
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
find_library(GROWL Growl)
|
find_library(GROWL Growl)
|
||||||
option(ENABLE_SPARKLE "Sparkle updating" ON)
|
option(ENABLE_SPARKLE "Sparkle updating" ON)
|
||||||
@ -102,7 +106,9 @@ include_directories(${GSTREAMER_INCLUDE_DIRS})
|
|||||||
include_directories(${GLIB_INCLUDE_DIRS})
|
include_directories(${GLIB_INCLUDE_DIRS})
|
||||||
include_directories(${GLIBCONFIG_INCLUDE_DIRS})
|
include_directories(${GLIBCONFIG_INCLUDE_DIRS})
|
||||||
include_directories(${LIBXML_INCLUDE_DIRS})
|
include_directories(${LIBXML_INCLUDE_DIRS})
|
||||||
include_directories(${LASTFM_INCLUDE_DIRS})
|
if (HAVE_LIBLASTFM)
|
||||||
|
include_directories(${LASTFM_INCLUDE_DIRS})
|
||||||
|
endif (HAVE_LIBLASTFM)
|
||||||
include_directories("3rdparty/qsqlite")
|
include_directories("3rdparty/qsqlite")
|
||||||
include_directories("3rdparty/universalchardet")
|
include_directories("3rdparty/universalchardet")
|
||||||
|
|
||||||
@ -263,4 +269,5 @@ summary_add("Gnome sound menu integration" HAVE_LIBINDICATE)
|
|||||||
summary_add("Wiimote support" ENABLE_WIIMOTEDEV)
|
summary_add("Wiimote support" ENABLE_WIIMOTEDEV)
|
||||||
summary_add("Visualisations" ENABLE_VISUALISATIONS)
|
summary_add("Visualisations" ENABLE_VISUALISATIONS)
|
||||||
summary_add("Sparkle integration" HAVE_SPARKLE)
|
summary_add("Sparkle integration" HAVE_SPARKLE)
|
||||||
|
summary_add("Last.fm support" HAVE_LIBLASTFM)
|
||||||
summary_show()
|
summary_show()
|
||||||
|
@ -37,7 +37,6 @@ set(SOURCES
|
|||||||
analyzers/sonogram.cpp
|
analyzers/sonogram.cpp
|
||||||
analyzers/turbine.cpp
|
analyzers/turbine.cpp
|
||||||
|
|
||||||
core/albumcoverfetcher.cpp
|
|
||||||
core/albumcoverloader.cpp
|
core/albumcoverloader.cpp
|
||||||
core/backgroundstreams.cpp
|
core/backgroundstreams.cpp
|
||||||
core/backgroundthread.cpp
|
core/backgroundthread.cpp
|
||||||
@ -120,7 +119,6 @@ set(SOURCES
|
|||||||
playlistparsers/xmlparser.cpp
|
playlistparsers/xmlparser.cpp
|
||||||
playlistparsers/xspfparser.cpp
|
playlistparsers/xspfparser.cpp
|
||||||
|
|
||||||
radio/fixlastfm.cpp
|
|
||||||
radio/icecastbackend.cpp
|
radio/icecastbackend.cpp
|
||||||
radio/icecastfilterwidget.cpp
|
radio/icecastfilterwidget.cpp
|
||||||
radio/icecastmodel.cpp
|
radio/icecastmodel.cpp
|
||||||
@ -128,9 +126,6 @@ set(SOURCES
|
|||||||
radio/jamendodynamicplaylist.cpp
|
radio/jamendodynamicplaylist.cpp
|
||||||
radio/jamendoplaylistitem.cpp
|
radio/jamendoplaylistitem.cpp
|
||||||
radio/jamendoservice.cpp
|
radio/jamendoservice.cpp
|
||||||
radio/lastfmconfig.cpp
|
|
||||||
radio/lastfmservice.cpp
|
|
||||||
radio/lastfmstationdialog.cpp
|
|
||||||
radio/magnatuneconfig.cpp
|
radio/magnatuneconfig.cpp
|
||||||
radio/magnatunedownloaddialog.cpp
|
radio/magnatunedownloaddialog.cpp
|
||||||
radio/magnatuneplaylistitem.cpp
|
radio/magnatuneplaylistitem.cpp
|
||||||
@ -160,9 +155,6 @@ set(SOURCES
|
|||||||
songinfo/collapsibleinfopane.cpp
|
songinfo/collapsibleinfopane.cpp
|
||||||
songinfo/echonestbiographies.cpp
|
songinfo/echonestbiographies.cpp
|
||||||
songinfo/echonestimages.cpp
|
songinfo/echonestimages.cpp
|
||||||
songinfo/echonestsimilarartists.cpp
|
|
||||||
songinfo/echonesttags.cpp
|
|
||||||
songinfo/lastfmtrackinfoprovider.cpp
|
|
||||||
songinfo/lyricsettings.cpp
|
songinfo/lyricsettings.cpp
|
||||||
songinfo/songinfobase.cpp
|
songinfo/songinfobase.cpp
|
||||||
songinfo/songinfofetcher.cpp
|
songinfo/songinfofetcher.cpp
|
||||||
@ -170,15 +162,11 @@ set(SOURCES
|
|||||||
songinfo/songinfotextview.cpp
|
songinfo/songinfotextview.cpp
|
||||||
songinfo/songinfoview.cpp
|
songinfo/songinfoview.cpp
|
||||||
songinfo/songplaystats.cpp
|
songinfo/songplaystats.cpp
|
||||||
songinfo/tagwidget.cpp
|
|
||||||
songinfo/ultimatelyricsprovider.cpp
|
songinfo/ultimatelyricsprovider.cpp
|
||||||
songinfo/ultimatelyricsreader.cpp
|
songinfo/ultimatelyricsreader.cpp
|
||||||
|
|
||||||
ui/about.cpp
|
ui/about.cpp
|
||||||
ui/addstreamdialog.cpp
|
ui/addstreamdialog.cpp
|
||||||
ui/albumcovermanager.cpp
|
|
||||||
ui/albumcovermanagerlist.cpp
|
|
||||||
ui/albumcoversearcher.cpp
|
|
||||||
ui/edittagdialog.cpp
|
ui/edittagdialog.cpp
|
||||||
ui/equalizer.cpp
|
ui/equalizer.cpp
|
||||||
ui/flowlayout.cpp
|
ui/flowlayout.cpp
|
||||||
@ -231,7 +219,6 @@ set(HEADERS
|
|||||||
analyzers/sonogram.h
|
analyzers/sonogram.h
|
||||||
analyzers/turbine.h
|
analyzers/turbine.h
|
||||||
|
|
||||||
core/albumcoverfetcher.h
|
|
||||||
core/albumcoverloader.h
|
core/albumcoverloader.h
|
||||||
core/backgroundstreams.h
|
core/backgroundstreams.h
|
||||||
core/backgroundthread.h
|
core/backgroundthread.h
|
||||||
@ -300,9 +287,6 @@ set(HEADERS
|
|||||||
radio/icecastservice.h
|
radio/icecastservice.h
|
||||||
radio/jamendodynamicplaylist.h
|
radio/jamendodynamicplaylist.h
|
||||||
radio/jamendoservice.h
|
radio/jamendoservice.h
|
||||||
radio/lastfmconfig.h
|
|
||||||
radio/lastfmservice.h
|
|
||||||
radio/lastfmstationdialog.h
|
|
||||||
radio/magnatuneconfig.h
|
radio/magnatuneconfig.h
|
||||||
radio/magnatunedownloaddialog.h
|
radio/magnatunedownloaddialog.h
|
||||||
radio/magnatuneservice.h
|
radio/magnatuneservice.h
|
||||||
@ -328,9 +312,6 @@ set(HEADERS
|
|||||||
songinfo/collapsibleinfopane.h
|
songinfo/collapsibleinfopane.h
|
||||||
songinfo/echonestbiographies.h
|
songinfo/echonestbiographies.h
|
||||||
songinfo/echonestimages.h
|
songinfo/echonestimages.h
|
||||||
songinfo/echonestsimilarartists.h
|
|
||||||
songinfo/echonesttags.h
|
|
||||||
songinfo/lastfmtrackinfoprovider.h
|
|
||||||
songinfo/lyricsettings.h
|
songinfo/lyricsettings.h
|
||||||
songinfo/songinfobase.h
|
songinfo/songinfobase.h
|
||||||
songinfo/songinfofetcher.h
|
songinfo/songinfofetcher.h
|
||||||
@ -338,15 +319,11 @@ set(HEADERS
|
|||||||
songinfo/songinfotextview.h
|
songinfo/songinfotextview.h
|
||||||
songinfo/songinfoview.h
|
songinfo/songinfoview.h
|
||||||
songinfo/songplaystats.h
|
songinfo/songplaystats.h
|
||||||
songinfo/tagwidget.h
|
|
||||||
songinfo/ultimatelyricsprovider.h
|
songinfo/ultimatelyricsprovider.h
|
||||||
songinfo/ultimatelyricsreader.h
|
songinfo/ultimatelyricsreader.h
|
||||||
|
|
||||||
ui/about.h
|
ui/about.h
|
||||||
ui/addstreamdialog.h
|
ui/addstreamdialog.h
|
||||||
ui/albumcovermanager.h
|
|
||||||
ui/albumcovermanagerlist.h
|
|
||||||
ui/albumcoversearcher.h
|
|
||||||
ui/edittagdialog.h
|
ui/edittagdialog.h
|
||||||
ui/equalizer.h
|
ui/equalizer.h
|
||||||
ui/globalshortcutgrabber.h
|
ui/globalshortcutgrabber.h
|
||||||
@ -399,8 +376,6 @@ set(UI
|
|||||||
playlist/queuemanager.ui
|
playlist/queuemanager.ui
|
||||||
|
|
||||||
radio/icecastfilterwidget.ui
|
radio/icecastfilterwidget.ui
|
||||||
radio/lastfmconfig.ui
|
|
||||||
radio/lastfmstationdialog.ui
|
|
||||||
radio/magnatuneconfig.ui
|
radio/magnatuneconfig.ui
|
||||||
radio/magnatunedownloaddialog.ui
|
radio/magnatunedownloaddialog.ui
|
||||||
radio/radioviewcontainer.ui
|
radio/radioviewcontainer.ui
|
||||||
@ -415,8 +390,6 @@ set(UI
|
|||||||
|
|
||||||
ui/about.ui
|
ui/about.ui
|
||||||
ui/addstreamdialog.ui
|
ui/addstreamdialog.ui
|
||||||
ui/albumcovermanager.ui
|
|
||||||
ui/albumcoversearcher.ui
|
|
||||||
ui/edittagdialog.ui
|
ui/edittagdialog.ui
|
||||||
ui/equalizer.ui
|
ui/equalizer.ui
|
||||||
ui/globalshortcutgrabber.ui
|
ui/globalshortcutgrabber.ui
|
||||||
@ -501,6 +474,43 @@ if(ENABLE_VISUALISATIONS)
|
|||||||
)
|
)
|
||||||
endif(ENABLE_VISUALISATIONS)
|
endif(ENABLE_VISUALISATIONS)
|
||||||
|
|
||||||
|
# Lastfm
|
||||||
|
if(HAVE_LIBLASTFM)
|
||||||
|
list(APPEND SOURCES
|
||||||
|
core/albumcoverfetcher.cpp
|
||||||
|
radio/fixlastfm.cpp
|
||||||
|
radio/lastfmconfig.cpp
|
||||||
|
radio/lastfmservice.cpp
|
||||||
|
radio/lastfmstationdialog.cpp
|
||||||
|
songinfo/echonestsimilarartists.cpp
|
||||||
|
songinfo/echonesttags.cpp
|
||||||
|
songinfo/lastfmtrackinfoprovider.cpp
|
||||||
|
songinfo/tagwidget.cpp
|
||||||
|
ui/albumcovermanager.cpp
|
||||||
|
ui/albumcovermanagerlist.cpp
|
||||||
|
ui/albumcoversearcher.cpp
|
||||||
|
)
|
||||||
|
list(APPEND HEADERS
|
||||||
|
core/albumcoverfetcher.h
|
||||||
|
radio/lastfmconfig.h
|
||||||
|
radio/lastfmservice.h
|
||||||
|
radio/lastfmstationdialog.h
|
||||||
|
songinfo/echonestsimilarartists.h
|
||||||
|
songinfo/echonesttags.h
|
||||||
|
songinfo/lastfmtrackinfoprovider.h
|
||||||
|
songinfo/tagwidget.h
|
||||||
|
ui/albumcovermanager.h
|
||||||
|
ui/albumcovermanagerlist.h
|
||||||
|
ui/albumcoversearcher.h
|
||||||
|
)
|
||||||
|
list(APPEND UI
|
||||||
|
radio/lastfmconfig.ui
|
||||||
|
radio/lastfmstationdialog.ui
|
||||||
|
ui/albumcovermanager.ui
|
||||||
|
ui/albumcoversearcher.ui
|
||||||
|
)
|
||||||
|
endif(HAVE_LIBLASTFM)
|
||||||
|
|
||||||
# Transcoder
|
# Transcoder
|
||||||
if(HAVE_GSTREAMER)
|
if(HAVE_GSTREAMER)
|
||||||
list(APPEND SOURCES
|
list(APPEND SOURCES
|
||||||
@ -766,7 +776,6 @@ target_link_libraries(clementine_lib
|
|||||||
${TAGLIB_LIBRARIES}
|
${TAGLIB_LIBRARIES}
|
||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
${ENGINE_LIBRARIES}
|
${ENGINE_LIBRARIES}
|
||||||
${LASTFM_LIBRARIES}
|
|
||||||
${QTSINGLEAPPLICATION_LIBRARIES}
|
${QTSINGLEAPPLICATION_LIBRARIES}
|
||||||
${QTSINGLECOREAPPLICATION_LIBRARIES}
|
${QTSINGLECOREAPPLICATION_LIBRARIES}
|
||||||
${QTIOCOMPRESSOR_LIBRARIES}
|
${QTIOCOMPRESSOR_LIBRARIES}
|
||||||
@ -779,6 +788,10 @@ if(ENABLE_VISUALISATIONS)
|
|||||||
target_link_libraries(clementine_lib ${LIBPROJECTM_LIBRARIES})
|
target_link_libraries(clementine_lib ${LIBPROJECTM_LIBRARIES})
|
||||||
endif(ENABLE_VISUALISATIONS)
|
endif(ENABLE_VISUALISATIONS)
|
||||||
|
|
||||||
|
if(HAVE_LIBLASTFM)
|
||||||
|
target_link_libraries(clementine_lib ${LASTFM_LIBRARIES})
|
||||||
|
endif(HAVE_LIBLASTFM)
|
||||||
|
|
||||||
if(HAVE_LIBGPOD)
|
if(HAVE_LIBGPOD)
|
||||||
target_link_libraries(clementine_lib ${LIBGPOD_LIBRARIES})
|
target_link_libraries(clementine_lib ${LIBGPOD_LIBRARIES})
|
||||||
endif(HAVE_LIBGPOD)
|
endif(HAVE_LIBGPOD)
|
||||||
|
@ -48,4 +48,6 @@
|
|||||||
|
|
||||||
#cmakedefine HAVE_LIBINDICATE
|
#cmakedefine HAVE_LIBINDICATE
|
||||||
|
|
||||||
|
#cmakedefine HAVE_LIBLASTFM
|
||||||
|
|
||||||
#endif // CONFIG_H_IN
|
#endif // CONFIG_H_IN
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include "playlist/playlist.h"
|
#include "playlist/playlist.h"
|
||||||
#include "playlist/playlistitem.h"
|
#include "playlist/playlistitem.h"
|
||||||
#include "playlist/playlistmanager.h"
|
#include "playlist/playlistmanager.h"
|
||||||
#include "radio/lastfmservice.h"
|
|
||||||
#include "mpris_common.h"
|
#include "mpris_common.h"
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
#ifdef HAVE_GSTREAMER
|
||||||
@ -36,6 +35,9 @@
|
|||||||
#ifdef HAVE_QT_PHONON
|
#ifdef HAVE_QT_PHONON
|
||||||
# include "engines/phononengine.h"
|
# include "engines/phononengine.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
# include "radio/lastfmservice.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
# include "mpris.h"
|
# include "mpris.h"
|
||||||
@ -53,13 +55,18 @@ using boost::shared_ptr;
|
|||||||
|
|
||||||
|
|
||||||
Player::Player(MainWindow* main_window, PlaylistManager* playlists,
|
Player::Player(MainWindow* main_window, PlaylistManager* playlists,
|
||||||
LastFMService* lastfm, Engine::Type engine, QObject* parent)
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
LastFMService* lastfm,
|
||||||
|
#endif
|
||||||
|
Engine::Type engine, QObject* parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
art_loader_(new mpris::ArtLoader(this)),
|
art_loader_(new mpris::ArtLoader(this)),
|
||||||
mpris1_(NULL),
|
mpris1_(NULL),
|
||||||
mpris2_(NULL),
|
mpris2_(NULL),
|
||||||
playlists_(playlists),
|
playlists_(playlists),
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
lastfm_(lastfm),
|
lastfm_(lastfm),
|
||||||
|
#endif
|
||||||
engine_(CreateEngine(engine)),
|
engine_(CreateEngine(engine)),
|
||||||
stream_change_type_(Engine::First),
|
stream_change_type_(Engine::First),
|
||||||
last_state_(Engine::Empty),
|
last_state_(Engine::Empty),
|
||||||
@ -322,13 +329,17 @@ void Player::PlayAt(int index, Engine::TrackChangeType change, bool reshuffle) {
|
|||||||
loading_async_ = QUrl();
|
loading_async_ = QUrl();
|
||||||
engine_->Play(current_item_->Url(), change);
|
engine_->Play(current_item_->Url(), change);
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
if (lastfm_->IsScrobblingEnabled())
|
if (lastfm_->IsScrobblingEnabled())
|
||||||
lastfm_->NowPlaying(current_item_->Metadata());
|
lastfm_->NowPlaying(current_item_->Metadata());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::CurrentMetadataChanged(const Song& metadata) {
|
void Player::CurrentMetadataChanged(const Song& metadata) {
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
lastfm_->NowPlaying(metadata);
|
lastfm_->NowPlaying(metadata);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::Seek(int seconds) {
|
void Player::Seek(int seconds) {
|
||||||
|
@ -30,9 +30,12 @@
|
|||||||
|
|
||||||
class PlaylistManager;
|
class PlaylistManager;
|
||||||
class Settings;
|
class Settings;
|
||||||
class LastFMService;
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
class LastFMService;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace mpris {
|
namespace mpris {
|
||||||
class Mpris1;
|
class Mpris1;
|
||||||
class Mpris2;
|
class Mpris2;
|
||||||
@ -50,7 +53,10 @@ class Player : public QObject {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
Player(MainWindow* main_window, PlaylistManager* playlists,
|
Player(MainWindow* main_window, PlaylistManager* playlists,
|
||||||
LastFMService* lastfm, Engine::Type engine, QObject* parent = 0);
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
LastFMService* lastfm,
|
||||||
|
#endif
|
||||||
|
Engine::Type engine, QObject* parent = 0);
|
||||||
~Player();
|
~Player();
|
||||||
|
|
||||||
EngineBase* CreateEngine(Engine::Type engine);
|
EngineBase* CreateEngine(Engine::Type engine);
|
||||||
@ -124,7 +130,9 @@ class Player : public QObject {
|
|||||||
mpris::Mpris2* mpris2_;
|
mpris::Mpris2* mpris2_;
|
||||||
|
|
||||||
PlaylistManager* playlists_;
|
PlaylistManager* playlists_;
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
LastFMService* lastfm_;
|
LastFMService* lastfm_;
|
||||||
|
#endif
|
||||||
QSettings settings_;
|
QSettings settings_;
|
||||||
|
|
||||||
PlaylistItemPtr current_item_;
|
PlaylistItemPtr current_item_;
|
||||||
|
@ -42,8 +42,10 @@
|
|||||||
#include <taglib/vorbisfile.h>
|
#include <taglib/vorbisfile.h>
|
||||||
#include <taglib/wavfile.h>
|
#include <taglib/wavfile.h>
|
||||||
|
|
||||||
#include "radio/fixlastfm.h"
|
#ifdef HAVE_LIBLASTFM
|
||||||
#include <lastfm/Track>
|
#include "radio/fixlastfm.h"
|
||||||
|
#include <lastfm/Track>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
@ -485,6 +487,7 @@ void Song::InitFromQuery(const SqlRow& q, int col) {
|
|||||||
#undef tofloat
|
#undef tofloat
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
void Song::InitFromLastFM(const lastfm::Track& track) {
|
void Song::InitFromLastFM(const lastfm::Track& track) {
|
||||||
d->valid_ = true;
|
d->valid_ = true;
|
||||||
d->filetype_ = Type_Stream;
|
d->filetype_ = Type_Stream;
|
||||||
@ -495,6 +498,7 @@ void Song::InitFromLastFM(const lastfm::Track& track) {
|
|||||||
d->track_ = track.trackNumber();
|
d->track_ = track.trackNumber();
|
||||||
d->length_ = track.duration();
|
d->length_ = track.duration();
|
||||||
}
|
}
|
||||||
|
#endif // HAVE_LIBLASTFM
|
||||||
|
|
||||||
#ifdef HAVE_LIBGPOD
|
#ifdef HAVE_LIBGPOD
|
||||||
void Song::InitFromItdb(const Itdb_Track* track) {
|
void Song::InitFromItdb(const Itdb_Track* track) {
|
||||||
@ -948,6 +952,7 @@ void Song::BindToFtsQuery(QSqlQuery *query) const {
|
|||||||
query->bindValue(":ftscomment", d->comment_);
|
query->bindValue(":ftscomment", d->comment_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
void Song::ToLastFM(lastfm::Track* track) const {
|
void Song::ToLastFM(lastfm::Track* track) const {
|
||||||
lastfm::MutableTrack mtrack(*track);
|
lastfm::MutableTrack mtrack(*track);
|
||||||
|
|
||||||
@ -958,6 +963,7 @@ void Song::ToLastFM(lastfm::Track* track) const {
|
|||||||
mtrack.setTrackNumber(d->track_);
|
mtrack.setTrackNumber(d->track_);
|
||||||
mtrack.setSource(lastfm::Track::Player);
|
mtrack.setSource(lastfm::Track::Player);
|
||||||
}
|
}
|
||||||
|
#endif // HAVE_LIBLASTFM
|
||||||
|
|
||||||
QString Song::PrettyTitle() const {
|
QString Song::PrettyTitle() const {
|
||||||
QString title(d->title_);
|
QString title(d->title_);
|
||||||
|
@ -46,9 +46,11 @@
|
|||||||
|
|
||||||
class SqlRow;
|
class SqlRow;
|
||||||
|
|
||||||
namespace lastfm {
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
namespace lastfm {
|
||||||
class Track;
|
class Track;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace TagLib {
|
namespace TagLib {
|
||||||
class FileRef;
|
class FileRef;
|
||||||
@ -112,7 +114,9 @@ class Song {
|
|||||||
void Init(const QString& title, const QString& artist, const QString& album, int length);
|
void Init(const QString& title, const QString& artist, const QString& album, int length);
|
||||||
void InitFromFile(const QString& filename, int directory_id);
|
void InitFromFile(const QString& filename, int directory_id);
|
||||||
void InitFromQuery(const SqlRow& query, int col = 0);
|
void InitFromQuery(const SqlRow& query, int col = 0);
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
void InitFromLastFM(const lastfm::Track& track);
|
void InitFromLastFM(const lastfm::Track& track);
|
||||||
|
#endif
|
||||||
|
|
||||||
void MergeFromSimpleMetaBundle(const Engine::SimpleMetaBundle& bundle);
|
void MergeFromSimpleMetaBundle(const Engine::SimpleMetaBundle& bundle);
|
||||||
|
|
||||||
@ -137,7 +141,9 @@ class Song {
|
|||||||
// Save
|
// Save
|
||||||
void BindToQuery(QSqlQuery* query) const;
|
void BindToQuery(QSqlQuery* query) const;
|
||||||
void BindToFtsQuery(QSqlQuery* query) const;
|
void BindToFtsQuery(QSqlQuery* query) const;
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
void ToLastFM(lastfm::Track* track) const;
|
void ToLastFM(lastfm::Track* track) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Simple accessors
|
// Simple accessors
|
||||||
bool is_valid() const { return d->valid_; }
|
bool is_valid() const { return d->valid_; }
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
#include "core/utilities.h"
|
#include "core/utilities.h"
|
||||||
#include "engines/enginebase.h"
|
#include "engines/enginebase.h"
|
||||||
#include "library/directory.h"
|
#include "library/directory.h"
|
||||||
#include "radio/lastfmservice.h"
|
|
||||||
#include "smartplaylists/generator.h"
|
#include "smartplaylists/generator.h"
|
||||||
#include "ui/equalizer.h"
|
#include "ui/equalizer.h"
|
||||||
#include "ui/iconloader.h"
|
#include "ui/iconloader.h"
|
||||||
@ -55,6 +54,9 @@
|
|||||||
#include <echonest/Config.h>
|
#include <echonest/Config.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
#include "radio/lastfmservice.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GSTREAMER
|
#ifdef HAVE_GSTREAMER
|
||||||
# include <gst/gst.h>
|
# include <gst/gst.h>
|
||||||
@ -151,8 +153,10 @@ int main(int argc, char *argv[]) {
|
|||||||
qRegisterMetaType<GstEnginePipeline*>("GstEnginePipeline*");
|
qRegisterMetaType<GstEnginePipeline*>("GstEnginePipeline*");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
lastfm::ws::ApiKey = LastFMService::kApiKey;
|
lastfm::ws::ApiKey = LastFMService::kApiKey;
|
||||||
lastfm::ws::SharedSecret = LastFMService::kSecret;
|
lastfm::ws::SharedSecret = LastFMService::kSecret;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Parse commandline options - need to do this before starting the
|
// Parse commandline options - need to do this before starting the
|
||||||
// QApplication so it works without an X server
|
// QApplication so it works without an X server
|
||||||
|
@ -52,8 +52,6 @@
|
|||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <lastfm/ScrobblePoint>
|
|
||||||
|
|
||||||
using smart_playlists::Generator;
|
using smart_playlists::Generator;
|
||||||
using smart_playlists::GeneratorInserter;
|
using smart_playlists::GeneratorInserter;
|
||||||
using smart_playlists::GeneratorPtr;
|
using smart_playlists::GeneratorPtr;
|
||||||
@ -1194,10 +1192,9 @@ Song Playlist::current_item_metadata() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Playlist::UpdateScrobblePoint() {
|
void Playlist::UpdateScrobblePoint() {
|
||||||
int length = qMin(current_item_metadata().length(), 240);
|
const int length = current_item_metadata().length();
|
||||||
|
|
||||||
ScrobblePoint point(length / 2);
|
scrobble_point_ = length == 0 ? 240 : qBound(31, length/2, 240);
|
||||||
scrobble_point_ = point;
|
|
||||||
has_scrobbled_ = false;
|
has_scrobbled_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include "core/mergedproxymodel.h"
|
#include "core/mergedproxymodel.h"
|
||||||
#include "icecastservice.h"
|
#include "icecastservice.h"
|
||||||
#include "jamendoservice.h"
|
#include "jamendoservice.h"
|
||||||
#include "lastfmservice.h"
|
|
||||||
#include "magnatuneservice.h"
|
#include "magnatuneservice.h"
|
||||||
#include "radiomimedata.h"
|
#include "radiomimedata.h"
|
||||||
#include "radiomodel.h"
|
#include "radiomodel.h"
|
||||||
@ -26,6 +25,10 @@
|
|||||||
#include "savedradio.h"
|
#include "savedradio.h"
|
||||||
#include "somafmservice.h"
|
#include "somafmservice.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
#include "lastfmservice.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
@ -43,7 +46,9 @@ RadioModel::RadioModel(BackgroundThread<Database>* db_thread,
|
|||||||
root_->lazy_loaded = true;
|
root_->lazy_loaded = true;
|
||||||
merged_model_->setSourceModel(this);
|
merged_model_->setSourceModel(this);
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
AddService(new LastFMService(this));
|
AddService(new LastFMService(this));
|
||||||
|
#endif
|
||||||
AddService(new SomaFMService(this));
|
AddService(new SomaFMService(this));
|
||||||
AddService(new MagnatuneService(this));
|
AddService(new MagnatuneService(this));
|
||||||
AddService(new JamendoService(this));
|
AddService(new JamendoService(this));
|
||||||
@ -139,11 +144,13 @@ QMimeData* RadioModel::mimeData(const QModelIndexList& indexes) const {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
LastFMService* RadioModel::GetLastFMService() const {
|
LastFMService* RadioModel::GetLastFMService() const {
|
||||||
if (sServices.contains(LastFMService::kServiceName))
|
if (sServices.contains(LastFMService::kServiceName))
|
||||||
return static_cast<LastFMService*>(sServices[LastFMService::kServiceName]);
|
return static_cast<LastFMService*>(sServices[LastFMService::kServiceName]);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void RadioModel::ShowContextMenu(RadioItem* item, const QModelIndex& index,
|
void RadioModel::ShowContextMenu(RadioItem* item, const QModelIndex& index,
|
||||||
const QPoint& global_pos) {
|
const QPoint& global_pos) {
|
||||||
|
@ -27,12 +27,15 @@
|
|||||||
#include "widgets/multiloadingindicator.h"
|
#include "widgets/multiloadingindicator.h"
|
||||||
|
|
||||||
class Database;
|
class Database;
|
||||||
class LastFMService;
|
|
||||||
class MergedProxyModel;
|
class MergedProxyModel;
|
||||||
class RadioService;
|
class RadioService;
|
||||||
class SettingsDialog;
|
class SettingsDialog;
|
||||||
class TaskManager;
|
class TaskManager;
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
class LastFMService;
|
||||||
|
#endif
|
||||||
|
|
||||||
class RadioModel : public SimpleTreeModel<RadioItem> {
|
class RadioModel : public SimpleTreeModel<RadioItem> {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -58,7 +61,9 @@ class RadioModel : public SimpleTreeModel<RadioItem> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This is special because Player needs it for scrobbling
|
// This is special because Player needs it for scrobbling
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
LastFMService* GetLastFMService() const;
|
LastFMService* GetLastFMService() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
// QAbstractItemModel
|
// QAbstractItemModel
|
||||||
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
|
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
|
||||||
|
@ -18,18 +18,23 @@
|
|||||||
#include "artistinfoview.h"
|
#include "artistinfoview.h"
|
||||||
#include "echonestbiographies.h"
|
#include "echonestbiographies.h"
|
||||||
#include "echonestimages.h"
|
#include "echonestimages.h"
|
||||||
#include "echonestsimilarartists.h"
|
|
||||||
#include "echonesttags.h"
|
|
||||||
#include "songinfofetcher.h"
|
#include "songinfofetcher.h"
|
||||||
#include "widgets/prettyimageview.h"
|
#include "widgets/prettyimageview.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
#include "echonestsimilarartists.h"
|
||||||
|
#include "echonesttags.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
ArtistInfoView::ArtistInfoView(QWidget *parent)
|
ArtistInfoView::ArtistInfoView(QWidget *parent)
|
||||||
: SongInfoBase(parent)
|
: SongInfoBase(parent)
|
||||||
{
|
{
|
||||||
fetcher_->AddProvider(new EchoNestBiographies);
|
fetcher_->AddProvider(new EchoNestBiographies);
|
||||||
fetcher_->AddProvider(new EchoNestImages);
|
fetcher_->AddProvider(new EchoNestImages);
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
fetcher_->AddProvider(new EchoNestSimilarArtists);
|
fetcher_->AddProvider(new EchoNestSimilarArtists);
|
||||||
fetcher_->AddProvider(new EchoNestTags);
|
fetcher_->AddProvider(new EchoNestTags);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ArtistInfoView::~ArtistInfoView() {
|
ArtistInfoView::~ArtistInfoView() {
|
||||||
|
@ -15,12 +15,16 @@
|
|||||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "lastfmtrackinfoprovider.h"
|
#include "config.h"
|
||||||
#include "songinfoprovider.h"
|
#include "songinfoprovider.h"
|
||||||
#include "songinfoview.h"
|
#include "songinfoview.h"
|
||||||
#include "ultimatelyricsprovider.h"
|
#include "ultimatelyricsprovider.h"
|
||||||
#include "ultimatelyricsreader.h"
|
#include "ultimatelyricsreader.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
#include "lastfmtrackinfoprovider.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
@ -42,7 +46,9 @@ SongInfoView::SongInfoView(QWidget* parent)
|
|||||||
watcher->setFuture(future);
|
watcher->setFuture(future);
|
||||||
connect(watcher, SIGNAL(finished()), SLOT(UltimateLyricsParsed()));
|
connect(watcher, SIGNAL(finished()), SLOT(UltimateLyricsParsed()));
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
fetcher_->AddProvider(new LastfmTrackInfoProvider);
|
fetcher_->AddProvider(new LastfmTrackInfoProvider);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
SongInfoView::~SongInfoView() {
|
SongInfoView::~SongInfoView() {
|
||||||
|
@ -51,7 +51,6 @@
|
|||||||
#include "playlist/songloaderinserter.h"
|
#include "playlist/songloaderinserter.h"
|
||||||
#include "playlist/songplaylistitem.h"
|
#include "playlist/songplaylistitem.h"
|
||||||
#include "playlistparsers/playlistparser.h"
|
#include "playlistparsers/playlistparser.h"
|
||||||
#include "radio/lastfmservice.h"
|
|
||||||
#include "radio/magnatuneservice.h"
|
#include "radio/magnatuneservice.h"
|
||||||
#include "radio/radiomodel.h"
|
#include "radio/radiomodel.h"
|
||||||
#include "radio/radioview.h"
|
#include "radio/radioview.h"
|
||||||
@ -63,13 +62,9 @@
|
|||||||
#include "transcoder/transcodedialog.h"
|
#include "transcoder/transcodedialog.h"
|
||||||
#include "ui/about.h"
|
#include "ui/about.h"
|
||||||
#include "ui/addstreamdialog.h"
|
#include "ui/addstreamdialog.h"
|
||||||
#include "ui/albumcovermanager.h"
|
|
||||||
#include "ui/edittagdialog.h"
|
#include "ui/edittagdialog.h"
|
||||||
#include "ui/equalizer.h"
|
#include "ui/equalizer.h"
|
||||||
#include "ui/iconloader.h"
|
#include "ui/iconloader.h"
|
||||||
#ifdef Q_OS_DARWIN
|
|
||||||
#include "ui/macsystemtrayicon.h"
|
|
||||||
#endif
|
|
||||||
#include "ui/organisedialog.h"
|
#include "ui/organisedialog.h"
|
||||||
#include "ui/organiseerrordialog.h"
|
#include "ui/organiseerrordialog.h"
|
||||||
#include "ui/qtsystemtrayicon.h"
|
#include "ui/qtsystemtrayicon.h"
|
||||||
@ -82,6 +77,15 @@
|
|||||||
#include "widgets/stylehelper.h"
|
#include "widgets/stylehelper.h"
|
||||||
#include "widgets/trackslider.h"
|
#include "widgets/trackslider.h"
|
||||||
|
|
||||||
|
#ifdef Q_OS_DARWIN
|
||||||
|
# include "ui/macsystemtrayicon.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
# include "radio/lastfmservice.h"
|
||||||
|
# include "ui/albumcovermanager.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_WIIMOTEDEV
|
#ifdef ENABLE_WIIMOTEDEV
|
||||||
# include "wiimotedev/shortcuts.h"
|
# include "wiimotedev/shortcuts.h"
|
||||||
#endif
|
#endif
|
||||||
@ -148,7 +152,9 @@ MainWindow::MainWindow(Engine::Type engine, QWidget *parent)
|
|||||||
song_info_view_(new SongInfoView(this)),
|
song_info_view_(new SongInfoView(this)),
|
||||||
artist_info_view_(new ArtistInfoView(this)),
|
artist_info_view_(new ArtistInfoView(this)),
|
||||||
settings_dialog_(NULL),
|
settings_dialog_(NULL),
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
cover_manager_(NULL),
|
cover_manager_(NULL),
|
||||||
|
#endif
|
||||||
equalizer_(new Equalizer),
|
equalizer_(new Equalizer),
|
||||||
error_dialog_(NULL),
|
error_dialog_(NULL),
|
||||||
organise_dialog_(new OrganiseDialog(task_manager_)),
|
organise_dialog_(new OrganiseDialog(task_manager_)),
|
||||||
@ -174,7 +180,11 @@ MainWindow::MainWindow(Engine::Type engine, QWidget *parent)
|
|||||||
|
|
||||||
// Create stuff that needs the database
|
// Create stuff that needs the database
|
||||||
radio_model_ = new RadioModel(database_, task_manager_, this);
|
radio_model_ = new RadioModel(database_, task_manager_, this);
|
||||||
player_ = new Player(this, playlists_, radio_model_->GetLastFMService(), engine, this);
|
player_ = new Player(this, playlists_,
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
radio_model_->GetLastFMService(),
|
||||||
|
#endif
|
||||||
|
engine, this);
|
||||||
library_ = new Library(database_, task_manager_, this);
|
library_ = new Library(database_, task_manager_, this);
|
||||||
devices_ = new DeviceManager(database_, task_manager_, this);
|
devices_ = new DeviceManager(database_, task_manager_, this);
|
||||||
|
|
||||||
@ -286,8 +296,10 @@ MainWindow::MainWindow(Engine::Type engine, QWidget *parent)
|
|||||||
connect(ui_->action_quit, SIGNAL(triggered()), qApp, SLOT(quit()));
|
connect(ui_->action_quit, SIGNAL(triggered()), qApp, SLOT(quit()));
|
||||||
connect(ui_->action_stop_after_this_track, SIGNAL(triggered()), SLOT(StopAfterCurrent()));
|
connect(ui_->action_stop_after_this_track, SIGNAL(triggered()), SLOT(StopAfterCurrent()));
|
||||||
connect(ui_->action_mute, SIGNAL(triggered()), player_, SLOT(Mute()));
|
connect(ui_->action_mute, SIGNAL(triggered()), player_, SLOT(Mute()));
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
connect(ui_->action_ban, SIGNAL(triggered()), radio_model_->GetLastFMService(), SLOT(Ban()));
|
connect(ui_->action_ban, SIGNAL(triggered()), radio_model_->GetLastFMService(), SLOT(Ban()));
|
||||||
connect(ui_->action_love, SIGNAL(triggered()), SLOT(Love()));
|
connect(ui_->action_love, SIGNAL(triggered()), SLOT(Love()));
|
||||||
|
#endif
|
||||||
connect(ui_->action_clear_playlist, SIGNAL(triggered()), playlists_, SLOT(ClearCurrent()));
|
connect(ui_->action_clear_playlist, SIGNAL(triggered()), playlists_, SLOT(ClearCurrent()));
|
||||||
connect(ui_->action_remove_from_playlist, SIGNAL(triggered()), SLOT(PlaylistRemoveCurrent()));
|
connect(ui_->action_remove_from_playlist, SIGNAL(triggered()), SLOT(PlaylistRemoveCurrent()));
|
||||||
connect(ui_->action_edit_track, SIGNAL(triggered()), SLOT(EditTracks()));
|
connect(ui_->action_edit_track, SIGNAL(triggered()), SLOT(EditTracks()));
|
||||||
@ -302,7 +314,11 @@ MainWindow::MainWindow(Engine::Type engine, QWidget *parent)
|
|||||||
connect(ui_->action_add_file, SIGNAL(triggered()), SLOT(AddFile()));
|
connect(ui_->action_add_file, SIGNAL(triggered()), SLOT(AddFile()));
|
||||||
connect(ui_->action_add_folder, SIGNAL(triggered()), SLOT(AddFolder()));
|
connect(ui_->action_add_folder, SIGNAL(triggered()), SLOT(AddFolder()));
|
||||||
connect(ui_->action_add_stream, SIGNAL(triggered()), SLOT(AddStream()));
|
connect(ui_->action_add_stream, SIGNAL(triggered()), SLOT(AddStream()));
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
connect(ui_->action_cover_manager, SIGNAL(triggered()), SLOT(ShowCoverManager()));
|
connect(ui_->action_cover_manager, SIGNAL(triggered()), SLOT(ShowCoverManager()));
|
||||||
|
#else
|
||||||
|
ui_->action_cover_manager->setVisible(false);
|
||||||
|
#endif
|
||||||
connect(ui_->action_equalizer, SIGNAL(triggered()), equalizer_.get(), SLOT(show()));
|
connect(ui_->action_equalizer, SIGNAL(triggered()), equalizer_.get(), SLOT(show()));
|
||||||
connect(ui_->action_transcode, SIGNAL(triggered()), SLOT(ShowTranscodeDialog()));
|
connect(ui_->action_transcode, SIGNAL(triggered()), SLOT(ShowTranscodeDialog()));
|
||||||
connect(ui_->action_jump, SIGNAL(triggered()), ui_->playlist->view(), SLOT(JumpToCurrentlyPlayingTrack()));
|
connect(ui_->action_jump, SIGNAL(triggered()), ui_->playlist->view(), SLOT(JumpToCurrentlyPlayingTrack()));
|
||||||
@ -452,12 +468,18 @@ MainWindow::MainWindow(Engine::Type engine, QWidget *parent)
|
|||||||
connect(radio_model_, SIGNAL(OpenSettingsAtPage(SettingsDialog::Page)), SLOT(OpenSettingsDialogAtPage(SettingsDialog::Page)));
|
connect(radio_model_, SIGNAL(OpenSettingsAtPage(SettingsDialog::Page)), SLOT(OpenSettingsDialogAtPage(SettingsDialog::Page)));
|
||||||
connect(radio_model_, SIGNAL(AddItemToPlaylist(RadioItem*,bool)), SLOT(InsertRadioItem(RadioItem*,bool)));
|
connect(radio_model_, SIGNAL(AddItemToPlaylist(RadioItem*,bool)), SLOT(InsertRadioItem(RadioItem*,bool)));
|
||||||
connect(radio_model_, SIGNAL(AddItemsToPlaylist(PlaylistItemList,bool)), SLOT(InsertRadioItems(PlaylistItemList,bool)));
|
connect(radio_model_, SIGNAL(AddItemsToPlaylist(PlaylistItemList,bool)), SLOT(InsertRadioItems(PlaylistItemList,bool)));
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
connect(radio_model_->GetLastFMService(), SIGNAL(ScrobblingEnabledChanged(bool)), SLOT(ScrobblingEnabledChanged(bool)));
|
connect(radio_model_->GetLastFMService(), SIGNAL(ScrobblingEnabledChanged(bool)), SLOT(ScrobblingEnabledChanged(bool)));
|
||||||
connect(radio_model_->GetLastFMService(), SIGNAL(ButtonVisibilityChanged(bool)), SLOT(LastFMButtonVisibilityChanged(bool)));
|
connect(radio_model_->GetLastFMService(), SIGNAL(ButtonVisibilityChanged(bool)), SLOT(LastFMButtonVisibilityChanged(bool)));
|
||||||
|
#endif
|
||||||
connect(radio_view_->tree(), SIGNAL(doubleClicked(QModelIndex)), SLOT(RadioDoubleClick(QModelIndex)));
|
connect(radio_view_->tree(), SIGNAL(doubleClicked(QModelIndex)), SLOT(RadioDoubleClick(QModelIndex)));
|
||||||
connect(radio_model_->Service<MagnatuneService>(), SIGNAL(DownloadFinished(QStringList)), osd_, SLOT(MagnatuneDownloadFinished(QStringList)));
|
connect(radio_model_->Service<MagnatuneService>(), SIGNAL(DownloadFinished(QStringList)), osd_, SLOT(MagnatuneDownloadFinished(QStringList)));
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
LastFMButtonVisibilityChanged(radio_model_->GetLastFMService()->AreButtonsVisible());
|
LastFMButtonVisibilityChanged(radio_model_->GetLastFMService()->AreButtonsVisible());
|
||||||
|
#else
|
||||||
|
LastFMButtonVisibilityChanged(false);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Connections to the saved streams service
|
// Connections to the saved streams service
|
||||||
connect(RadioModel::Service<SavedRadio>(), SIGNAL(ShowAddStreamDialog()), SLOT(AddStream()));
|
connect(RadioModel::Service<SavedRadio>(), SIGNAL(ShowAddStreamDialog()), SLOT(AddStream()));
|
||||||
@ -769,6 +791,7 @@ void MainWindow::MediaPlaying() {
|
|||||||
ui_->action_play_pause->setEnabled(
|
ui_->action_play_pause->setEnabled(
|
||||||
! (player_->GetCurrentItem()->options() & PlaylistItem::PauseDisabled));
|
! (player_->GetCurrentItem()->options() & PlaylistItem::PauseDisabled));
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
bool is_lastfm = (player_->GetCurrentItem()->options() & PlaylistItem::LastFMControls);
|
bool is_lastfm = (player_->GetCurrentItem()->options() & PlaylistItem::LastFMControls);
|
||||||
LastFMService* lastfm = radio_model_->GetLastFMService();
|
LastFMService* lastfm = radio_model_->GetLastFMService();
|
||||||
|
|
||||||
@ -776,6 +799,9 @@ void MainWindow::MediaPlaying() {
|
|||||||
ui_->action_love->setEnabled(lastfm->IsScrobblingEnabled());
|
ui_->action_love->setEnabled(lastfm->IsScrobblingEnabled());
|
||||||
|
|
||||||
ui_->track_slider->SetCanSeek(!is_lastfm);
|
ui_->track_slider->SetCanSeek(!is_lastfm);
|
||||||
|
#else
|
||||||
|
ui_->track_slider->SetCanSeek(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
track_position_timer_->start();
|
track_position_timer_->start();
|
||||||
UpdateTrackPosition();
|
UpdateTrackPosition();
|
||||||
@ -804,6 +830,7 @@ void MainWindow::TrackSkipped(PlaylistItemPtr item) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
void MainWindow::ScrobblingEnabledChanged(bool value) {
|
void MainWindow::ScrobblingEnabledChanged(bool value) {
|
||||||
if (!player_->GetState() == Engine::Idle)
|
if (!player_->GetState() == Engine::Idle)
|
||||||
return;
|
return;
|
||||||
@ -812,6 +839,7 @@ void MainWindow::ScrobblingEnabledChanged(bool value) {
|
|||||||
ui_->action_ban->setEnabled(value && is_lastfm);
|
ui_->action_ban->setEnabled(value && is_lastfm);
|
||||||
ui_->action_love->setEnabled(value);
|
ui_->action_love->setEnabled(value);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void MainWindow::LastFMButtonVisibilityChanged(bool value) {
|
void MainWindow::LastFMButtonVisibilityChanged(bool value) {
|
||||||
ui_->action_ban->setVisible(value);
|
ui_->action_ban->setVisible(value);
|
||||||
@ -957,11 +985,12 @@ void MainWindow::UpdateTrackPosition() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Time to scrobble?
|
// Time to scrobble?
|
||||||
LastFMService* lastfm = radio_model_->GetLastFMService();
|
|
||||||
|
|
||||||
if (!playlists_->active()->has_scrobbled() &&
|
if (!playlists_->active()->has_scrobbled() &&
|
||||||
position >= playlists_->active()->scrobble_point()) {
|
position >= playlists_->active()->scrobble_point()) {
|
||||||
lastfm->Scrobble();
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
radio_model_->GetLastFMService()->Scrobble();
|
||||||
|
#endif
|
||||||
playlists_->active()->set_scrobbled(true);
|
playlists_->active()->set_scrobbled(true);
|
||||||
|
|
||||||
// Update the play count for the song if it's from the library
|
// Update the play count for the song if it's from the library
|
||||||
@ -979,10 +1008,12 @@ void MainWindow::UpdateTrackPosition() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
void MainWindow::Love() {
|
void MainWindow::Love() {
|
||||||
radio_model_->GetLastFMService()->Love();
|
radio_model_->GetLastFMService()->Love();
|
||||||
ui_->action_love->setEnabled(false);
|
ui_->action_love->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void MainWindow::RadioDoubleClick(const QModelIndex& index) {
|
void MainWindow::RadioDoubleClick(const QModelIndex& index) {
|
||||||
if (autoclear_playlist_)
|
if (autoclear_playlist_)
|
||||||
@ -1586,6 +1617,7 @@ void MainWindow::PlaylistCopyToDevice() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
void MainWindow::ShowCoverManager() {
|
void MainWindow::ShowCoverManager() {
|
||||||
if (!cover_manager_) {
|
if (!cover_manager_) {
|
||||||
cover_manager_.reset(new AlbumCoverManager(library_->backend()));
|
cover_manager_.reset(new AlbumCoverManager(library_->backend()));
|
||||||
@ -1599,6 +1631,7 @@ void MainWindow::ShowCoverManager() {
|
|||||||
|
|
||||||
cover_manager_->show();
|
cover_manager_->show();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void MainWindow::EnsureSettingsDialogCreated() {
|
void MainWindow::EnsureSettingsDialogCreated() {
|
||||||
if (settings_dialog_)
|
if (settings_dialog_)
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
class About;
|
class About;
|
||||||
class AddStreamDialog;
|
class AddStreamDialog;
|
||||||
class AlbumCoverManager;
|
|
||||||
class ArtistInfoView;
|
class ArtistInfoView;
|
||||||
class BackgroundStreams;
|
class BackgroundStreams;
|
||||||
class CommandlineOptions;
|
class CommandlineOptions;
|
||||||
@ -70,6 +69,10 @@ class Ui_MainWindow;
|
|||||||
|
|
||||||
class QSortFilterProxyModel;
|
class QSortFilterProxyModel;
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
class AlbumCoverManager;
|
||||||
|
#endif
|
||||||
|
|
||||||
class MainWindow : public QMainWindow, public PlatformInterface {
|
class MainWindow : public QMainWindow, public PlatformInterface {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -162,9 +165,11 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
|||||||
void RadioDoubleClick(const QModelIndex& index);
|
void RadioDoubleClick(const QModelIndex& index);
|
||||||
void InsertRadioItem(RadioItem*, bool clear_first);
|
void InsertRadioItem(RadioItem*, bool clear_first);
|
||||||
void InsertRadioItems(const PlaylistItemList& items, bool clear_first);
|
void InsertRadioItems(const PlaylistItemList& items, bool clear_first);
|
||||||
void ScrobblingEnabledChanged(bool value);
|
|
||||||
void LastFMButtonVisibilityChanged(bool value);
|
void LastFMButtonVisibilityChanged(bool value);
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
void ScrobblingEnabledChanged(bool value);
|
||||||
void Love();
|
void Love();
|
||||||
|
#endif
|
||||||
|
|
||||||
void TaskCountChanged(int count);
|
void TaskCountChanged(int count);
|
||||||
|
|
||||||
@ -185,7 +190,9 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
|||||||
|
|
||||||
void SongSaveComplete();
|
void SongSaveComplete();
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
void ShowCoverManager();
|
void ShowCoverManager();
|
||||||
|
#endif
|
||||||
void ShowAboutDialog();
|
void ShowAboutDialog();
|
||||||
void ShowTranscodeDialog();
|
void ShowTranscodeDialog();
|
||||||
void ShowErrorDialog(const QString& message);
|
void ShowErrorDialog(const QString& message);
|
||||||
@ -240,7 +247,9 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
|||||||
|
|
||||||
boost::scoped_ptr<SettingsDialog> settings_dialog_;
|
boost::scoped_ptr<SettingsDialog> settings_dialog_;
|
||||||
boost::scoped_ptr<AddStreamDialog> add_stream_dialog_;
|
boost::scoped_ptr<AddStreamDialog> add_stream_dialog_;
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
boost::scoped_ptr<AlbumCoverManager> cover_manager_;
|
boost::scoped_ptr<AlbumCoverManager> cover_manager_;
|
||||||
|
#endif
|
||||||
boost::scoped_ptr<Equalizer> equalizer_;
|
boost::scoped_ptr<Equalizer> equalizer_;
|
||||||
boost::scoped_ptr<TranscodeDialog> transcode_dialog_;
|
boost::scoped_ptr<TranscodeDialog> transcode_dialog_;
|
||||||
boost::scoped_ptr<ErrorDialog> error_dialog_;
|
boost::scoped_ptr<ErrorDialog> error_dialog_;
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
|
|
||||||
#include "ui_settingsdialog.h"
|
#include "ui_settingsdialog.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
#include "radio/lastfmconfig.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_WIIMOTEDEV
|
#ifdef ENABLE_WIIMOTEDEV
|
||||||
#include "ui/wiimotedevshortcutsconfig.h"
|
#include "ui/wiimotedevshortcutsconfig.h"
|
||||||
#include "ui_wiimotedevshortcutsconfig.h"
|
#include "ui_wiimotedevshortcutsconfig.h"
|
||||||
@ -95,6 +99,22 @@ SettingsDialog::SettingsDialog(BackgroundStreams* streams, QWidget* parent)
|
|||||||
pretty_popup_->SetMessage(tr("OSD Preview"), tr("Drag to reposition"),
|
pretty_popup_->SetMessage(tr("OSD Preview"), tr("Drag to reposition"),
|
||||||
QImage(":nocover.png"));
|
QImage(":nocover.png"));
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
ui_->list->insertItem(Page_Lastfm, tr("Last.fm"));
|
||||||
|
ui_->list->item(Page_Lastfm)->setIcon(QIcon(":/last.fm/as.png"));
|
||||||
|
|
||||||
|
QWidget* lastfm_page = new QWidget;
|
||||||
|
QVBoxLayout* lastfm_layout = new QVBoxLayout;
|
||||||
|
lastfm_layout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
lastfm_config_ = new LastFMConfig;
|
||||||
|
lastfm_layout->addWidget(lastfm_config_);
|
||||||
|
lastfm_page->setLayout(lastfm_layout);
|
||||||
|
|
||||||
|
ui_->stacked_widget->insertWidget(Page_Lastfm, lastfm_page);
|
||||||
|
|
||||||
|
connect(lastfm_config_, SIGNAL(ValidationComplete(bool)), SLOT(LastFMValidationComplete(bool)));
|
||||||
|
#endif
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
ui_->list->item(Page_Playback)->setIcon(IconLoader::Load("media-playback-start"));
|
ui_->list->item(Page_Playback)->setIcon(IconLoader::Load("media-playback-start"));
|
||||||
ui_->list->item(Page_SongInformation)->setIcon(IconLoader::Load("view-media-lyrics"));
|
ui_->list->item(Page_SongInformation)->setIcon(IconLoader::Load("view-media-lyrics"));
|
||||||
@ -177,9 +197,6 @@ SettingsDialog::SettingsDialog(BackgroundStreams* streams, QWidget* parent)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Last.fm
|
|
||||||
connect(ui_->lastfm, SIGNAL(ValidationComplete(bool)), SLOT(LastFMValidationComplete(bool)));
|
|
||||||
|
|
||||||
// List box
|
// List box
|
||||||
connect(ui_->list, SIGNAL(currentTextChanged(QString)), SLOT(CurrentTextChanged(QString)));
|
connect(ui_->list, SIGNAL(currentTextChanged(QString)), SLOT(CurrentTextChanged(QString)));
|
||||||
ui_->list->setCurrentRow(Page_Playback);
|
ui_->list->setCurrentRow(Page_Playback);
|
||||||
@ -232,21 +249,25 @@ void SettingsDialog::SetGlobalShortcutManager(GlobalShortcuts *manager) {
|
|||||||
ui_->global_shortcuts->SetManager(manager);
|
ui_->global_shortcuts->SetManager(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
void SettingsDialog::LastFMValidationComplete(bool success) {
|
void SettingsDialog::LastFMValidationComplete(bool success) {
|
||||||
ui_->buttonBox->setEnabled(true);
|
ui_->buttonBox->setEnabled(true);
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void SettingsDialog::accept() {
|
void SettingsDialog::accept() {
|
||||||
if (ui_->lastfm->NeedsValidation()) {
|
#ifdef HAVE_LIBLASTFM
|
||||||
ui_->lastfm->Validate();
|
if (lastfm_config_->NeedsValidation()) {
|
||||||
|
lastfm_config_->Validate();
|
||||||
ui_->buttonBox->setEnabled(false);
|
ui_->buttonBox->setEnabled(false);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
ui_->lastfm->Save();
|
lastfm_config_->Save();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QSettings s;
|
QSettings s;
|
||||||
|
|
||||||
@ -399,7 +420,9 @@ void SettingsDialog::showEvent(QShowEvent*) {
|
|||||||
ui_->lyric_settings->Load();
|
ui_->lyric_settings->Load();
|
||||||
|
|
||||||
// Last.fm
|
// Last.fm
|
||||||
ui_->lastfm->Load();
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
lastfm_config_->Load();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Magnatune
|
// Magnatune
|
||||||
ui_->magnatune->Load();
|
ui_->magnatune->Load();
|
||||||
|
@ -35,6 +35,9 @@ class OSDPretty;
|
|||||||
class SongInfoView;
|
class SongInfoView;
|
||||||
class Ui_SettingsDialog;
|
class Ui_SettingsDialog;
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
class LastFMConfig;
|
||||||
|
#endif
|
||||||
#ifdef ENABLE_WIIMOTEDEV
|
#ifdef ENABLE_WIIMOTEDEV
|
||||||
class WiimotedevShortcutsConfig;
|
class WiimotedevShortcutsConfig;
|
||||||
#endif
|
#endif
|
||||||
@ -55,7 +58,9 @@ class SettingsDialog : public QDialog {
|
|||||||
Page_GlobalShortcuts,
|
Page_GlobalShortcuts,
|
||||||
Page_Notifications,
|
Page_Notifications,
|
||||||
Page_Library,
|
Page_Library,
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
Page_Lastfm,
|
Page_Lastfm,
|
||||||
|
#endif
|
||||||
Page_Magnatune,
|
Page_Magnatune,
|
||||||
Page_BackgroundStreams,
|
Page_BackgroundStreams,
|
||||||
#ifdef ENABLE_WIIMOTEDEV
|
#ifdef ENABLE_WIIMOTEDEV
|
||||||
@ -85,7 +90,9 @@ class SettingsDialog : public QDialog {
|
|||||||
private slots:
|
private slots:
|
||||||
void CurrentTextChanged(const QString& text);
|
void CurrentTextChanged(const QString& text);
|
||||||
void NotificationTypeChanged();
|
void NotificationTypeChanged();
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
void LastFMValidationComplete(bool success);
|
void LastFMValidationComplete(bool success);
|
||||||
|
#endif
|
||||||
|
|
||||||
void PrettyOpacityChanged(int value);
|
void PrettyOpacityChanged(int value);
|
||||||
void PrettyColorPresetChanged(int index);
|
void PrettyColorPresetChanged(int index);
|
||||||
@ -105,6 +112,9 @@ class SettingsDialog : public QDialog {
|
|||||||
void StreamVolumeChanged(int value);
|
void StreamVolumeChanged(int value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#ifdef HAVE_LIBLASTFM
|
||||||
|
LastFMConfig* lastfm_config_;
|
||||||
|
#endif
|
||||||
#ifdef ENABLE_WIIMOTEDEV
|
#ifdef ENABLE_WIIMOTEDEV
|
||||||
WiimotedevShortcutsConfig* wiimotedev_config_;
|
WiimotedevShortcutsConfig* wiimotedev_config_;
|
||||||
#endif
|
#endif
|
||||||
|
@ -84,15 +84,6 @@
|
|||||||
<string>Music Library</string>
|
<string>Music Library</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Last.fm</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../../data/data.qrc">
|
|
||||||
<normaloff>:/last.fm/as.png</normaloff>:/last.fm/as.png</iconset>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Magnatune</string>
|
<string>Magnatune</string>
|
||||||
@ -777,16 +768,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="lastfm_page">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="LastFMConfig" name="lastfm" native="true"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="magnatune_page">
|
<widget class="QWidget" name="magnatune_page">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
@ -850,12 +831,6 @@
|
|||||||
<extends>QLineEdit</extends>
|
<extends>QLineEdit</extends>
|
||||||
<header>widgets/lineedit.h</header>
|
<header>widgets/lineedit.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
|
||||||
<class>LastFMConfig</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>radio/lastfmconfig.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>LibraryConfig</class>
|
<class>LibraryConfig</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user