summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorForkk <forkk@forkk.net>2014-01-06 15:02:58 -0600
committerForkk <forkk@forkk.net>2014-01-06 15:02:58 -0600
commit0a312d3b08a40d51acc1952df3ed2f0348f4aa5e (patch)
treec232f2fd9039e55d7a0fff0cba7f935573f7ac2b /gui
parentfcb8612c10ae1bb1d2d8883a762979e9bca1f31e (diff)
downloadMultiMC-0a312d3b08a40d51acc1952df3ed2f0348f4aa5e.tar
MultiMC-0a312d3b08a40d51acc1952df3ed2f0348f4aa5e.tar.gz
MultiMC-0a312d3b08a40d51acc1952df3ed2f0348f4aa5e.tar.lz
MultiMC-0a312d3b08a40d51acc1952df3ed2f0348f4aa5e.tar.xz
MultiMC-0a312d3b08a40d51acc1952df3ed2f0348f4aa5e.zip
Implement proxy settings
Diffstat (limited to 'gui')
-rw-r--r--gui/dialogs/SettingsDialog.cpp37
-rw-r--r--gui/dialogs/SettingsDialog.h2
-rw-r--r--gui/dialogs/SettingsDialog.ui151
3 files changed, 187 insertions, 3 deletions
diff --git a/gui/dialogs/SettingsDialog.cpp b/gui/dialogs/SettingsDialog.cpp
index 549b11b0..091ffb1c 100644
--- a/gui/dialogs/SettingsDialog.cpp
+++ b/gui/dialogs/SettingsDialog.cpp
@@ -83,6 +83,8 @@ void SettingsDialog::updateCheckboxStuff()
{
ui->windowWidthSpinBox->setEnabled(!ui->maximizedCheckBox->isChecked());
ui->windowHeightSpinBox->setEnabled(!ui->maximizedCheckBox->isChecked());
+ ui->proxyAddrBox->setEnabled(!ui->proxyNoneBtn->isChecked() && !ui->proxyDefaultBtn->isChecked());
+ ui->proxyAuthBox->setEnabled(!ui->proxyNoneBtn->isChecked() && !ui->proxyDefaultBtn->isChecked());
}
void SettingsDialog::on_ftbLauncherBrowseBtn_clicked()
@@ -202,6 +204,9 @@ void SettingsDialog::on_buttonBox_accepted()
{
applySettings(MMC->settings().get());
+ // Apply proxy settings
+ MMC->updateProxySettings();
+
MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64());
}
@@ -210,6 +215,12 @@ void SettingsDialog::on_buttonBox_rejected()
MMC->settings()->set("SettingsGeometry", saveGeometry().toBase64());
}
+void SettingsDialog::on_proxyNoneBtn_toggled(bool checked)
+{
+ Q_UNUSED(checked);
+ updateCheckboxStuff();
+}
+
void SettingsDialog::refreshUpdateChannelList()
{
// Stop listening for selection changes. It's going to change a lot while we update it and we don't need to update the
@@ -310,6 +321,19 @@ void SettingsDialog::applySettings(SettingsObject *s)
s->set("MinecraftWinWidth", ui->windowWidthSpinBox->value());
s->set("MinecraftWinHeight", ui->windowHeightSpinBox->value());
+ // Proxy
+ QString proxyType = "None";
+ if (ui->proxyDefaultBtn->isChecked()) proxyType = "Default";
+ else if (ui->proxyNoneBtn->isChecked()) proxyType = "None";
+ else if (ui->proxySOCKS5Btn->isChecked()) proxyType = "SOCKS5";
+ else if (ui->proxyHTTPBtn->isChecked()) proxyType = "HTTP";
+
+ s->set("ProxyType", proxyType);
+ s->set("ProxyAddr", ui->proxyAddrEdit->text());
+ s->set("ProxyPort", ui->proxyPortEdit->value());
+ s->set("ProxyUser", ui->proxyUserEdit->text());
+ s->set("ProxyPass", ui->proxyPassEdit->text());
+
// Memory
s->set("MinMemAlloc", ui->minMemSpinBox->value());
s->set("MaxMemAlloc", ui->maxMemSpinBox->value());
@@ -384,6 +408,18 @@ void SettingsDialog::loadSettings(SettingsObject *s)
ui->sortByNameBtn->setChecked(true);
}
+ // Proxy
+ QString proxyType = s->get("ProxyType").toString();
+ if (proxyType == "Default") ui->proxyDefaultBtn->setChecked(true);
+ else if (proxyType == "None") ui->proxyNoneBtn->setChecked(true);
+ else if (proxyType == "SOCKS5") ui->proxySOCKS5Btn->setChecked(true);
+ else if (proxyType == "HTTP") ui->proxyHTTPBtn->setChecked(true);
+
+ ui->proxyAddrEdit->setText(s->get("ProxyAddr").toString());
+ ui->proxyPortEdit->setValue(s->get("ProxyPort").value<qint16>());
+ ui->proxyUserEdit->setText(s->get("ProxyUser").toString());
+ ui->proxyPassEdit->setText(s->get("ProxyPass").toString());
+
// Java Settings
ui->javaPathTextBox->setText(s->get("JavaPath").toString());
ui->jvmArgsTextBox->setText(s->get("JvmArgs").toString());
@@ -447,4 +483,3 @@ void SettingsDialog::checkFinished(JavaCheckResult result)
"or set the path to the java executable."));
}
}
-
diff --git a/gui/dialogs/SettingsDialog.h b/gui/dialogs/SettingsDialog.h
index df67d492..6039ecab 100644
--- a/gui/dialogs/SettingsDialog.h
+++ b/gui/dialogs/SettingsDialog.h
@@ -75,6 +75,8 @@ slots:
void checkFinished(JavaCheckResult result);
+ void on_proxyNoneBtn_toggled(bool checked);
+
/*!
* Updates the list of update channels in the combo box.
*/
diff --git a/gui/dialogs/SettingsDialog.ui b/gui/dialogs/SettingsDialog.ui
index 7d2708cb..756e2a1f 100644
--- a/gui/dialogs/SettingsDialog.ui
+++ b/gui/dialogs/SettingsDialog.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>526</width>
- <height>639</height>
+ <height>683</height>
</rect>
</property>
<property name="sizePolicy">
@@ -33,7 +33,7 @@
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
- <number>0</number>
+ <number>2</number>
</property>
<widget class="QWidget" name="generalTab">
<attribute name="title">
@@ -424,6 +424,153 @@
</item>
</layout>
</widget>
+ <widget class="QWidget" name="networkTab">
+ <property name="toolTip">
+ <string>Network settings.</string>
+ </property>
+ <attribute name="title">
+ <string>Network</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_6">
+ <item>
+ <widget class="QGroupBox" name="proxySettingsBox">
+ <property name="title">
+ <string>Proxy</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_8">
+ <item>
+ <widget class="QGroupBox" name="proxyTypeBox">
+ <property name="title">
+ <string>Type</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QRadioButton" name="proxyDefaultBtn">
+ <property name="toolTip">
+ <string>Uses your system's default proxy settings.</string>
+ </property>
+ <property name="text">
+ <string>Default</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="proxyNoneBtn">
+ <property name="text">
+ <string>None</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="proxySOCKS5Btn">
+ <property name="text">
+ <string>SOCKS5</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="proxyHTTPBtn">
+ <property name="text">
+ <string>HTTP</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="proxyAddrBox">
+ <property name="title">
+ <string>Address and Port</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLineEdit" name="proxyAddrEdit">
+ <property name="placeholderText">
+ <string>127.0.0.1</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="proxyPortEdit">
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="buttonSymbols">
+ <enum>QAbstractSpinBox::PlusMinus</enum>
+ </property>
+ <property name="maximum">
+ <number>65535</number>
+ </property>
+ <property name="value">
+ <number>8080</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="proxyAuthBox">
+ <property name="title">
+ <string>Authentication</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_5">
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="proxyUserEdit"/>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="proxyUsernameLabel">
+ <property name="text">
+ <string>Username:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="proxyPasswordLabel">
+ <property name="text">
+ <string>Password:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="proxyPassEdit">
+ <property name="echoMode">
+ <enum>QLineEdit::Password</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QLabel" name="proxyPlainTextWarningLabel">
+ <property name="text">
+ <string>Note: Proxy username and password are stored in plain text inside MultiMC's configuration file!</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
<widget class="QWidget" name="javaTab">
<attribute name="title">
<string>Java</string>