mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-20 16:02:07 +02:00
Add setting to enable/disable Adium now-playing (defaults to off, and only shows up on macs).
This commit is contained in:
parent
f4b4a021ee
commit
0bac06b2c0
@ -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 )
|
||||
{
|
||||
|
@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -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 );
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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() );
|
||||
|
@ -100,7 +100,7 @@
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="accountsPage">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
@ -253,6 +253,29 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="nowPlaying">
|
||||
<property name="title">
|
||||
<string>Now Playing Information</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Applications to update with currently playing track:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxEnableAdium">
|
||||
<property name="text">
|
||||
<string>Adium</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
Loading…
x
Reference in New Issue
Block a user