mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 03:40:16 +02:00
Add setting to enable/disable Adium now-playing (defaults to off, and only shows up on macs).
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
#include "infosystem/infosystemworker.h"
|
#include "infosystem/infosystemworker.h"
|
||||||
#include "artist.h"
|
#include "artist.h"
|
||||||
#include "result.h"
|
#include "result.h"
|
||||||
|
#include "tomahawksettings.h"
|
||||||
|
|
||||||
#include "adiumplugin.h"
|
#include "adiumplugin.h"
|
||||||
#include "adium.h"
|
#include "adium.h"
|
||||||
@@ -43,6 +44,11 @@ AdiumPlugin::AdiumPlugin()
|
|||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
m_supportedPushTypes << InfoNowPlaying << InfoNowPaused << InfoNowResumed << InfoNowStopped;
|
m_supportedPushTypes << InfoNowPlaying << InfoNowPaused << InfoNowResumed << InfoNowStopped;
|
||||||
|
|
||||||
|
m_active = TomahawkSettings::instance()->nowPlayingEnabled();
|
||||||
|
|
||||||
|
connect( TomahawkSettings::instance(), SIGNAL( changed() ),
|
||||||
|
SLOT( settingsChanged() ), Qt::QueuedConnection );
|
||||||
}
|
}
|
||||||
|
|
||||||
AdiumPlugin::~AdiumPlugin()
|
AdiumPlugin::~AdiumPlugin()
|
||||||
@@ -51,6 +57,14 @@ AdiumPlugin::~AdiumPlugin()
|
|||||||
setStatus( "" );
|
setStatus( "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AdiumPlugin::settingsChanged()
|
||||||
|
{
|
||||||
|
m_active = TomahawkSettings::instance()->nowPlayingEnabled();
|
||||||
|
if( !m_active )
|
||||||
|
setStatus( "" );
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AdiumPlugin::getInfo( const QString caller, const InfoType type, const QVariant data, InfoCustomData customData )
|
AdiumPlugin::getInfo( const QString caller, const InfoType type, const QVariant data, InfoCustomData customData )
|
||||||
{
|
{
|
||||||
@@ -69,6 +83,9 @@ AdiumPlugin::pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoTyp
|
|||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
|
if( !m_active )
|
||||||
|
return;
|
||||||
|
|
||||||
switch ( type )
|
switch ( type )
|
||||||
{
|
{
|
||||||
case InfoNowPlaying:
|
case InfoNowPlaying:
|
||||||
|
@@ -41,6 +41,8 @@ protected slots:
|
|||||||
void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input );
|
void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input );
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void settingsChanged();
|
||||||
|
|
||||||
void audioStarted( const QVariant &input );
|
void audioStarted( const QVariant &input );
|
||||||
void audioFinished( const QVariant &input );
|
void audioFinished( const QVariant &input );
|
||||||
void audioStopped();
|
void audioStopped();
|
||||||
@@ -50,6 +52,9 @@ public slots:
|
|||||||
void namChangedSlot( QNetworkAccessManager *nam ) {} // unused
|
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
|
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 );
|
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;
|
QStringList enabledScriptResolvers() const;
|
||||||
void setEnabledScriptResolvers( const QStringList& resolvers );
|
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:
|
signals:
|
||||||
void changed();
|
void changed();
|
||||||
|
@@ -104,6 +104,13 @@ SettingsDialog::SettingsDialog( QWidget *parent )
|
|||||||
ui->lineEditMusicPath_2->setText( s->scannerPaths().first() );
|
ui->lineEditMusicPath_2->setText( s->scannerPaths().first() );
|
||||||
ui->checkBoxWatchForChanges->setChecked( s->watchForChanges() );
|
ui->checkBoxWatchForChanges->setChecked( s->watchForChanges() );
|
||||||
|
|
||||||
|
// NOW PLAYING
|
||||||
|
#ifdef Q_WS_MAC
|
||||||
|
ui->checkBoxEnableAdium->setChecked( s->nowPlayingEnabled() );
|
||||||
|
#else
|
||||||
|
ui->checkBoxEnableAdium->hide();
|
||||||
|
#endif
|
||||||
|
|
||||||
// LAST FM
|
// LAST FM
|
||||||
ui->checkBoxEnableLastfm->setChecked( s->scrobblingEnabled() );
|
ui->checkBoxEnableLastfm->setChecked( s->scrobblingEnabled() );
|
||||||
ui->lineEditLastfmUsername->setText( s->lastFmUsername() );
|
ui->lineEditLastfmUsername->setText( s->lastFmUsername() );
|
||||||
@@ -149,6 +156,8 @@ SettingsDialog::~SettingsDialog()
|
|||||||
s->setScannerPaths( QStringList( ui->lineEditMusicPath_2->text() ) );
|
s->setScannerPaths( QStringList( ui->lineEditMusicPath_2->text() ) );
|
||||||
s->setWatchForChanges( ui->checkBoxWatchForChanges->isChecked() );
|
s->setWatchForChanges( ui->checkBoxWatchForChanges->isChecked() );
|
||||||
|
|
||||||
|
s->setNowPlayingEnabled( ui->checkBoxEnableAdium->isChecked() );
|
||||||
|
|
||||||
s->setScrobblingEnabled( ui->checkBoxEnableLastfm->isChecked() );
|
s->setScrobblingEnabled( ui->checkBoxEnableLastfm->isChecked() );
|
||||||
s->setLastFmUsername( ui->lineEditLastfmUsername->text() );
|
s->setLastFmUsername( ui->lineEditLastfmUsername->text() );
|
||||||
s->setLastFmPassword( ui->lineEditLastfmPassword->text() );
|
s->setLastFmPassword( ui->lineEditLastfmPassword->text() );
|
||||||
|
@@ -100,7 +100,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QStackedWidget" name="stackedWidget">
|
<widget class="QStackedWidget" name="stackedWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="accountsPage">
|
<widget class="QWidget" name="accountsPage">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||||
@@ -253,6 +253,29 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
Reference in New Issue
Block a user