Disable connections menu when preferences dialog is open.
This commit is contained in:
committed by
craig.p.drummond
parent
78b21f730d
commit
a279d2bbdb
@@ -106,6 +106,7 @@
|
||||
This is so that when these are read back, and the tag-editor has the
|
||||
actual values.
|
||||
63. If we change a genre in the tag-editor, then update genre list in views.
|
||||
64. Disable connections menu when preferences dialog is open.
|
||||
|
||||
0.9.2
|
||||
-----
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
#include "tageditor.h"
|
||||
#include "actiondialog.h"
|
||||
#include "trackorganiser.h"
|
||||
#include "preferencesdialog.h"
|
||||
#include "coverdialog.h"
|
||||
|
||||
DevicesPage::DevicesPage(QWidget *p)
|
||||
: QWidget(p)
|
||||
@@ -455,7 +457,7 @@ void DevicesPage::toggleDevice()
|
||||
}
|
||||
}
|
||||
|
||||
#define DIALOG_ERROR MessageBox::error(this, i18n("Action is not currently possible, due to other open dialogs.")); return
|
||||
#define DIALOG_ERROR MessageBox::error(this, i18n("Please close other dialogs first.")); return
|
||||
|
||||
void DevicesPage::sync()
|
||||
{
|
||||
@@ -463,14 +465,14 @@ void DevicesPage::sync()
|
||||
return;
|
||||
}
|
||||
|
||||
if (0!=TagEditor::instanceCount() || 0!=ActionDialog::instanceCount() || 0!=TrackOrganiser::instanceCount()) {
|
||||
if (0!=PreferencesDialog::instanceCount() || 0!=TagEditor::instanceCount() || 0!=TrackOrganiser::instanceCount()
|
||||
|| 0!=ActionDialog::instanceCount() || 0!=CoverDialog::instanceCount()
|
||||
#ifdef ENABLE_REPLAYGAIN_SUPPORT
|
||||
|| 0!=RgDialog::instanceCount()
|
||||
#endif
|
||||
) {
|
||||
DIALOG_ERROR;
|
||||
}
|
||||
#ifdef ENABLE_REPLAYGAIN_SUPPORT
|
||||
if (0!=RgDialog::instanceCount()) {
|
||||
DIALOG_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
const QModelIndexList selected = view->selectedIndexes();
|
||||
|
||||
|
||||
@@ -1064,7 +1064,7 @@ void MainWindow::refresh()
|
||||
emit getStats(true);
|
||||
}
|
||||
|
||||
#define DIALOG_ERROR MessageBox::error(this, i18n("Action is not currently possible, due to other open dialogs.")); return
|
||||
#define DIALOG_ERROR MessageBox::error(this, i18n("Please close other dialogs first.")); return
|
||||
|
||||
#ifdef ENABLE_KDE_SUPPORT
|
||||
void MainWindow::configureShortcuts()
|
||||
@@ -1102,10 +1102,11 @@ void MainWindow::showPreferencesDialog()
|
||||
#endif
|
||||
|
||||
PreferencesDialog *pref=new PreferencesDialog(this, lyricsPage);
|
||||
controlConnectionsMenu(false);
|
||||
connect(pref, SIGNAL(settingsSaved()), this, SLOT(updateSettings()));
|
||||
connect(pref, SIGNAL(connectTo(const MPDConnectionDetails &)), this, SLOT(connectToMpd(const MPDConnectionDetails &)));
|
||||
connect(pref, SIGNAL(reloadStreams()), streamsPage, SLOT(refresh()));
|
||||
connect(pref, SIGNAL(destroyed()), SLOT(updateConnectionsMenu()));
|
||||
connect(pref, SIGNAL(destroyed()), SLOT(controlConnectionsMenu()));
|
||||
pref->show();
|
||||
}
|
||||
}
|
||||
@@ -1247,6 +1248,17 @@ void MainWindow::updateConnectionsMenu()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::controlConnectionsMenu(bool enable)
|
||||
{
|
||||
if (enable) {
|
||||
updateConnectionsMenu();
|
||||
}
|
||||
|
||||
foreach(QAction *act, connectionsAction->menu()->actions()) {
|
||||
act->setEnabled(enable);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::readSettings()
|
||||
{
|
||||
checkMpdDir();
|
||||
@@ -1394,38 +1406,10 @@ void MainWindow::toggleOutput()
|
||||
|
||||
void MainWindow::changeConnection()
|
||||
{
|
||||
bool allowChange=true;
|
||||
#ifdef TAGLIB_FOUND
|
||||
if (0!=TagEditor::instanceCount() || 0!=TrackOrganiser::instanceCount()) {
|
||||
allowChange=false;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_DEVICES_SUPPORT
|
||||
if (0!=ActionDialog::instanceCount() || 0!=SyncDialog::instanceCount()) {
|
||||
allowChange=false;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_REPLAYGAIN_SUPPORT
|
||||
if (0!=RgDialog::instanceCount()) {
|
||||
allowChange=false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (allowChange) {
|
||||
QAction *act=qobject_cast<QAction *>(sender());
|
||||
|
||||
if (act) {
|
||||
Settings::self()->saveCurrentConnection(act->data().toString());
|
||||
connectToMpd();
|
||||
}
|
||||
} else {
|
||||
QString current=Settings::self()->currentConnection();
|
||||
foreach (QAction *act, connectionsAction->menu()->actions()) {
|
||||
if (act->data().toString()==current) {
|
||||
act->setChecked(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
QAction *act=qobject_cast<QAction *>(sender());
|
||||
if (act) {
|
||||
Settings::self()->saveCurrentConnection(act->data().toString());
|
||||
connectToMpd();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2586,7 +2570,7 @@ void MainWindow::editTags(const QList<Song> &songs, bool isPlayQueue)
|
||||
return;
|
||||
}
|
||||
|
||||
if (0!=TagEditor::instanceCount() || 0!=TrackOrganiser::instanceCount()) {
|
||||
if (0!=TagEditor::instanceCount() || 0!=TrackOrganiser::instanceCount() || 0!=PreferencesDialog::instanceCount()) {
|
||||
DIALOG_ERROR;
|
||||
}
|
||||
#ifdef ENABLE_DEVICES_SUPPORT
|
||||
@@ -2631,7 +2615,7 @@ void MainWindow::organiseFiles()
|
||||
return;
|
||||
}
|
||||
|
||||
if (0!=TagEditor::instanceCount() || 0!=CoverDialog::instanceCount()) {
|
||||
if (0!=TagEditor::instanceCount() || 0!=CoverDialog::instanceCount() || 0!=PreferencesDialog::instanceCount()) {
|
||||
DIALOG_ERROR;
|
||||
}
|
||||
#ifdef ENABLE_DEVICES_SUPPORT
|
||||
@@ -2709,21 +2693,16 @@ void MainWindow::copyToDevice(const QString &from, const QString &to, const QLis
|
||||
if (songs.isEmpty() || 0!=ActionDialog::instanceCount()) {
|
||||
return;
|
||||
}
|
||||
#ifdef TAGLIB_FOUND
|
||||
if (0!=TagEditor::instanceCount() || 0!=TrackOrganiser::instanceCount()) {
|
||||
if (0!=CoverDialog::instanceCount() || 0!=PreferencesDialog::instanceCount() || 0!=SyncDialog::instanceCount()
|
||||
#ifdef TAGLIB_FOUND
|
||||
|| 0!=TagEditor::instanceCount() || 0!=TrackOrganiser::instanceCount()
|
||||
#endif
|
||||
#ifdef ENABLE_REPLAYGAIN_SUPPORT
|
||||
|| 0!=RgDialog::instanceCount()
|
||||
#endif
|
||||
) {
|
||||
DIALOG_ERROR;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_DEVICES_SUPPORT
|
||||
if (0!=SyncDialog::instanceCount()) {
|
||||
DIALOG_ERROR;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_REPLAYGAIN_SUPPORT
|
||||
if (0!=RgDialog::instanceCount()) {
|
||||
DIALOG_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
ActionDialog *dlg=new ActionDialog(this);
|
||||
dlg->copy(from, to, songs);
|
||||
@@ -2734,24 +2713,16 @@ void MainWindow::deleteSongs(const QString &from, const QList<Song> &songs)
|
||||
if (songs.isEmpty() || 0!=ActionDialog::instanceCount()) {
|
||||
return;
|
||||
}
|
||||
if (0!=CoverDialog::instanceCount()) {
|
||||
if (0!=CoverDialog::instanceCount() || 0!=PreferencesDialog::instanceCount() || 0!=SyncDialog::instanceCount()
|
||||
#ifdef TAGLIB_FOUND
|
||||
|| 0!=TagEditor::instanceCount() || 0!=TrackOrganiser::instanceCount()
|
||||
#endif
|
||||
#ifdef ENABLE_REPLAYGAIN_SUPPORT
|
||||
|| 0!=RgDialog::instanceCount()
|
||||
#endif
|
||||
) {
|
||||
DIALOG_ERROR;
|
||||
}
|
||||
#ifdef TAGLIB_FOUND
|
||||
if (0!=TagEditor::instanceCount() || 0!=TrackOrganiser::instanceCount()) {
|
||||
DIALOG_ERROR;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_DEVICES_SUPPORT
|
||||
if (0!=SyncDialog::instanceCount()) {
|
||||
DIALOG_ERROR;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_REPLAYGAIN_SUPPORT
|
||||
if (0!=RgDialog::instanceCount()) {
|
||||
DIALOG_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
ActionDialog *dlg=new ActionDialog(this);
|
||||
dlg->remove(from, songs);
|
||||
@@ -2764,16 +2735,16 @@ void MainWindow::replayGain()
|
||||
if (0!=RgDialog::instanceCount()) {
|
||||
return;
|
||||
}
|
||||
#ifdef TAGLIB_FOUND
|
||||
if (0!=TagEditor::instanceCount() || 0!=TrackOrganiser::instanceCount()) {
|
||||
if (0!=CoverDialog::instanceCount() || 0!=PreferencesDialog::instanceCount()
|
||||
#ifdef TAGLIB_FOUND
|
||||
|| 0!=TagEditor::instanceCount() || 0!=TrackOrganiser::instanceCount()
|
||||
#endif
|
||||
#ifdef ENABLE_DEVICES_SUPPORT
|
||||
|| 0!=ActionDialog::instanceCount() || 0!=SyncDialog::instanceCount()
|
||||
#endif
|
||||
) {
|
||||
DIALOG_ERROR;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_DEVICES_SUPPORT
|
||||
if (0!=ActionDialog::instanceCount() || 0!=SyncDialog::instanceCount()) {
|
||||
DIALOG_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
QList<Song> songs;
|
||||
if (libraryPage->isVisible()) {
|
||||
@@ -2811,16 +2782,19 @@ void MainWindow::setCover()
|
||||
if (0!=CoverDialog::instanceCount()) {
|
||||
return;
|
||||
}
|
||||
#ifdef TAGLIB_FOUND
|
||||
if (0!=TrackOrganiser::instanceCount()) {
|
||||
if (0!=PreferencesDialog::instanceCount()
|
||||
#ifdef TAGLIB_FOUND
|
||||
|| 0!=TagEditor::instanceCount() || 0!=TrackOrganiser::instanceCount()
|
||||
#endif
|
||||
#ifdef ENABLE_DEVICES_SUPPORT
|
||||
|| 0!=ActionDialog::instanceCount() || 0!=SyncDialog::instanceCount()
|
||||
#endif
|
||||
#ifdef ENABLE_REPLAYGAIN_SUPPORT
|
||||
|| 0!=RgDialog::instanceCount()
|
||||
#endif
|
||||
) {
|
||||
DIALOG_ERROR;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_DEVICES_SUPPORT
|
||||
if (0!=ActionDialog::instanceCount()) {
|
||||
DIALOG_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
QList<Song> songs;
|
||||
if (libraryPage->isVisible()) {
|
||||
|
||||
@@ -298,6 +298,7 @@ public Q_SLOTS:
|
||||
void checkMpdDir();
|
||||
void outputsUpdated(const QList<Output> &outputs);
|
||||
void updateConnectionsMenu();
|
||||
void controlConnectionsMenu(bool enable=true);
|
||||
|
||||
private:
|
||||
void updateStatus(MPDStatus * const status);
|
||||
|
||||
Reference in New Issue
Block a user