Bug fix for file name patterns used with QFileDialog

This commit is contained in:
Matthew Budd 2020-07-19 20:04:42 -04:00
parent 397e17ba99
commit 188320147a
3 changed files with 14 additions and 14 deletions

View File

@ -527,7 +527,7 @@ void consoleWin_t::openROMFile(void)
dialog.setFileMode(QFileDialog::ExistingFile);
dialog.setNameFilter(tr("NES files (*.nes)(*.NES) ;; All files (*)"));
dialog.setNameFilter(tr("NES files (*.nes *.NES) ;; All files (*)"));
dialog.setViewMode(QFileDialog::List);
@ -589,7 +589,7 @@ void consoleWin_t::loadNSF(void)
dialog.setFileMode(QFileDialog::ExistingFile);
dialog.setNameFilter(tr("NSF Sound Files (*.nsf)(*.NSF) ;; Zip Files (*.zip)(*.ZIP) ;; All files (*)"));
dialog.setNameFilter(tr("NSF Sound Files (*.nsf *.NSF) ;; Zip Files (*.zip *.ZIP) ;; All files (*)"));
dialog.setViewMode(QFileDialog::List);
@ -641,7 +641,7 @@ void consoleWin_t::loadStateFrom(void)
dialog.setFileMode(QFileDialog::ExistingFile);
dialog.setNameFilter(tr("FCS Files (*.fc?)(*.FC?) ;; SAV Files (*.sav)(*.SAV) ;; All files (*)"));
dialog.setNameFilter(tr("FCS Files (*.fc? *.FC?) ;; SAV Files (*.sav *.SAV) ;; All files (*)"));
dialog.setViewMode(QFileDialog::List);
@ -693,7 +693,7 @@ void consoleWin_t::saveStateAs(void)
dialog.setFileMode(QFileDialog::AnyFile);
dialog.setNameFilter(tr("FCS Files (*.fc?)(*.FC?) ;; SAV Files (*.sav)(*.SAV) ;; All files (*)"));
dialog.setNameFilter(tr("SAV Files (*.sav *.SAV) ;; All files (*)"));
dialog.setViewMode(QFileDialog::List);
@ -837,7 +837,7 @@ void consoleWin_t::loadLua(void)
dialog.setFileMode(QFileDialog::ExistingFile);
dialog.setNameFilter(tr("LUA Scripts (*.lua)(*.LUA) ;; All files (*)"));
dialog.setNameFilter(tr("LUA Scripts (*.lua *.LUA) ;; All files (*)"));
dialog.setViewMode(QFileDialog::List);
@ -1062,7 +1062,7 @@ void consoleWin_t::loadGameGenieROM(void)
dialog.setFileMode(QFileDialog::ExistingFile);
dialog.setNameFilter(tr("GG ROM File (gg.rom)(*Genie*.nes) ;; All files (*)"));
dialog.setNameFilter(tr("GG ROM File (gg.rom *Genie*.nes) ;; All files (*)"));
dialog.setViewMode(QFileDialog::List);
@ -1143,7 +1143,7 @@ void consoleWin_t::fdsLoadBiosFile(void)
dialog.setFileMode(QFileDialog::ExistingFile);
dialog.setNameFilter(tr("ROM files (*.rom)(*.ROM) ;; All files (*)"));
dialog.setNameFilter(tr("ROM files (*.rom *.ROM) ;; All files (*)"));
dialog.setViewMode(QFileDialog::List);

View File

@ -1,6 +1,5 @@
// PaletteConf.cpp
//
#include <QFileDialog>
#include <QTextEdit>
#include "Qt/GuiConf.h"
@ -26,7 +25,7 @@ GuiConfDialog_t::GuiConfDialog_t(QWidget *parent)
mainLayout = new QVBoxLayout();
useNativeFileDialog = new QCheckBox( tr("Use Native File Dialog") );
useNativeFileDialog = new QCheckBox( tr("Use Native OS File Dialog") );
useNativeFileDialog->setChecked( useNativeFileDialogVal );

View File

@ -287,21 +287,22 @@ void PaletteConfDialog_t::clearPalette(void)
//----------------------------------------------------
void PaletteConfDialog_t::openPaletteFile(void)
{
int ret;
int ret, useNativeFileDialogVal;
QString filename;
QFileDialog dialog(this, tr("Open NES Palette") );
dialog.setFileMode(QFileDialog::ExistingFile);
dialog.setNameFilter(tr("NES Palettes (*.pal)(*.PAL) ;; All files (*)"));
dialog.setNameFilter(tr("NES Palettes (*.pal *.PAL) ;; All files (*)"));
dialog.setViewMode(QFileDialog::List);
dialog.setDirectory( tr("/usr/share/fceux/palettes") );
// the gnome default file dialog is not playing nice with QT.
// TODO make this a config option to use native file dialog.
dialog.setOption(QFileDialog::DontUseNativeDialog, true);
// Check config option to use native file dialog or not
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
dialog.setOption(QFileDialog::DontUseNativeDialog, !useNativeFileDialogVal);
dialog.show();
ret = dialog.exec();