port some small fry to the new config system.
This commit is contained in:
parent
f9449999ec
commit
b5cc5a2cf7
|
@ -85,18 +85,6 @@ bool DirectLAN;
|
|||
|
||||
bool SavestateRelocSRAM;
|
||||
|
||||
int AudioInterp;
|
||||
int AudioBitDepth;
|
||||
int AudioVolume;
|
||||
bool DSiVolumeSync;
|
||||
int MicInputType;
|
||||
std::string MicDevice;
|
||||
std::string MicWavPath;
|
||||
|
||||
std::string LastROMFolder;
|
||||
|
||||
std::string RecentROMList[10];
|
||||
|
||||
std::string SaveFilePath;
|
||||
std::string SavestatePath;
|
||||
std::string CheatFilePath;
|
||||
|
@ -411,6 +399,12 @@ size_t Array::Size()
|
|||
return Data.size();
|
||||
}
|
||||
|
||||
void Array::Clear()
|
||||
{
|
||||
toml::array newarray;
|
||||
Data = newarray;
|
||||
}
|
||||
|
||||
Array Array::GetArray(const int id)
|
||||
{
|
||||
while (Data.size() < id+1)
|
||||
|
|
|
@ -78,6 +78,8 @@ public:
|
|||
|
||||
size_t Size();
|
||||
|
||||
void Clear();
|
||||
|
||||
Array GetArray(const int id);
|
||||
|
||||
int GetInt(const int id);
|
||||
|
@ -197,10 +199,6 @@ extern bool DirectLAN;
|
|||
|
||||
extern bool SavestateRelocSRAM;
|
||||
|
||||
extern std::string LastROMFolder;
|
||||
|
||||
extern std::string RecentROMList[10];
|
||||
|
||||
extern std::string SaveFilePath;
|
||||
extern std::string SavestatePath;
|
||||
extern std::string CheatFilePath;
|
||||
|
|
|
@ -139,7 +139,7 @@ void ROMInfoDialog::on_saveIconButton_clicked()
|
|||
{
|
||||
QString filename = QFileDialog::getSaveFileName(this,
|
||||
"Save Icon",
|
||||
QString::fromStdString(Config::LastROMFolder),
|
||||
emuInstance->getGlobalConfig().GetQString("LastROMFolder"),
|
||||
"PNG Images (*.png)");
|
||||
if (filename.isEmpty())
|
||||
return;
|
||||
|
@ -151,7 +151,7 @@ void ROMInfoDialog::on_saveAnimatedIconButton_clicked()
|
|||
{
|
||||
QString filename = QFileDialog::getSaveFileName(this,
|
||||
"Save Animated Icon",
|
||||
QString::fromStdString(Config::LastROMFolder),
|
||||
emuInstance->getGlobalConfig().GetQString("LastROMFolder"),
|
||||
"GIF Images (*.gif)");
|
||||
if (filename.isEmpty())
|
||||
return;
|
||||
|
|
|
@ -251,9 +251,11 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
|||
actOpenROMArchive->setShortcut(QKeySequence(Qt::Key_O | Qt::CTRL | Qt::SHIFT));*/
|
||||
|
||||
recentMenu = menu->addMenu("Open recent");
|
||||
for (int i = 0; i < 10; ++i)
|
||||
Config::Array recentROMs = globalCfg.GetArray("RecentROM");
|
||||
int numrecent = std::min(kMaxRecentROMs, (int)recentROMs.Size());
|
||||
for (int i = 0; i < numrecent; ++i)
|
||||
{
|
||||
std::string item = Config::RecentROMList[i];
|
||||
std::string item = recentROMs.GetString(i);
|
||||
if (!item.empty())
|
||||
recentFileList.push_back(QString::fromStdString(item));
|
||||
}
|
||||
|
@ -1154,13 +1156,13 @@ QStringList MainWindow::pickROM(bool gba)
|
|||
|
||||
const QString filename = QFileDialog::getOpenFileName(
|
||||
this, "Open " + console + " ROM",
|
||||
QString::fromStdString(Config::LastROMFolder),
|
||||
globalCfg.GetQString("LastROMFolder"),
|
||||
"All supported files (*" + allROMs + ")" + extraFilters
|
||||
);
|
||||
|
||||
if (filename.isEmpty()) return {};
|
||||
|
||||
Config::LastROMFolder = QFileInfo(filename).dir().path().toStdString();
|
||||
globalCfg.SetQString("LastROMFolder", QFileInfo(filename).dir().path());
|
||||
return splitArchivePath(filename, false);
|
||||
}
|
||||
|
||||
|
@ -1223,8 +1225,7 @@ void MainWindow::onOpenFile()
|
|||
void MainWindow::onClearRecentFiles()
|
||||
{
|
||||
recentFileList.clear();
|
||||
for (int i = 0; i < 10; i++)
|
||||
Config::RecentROMList[i] = "";
|
||||
globalCfg.GetArray("RecentROM").Clear();
|
||||
updateRecentFilesMenu();
|
||||
}
|
||||
|
||||
|
@ -1232,9 +1233,12 @@ void MainWindow::updateRecentFilesMenu()
|
|||
{
|
||||
recentMenu->clear();
|
||||
|
||||
Config::Array recentroms = globalCfg.GetArray("RecentROM");
|
||||
recentroms.Clear();
|
||||
|
||||
for (int i = 0; i < recentFileList.size(); ++i)
|
||||
{
|
||||
if (i >= 10) break;
|
||||
if (i >= kMaxRecentROMs) break;
|
||||
|
||||
QString item_full = recentFileList.at(i);
|
||||
QString item_display = item_full;
|
||||
|
@ -1262,7 +1266,7 @@ void MainWindow::updateRecentFilesMenu()
|
|||
actRecentFile_i->setData(item_full);
|
||||
connect(actRecentFile_i, &QAction::triggered, this, &MainWindow::onClickRecentFile);
|
||||
|
||||
Config::RecentROMList[i] = recentFileList.at(i).toStdString();
|
||||
recentroms.SetQString(i, recentFileList.at(i));
|
||||
}
|
||||
|
||||
while (recentFileList.size() > 10)
|
||||
|
@ -1435,7 +1439,7 @@ void MainWindow::onSaveState()
|
|||
// TODO: specific 'last directory' for savestate files?
|
||||
QString qfilename = QFileDialog::getSaveFileName(this,
|
||||
"Save state",
|
||||
QString::fromStdString(Config::LastROMFolder),
|
||||
globalCfg.GetQString("LastROMFolder"),
|
||||
"melonDS savestates (*.mln);;Any file (*.*)");
|
||||
if (qfilename.isEmpty())
|
||||
{
|
||||
|
@ -1477,7 +1481,7 @@ void MainWindow::onLoadState()
|
|||
// TODO: specific 'last directory' for savestate files?
|
||||
QString qfilename = QFileDialog::getOpenFileName(this,
|
||||
"Load state",
|
||||
QString::fromStdString(Config::LastROMFolder),
|
||||
globalCfg.GetQString("LastROMFolder"),
|
||||
"melonDS savestates (*.ml*);;Any file (*.*)");
|
||||
if (qfilename.isEmpty())
|
||||
{
|
||||
|
@ -1526,7 +1530,7 @@ void MainWindow::onImportSavefile()
|
|||
emuThread->emuPause();
|
||||
QString path = QFileDialog::getOpenFileName(this,
|
||||
"Select savefile",
|
||||
QString::fromStdString(Config::LastROMFolder),
|
||||
globalCfg.GetQString("LastROMFolder"),
|
||||
"Savefiles (*.sav *.bin *.dsv);;Any file (*.*)");
|
||||
|
||||
if (path.isEmpty())
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
class EmuInstance;
|
||||
class EmuThread;
|
||||
|
||||
const int kMaxRecentROMs = 10;
|
||||
|
||||
/*
|
||||
class WindowBase : public QMainWindow
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue