Ignore quit action if we have open dialogs.

This commit is contained in:
craig.p.drummond
2012-11-30 16:42:23 +00:00
parent 914c6dc677
commit 43e286b943
3 changed files with 37 additions and 7 deletions

View File

@@ -110,6 +110,7 @@
61. Add a 1 pixel border around large cover in top-left corner.
62. When refresh button is pressed send an update and stats request to MPD.
63. Hard-code black background and gray text for cover widget tooltip.
64. Ignore quit action if we have open dialogs.
0.8.3.1
-------

View File

@@ -272,13 +272,13 @@ MainWindow::MainWindow(QWidget *parent)
#ifdef ENABLE_KDE_SUPPORT
prefAction=static_cast<Action *>(KStandardAction::preferences(this, SLOT(showPreferencesDialog()), ActionCollection::get()));
quitAction=static_cast<Action *>(KStandardAction::quit(kapp, SLOT(quit()), ActionCollection::get()));
quitAction=static_cast<Action *>(KStandardAction::quit(this, SLOT(quit()), ActionCollection::get()));
#else
setWindowIcon(Icons::appIcon);
QNetworkProxyFactory::setApplicationProxyFactory(NetworkProxyFactory::self());
quitAction = ActionCollection::get()->createAction("quit", i18n("Quit"), "application-exit");
connect(quitAction, SIGNAL(triggered(bool)), qApp, SLOT(quit()));
connect(quitAction, SIGNAL(triggered(bool)), this, SLOT(quit()));
quitAction->setShortcut(QKeySequence::Quit);
#endif // ENABLE_KDE_SUPPORT
#if !defined Q_OS_WIN
@@ -1171,11 +1171,11 @@ void MainWindow::saveShortcuts()
#endif
static bool showingPrefDlg=false;
void MainWindow::showPreferencesDialog()
{
static bool showing=false;
if (!showing) {
if (!showingPrefDlg) {
#ifdef TAGLIB_FOUND
if (0!=TagEditor::instanceCount() || 0!=TrackOrganiser::instanceCount()) {
DIALOG_ERROR;
@@ -1192,17 +1192,45 @@ void MainWindow::showPreferencesDialog()
}
#endif
showing=true;
showingPrefDlg=true;
PreferencesDialog pref(this, lyricsPage);
connect(&pref, SIGNAL(settingsSaved()), this, SLOT(updateSettings()));
connect(&pref, SIGNAL(connectTo(const MPDConnectionDetails &)), this, SLOT(connectToMpd(const MPDConnectionDetails &)));
pref.exec();
updateConnectionsMenu();
showing=false;
showingPrefDlg=false;
}
}
void MainWindow::quit()
{
if (showingPrefDlg) {
return;
}
#ifdef ENABLE_REPLAYGAIN_SUPPORT
if (0!=RgDialog::instanceCount()) {
return;
}
#endif
#ifdef TAGLIB_FOUND
if (0!=TagEditor::instanceCount() || 0!=TrackOrganiser::instanceCount()) {
return;
}
#endif
#ifdef ENABLE_DEVICES_SUPPORT
if (0!=ActionDialog::instanceCount() || 0!=SyncDialog::instanceCount()) {
return;
}
#endif
#ifdef ENABLE_KDE_SUPPORT
kapp->quit();
#else
qApp->quit();
#endif
}
void MainWindow::checkMpdDir()
{
#ifdef Q_OS_LINUX

View File

@@ -225,6 +225,7 @@ public Q_SLOTS:
void playQueueItemsSelected(bool s);
void showVolumeControl();
void showPreferencesDialog();
void quit();
void updateSettings();
void toggleOutput();
void changeConnection();