From 1c9cb08b7561bc25bfe85e6ec32f892d55ad66b4 Mon Sep 17 00:00:00 2001 From: lordmulder Date: Sun, 2 Jan 2011 21:46:36 +0100 Subject: [PATCH] Workaround for Qt bug: Don't use "native" FileOpen dialog when Themes are disabled. --- etc/Translation/LameXP_DE.ts | 2 +- res/localization/LameXP_DE.qm | Bin 41212 -> 41214 bytes src/Config.h | 2 +- src/Dialog_MainWindow.cpp | 101 ++++++++++++++++++++++++---------- 4 files changed, 73 insertions(+), 32 deletions(-) diff --git a/etc/Translation/LameXP_DE.ts b/etc/Translation/LameXP_DE.ts index cd55c977..0b83041b 100644 --- a/etc/Translation/LameXP_DE.ts +++ b/etc/Translation/LameXP_DE.ts @@ -577,7 +577,7 @@ Add folder - Ordner Erstellen + Ordner Hinzufügen New Folder diff --git a/res/localization/LameXP_DE.qm b/res/localization/LameXP_DE.qm index e3754a1b5c7bc93cca60daab0d5e9bfff49fd67e..e6425371dde2b6a499eca277b41e6895ed4f4d2e 100644 GIT binary patch delta 2324 zcmX9=dt8k99)4!#z0Et9*CpD-jM~x-p|D*Ag%3UQgYVTop5MR<$Enz)1 ze+;I^W&;^&Os`u9B&T6c{WT!C5OZ$s0=7OyNky;7w-jx@4|fj zW7>BJ^Vj^90RDuy>QTT~&B(AD4XpVSo6Y60I?DRE1LvX4n8 z2-smcha5qt+dv#Gj*9CDA@ zX}CbndC2Um@dt!Drm|`S0SjafEhs0TmzZPG!EbPtS07mJXwAGH0GXlEs(U1=?UYxh{^Np*YCyyvFU71do?+-H(L-?M>WD) zs<5?~*!^$hbZQ^=@T~(tLIHa;p9X7FU$$oS&wzgid*_~&Zfjug`YZ?1&1`e&EgC={ zwq?>XI^BVNew=I&HIb9T|5Wj@Kg@GbAU z-v^kR%X_`N0rUyw{exsc>I;6souz-gm2bLC>iXT_e~&Jw3orAnDmsU26`cAJK=Te^Y(!sDHB#^y zSOeJJ7bccnB0z(L8K*zM0>2Vrjz9uA7YjL^#Lp1Vo|<3~*6PV`Hlu|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U}5GrbhdjbCVwsiQksu4$?DPrNk5$T23>hq^M@H zjGdHO;!GB_lh)VJ_v`^FYx#cKu9{0yl`VBStxGz2GmJcGkgnu!qG?T$nyPK-?dc}{ zQ=z4w2^I8e-R-ZS)FVyNst>+;pbWPjH5#+92JtXp8O6~Eq`#?1qbEJ|Uxhifont(); _font.setBold(BOLD); WIDGET->setFont(_font); } #define FLASH_WINDOW(WND) { FLASHWINFO flashInfo; memset(&flashInfo, 0, sizeof(FLASHWINFO)); flashInfo.cbSize = sizeof(FLASHWINFO); flashInfo.dwFlags = FLASHW_ALL; flashInfo.uCount = 12; flashInfo.dwTimeout = 125; flashInfo.hwnd = WND->winId(); FlashWindowEx(&flashInfo); } #define LINK(URL) QString("%2").arg(URL).arg(URL) +#define TEMP_HIDE_DROPBOX(CMD) { bool __dropBoxVisible = m_dropBox->isVisible(); if(__dropBoxVisible) m_dropBox->hide(); CMD; if(__dropBoxVisible) m_dropBox->show(); } //Helper class class Index: public QObjectUserData @@ -706,11 +707,13 @@ void MainWindow::windowShown(void) void MainWindow::aboutButtonClicked(void) { ABORT_IF_BUSY; - if(m_dropBox->isVisible()) m_dropBox->hide(); - AboutDialog *aboutBox = new AboutDialog(m_settings, this); - aboutBox->exec(); - LAMEXP_DELETE(aboutBox); - if(m_settings->dropBoxWidgetEnabled()) m_dropBox->show(); + + TEMP_HIDE_DROPBOX + ( + AboutDialog *aboutBox = new AboutDialog(m_settings, this); + aboutBox->exec(); + LAMEXP_DELETE(aboutBox); + ) } /* @@ -799,9 +802,30 @@ void MainWindow::closeButtonClicked(void) void MainWindow::addFilesButtonClicked(void) { ABORT_IF_BUSY; - QStringList fileTypeFilters = DecoderRegistry::getSupportedTypes(); - QStringList selectedFiles = QFileDialog::getOpenFileNames(this, tr("Add file(s)"), QString(), fileTypeFilters.join(";;")); - addFiles(selectedFiles); + + TEMP_HIDE_DROPBOX + ( + if(lamexp_themes_enabled()) + { + QStringList fileTypeFilters = DecoderRegistry::getSupportedTypes(); + QStringList selectedFiles = QFileDialog::getOpenFileNames(this, tr("Add file(s)"), QString(), fileTypeFilters.join(";;")); + if(!selectedFiles.isEmpty()) + { + addFiles(selectedFiles); + } + } + else + { + QFileDialog dialog(this, tr("Add file(s)")); + QStringList fileTypeFilters = DecoderRegistry::getSupportedTypes(); + dialog.setNameFilter(fileTypeFilters.join(";;")); + if(dialog.exec()) + { + QStringList selectedFiles = dialog.selectedFiles(); + addFiles(selectedFiles); + } + } + ) } /* @@ -810,21 +834,39 @@ void MainWindow::addFilesButtonClicked(void) void MainWindow::openFolderActionActivated(void) { ABORT_IF_BUSY; - QString selectedFolder = QFileDialog::getExistingDirectory(this, tr("Add folder"), QDesktopServices::storageLocation(QDesktopServices::MusicLocation)); + QString selectedFolder; - if(!selectedFolder.isEmpty()) - { - QDir sourceDir(selectedFolder); - QFileInfoList fileInfoList = sourceDir.entryInfoList(QDir::Files); - QStringList fileList; - - while(!fileInfoList.isEmpty()) + TEMP_HIDE_DROPBOX + ( + if(lamexp_themes_enabled()) { - fileList << fileInfoList.takeFirst().canonicalFilePath(); + selectedFolder = QFileDialog::getExistingDirectory(this, tr("Add folder"), QDesktopServices::storageLocation(QDesktopServices::MusicLocation)); } + else + { + QFileDialog dialog(this, tr("Add folder")); + dialog.setFileMode(QFileDialog::DirectoryOnly); + dialog.setDirectory(QDesktopServices::storageLocation(QDesktopServices::MusicLocation)); + if(dialog.exec()) + { + selectedFolder = dialog.selectedFiles().first(); + } + } + + if(!selectedFolder.isEmpty()) + { + QDir sourceDir(selectedFolder); + QFileInfoList fileInfoList = sourceDir.entryInfoList(QDir::Files); + QStringList fileList; - addFiles(fileList); - } + while(!fileInfoList.isEmpty()) + { + fileList << fileInfoList.takeFirst().canonicalFilePath(); + } + + addFiles(fileList); + } + ) } /* @@ -1206,17 +1248,16 @@ void MainWindow::checkUpdatesActionActivated(void) { ABORT_IF_BUSY; - if(m_dropBox->isVisible()) m_dropBox->hide(); - UpdateDialog *updateDialog = new UpdateDialog(m_settings, this); - - updateDialog->exec(); - if(updateDialog->getSuccess()) - { - m_settings->autoUpdateLastCheck(QDate::currentDate().toString(Qt::ISODate)); - } - - LAMEXP_DELETE(updateDialog); - if(m_settings->dropBoxWidgetEnabled()) m_dropBox->show(); + TEMP_HIDE_DROPBOX + ( + UpdateDialog *updateDialog = new UpdateDialog(m_settings, this); + updateDialog->exec(); + if(updateDialog->getSuccess()) + { + m_settings->autoUpdateLastCheck(QDate::currentDate().toString(Qt::ISODate)); + } + LAMEXP_DELETE(updateDialog); + ) } /*