Workaround for Qt bug: Don't use "native" FileOpen dialog when Themes are disabled.

This commit is contained in:
LoRd_MuldeR 2011-01-02 21:46:36 +01:00
parent 8f4fae7fda
commit 1c9cb08b75
4 changed files with 73 additions and 32 deletions

View File

@ -577,7 +577,7 @@
</message> </message>
<message> <message>
<source>Add folder</source> <source>Add folder</source>
<translation>Ordner Erstellen</translation> <translation>Ordner Hinzufügen</translation>
</message> </message>
<message> <message>
<source>New Folder</source> <source>New Folder</source>

Binary file not shown.

View File

@ -25,7 +25,7 @@
#define VER_LAMEXP_MAJOR 4 #define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 0 #define VER_LAMEXP_MINOR_LO 0
#define VER_LAMEXP_BUILD 212 #define VER_LAMEXP_BUILD 213
#define VER_LAMEXP_SUFFIX TechPreview #define VER_LAMEXP_SUFFIX TechPreview
/* /*

View File

@ -71,6 +71,7 @@
#define SET_FONT_BOLD(WIDGET,BOLD) { QFont _font = WIDGET->font(); _font.setBold(BOLD); WIDGET->setFont(_font); } #define SET_FONT_BOLD(WIDGET,BOLD) { QFont _font = WIDGET->font(); _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 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("<a href=\"%1\">%2</a>").arg(URL).arg(URL) #define LINK(URL) QString("<a href=\"%1\">%2</a>").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 //Helper class
class Index: public QObjectUserData class Index: public QObjectUserData
@ -706,11 +707,13 @@ void MainWindow::windowShown(void)
void MainWindow::aboutButtonClicked(void) void MainWindow::aboutButtonClicked(void)
{ {
ABORT_IF_BUSY; ABORT_IF_BUSY;
if(m_dropBox->isVisible()) m_dropBox->hide();
TEMP_HIDE_DROPBOX
(
AboutDialog *aboutBox = new AboutDialog(m_settings, this); AboutDialog *aboutBox = new AboutDialog(m_settings, this);
aboutBox->exec(); aboutBox->exec();
LAMEXP_DELETE(aboutBox); LAMEXP_DELETE(aboutBox);
if(m_settings->dropBoxWidgetEnabled()) m_dropBox->show(); )
} }
/* /*
@ -799,10 +802,31 @@ void MainWindow::closeButtonClicked(void)
void MainWindow::addFilesButtonClicked(void) void MainWindow::addFilesButtonClicked(void)
{ {
ABORT_IF_BUSY; ABORT_IF_BUSY;
TEMP_HIDE_DROPBOX
(
if(lamexp_themes_enabled())
{
QStringList fileTypeFilters = DecoderRegistry::getSupportedTypes(); QStringList fileTypeFilters = DecoderRegistry::getSupportedTypes();
QStringList selectedFiles = QFileDialog::getOpenFileNames(this, tr("Add file(s)"), QString(), fileTypeFilters.join(";;")); QStringList selectedFiles = QFileDialog::getOpenFileNames(this, tr("Add file(s)"), QString(), fileTypeFilters.join(";;"));
if(!selectedFiles.isEmpty())
{
addFiles(selectedFiles); 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);
}
}
)
}
/* /*
* Open folder action * Open folder action
@ -810,7 +834,24 @@ void MainWindow::addFilesButtonClicked(void)
void MainWindow::openFolderActionActivated(void) void MainWindow::openFolderActionActivated(void)
{ {
ABORT_IF_BUSY; ABORT_IF_BUSY;
QString selectedFolder = QFileDialog::getExistingDirectory(this, tr("Add folder"), QDesktopServices::storageLocation(QDesktopServices::MusicLocation)); QString selectedFolder;
TEMP_HIDE_DROPBOX
(
if(lamexp_themes_enabled())
{
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()) if(!selectedFolder.isEmpty())
{ {
@ -825,6 +866,7 @@ void MainWindow::openFolderActionActivated(void)
addFiles(fileList); addFiles(fileList);
} }
)
} }
/* /*
@ -1206,17 +1248,16 @@ void MainWindow::checkUpdatesActionActivated(void)
{ {
ABORT_IF_BUSY; ABORT_IF_BUSY;
if(m_dropBox->isVisible()) m_dropBox->hide(); TEMP_HIDE_DROPBOX
(
UpdateDialog *updateDialog = new UpdateDialog(m_settings, this); UpdateDialog *updateDialog = new UpdateDialog(m_settings, this);
updateDialog->exec(); updateDialog->exec();
if(updateDialog->getSuccess()) if(updateDialog->getSuccess())
{ {
m_settings->autoUpdateLastCheck(QDate::currentDate().toString(Qt::ISODate)); m_settings->autoUpdateLastCheck(QDate::currentDate().toString(Qt::ISODate));
} }
LAMEXP_DELETE(updateDialog); LAMEXP_DELETE(updateDialog);
if(m_settings->dropBoxWidgetEnabled()) m_dropBox->show(); )
} }
/* /*