mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-17 03:24:15 +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
|
bool
|
||||||
TomahawkSettings::songChangeNotificationEnabled() const
|
TomahawkSettings::songChangeNotificationEnabled() const
|
||||||
{
|
{
|
||||||
|
@@ -163,6 +163,9 @@ public:
|
|||||||
bool crashReporterEnabled() const; /// true by default
|
bool crashReporterEnabled() const; /// true by default
|
||||||
void setCrashReporterEnabled( bool enable );
|
void setCrashReporterEnabled( bool enable );
|
||||||
|
|
||||||
|
bool exitOnClose() const; /// false by default
|
||||||
|
void setExitOnClose( bool enable );
|
||||||
|
|
||||||
bool songChangeNotificationEnabled() const; /// true by default
|
bool songChangeNotificationEnabled() const; /// true by default
|
||||||
void setSongChangeNotificationEnabled( bool enable );
|
void setSongChangeNotificationEnabled( bool enable );
|
||||||
|
|
||||||
|
@@ -756,13 +756,21 @@ TomahawkWindow::changeEvent( QEvent* e )
|
|||||||
void
|
void
|
||||||
TomahawkWindow::closeEvent( QCloseEvent* e )
|
TomahawkWindow::closeEvent( QCloseEvent* e )
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_MAC
|
|
||||||
if ( e->spontaneous() && QSystemTrayIcon::isSystemTrayAvailable() )
|
TomahawkSettings* s = TomahawkSettings::instance();
|
||||||
{
|
|
||||||
hide();
|
if( s->exitOnClose() ){
|
||||||
e->ignore();
|
qApp->quit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
else if ( e->spontaneous() && QSystemTrayIcon::isSystemTrayAvailable() )
|
||||||
|
{
|
||||||
|
hide();
|
||||||
|
e->ignore();
|
||||||
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QMainWindow::closeEvent( e );
|
QMainWindow::closeEvent( e );
|
||||||
|
@@ -313,6 +313,7 @@ SettingsDialog::saveSettings()
|
|||||||
TomahawkSettings* s = TomahawkSettings::instance();
|
TomahawkSettings* s = TomahawkSettings::instance();
|
||||||
|
|
||||||
s->setCrashReporterEnabled( m_advancedWidgetUi->checkBoxReporter->checkState() == Qt::Checked );
|
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->setHttpEnabled( m_advancedWidgetUi->checkBoxHttp->checkState() == Qt::Checked );
|
||||||
s->setHttpBindAll( m_advancedWidgetUi->checkBoxListenApi->checkState() == Qt::Checked );
|
s->setHttpBindAll( m_advancedWidgetUi->checkBoxListenApi->checkState() == Qt::Checked );
|
||||||
s->setSongChangeNotificationEnabled( m_advancedWidgetUi->checkBoxSongChangeNotifications->checkState() == Qt::Checked );
|
s->setSongChangeNotificationEnabled( m_advancedWidgetUi->checkBoxSongChangeNotifications->checkState() == Qt::Checked );
|
||||||
|
@@ -171,6 +171,19 @@
|
|||||||
<string>Other Settings</string>
|
<string>Other Settings</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<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>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBoxHttp">
|
<widget class="QCheckBox" name="checkBoxHttp">
|
||||||
<property name="layoutDirection">
|
<property name="layoutDirection">
|
||||||
|
Reference in New Issue
Block a user