Add love/ban (lastfm) global shortcuts

This commit is contained in:
Chocobozzz 2015-06-17 14:21:24 +02:00
parent b077fe97cf
commit 7b8552ab6d
4 changed files with 13 additions and 2 deletions

View File

@ -75,6 +75,10 @@ GlobalShortcuts::GlobalShortcuts(QWidget* parent)
AddShortcut("toggle_last_fm_scrobbling",
tr("Enable/disable Last.fm scrobbling"),
SIGNAL(ToggleScrobbling()));
AddShortcut("love_last_fm_scrobbling", tr("Love (Last.fm scrobbling)"),
SIGNAL(Love()));
AddShortcut("ban_last_fm_scrobbling", tr("Ban (Last.fm scrobbling)"),
SIGNAL(Ban()));
AddRatingShortcut("rate_zero_star", tr("Rate the current song 0 stars"),
rating_signals_mapper_, 0);

View File

@ -60,7 +60,7 @@ class GlobalShortcuts : public QWidget {
void Unregister();
void Register();
signals:
signals:
void Play();
void Pause();
void PlayPause();
@ -80,6 +80,8 @@ class GlobalShortcuts : public QWidget {
void CycleShuffleMode();
void CycleRepeatMode();
void ToggleScrobbling();
void Love();
void Ban();
private:
void AddShortcut(const QString& id, const QString& name, const char* signal,

View File

@ -345,7 +345,8 @@ void LastFMService::NowPlaying(const Song& song) {
return;
}
#else
// TODO(John Maguire): validity was removed from liblastfm1 but might reappear, it should have
// TODO(John Maguire): validity was removed from liblastfm1 but might reappear,
// it should have
// no impact as we get a different error when actually trying to scrobble.
#endif
@ -382,6 +383,8 @@ void LastFMService::Love() {
}
void LastFMService::Ban() {
if (!IsAuthenticated()) ShowConfig();
lastfm::MutableTrack mtrack(last_track_);
mtrack.ban();
last_track_ = mtrack;

View File

@ -774,6 +774,8 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd,
#ifdef HAVE_LIBLASTFM
connect(global_shortcuts_, SIGNAL(ToggleScrobbling()), app_->scrobbler(),
SLOT(ToggleScrobbling()));
connect(global_shortcuts_, SIGNAL(Love()), app_->scrobbler(), SLOT(Love()));
connect(global_shortcuts_, SIGNAL(Ban()), app_->scrobbler(), SLOT(Ban()));
#endif
connect(global_shortcuts_, SIGNAL(RateCurrentSong(int)),