1
0
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:
Gil Domingues
2020-07-03 12:29:03 +01:00
committed by GitHub
parent 77acc1cd66
commit 5b6aecd8d0
5 changed files with 44 additions and 5 deletions

View File

@@ -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
{

View File

@@ -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 );

View File

@@ -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();

View File

@@ -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 );

View File

@@ -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">