summaryrefslogtreecommitdiffstats
path: root/application/pages
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-12-03 19:21:04 +0100
committerPetr Mrázek <peterix@gmail.com>2017-12-03 19:21:04 +0100
commit4bae6fe491c8c92286c4ac9f39e9d4ac846d4f2f (patch)
tree2da09958eae5379e8ecb2bd20c8a17e57f5ddf3b /application/pages
parent95e6f37d3942d4ab681e2f2484f17bbf8489c332 (diff)
downloadMultiMC-4bae6fe491c8c92286c4ac9f39e9d4ac846d4f2f.tar
MultiMC-4bae6fe491c8c92286c4ac9f39e9d4ac846d4f2f.tar.gz
MultiMC-4bae6fe491c8c92286c4ac9f39e9d4ac846d4f2f.tar.lz
MultiMC-4bae6fe491c8c92286c4ac9f39e9d4ac846d4f2f.tar.xz
MultiMC-4bae6fe491c8c92286c4ac9f39e9d4ac846d4f2f.zip
GH-2050 fix cancel button in file browse dialogs filling text fields
Diffstat (limited to 'application/pages')
-rw-r--r--application/pages/InstanceSettingsPage.cpp4
-rw-r--r--application/pages/global/ExternalToolsPage.cpp4
-rw-r--r--application/pages/global/JavaPage.cpp4
-rw-r--r--application/pages/global/MultiMCPage.cpp21
4 files changed, 15 insertions, 18 deletions
diff --git a/application/pages/InstanceSettingsPage.cpp b/application/pages/InstanceSettingsPage.cpp
index 90c2e92e..b146ffd8 100644
--- a/application/pages/InstanceSettingsPage.cpp
+++ b/application/pages/InstanceSettingsPage.cpp
@@ -212,13 +212,13 @@ void InstanceSettingsPage::on_javaDetectBtn_clicked()
void InstanceSettingsPage::on_javaBrowseBtn_clicked()
{
QString raw_path = QFileDialog::getOpenFileName(this, tr("Find Java executable"));
- QString cooked_path = FS::NormalizePath(raw_path);
// do not allow current dir - it's dirty. Do not allow dirs that don't exist
- if(cooked_path.isEmpty())
+ if(raw_path.isEmpty())
{
return;
}
+ QString cooked_path = FS::NormalizePath(raw_path);
QFileInfo javaInfo(cooked_path);;
if(!javaInfo.exists() || !javaInfo.isExecutable())
diff --git a/application/pages/global/ExternalToolsPage.cpp b/application/pages/global/ExternalToolsPage.cpp
index b446fc06..a1a029ff 100644
--- a/application/pages/global/ExternalToolsPage.cpp
+++ b/application/pages/global/ExternalToolsPage.cpp
@@ -206,12 +206,12 @@ void ExternalToolsPage::on_jsonEditorBrowseBtn_clicked()
? QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation).first()
#endif
: ui->jsonEditorTextBox->text());
- QString cooked_file = FS::NormalizePath(raw_file);
- if (cooked_file.isEmpty())
+ if (raw_file.isEmpty())
{
return;
}
+ QString cooked_file = FS::NormalizePath(raw_file);
// it has to exist and be an executable
if (QFileInfo(cooked_file).exists() && QFileInfo(cooked_file).isExecutable())
diff --git a/application/pages/global/JavaPage.cpp b/application/pages/global/JavaPage.cpp
index 81c6f7a7..1c1e7658 100644
--- a/application/pages/global/JavaPage.cpp
+++ b/application/pages/global/JavaPage.cpp
@@ -131,14 +131,14 @@ void JavaPage::on_javaDetectBtn_clicked()
void JavaPage::on_javaBrowseBtn_clicked()
{
QString raw_path = QFileDialog::getOpenFileName(this, tr("Find Java executable"));
- QString cooked_path = FS::NormalizePath(raw_path);
// do not allow current dir - it's dirty. Do not allow dirs that don't exist
- if(cooked_path.isEmpty())
+ if(raw_path.isEmpty())
{
return;
}
+ QString cooked_path = FS::NormalizePath(raw_path);
QFileInfo javaInfo(cooked_path);;
if(!javaInfo.exists() || !javaInfo.isExecutable())
{
diff --git a/application/pages/global/MultiMCPage.cpp b/application/pages/global/MultiMCPage.cpp
index d945de94..88c3a3b1 100644
--- a/application/pages/global/MultiMCPage.cpp
+++ b/application/pages/global/MultiMCPage.cpp
@@ -94,13 +94,12 @@ bool MultiMCPage::apply()
void MultiMCPage::on_instDirBrowseBtn_clicked()
{
- QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Instance Folder"),
- ui->instDirTextBox->text());
- QString cooked_dir = FS::NormalizePath(raw_dir);
+ QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Instance Folder"), ui->instDirTextBox->text());
// do not allow current dir - it's dirty. Do not allow dirs that don't exist
- if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists())
+ if (!raw_dir.isEmpty() && QDir(raw_dir).exists())
{
+ QString cooked_dir = FS::NormalizePath(raw_dir);
if (FS::checkProblemticPathJava(QDir(cooked_dir)))
{
QMessageBox warning;
@@ -127,25 +126,23 @@ void MultiMCPage::on_instDirBrowseBtn_clicked()
void MultiMCPage::on_iconsDirBrowseBtn_clicked()
{
- QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Icons Folder"),
- ui->iconsDirTextBox->text());
- QString cooked_dir = FS::NormalizePath(raw_dir);
+ QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Icons Folder"), ui->iconsDirTextBox->text());
// do not allow current dir - it's dirty. Do not allow dirs that don't exist
- if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists())
+ if (!raw_dir.isEmpty() && QDir(raw_dir).exists())
{
+ QString cooked_dir = FS::NormalizePath(raw_dir);
ui->iconsDirTextBox->setText(cooked_dir);
}
}
void MultiMCPage::on_modsDirBrowseBtn_clicked()
{
- QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Mods Folder"),
- ui->modsDirTextBox->text());
- QString cooked_dir = FS::NormalizePath(raw_dir);
+ QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Mods Folder"), ui->modsDirTextBox->text());
// do not allow current dir - it's dirty. Do not allow dirs that don't exist
- if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists())
+ if (!raw_dir.isEmpty() && QDir(raw_dir).exists())
{
+ QString cooked_dir = FS::NormalizePath(raw_dir);
ui->modsDirTextBox->setText(cooked_dir);
}
}