diff --git a/src/libtomahawk/infosystem/infoplugins/adiumplugin.cpp b/src/libtomahawk/infosystem/infoplugins/adiumplugin.cpp
index 4a9da79ef..bbd8d7cfb 100644
--- a/src/libtomahawk/infosystem/infoplugins/adiumplugin.cpp
+++ b/src/libtomahawk/infosystem/infoplugins/adiumplugin.cpp
@@ -21,6 +21,7 @@
#include "infosystem/infosystemworker.h"
#include "artist.h"
#include "result.h"
+#include "tomahawksettings.h"
#include "adiumplugin.h"
#include "adium.h"
@@ -43,6 +44,11 @@ AdiumPlugin::AdiumPlugin()
{
qDebug() << Q_FUNC_INFO;
m_supportedPushTypes << InfoNowPlaying << InfoNowPaused << InfoNowResumed << InfoNowStopped;
+
+ m_active = TomahawkSettings::instance()->nowPlayingEnabled();
+
+ connect( TomahawkSettings::instance(), SIGNAL( changed() ),
+ SLOT( settingsChanged() ), Qt::QueuedConnection );
}
AdiumPlugin::~AdiumPlugin()
@@ -51,6 +57,14 @@ AdiumPlugin::~AdiumPlugin()
setStatus( "" );
}
+void
+AdiumPlugin::settingsChanged()
+{
+ m_active = TomahawkSettings::instance()->nowPlayingEnabled();
+ if( !m_active )
+ setStatus( "" );
+}
+
void
AdiumPlugin::getInfo( const QString caller, const InfoType type, const QVariant data, InfoCustomData customData )
{
@@ -68,6 +82,9 @@ void
AdiumPlugin::pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input )
{
qDebug() << Q_FUNC_INFO;
+
+ if( !m_active )
+ return;
switch ( type )
{
diff --git a/src/libtomahawk/infosystem/infoplugins/adiumplugin.h b/src/libtomahawk/infosystem/infoplugins/adiumplugin.h
index 12ecdbe8b..8660ce3d8 100644
--- a/src/libtomahawk/infosystem/infoplugins/adiumplugin.h
+++ b/src/libtomahawk/infosystem/infoplugins/adiumplugin.h
@@ -41,6 +41,8 @@ protected slots:
void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input );
public slots:
+ void settingsChanged();
+
void audioStarted( const QVariant &input );
void audioFinished( const QVariant &input );
void audioStopped();
@@ -50,6 +52,9 @@ public slots:
void namChangedSlot( QNetworkAccessManager *nam ) {} // unused
void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ) {} // unused
+private:
+ bool m_active;
+
};
diff --git a/src/libtomahawk/tomahawksettings.cpp b/src/libtomahawk/tomahawksettings.cpp
index 62674e4f9..fd06d6821 100644
--- a/src/libtomahawk/tomahawksettings.cpp
+++ b/src/libtomahawk/tomahawksettings.cpp
@@ -661,3 +661,16 @@ TomahawkSettings::setEnabledScriptResolvers( const QStringList& resolvers )
{
setValue( "script/loadedresolvers", resolvers );
}
+
+bool
+TomahawkSettings::nowPlayingEnabled() const
+{
+ return value( "adium/enablenowplaying", false ).toBool();
+}
+
+
+void
+TomahawkSettings::setNowPlayingEnabled( bool enable )
+{
+ setValue( "adium/enablenowplaying", enable );
+}
diff --git a/src/libtomahawk/tomahawksettings.h b/src/libtomahawk/tomahawksettings.h
index 366355bb4..310904228 100644
--- a/src/libtomahawk/tomahawksettings.h
+++ b/src/libtomahawk/tomahawksettings.h
@@ -156,6 +156,11 @@ public:
QStringList enabledScriptResolvers() const;
void setEnabledScriptResolvers( const QStringList& resolvers );
+ // Now-Playing Settings
+ // For now, just Adium. Soon, the world!
+ bool nowPlayingEnabled() const; // false by default
+ void setNowPlayingEnabled( bool enable );
+
signals:
void changed();
diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp
index fbd9def16..0249b3534 100644
--- a/src/settingsdialog.cpp
+++ b/src/settingsdialog.cpp
@@ -104,6 +104,13 @@ SettingsDialog::SettingsDialog( QWidget *parent )
ui->lineEditMusicPath_2->setText( s->scannerPaths().first() );
ui->checkBoxWatchForChanges->setChecked( s->watchForChanges() );
+ // NOW PLAYING
+ #ifdef Q_WS_MAC
+ ui->checkBoxEnableAdium->setChecked( s->nowPlayingEnabled() );
+ #else
+ ui->checkBoxEnableAdium->hide();
+ #endif
+
// LAST FM
ui->checkBoxEnableLastfm->setChecked( s->scrobblingEnabled() );
ui->lineEditLastfmUsername->setText( s->lastFmUsername() );
@@ -149,6 +156,8 @@ SettingsDialog::~SettingsDialog()
s->setScannerPaths( QStringList( ui->lineEditMusicPath_2->text() ) );
s->setWatchForChanges( ui->checkBoxWatchForChanges->isChecked() );
+ s->setNowPlayingEnabled( ui->checkBoxEnableAdium->isChecked() );
+
s->setScrobblingEnabled( ui->checkBoxEnableLastfm->isChecked() );
s->setLastFmUsername( ui->lineEditLastfmUsername->text() );
s->setLastFmPassword( ui->lineEditLastfmPassword->text() );
diff --git a/src/stackedsettingsdialog.ui b/src/stackedsettingsdialog.ui
index 91abc1c48..fce3a1fb8 100644
--- a/src/stackedsettingsdialog.ui
+++ b/src/stackedsettingsdialog.ui
@@ -100,7 +100,7 @@
-
- 0
+ 1
@@ -253,6 +253,29 @@
+ -
+
+
+ Now Playing Information
+
+
+
-
+
+
+ Applications to update with currently playing track:
+
+
+
+ -
+
+
+ Adium
+
+
+
+
+
+
-