1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 19:30:21 +02:00

Allow disabling song change notifications

This is a hack actually, it would be better to allow disabling plugins
in a generic way
This commit is contained in:
Dominik Schmidt
2012-11-25 22:47:54 +01:00
parent 9b06cde3a6
commit 23001f4e4a
5 changed files with 38 additions and 3 deletions

View File

@@ -90,6 +90,7 @@ SettingsDialog::SettingsDialog(QObject *parent )
m_advancedWidgetUi->checkBoxReporter->setChecked( s->crashReporterEnabled() );
m_advancedWidgetUi->checkBoxHttp->setChecked( s->httpEnabled() );
m_advancedWidgetUi->checkBoxSongChangeNotifications->setChecked( s->songChangeNotificationEnabled() );
//Network settings
TomahawkSettings::ExternalAddressMode mode = TomahawkSettings::instance()->externalAddressMode();
@@ -254,6 +255,7 @@ SettingsDialog::saveSettings()
s->setCrashReporterEnabled( m_advancedWidgetUi->checkBoxReporter->checkState() == Qt::Checked );
s->setHttpEnabled( m_advancedWidgetUi->checkBoxHttp->checkState() == Qt::Checked );
s->setSongChangeNotificationEnabled( m_advancedWidgetUi->checkBoxSongChangeNotifications->checkState() == Qt::Checked );
s->setProxyType( m_advancedWidgetUi->enableProxyCheckBox->isChecked() ? QNetworkProxy::Socks5Proxy : QNetworkProxy::NoProxy );
s->setExternalAddressMode( m_advancedWidgetUi->upnpRadioButton->isChecked() ? TomahawkSettings::Upnp : ( m_advancedWidgetUi->lanOnlyRadioButton->isChecked() ? TomahawkSettings::Lan : TomahawkSettings::Static ) );

View File

@@ -221,6 +221,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxSongChangeNotifications">
<property name="text">
<string>Show notification when a new song starts to play</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="aclEntryClearLayout">
<item>

View File

@@ -41,13 +41,15 @@
#include "utils/TomahawkUtils.h"
#include "ImageConverter.h"
#include "TomahawkSettings.h"
#include "utils/Logger.h"
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusMessage>
#include <QtGui/QImage>
#include <QtPlugin>
#include "utils/Logger.h"
namespace Tomahawk
{
@@ -72,7 +74,11 @@ FdoNotifyPlugin::~FdoNotifyPlugin()
void
FdoNotifyPlugin::pushInfo( Tomahawk::InfoSystem::InfoPushData pushData )
{
qDebug() << Q_FUNC_INFO;
qDebug() << Q_FUNC_INFO << "showing notification: " << TomahawkSettings::instance()->songChangeNotificationEnabled();
if ( !TomahawkSettings::instance()->songChangeNotificationEnabled() )
return;
QVariant inputData = pushData.infoPair.second;
switch ( pushData.type )

View File

@@ -727,6 +727,20 @@ TomahawkSettings::setCrashReporterEnabled( bool enable )
}
bool
TomahawkSettings::songChangeNotificationEnabled() const
{
return value( "ui/songChangeNotification", true ).toBool();
}
void
TomahawkSettings::setSongChangeNotificationEnabled(bool enable)
{
setValue( "ui/songChangeNotification", enable );
}
unsigned int
TomahawkSettings::volume() const
{

View File

@@ -139,6 +139,9 @@ public:
bool crashReporterEnabled() const; /// true by default
void setCrashReporterEnabled( bool enable );
bool songChangeNotificationEnabled() const; /// true by default
void setSongChangeNotificationEnabled( bool enable );
QString externalHostname() const;
void setExternalHostname( const QString& externalHostname );