From 946d397ccedfe1c116566fce1f86ae4f794e44a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 29 Oct 2013 22:13:42 +0100 Subject: [PATCH] Customizable folder browsing is same as for the instance folder. Syste Proxy usage. --- MultiMC.cpp | 3 +++ gui/settingsdialog.cpp | 22 ++++++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/MultiMC.cpp b/MultiMC.cpp index 4e2a5b0b..e425aa44 100644 --- a/MultiMC.cpp +++ b/MultiMC.cpp @@ -149,6 +149,9 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv) // init the http meta cache initHttpMetaCache(); + // set up a basic autodetected proxy (system default) + QNetworkProxyFactory::setUseSystemConfiguration(true); + // create the global network manager m_qnam.reset(new QNetworkAccessManager(this)); diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp index fb204d10..f961a7de 100644 --- a/gui/settingsdialog.cpp +++ b/gui/settingsdialog.cpp @@ -67,21 +67,27 @@ void SettingsDialog::on_instDirBrowseBtn_clicked() void SettingsDialog::on_modsDirBrowseBtn_clicked() { - QString dir = QFileDialog::getExistingDirectory(this, tr("Mods Directory"), - ui->modsDirTextBox->text()); - if (!dir.isEmpty()) + QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Mods Directory"), + ui->modsDirTextBox->text()); + QString cooked_dir = NormalizePath(raw_dir); + + // do not allow current dir - it's dirty. Do not allow dirs that don't exist + if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists()) { - ui->modsDirTextBox->setText(dir); + ui->modsDirTextBox->setText(cooked_dir); } } void SettingsDialog::on_lwjglDirBrowseBtn_clicked() { - QString dir = QFileDialog::getExistingDirectory(this, tr("LWJGL Directory"), - ui->lwjglDirTextBox->text()); - if (!dir.isEmpty()) + QString raw_dir = QFileDialog::getExistingDirectory(this, tr("LWJGL Directory"), + ui->lwjglDirTextBox->text()); + QString cooked_dir = NormalizePath(raw_dir); + + // do not allow current dir - it's dirty. Do not allow dirs that don't exist + if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists()) { - ui->lwjglDirTextBox->setText(dir); + ui->lwjglDirTextBox->setText(cooked_dir); } }