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>
<source>Add folder</source>
<translation>Ordner Erstellen</translation>
<translation>Ordner Hinzufügen</translation>
</message>
<message>
<source>New Folder</source>

Binary file not shown.

View File

@ -25,7 +25,7 @@
#define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 0
#define VER_LAMEXP_BUILD 212
#define VER_LAMEXP_BUILD 213
#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 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 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);
)
}
/*