Qt: Move last directory setting from qt.ini to config.ini

This commit is contained in:
Jeffrey Pfau 2016-12-20 01:35:07 -08:00
parent d7d48e605b
commit 20f8cdc3e0
2 changed files with 9 additions and 8 deletions

View File

@ -53,6 +53,7 @@ Misc:
- GBA Memory: Support for Mo Jie Qi Bing by Vast Fame (taizou)
- GBA Memory: Support reading/writing POSTFLG
- Util: Add size counting to Table
- Qt: Move last directory setting from qt.ini to config.ini
0.5.1: (2016-10-05)
Bugfixes:

View File

@ -152,10 +152,10 @@ void GBAApp::continueAll(const QList<int>* paused) {
QString GBAApp::getOpenFileName(QWidget* owner, const QString& title, const QString& filter) {
QList<int> paused;
pauseAll(&paused);
QString filename = QFileDialog::getOpenFileName(owner, title, m_configController.getQtOption("lastDirectory").toString(), filter);
QString filename = QFileDialog::getOpenFileName(owner, title, m_configController.getOption("lastDirectory"), filter);
continueAll(&paused);
if (!filename.isEmpty()) {
m_configController.setQtOption("lastDirectory", QFileInfo(filename).dir().path());
m_configController.setOption("lastDirectory", QFileInfo(filename).dir().path());
}
return filename;
}
@ -163,10 +163,10 @@ QString GBAApp::getOpenFileName(QWidget* owner, const QString& title, const QStr
QString GBAApp::getSaveFileName(QWidget* owner, const QString& title, const QString& filter) {
QList<int> paused;
pauseAll(&paused);
QString filename = QFileDialog::getSaveFileName(owner, title, m_configController.getQtOption("lastDirectory").toString(), filter);
QString filename = QFileDialog::getSaveFileName(owner, title, m_configController.getOption("lastDirectory"), filter);
continueAll(&paused);
if (!filename.isEmpty()) {
m_configController.setQtOption("lastDirectory", QFileInfo(filename).dir().path());
m_configController.setOption("lastDirectory", QFileInfo(filename).dir().path());
}
return filename;
}
@ -174,10 +174,10 @@ QString GBAApp::getSaveFileName(QWidget* owner, const QString& title, const QStr
QString GBAApp::getOpenDirectoryName(QWidget* owner, const QString& title) {
QList<int> paused;
pauseAll(&paused);
QString filename = QFileDialog::getExistingDirectory(owner, title, m_configController.getQtOption("lastDirectory").toString());
QString filename = QFileDialog::getExistingDirectory(owner, title, m_configController.getOption("lastDirectory"));
continueAll(&paused);
if (!filename.isEmpty()) {
m_configController.setQtOption("lastDirectory", QFileInfo(filename).dir().path());
m_configController.setOption("lastDirectory", QFileInfo(filename).dir().path());
}
return filename;
}
@ -224,7 +224,7 @@ bool GBAApp::reloadGameDB() {
}
GBAApp::FileDialog::FileDialog(GBAApp* app, QWidget* parent, const QString& caption, const QString& filter)
: QFileDialog(parent, caption, app->m_configController.getQtOption("lastDirectory").toString(), filter)
: QFileDialog(parent, caption, app->m_configController.getOption("lastDirectory"), filter)
, m_app(app)
{
}
@ -235,7 +235,7 @@ int GBAApp::FileDialog::exec() {
bool didAccept = QFileDialog::exec() == QDialog::Accepted;
QStringList filenames = selectedFiles();
if (!filenames.isEmpty()) {
m_app->m_configController.setQtOption("lastDirectory", QFileInfo(filenames[0]).dir().path());
m_app->m_configController.setOption("lastDirectory", QFileInfo(filenames[0]).dir().path());
}
m_app->continueAll(&paused);
return didAccept;