Changed interface to Qt GUI function getDirFromFile to pass reference to std::string so that returned string will not have string length limitations. Buffer size will grow as needed for the path and will not be allocated on the stack.
This commit is contained in:
parent
4e54ea54ac
commit
6ae834a1df
|
@ -755,7 +755,7 @@ void GuiCheatsDialog_t::openCheatFile(void)
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
QString filename;
|
QString filename;
|
||||||
std::string last;
|
std::string last;
|
||||||
char dir[512];
|
std::string dir;
|
||||||
QFileDialog dialog(this, tr("Open Cheat File"));
|
QFileDialog dialog(this, tr("Open Cheat File"));
|
||||||
|
|
||||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||||
|
@ -768,9 +768,9 @@ void GuiCheatsDialog_t::openCheatFile(void)
|
||||||
|
|
||||||
g_config->getOption("SDL.LastOpenFile", &last);
|
g_config->getOption("SDL.LastOpenFile", &last);
|
||||||
|
|
||||||
getDirFromFile(last.c_str(), dir, sizeof(dir));
|
getDirFromFile(last.c_str(), dir);
|
||||||
|
|
||||||
dialog.setDirectory(tr(dir));
|
dialog.setDirectory(tr(dir.c_str()));
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
g_config->getOption("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
g_config->getOption("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||||
|
|
|
@ -489,7 +489,7 @@ void CodeDataLoggerDialog_t::loadCdlFile(void)
|
||||||
{
|
{
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
QString filename;
|
QString filename;
|
||||||
char dir[512];
|
std::string dir;
|
||||||
const char *romFile;
|
const char *romFile;
|
||||||
QFileDialog dialog(this, tr("Load CDL File"));
|
QFileDialog dialog(this, tr("Load CDL File"));
|
||||||
|
|
||||||
|
@ -505,9 +505,9 @@ void CodeDataLoggerDialog_t::loadCdlFile(void)
|
||||||
|
|
||||||
if (romFile)
|
if (romFile)
|
||||||
{
|
{
|
||||||
getDirFromFile(romFile, dir, sizeof(dir));
|
getDirFromFile(romFile, dir);
|
||||||
|
|
||||||
dialog.setDirectory(tr(dir));
|
dialog.setDirectory(tr(dir.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
|
|
|
@ -50,9 +50,9 @@
|
||||||
|
|
||||||
static std::string fceuExecPath;
|
static std::string fceuExecPath;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
int getDirFromFile( const char *path, char *dir, size_t bufSize )
|
int getDirFromFile( const char *path, std::string &dir )
|
||||||
{
|
{
|
||||||
dir[0] = 0;
|
dir.clear();
|
||||||
|
|
||||||
if (path[0] != 0)
|
if (path[0] != 0)
|
||||||
{
|
{
|
||||||
|
@ -62,16 +62,13 @@ int getDirFromFile( const char *path, char *dir, size_t bufSize )
|
||||||
|
|
||||||
if (fi.exists())
|
if (fi.exists())
|
||||||
{
|
{
|
||||||
strncpy( dir, fi.canonicalPath().toStdString().c_str(), bufSize );
|
dir = fi.canonicalPath().toStdString();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strncpy( dir, fi.absolutePath().toStdString().c_str(), bufSize );
|
dir = fi.absolutePath().toStdString();
|
||||||
}
|
}
|
||||||
|
//printf("Dir: '%s'\n", dir.c_str());
|
||||||
dir[bufSize-1] = 0;
|
|
||||||
|
|
||||||
//printf("Dir: '%s'\n", dir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QValidator>
|
#include <QValidator>
|
||||||
|
@ -9,7 +11,7 @@
|
||||||
#include <QHelpEvent>
|
#include <QHelpEvent>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
|
||||||
int getDirFromFile( const char *path, char *dir, size_t bufSize );
|
int getDirFromFile( const char *path, std::string &dir );
|
||||||
|
|
||||||
const char *getRomFile( void );
|
const char *getRomFile( void );
|
||||||
|
|
||||||
|
|
|
@ -2315,8 +2315,8 @@ void consoleWin_t::openROMFile(void)
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
QString filename;
|
QString filename;
|
||||||
std::string last;
|
std::string last;
|
||||||
char dir[512];
|
std::string dir;
|
||||||
char *romDir;
|
const char *romDir;
|
||||||
QFileDialog dialog(this, tr("Open ROM File") );
|
QFileDialog dialog(this, tr("Open ROM File") );
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
QDir d;
|
QDir d;
|
||||||
|
@ -2358,9 +2358,9 @@ void consoleWin_t::openROMFile(void)
|
||||||
|
|
||||||
g_config->getOption ("SDL.LastOpenFile", &last );
|
g_config->getOption ("SDL.LastOpenFile", &last );
|
||||||
|
|
||||||
getDirFromFile( last.c_str(), dir, sizeof(dir) );
|
getDirFromFile( last.c_str(), dir);
|
||||||
|
|
||||||
dialog.setDirectory( tr(dir) );
|
dialog.setDirectory( tr(dir.c_str()) );
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||||
|
@ -2418,8 +2418,8 @@ void consoleWin_t::loadNSF(void)
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
QString filename;
|
QString filename;
|
||||||
std::string last;
|
std::string last;
|
||||||
char dir[512];
|
std::string dir;
|
||||||
char *romDir;
|
const char *romDir;
|
||||||
QFileDialog dialog(this, tr("Load NSF File") );
|
QFileDialog dialog(this, tr("Load NSF File") );
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
QDir d;
|
QDir d;
|
||||||
|
@ -2451,9 +2451,9 @@ void consoleWin_t::loadNSF(void)
|
||||||
|
|
||||||
g_config->getOption ("SDL.LastOpenNSF", &last );
|
g_config->getOption ("SDL.LastOpenNSF", &last );
|
||||||
|
|
||||||
getDirFromFile( last.c_str(), dir, sizeof(dir) );
|
getDirFromFile( last.c_str(), dir );
|
||||||
|
|
||||||
dialog.setDirectory( tr(dir) );
|
dialog.setDirectory( tr(dir.c_str()) );
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||||
|
@ -2492,7 +2492,7 @@ void consoleWin_t::loadStateFrom(void)
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
QString filename;
|
QString filename;
|
||||||
std::string last;
|
std::string last;
|
||||||
char dir[512];
|
std::string dir;
|
||||||
const char *base;
|
const char *base;
|
||||||
QFileDialog dialog(this, tr("Load State From File") );
|
QFileDialog dialog(this, tr("Load State From File") );
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
|
@ -2535,9 +2535,9 @@ void consoleWin_t::loadStateFrom(void)
|
||||||
|
|
||||||
g_config->getOption ("SDL.LastLoadStateFrom", &last );
|
g_config->getOption ("SDL.LastLoadStateFrom", &last );
|
||||||
|
|
||||||
getDirFromFile( last.c_str(), dir, sizeof(dir) );
|
getDirFromFile( last.c_str(), dir );
|
||||||
|
|
||||||
dialog.setDirectory( tr(dir) );
|
dialog.setDirectory( tr(dir.c_str()) );
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||||
|
@ -2576,7 +2576,7 @@ void consoleWin_t::saveStateAs(void)
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
QString filename;
|
QString filename;
|
||||||
std::string last;
|
std::string last;
|
||||||
char dir[512];
|
std::string dir;
|
||||||
const char *base;
|
const char *base;
|
||||||
QFileDialog dialog(this, tr("Save State To File") );
|
QFileDialog dialog(this, tr("Save State To File") );
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
|
@ -2626,9 +2626,9 @@ void consoleWin_t::saveStateAs(void)
|
||||||
last = std::string(base) + "/sav";
|
last = std::string(base) + "/sav";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getDirFromFile( last.c_str(), dir, sizeof(dir) );
|
getDirFromFile( last.c_str(), dir );
|
||||||
|
|
||||||
dialog.setDirectory( tr(dir) );
|
dialog.setDirectory( tr(dir.c_str()) );
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||||
|
@ -3376,7 +3376,7 @@ void consoleWin_t::loadGameGenieROM(void)
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
QString filename;
|
QString filename;
|
||||||
std::string last;
|
std::string last;
|
||||||
char dir[512];
|
std::string dir;
|
||||||
QFileDialog dialog(this, tr("Open Game Genie ROM") );
|
QFileDialog dialog(this, tr("Open Game Genie ROM") );
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
|
|
||||||
|
@ -3395,9 +3395,9 @@ void consoleWin_t::loadGameGenieROM(void)
|
||||||
|
|
||||||
g_config->getOption ("SDL.LastOpenFile", &last );
|
g_config->getOption ("SDL.LastOpenFile", &last );
|
||||||
|
|
||||||
getDirFromFile( last.c_str(), dir, sizeof(dir) );
|
getDirFromFile( last.c_str(), dir );
|
||||||
|
|
||||||
dialog.setDirectory( tr(dir) );
|
dialog.setDirectory( tr(dir.c_str()) );
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||||
|
@ -3471,7 +3471,7 @@ void consoleWin_t::fdsLoadBiosFile(void)
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
QString filename;
|
QString filename;
|
||||||
std::string last;
|
std::string last;
|
||||||
char dir[512];
|
std::string dir;
|
||||||
QFileDialog dialog(this, tr("Load FDS BIOS (disksys.rom)") );
|
QFileDialog dialog(this, tr("Load FDS BIOS (disksys.rom)") );
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
|
|
||||||
|
@ -3490,9 +3490,9 @@ void consoleWin_t::fdsLoadBiosFile(void)
|
||||||
|
|
||||||
g_config->getOption ("SDL.LastOpenFile", &last );
|
g_config->getOption ("SDL.LastOpenFile", &last );
|
||||||
|
|
||||||
getDirFromFile( last.c_str(), dir, sizeof(dir) );
|
getDirFromFile( last.c_str(), dir);
|
||||||
|
|
||||||
dialog.setDirectory( tr(dir) );
|
dialog.setDirectory( tr(dir.c_str()) );
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||||
|
|
|
@ -369,7 +369,7 @@ void GuiConfDialog_t::openQss(void)
|
||||||
int ret, useNativeFileDialogVal; //, useCustom;
|
int ret, useNativeFileDialogVal; //, useCustom;
|
||||||
QString filename;
|
QString filename;
|
||||||
std::string last, iniPath;
|
std::string last, iniPath;
|
||||||
char dir[512];
|
std::string dir;
|
||||||
const char *exePath = nullptr;
|
const char *exePath = nullptr;
|
||||||
QFileDialog dialog(this, tr("Open Qt Stylesheet (QSS)"));
|
QFileDialog dialog(this, tr("Open Qt Stylesheet (QSS)"));
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
|
@ -419,9 +419,9 @@ void GuiConfDialog_t::openQss(void)
|
||||||
last.assign(iniPath);
|
last.assign(iniPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
getDirFromFile(last.c_str(), dir, sizeof(dir));
|
getDirFromFile(last.c_str(), dir);
|
||||||
|
|
||||||
dialog.setDirectory(tr(dir));
|
dialog.setDirectory(tr(dir.c_str()));
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
g_config->getOption("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
g_config->getOption("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||||
|
@ -473,7 +473,7 @@ void GuiConfDialog_t::openQPal(void)
|
||||||
int ret, useNativeFileDialogVal; //, useCustom;
|
int ret, useNativeFileDialogVal; //, useCustom;
|
||||||
QString filename;
|
QString filename;
|
||||||
std::string last, iniPath;
|
std::string last, iniPath;
|
||||||
char dir[512];
|
std::string dir;
|
||||||
const char *exePath = nullptr;
|
const char *exePath = nullptr;
|
||||||
QFileDialog dialog(this, tr("Open Qt QPalette File (QPAL)"));
|
QFileDialog dialog(this, tr("Open Qt QPalette File (QPAL)"));
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
|
@ -523,9 +523,9 @@ void GuiConfDialog_t::openQPal(void)
|
||||||
last.assign(iniPath);
|
last.assign(iniPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
getDirFromFile(last.c_str(), dir, sizeof(dir));
|
getDirFromFile(last.c_str(), dir);
|
||||||
|
|
||||||
dialog.setDirectory(tr(dir));
|
dialog.setDirectory(tr(dir.c_str()));
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
g_config->getOption("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
g_config->getOption("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||||
|
@ -1176,7 +1176,7 @@ void GuiPaletteEditDialog_t::paletteSaveAs(void)
|
||||||
int ret, useNativeFileDialogVal; //, useCustom;
|
int ret, useNativeFileDialogVal; //, useCustom;
|
||||||
QString filename;
|
QString filename;
|
||||||
std::string last, iniPath;
|
std::string last, iniPath;
|
||||||
char dir[512];
|
std::string dir;
|
||||||
const char *exePath = nullptr;
|
const char *exePath = nullptr;
|
||||||
QFileDialog dialog(this, tr("Save QPalette (qpal)"));
|
QFileDialog dialog(this, tr("Save QPalette (qpal)"));
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
|
@ -1228,9 +1228,9 @@ void GuiPaletteEditDialog_t::paletteSaveAs(void)
|
||||||
last.assign(iniPath);
|
last.assign(iniPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
getDirFromFile(last.c_str(), dir, sizeof(dir));
|
getDirFromFile(last.c_str(), dir);
|
||||||
|
|
||||||
dialog.setDirectory(tr(dir));
|
dialog.setDirectory(tr(dir.c_str()));
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
g_config->getOption("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
g_config->getOption("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||||
|
|
|
@ -149,7 +149,7 @@ std::string consoleWin_t::findHelpFile(void)
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
QString filename;
|
QString filename;
|
||||||
std::string last;
|
std::string last;
|
||||||
char dir[512];
|
std::string dir;
|
||||||
QFileDialog dialog(this, tr("Open Help File") );
|
QFileDialog dialog(this, tr("Open Help File") );
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
//QDir d;
|
//QDir d;
|
||||||
|
@ -175,9 +175,9 @@ std::string consoleWin_t::findHelpFile(void)
|
||||||
|
|
||||||
if ( last.size() > 0 )
|
if ( last.size() > 0 )
|
||||||
{
|
{
|
||||||
getDirFromFile( last.c_str(), dir, sizeof(dir) );
|
getDirFromFile( last.c_str(), dir );
|
||||||
|
|
||||||
dialog.setDirectory( tr(dir) );
|
dialog.setDirectory( tr(dir.c_str()) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -279,7 +279,7 @@ void LuaControlDialog_t::openLuaScriptFile(void)
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
QString filename;
|
QString filename;
|
||||||
std::string last;
|
std::string last;
|
||||||
char dir[2048];
|
std::string dir;
|
||||||
const char *exePath = nullptr;
|
const char *exePath = nullptr;
|
||||||
const char *luaPath = nullptr;
|
const char *luaPath = nullptr;
|
||||||
QFileDialog dialog(this, tr("Open LUA Script"));
|
QFileDialog dialog(this, tr("Open LUA Script"));
|
||||||
|
@ -379,9 +379,9 @@ void LuaControlDialog_t::openLuaScriptFile(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
getDirFromFile(last.c_str(), dir, sizeof(dir));
|
getDirFromFile(last.c_str(), dir);
|
||||||
|
|
||||||
dialog.setDirectory(tr(dir));
|
dialog.setDirectory(tr(dir.c_str()));
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
g_config->getOption("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
g_config->getOption("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||||
|
|
|
@ -416,8 +416,8 @@ void MoviePlayDialog_t::doScan(void)
|
||||||
std::string path, last;
|
std::string path, last;
|
||||||
const char *romFile;
|
const char *romFile;
|
||||||
const char *baseDir = FCEUI_GetBaseDirectory();
|
const char *baseDir = FCEUI_GetBaseDirectory();
|
||||||
|
std::string lastDir;
|
||||||
char md5[256];
|
char md5[256];
|
||||||
char dir[512], base[256];
|
|
||||||
|
|
||||||
md5[0] = 0;
|
md5[0] = 0;
|
||||||
|
|
||||||
|
@ -434,6 +434,8 @@ void MoviePlayDialog_t::doScan(void)
|
||||||
|
|
||||||
if (romFile != NULL)
|
if (romFile != NULL)
|
||||||
{
|
{
|
||||||
|
char dir[512], base[256];
|
||||||
|
|
||||||
parseFilepath(romFile, dir, base);
|
parseFilepath(romFile, dir, base);
|
||||||
|
|
||||||
path = std::string(dir);
|
path = std::string(dir);
|
||||||
|
@ -443,9 +445,9 @@ void MoviePlayDialog_t::doScan(void)
|
||||||
|
|
||||||
g_config->getOption("SDL.LastOpenMovie", &last);
|
g_config->getOption("SDL.LastOpenMovie", &last);
|
||||||
|
|
||||||
getDirFromFile(last.c_str(), dir, sizeof(dir));
|
getDirFromFile(last.c_str(), lastDir);
|
||||||
|
|
||||||
scanDirectory(dir, md5);
|
scanDirectory(lastDir.c_str(), md5);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void MoviePlayDialog_t::playMovie(void)
|
void MoviePlayDialog_t::playMovie(void)
|
||||||
|
@ -495,7 +497,7 @@ void MoviePlayDialog_t::openMovie(void)
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
QString filename;
|
QString filename;
|
||||||
std::string last;
|
std::string last;
|
||||||
char dir[512];
|
std::string dir;
|
||||||
char md5Match = 0;
|
char md5Match = 0;
|
||||||
QFileDialog dialog(this, tr("Open FM2 Movie"));
|
QFileDialog dialog(this, tr("Open FM2 Movie"));
|
||||||
|
|
||||||
|
@ -509,9 +511,9 @@ void MoviePlayDialog_t::openMovie(void)
|
||||||
|
|
||||||
g_config->getOption("SDL.LastOpenMovie", &last);
|
g_config->getOption("SDL.LastOpenMovie", &last);
|
||||||
|
|
||||||
getDirFromFile(last.c_str(), dir, sizeof(dir));
|
getDirFromFile(last.c_str(), dir);
|
||||||
|
|
||||||
dialog.setDirectory(tr(dir));
|
dialog.setDirectory(tr(dir.c_str()));
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
g_config->getOption("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
g_config->getOption("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||||
|
|
|
@ -179,7 +179,7 @@ void MovieRecordDialog_t::setLoadState(void)
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
QString filename;
|
QString filename;
|
||||||
std::string last;
|
std::string last;
|
||||||
char dir[512];
|
std::string dir;
|
||||||
const char *base;
|
const char *base;
|
||||||
QFileDialog dialog(this, tr("Load State From File") );
|
QFileDialog dialog(this, tr("Load State From File") );
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
|
@ -222,9 +222,9 @@ void MovieRecordDialog_t::setLoadState(void)
|
||||||
|
|
||||||
g_config->getOption ("SDL.LastLoadStateFrom", &last );
|
g_config->getOption ("SDL.LastLoadStateFrom", &last );
|
||||||
|
|
||||||
getDirFromFile( last.c_str(), dir, sizeof(dir) );
|
getDirFromFile( last.c_str(), dir );
|
||||||
|
|
||||||
dialog.setDirectory( tr(dir) );
|
dialog.setDirectory( tr(dir.c_str()) );
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||||
|
@ -316,7 +316,7 @@ void MovieRecordDialog_t::browseFiles(void)
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
QString filename;
|
QString filename;
|
||||||
std::string last;
|
std::string last;
|
||||||
char dir[512];
|
std::string dir;
|
||||||
QFileDialog dialog(this, tr("Save FM2 Movie for Recording") );
|
QFileDialog dialog(this, tr("Save FM2 Movie for Recording") );
|
||||||
|
|
||||||
dialog.setFileMode(QFileDialog::AnyFile);
|
dialog.setFileMode(QFileDialog::AnyFile);
|
||||||
|
@ -330,9 +330,9 @@ void MovieRecordDialog_t::browseFiles(void)
|
||||||
|
|
||||||
g_config->getOption ("SDL.LastOpenMovie", &last );
|
g_config->getOption ("SDL.LastOpenMovie", &last );
|
||||||
|
|
||||||
getDirFromFile( last.c_str(), dir, sizeof(dir) );
|
getDirFromFile( last.c_str(), dir );
|
||||||
|
|
||||||
dialog.setDirectory( tr(dir) );
|
dialog.setDirectory( tr(dir.c_str()) );
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||||
|
|
|
@ -494,7 +494,7 @@ void PaletteConfDialog_t::openPaletteFile(void)
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
QString filename;
|
QString filename;
|
||||||
std::string last, iniPath;
|
std::string last, iniPath;
|
||||||
char dir[512];
|
std::string dir;
|
||||||
const char *exePath = nullptr;
|
const char *exePath = nullptr;
|
||||||
QFileDialog dialog(this, tr("Open NES Palette"));
|
QFileDialog dialog(this, tr("Open NES Palette"));
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
|
@ -575,9 +575,9 @@ void PaletteConfDialog_t::openPaletteFile(void)
|
||||||
last.assign(iniPath);
|
last.assign(iniPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
getDirFromFile(last.c_str(), dir, sizeof(dir));
|
getDirFromFile(last.c_str(), dir);
|
||||||
|
|
||||||
dialog.setDirectory(tr(dir));
|
dialog.setDirectory(tr(dir.c_str()));
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
g_config->getOption("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
g_config->getOption("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||||
|
|
|
@ -314,7 +314,7 @@ void PaletteEditorDialog_t::openPaletteFileDialog(void)
|
||||||
{
|
{
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
QString filename;
|
QString filename;
|
||||||
char dir[512];
|
std::string dir;
|
||||||
const char *exePath = nullptr;
|
const char *exePath = nullptr;
|
||||||
std::string last, iniPath;
|
std::string last, iniPath;
|
||||||
QFileDialog dialog(this, tr("Open Palette From File") );
|
QFileDialog dialog(this, tr("Open Palette From File") );
|
||||||
|
@ -401,9 +401,9 @@ void PaletteEditorDialog_t::openPaletteFileDialog(void)
|
||||||
{
|
{
|
||||||
last.assign( iniPath );
|
last.assign( iniPath );
|
||||||
}
|
}
|
||||||
getDirFromFile( last.c_str(), dir, sizeof(dir) );
|
getDirFromFile( last.c_str(), dir );
|
||||||
|
|
||||||
dialog.setDirectory( tr(dir) );
|
dialog.setDirectory( tr(dir.c_str()) );
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||||
|
|
|
@ -577,16 +577,16 @@ void TraceLoggerDialog_t::openLogFile(void)
|
||||||
|
|
||||||
if (romFile != NULL)
|
if (romFile != NULL)
|
||||||
{
|
{
|
||||||
char dir[1024];
|
std::string dir;
|
||||||
getDirFromFile(romFile, dir, sizeof(dir));
|
getDirFromFile(romFile, dir);
|
||||||
dialog.setDirectory(tr(dir));
|
dialog.setDirectory(tr(dir.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( logFilePath.size() != 0 )
|
if ( logFilePath.size() != 0 )
|
||||||
{
|
{
|
||||||
char dir[1024];
|
std::string dir;
|
||||||
getDirFromFile(logFilePath.c_str(), dir, sizeof(dir));
|
getDirFromFile(logFilePath.c_str(), dir);
|
||||||
dialog.setDirectory(tr(dir));
|
dialog.setDirectory(tr(dir.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
|
|
|
@ -776,7 +776,7 @@ bool iNesHeaderEditor_t::openFile(void)
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
QString filename;
|
QString filename;
|
||||||
std::string last;
|
std::string last;
|
||||||
char dir[512];
|
std::string dir;
|
||||||
QFileDialog dialog(this, tr("Open NES File") );
|
QFileDialog dialog(this, tr("Open NES File") );
|
||||||
|
|
||||||
const QStringList filters(
|
const QStringList filters(
|
||||||
|
@ -795,9 +795,9 @@ bool iNesHeaderEditor_t::openFile(void)
|
||||||
|
|
||||||
g_config->getOption ("SDL.LastOpenFile", &last );
|
g_config->getOption ("SDL.LastOpenFile", &last );
|
||||||
|
|
||||||
getDirFromFile( last.c_str(), dir, sizeof(dir) );
|
getDirFromFile( last.c_str(), dir );
|
||||||
|
|
||||||
dialog.setDirectory( tr(dir) );
|
dialog.setDirectory( tr(dir.c_str()) );
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||||
|
@ -836,7 +836,7 @@ void iNesHeaderEditor_t::saveFileAs(void)
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
QString filename;
|
QString filename;
|
||||||
std::string last;
|
std::string last;
|
||||||
char dir[512];
|
std::string dir;
|
||||||
QFileDialog dialog(this, tr("Save iNES File") );
|
QFileDialog dialog(this, tr("Save iNES File") );
|
||||||
|
|
||||||
dialog.setFileMode(QFileDialog::AnyFile);
|
dialog.setFileMode(QFileDialog::AnyFile);
|
||||||
|
@ -848,9 +848,9 @@ void iNesHeaderEditor_t::saveFileAs(void)
|
||||||
dialog.setLabelText( QFileDialog::Accept, tr("Save") );
|
dialog.setLabelText( QFileDialog::Accept, tr("Save") );
|
||||||
dialog.setDefaultSuffix( tr(".nes") );
|
dialog.setDefaultSuffix( tr(".nes") );
|
||||||
|
|
||||||
getDirFromFile( LoadedRomFName, dir, sizeof(dir) );
|
getDirFromFile( LoadedRomFName, dir );
|
||||||
|
|
||||||
dialog.setDirectory( tr(dir) );
|
dialog.setDirectory( tr(dir.c_str()) );
|
||||||
|
|
||||||
// Check config option to use native file dialog or not
|
// Check config option to use native file dialog or not
|
||||||
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
|
||||||
|
|
Loading…
Reference in New Issue