mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-17 19:37:09 +02:00
added exit on close option (#362)
* added exit on close option * Fixed the functionality, changed code style * Remove trailing white space
This commit is contained in:
@@ -873,6 +873,20 @@ TomahawkSettings::setCrashReporterEnabled( bool enable )
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
TomahawkSettings::exitOnClose() const
|
||||
{
|
||||
return value( "ui/exitOnClose", false ).toBool();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkSettings::setExitOnClose( bool enable )
|
||||
{
|
||||
setValue( "ui/exitOnClose", enable );
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
TomahawkSettings::songChangeNotificationEnabled() const
|
||||
{
|
||||
|
@@ -163,6 +163,9 @@ public:
|
||||
bool crashReporterEnabled() const; /// true by default
|
||||
void setCrashReporterEnabled( bool enable );
|
||||
|
||||
bool exitOnClose() const; /// false by default
|
||||
void setExitOnClose( bool enable );
|
||||
|
||||
bool songChangeNotificationEnabled() const; /// true by default
|
||||
void setSongChangeNotificationEnabled( bool enable );
|
||||
|
||||
|
@@ -756,8 +756,16 @@ TomahawkWindow::changeEvent( QEvent* e )
|
||||
void
|
||||
TomahawkWindow::closeEvent( QCloseEvent* e )
|
||||
{
|
||||
|
||||
TomahawkSettings* s = TomahawkSettings::instance();
|
||||
|
||||
if( s->exitOnClose() ){
|
||||
qApp->quit();
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
if ( e->spontaneous() && QSystemTrayIcon::isSystemTrayAvailable() )
|
||||
else if ( e->spontaneous() && QSystemTrayIcon::isSystemTrayAvailable() )
|
||||
{
|
||||
hide();
|
||||
e->ignore();
|
||||
|
@@ -313,6 +313,7 @@ SettingsDialog::saveSettings()
|
||||
TomahawkSettings* s = TomahawkSettings::instance();
|
||||
|
||||
s->setCrashReporterEnabled( m_advancedWidgetUi->checkBoxReporter->checkState() == Qt::Checked );
|
||||
s->setExitOnClose( m_advancedWidgetUi->checkBoxExitOnClose->checkState() == Qt::Checked );
|
||||
s->setHttpEnabled( m_advancedWidgetUi->checkBoxHttp->checkState() == Qt::Checked );
|
||||
s->setHttpBindAll( m_advancedWidgetUi->checkBoxListenApi->checkState() == Qt::Checked );
|
||||
s->setSongChangeNotificationEnabled( m_advancedWidgetUi->checkBoxSongChangeNotifications->checkState() == Qt::Checked );
|
||||
|
@@ -171,6 +171,19 @@
|
||||
<string>Other Settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxExitOnClose">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Exit on close</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxHttp">
|
||||
<property name="layoutDirection">
|
||||
|
Reference in New Issue
Block a user