diff options
Diffstat (limited to 'application/pages/global')
26 files changed, 382 insertions, 738 deletions
diff --git a/application/pages/global/AccountListPage.cpp b/application/pages/global/AccountListPage.cpp index b89c410f..ff3736ed 100644 --- a/application/pages/global/AccountListPage.cpp +++ b/application/pages/global/AccountListPage.cpp @@ -1,4 +1,4 @@ -/* Copyright 2013-2018 MultiMC Contributors +/* Copyright 2013-2021 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,11 +17,11 @@ #include "ui_AccountListPage.h" #include <QItemSelectionModel> +#include <QMenu> #include <QDebug> #include "net/NetJob.h" -#include "net/URLConstants.h" #include "Env.h" #include "dialogs/ProgressDialog.h" @@ -30,28 +30,38 @@ #include "dialogs/SkinUploadDialog.h" #include "tasks/Task.h" #include "minecraft/auth/YggdrasilTask.h" +#include "minecraft/services/SkinDelete.h" #include "MultiMC.h" +#include "BuildConfig.h" + AccountListPage::AccountListPage(QWidget *parent) - : QWidget(parent), ui(new Ui::AccountListPage) + : QMainWindow(parent), ui(new Ui::AccountListPage) { ui->setupUi(this); - ui->tabWidget->tabBar()->hide(); + ui->listView->setEmptyString(tr( + "Welcome!\n" + "If you're new here, you can click the \"Add\" button to add your Mojang or Minecraft account." + )); + ui->listView->setEmptyMode(VersionListView::String); + ui->listView->setContextMenuPolicy(Qt::CustomContextMenu); m_accounts = MMC->accounts(); ui->listView->setModel(m_accounts.get()); ui->listView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); + ui->listView->setSelectionMode(QAbstractItemView::SingleSelection); // Expand the account column ui->listView->header()->setSectionResizeMode(1, QHeaderView::Stretch); QItemSelectionModel *selectionModel = ui->listView->selectionModel(); - connect(selectionModel, &QItemSelectionModel::selectionChanged, - [this](const QItemSelection &sel, const QItemSelection &dsel) - { updateButtonStates(); }); + connect(selectionModel, &QItemSelectionModel::selectionChanged, [this](const QItemSelection &sel, const QItemSelection &dsel) { + updateButtonStates(); + }); + connect(ui->listView, &VersionListView::customContextMenuRequested, this, &AccountListPage::ShowContextMenu); connect(m_accounts.get(), SIGNAL(listChanged()), SLOT(listChanged())); connect(m_accounts.get(), SIGNAL(activeAccountChanged()), SLOT(listChanged())); @@ -64,18 +74,41 @@ AccountListPage::~AccountListPage() delete ui; } +void AccountListPage::ShowContextMenu(const QPoint& pos) +{ + auto menu = ui->toolBar->createContextMenu(this, tr("Context menu")); + menu->exec(ui->listView->mapToGlobal(pos)); + delete menu; +} + +void AccountListPage::changeEvent(QEvent* event) +{ + if (event->type() == QEvent::LanguageChange) + { + ui->retranslateUi(this); + } + QMainWindow::changeEvent(event); +} + +QMenu * AccountListPage::createPopupMenu() +{ + QMenu* filteredMenu = QMainWindow::createPopupMenu(); + filteredMenu->removeAction(ui->toolBar->toggleViewAction() ); + return filteredMenu; +} + + void AccountListPage::listChanged() { updateButtonStates(); } -void AccountListPage::on_addAccountBtn_clicked() +void AccountListPage::on_actionAdd_triggered() { - addAccount(tr("Please enter your Mojang or Minecraft account username and password to add " - "your account.")); + addAccount(tr("Please enter your Minecraft account email and password to add your account.")); } -void AccountListPage::on_rmAccountBtn_clicked() +void AccountListPage::on_actionRemove_triggered() { QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); if (selection.size() > 0) @@ -85,7 +118,7 @@ void AccountListPage::on_rmAccountBtn_clicked() } } -void AccountListPage::on_setDefaultBtn_clicked() +void AccountListPage::on_actionSetDefault_triggered() { QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); if (selection.size() > 0) @@ -97,7 +130,7 @@ void AccountListPage::on_setDefaultBtn_clicked() } } -void AccountListPage::on_noDefaultBtn_clicked() +void AccountListPage::on_actionNoDefault_triggered() { m_accounts->setActiveAccount(""); } @@ -107,11 +140,20 @@ void AccountListPage::updateButtonStates() // If there is no selection, disable buttons that require something selected. QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); - ui->rmAccountBtn->setEnabled(selection.size() > 0); - ui->setDefaultBtn->setEnabled(selection.size() > 0); - ui->uploadSkinBtn->setEnabled(selection.size() > 0); + ui->actionRemove->setEnabled(selection.size() > 0); + ui->actionSetDefault->setEnabled(selection.size() > 0); + ui->actionUploadSkin->setEnabled(selection.size() > 0); + ui->actionDeleteSkin->setEnabled(selection.size() > 0); + + if(m_accounts->activeAccount().get() == nullptr) { + ui->actionNoDefault->setEnabled(false); + ui->actionNoDefault->setChecked(true); + } + else { + ui->actionNoDefault->setEnabled(true); + ui->actionNoDefault->setChecked(false); + } - ui->noDefaultBtn->setDown(m_accounts->activeAccount().get() == nullptr); } void AccountListPage::addAccount(const QString &errMsg) @@ -131,7 +173,7 @@ void AccountListPage::addAccount(const QString &errMsg) for (AccountProfile profile : account->profiles()) { auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.id + ".png"); - auto action = Net::Download::makeCached(QUrl("https://" + URLConstants::SKINS_BASE + profile.id + ".png"), meta); + auto action = Net::Download::makeCached(QUrl(BuildConfig.SKINS_BASE + profile.id + ".png"), meta); job->addNetAction(action); meta->setStale(true); } @@ -140,7 +182,7 @@ void AccountListPage::addAccount(const QString &errMsg) } } -void AccountListPage::on_uploadSkinBtn_clicked() +void AccountListPage::on_actionUploadSkin_triggered() { QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); if (selection.size() > 0) @@ -151,3 +193,25 @@ void AccountListPage::on_uploadSkinBtn_clicked() dialog.exec(); } } + +void AccountListPage::on_actionDeleteSkin_triggered() +{ + QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); + if (selection.size() <= 0) + return; + + QModelIndex selected = selection.first(); + AuthSessionPtr session = std::make_shared<AuthSession>(); + MojangAccountPtr account = selected.data(MojangAccountList::PointerRole).value<MojangAccountPtr>(); + auto login = account->login(session); + ProgressDialog prog(this); + if (prog.execWithTask((Task*)login.get()) != QDialog::Accepted) { + CustomMessageBox::selectable(this, tr("Skin Delete"), tr("Failed to login!"), QMessageBox::Warning)->exec(); + return; + } + auto deleteSkinTask = std::make_shared<SkinDelete>(this, session); + if (prog.execWithTask((Task*)deleteSkinTask.get()) != QDialog::Accepted) { + CustomMessageBox::selectable(this, tr("Skin Delete"), tr("Failed to delete current skin!"), QMessageBox::Warning)->exec(); + return; + } +} diff --git a/application/pages/global/AccountListPage.h b/application/pages/global/AccountListPage.h index ad93c904..fba1833f 100644 --- a/application/pages/global/AccountListPage.h +++ b/application/pages/global/AccountListPage.h @@ -1,4 +1,4 @@ -/* Copyright 2013-2018 MultiMC Contributors +/* Copyright 2013-2021 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ #pragma once -#include <QDialog> +#include <QMainWindow> #include <memory> #include "pages/BasePage.h" @@ -30,7 +30,7 @@ class AccountListPage; class AuthenticateTask; -class AccountListPage : public QWidget, public BasePage +class AccountListPage : public QMainWindow, public BasePage { Q_OBJECT public: @@ -59,30 +59,26 @@ public: return "Getting-Started#adding-an-account"; } -public -slots: - void on_addAccountBtn_clicked(); - - void on_rmAccountBtn_clicked(); - - void on_setDefaultBtn_clicked(); - - void on_noDefaultBtn_clicked(); - - void on_uploadSkinBtn_clicked(); +public slots: + void on_actionAdd_triggered(); + void on_actionRemove_triggered(); + void on_actionSetDefault_triggered(); + void on_actionNoDefault_triggered(); + void on_actionUploadSkin_triggered(); + void on_actionDeleteSkin_triggered(); void listChanged(); //! Updates the states of the dialog's buttons. void updateButtonStates(); -protected: - std::shared_ptr<MojangAccountList> m_accounts; - -protected -slots: +protected slots: + void ShowContextMenu(const QPoint &pos); void addAccount(const QString& errMsg=""); private: + void changeEvent(QEvent * event) override; + QMenu * createPopupMenu() override; + std::shared_ptr<MojangAccountList> m_accounts; Ui::AccountListPage *ui; }; diff --git a/application/pages/global/AccountListPage.ui b/application/pages/global/AccountListPage.ui index f4e87680..71647db3 100644 --- a/application/pages/global/AccountListPage.ui +++ b/application/pages/global/AccountListPage.ui @@ -1,122 +1,98 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>AccountListPage</class> - <widget class="QWidget" name="AccountListPage"> + <widget class="QMainWindow" name="AccountListPage"> <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>694</width> - <height>609</height> + <width>800</width> + <height>600</height> </rect> </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="leftMargin"> - <number>0</number> + <widget class="QWidget" name="centralwidget"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="VersionListView" name="listView"/> + </item> + </layout> + </widget> + <widget class="WideBar" name="toolBar"> + <attribute name="toolBarArea"> + <enum>RightToolBarArea</enum> + </attribute> + <attribute name="toolBarBreak"> + <bool>false</bool> + </attribute> + <addaction name="actionAdd"/> + <addaction name="actionRemove"/> + <addaction name="actionSetDefault"/> + <addaction name="actionNoDefault"/> + <addaction name="separator"/> + <addaction name="actionUploadSkin"/> + <addaction name="actionDeleteSkin"/> + </widget> + <action name="actionAdd"> + <property name="text"> + <string>Add</string> </property> - <property name="topMargin"> - <number>0</number> + </action> + <action name="actionRemove"> + <property name="text"> + <string>Remove</string> </property> - <property name="rightMargin"> - <number>0</number> + </action> + <action name="actionSetDefault"> + <property name="text"> + <string>Set Default</string> </property> - <property name="bottomMargin"> - <number>0</number> + </action> + <action name="actionNoDefault"> + <property name="checkable"> + <bool>true</bool> </property> - <item> - <widget class="QTabWidget" name="tabWidget"> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="tab"> - <attribute name="title"> - <string notr="true">Tab 1</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QLabel" name="welcomeLabel"> - <property name="text"> - <string><html><head/><body><p>Welcome! If you're new here, you can click the &quot;Add&quot; button to add your Mojang or Minecraft account.</p></body></html></string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QTreeView" name="listView"/> - </item> - <item> - <layout class="QVBoxLayout" name="manageAcctsBtnBox"> - <item> - <widget class="QPushButton" name="addAccountBtn"> - <property name="text"> - <string>&Add</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="rmAccountBtn"> - <property name="text"> - <string>&Remove</string> - </property> - </widget> - </item> - <item> - <spacer name="buttonSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="setDefaultBtn"> - <property name="toolTip"> - <string><html><head/><body><p>Set the currently selected account as the active account. The active account is the account that is used to log in (unless it is overridden in an instance-specific setting).</p></body></html></string> - </property> - <property name="text"> - <string>&Set Default</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="noDefaultBtn"> - <property name="toolTip"> - <string>Set no default account. This will cause MultiMC to prompt you to select an account every time you launch an instance that doesn't have its own default set.</string> - </property> - <property name="text"> - <string>&No Default</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="uploadSkinBtn"> - <property name="toolTip"> - <string>Opens a dialog to select and upload a skin image to the selected account.</string> - </property> - <property name="text"> - <string>&Upload Skin</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> - </widget> - </item> - </layout> + <property name="text"> + <string>No Default</string> + </property> + </action> + <action name="actionUploadSkin"> + <property name="text"> + <string>Upload Skin</string> + </property> + </action> + <action name="actionDeleteSkin"> + <property name="text"> + <string>Delete Skin</string> + </property> + <property name="toolTip"> + <string>Delete the currently active skin and go back to the default one</string> + </property> + </action> </widget> + <customwidgets> + <customwidget> + <class>VersionListView</class> + <extends>QTreeView</extends> + <header>widgets/VersionListView.h</header> + </customwidget> + <customwidget> + <class>WideBar</class> + <extends>QToolBar</extends> + <header>widgets/WideBar.h</header> + </customwidget> + </customwidgets> <resources/> <connections/> </ui> diff --git a/application/pages/global/CustomCommandsPage.cpp b/application/pages/global/CustomCommandsPage.cpp index f2c3b185..3b182319 100644 --- a/application/pages/global/CustomCommandsPage.cpp +++ b/application/pages/global/CustomCommandsPage.cpp @@ -13,6 +13,7 @@ CustomCommandsPage::CustomCommandsPage(QWidget* parent): QWidget(parent) auto tabWidget = new QTabWidget(this); tabWidget->setObjectName(QStringLiteral("tabWidget")); commands = new CustomCommands(this); + commands->setContentsMargins(6, 6, 6, 6); tabWidget->addTab(commands, "Foo"); tabWidget->tabBar()->hide(); verticalLayout->addWidget(tabWidget); diff --git a/application/pages/global/CustomCommandsPage.h b/application/pages/global/CustomCommandsPage.h index d7206dfa..414c3259 100644 --- a/application/pages/global/CustomCommandsPage.h +++ b/application/pages/global/CustomCommandsPage.h @@ -1,4 +1,4 @@ -/* Copyright 2018-2018 MultiMC Contributors +/* Copyright 2018-2021 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/application/pages/global/ExternalToolsPage.cpp b/application/pages/global/ExternalToolsPage.cpp index 41ed3f7c..6a0a38be 100644 --- a/application/pages/global/ExternalToolsPage.cpp +++ b/application/pages/global/ExternalToolsPage.cpp @@ -1,4 +1,4 @@ -/* Copyright 2013-2018 MultiMC Contributors +/* Copyright 2013-2021 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/application/pages/global/ExternalToolsPage.h b/application/pages/global/ExternalToolsPage.h index bc42d2dd..0fc8ebe1 100644 --- a/application/pages/global/ExternalToolsPage.h +++ b/application/pages/global/ExternalToolsPage.h @@ -1,4 +1,4 @@ -/* Copyright 2013-2018 MultiMC Contributors +/* Copyright 2013-2021 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/application/pages/global/ExternalToolsPage.ui b/application/pages/global/ExternalToolsPage.ui index 5f19898b..e79e9388 100644 --- a/application/pages/global/ExternalToolsPage.ui +++ b/application/pages/global/ExternalToolsPage.ui @@ -63,7 +63,7 @@ <item> <widget class="QLabel" name="jprofilerLink"> <property name="text"> - <string notr="true"><html><head/><body><p><a href="http://www.ej-technologies.com/products/jprofiler/overview.html">http://www.ej-technologies.com/products/jprofiler/overview.html</a></p></body></html></string> + <string notr="true"><html><head/><body><p><a href="https://www.ej-technologies.com/products/jprofiler/overview.html">https://www.ej-technologies.com/products/jprofiler/overview.html</a></p></body></html></string> </property> </widget> </item> @@ -137,7 +137,7 @@ <item> <widget class="QLabel" name="mceditLink"> <property name="text"> - <string notr="true"><html><head/><body><p><a href="http://www.mcedit.net/">http://www.mcedit.net/</a></p></body></html></string> + <string notr="true"><html><head/><body><p><a href="https://www.mcedit.net/">https://www.mcedit.net/</a></p></body></html></string> </property> </widget> </item> diff --git a/application/pages/global/JavaPage.cpp b/application/pages/global/JavaPage.cpp index 57e60ddf..cde0e035 100644 --- a/application/pages/global/JavaPage.cpp +++ b/application/pages/global/JavaPage.cpp @@ -1,4 +1,4 @@ -/* Copyright 2013-2018 MultiMC Contributors +/* Copyright 2013-2021 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,8 +37,8 @@ JavaPage::JavaPage(QWidget *parent) : QWidget(parent), ui(new Ui::JavaPage) ui->setupUi(this); ui->tabWidget->tabBar()->hide(); - auto sysMB = Sys::getSystemRam() / Sys::megabyte; - ui->maxMemSpinBox->setMaximum(sysMB); + auto sysMiB = Sys::getSystemRam() / Sys::mebibyte; + ui->maxMemSpinBox->setMaximum(sysMiB); loadSettings(); } diff --git a/application/pages/global/JavaPage.h b/application/pages/global/JavaPage.h index dc53402a..832f460b 100644 --- a/application/pages/global/JavaPage.h +++ b/application/pages/global/JavaPage.h @@ -1,4 +1,4 @@ -/* Copyright 2013-2018 MultiMC Contributors +/* Copyright 2013-2021 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/application/pages/global/JavaPage.ui b/application/pages/global/JavaPage.ui index 201b310c..b67e9994 100644 --- a/application/pages/global/JavaPage.ui +++ b/application/pages/global/JavaPage.ui @@ -51,7 +51,7 @@ <string>The maximum amount of memory Minecraft is allowed to use.</string> </property> <property name="suffix"> - <string notr="true"> MB</string> + <string notr="true"> MiB</string> </property> <property name="minimum"> <number>128</number> @@ -87,7 +87,7 @@ <string>The amount of memory Minecraft is started with.</string> </property> <property name="suffix"> - <string notr="true"> MB</string> + <string notr="true"> MiB</string> </property> <property name="minimum"> <number>128</number> @@ -116,7 +116,7 @@ <string>The amount of memory available to store loaded Java classes.</string> </property> <property name="suffix"> - <string notr="true"> MB</string> + <string notr="true"> MiB</string> </property> <property name="minimum"> <number>64</number> diff --git a/application/pages/global/LanguagePage.cpp b/application/pages/global/LanguagePage.cpp new file mode 100644 index 00000000..ae3168cc --- /dev/null +++ b/application/pages/global/LanguagePage.cpp @@ -0,0 +1,51 @@ +#include "LanguagePage.h" + +#include "widgets/LanguageSelectionWidget.h" +#include <QVBoxLayout> + +LanguagePage::LanguagePage(QWidget* parent) : + QWidget(parent) +{ + setObjectName(QStringLiteral("languagePage")); + auto layout = new QVBoxLayout(this); + mainWidget = new LanguageSelectionWidget(this); + layout->setContentsMargins(0,0,0,0); + layout->addWidget(mainWidget); + retranslate(); +} + +LanguagePage::~LanguagePage() +{ +} + +bool LanguagePage::apply() +{ + applySettings(); + return true; +} + +void LanguagePage::applySettings() +{ + auto settings = MMC->settings(); + QString key = mainWidget->getSelectedLanguageKey(); + settings->set("Language", key); +} + +void LanguagePage::loadSettings() +{ + // NIL +} + +void LanguagePage::retranslate() +{ + mainWidget->retranslate(); +} + +void LanguagePage::changeEvent(QEvent* event) +{ + if (event->type() == QEvent::LanguageChange) + { + retranslate(); + } + QWidget::changeEvent(event); +} diff --git a/application/pages/global/LanguagePage.h b/application/pages/global/LanguagePage.h new file mode 100644 index 00000000..ca8eecc6 --- /dev/null +++ b/application/pages/global/LanguagePage.h @@ -0,0 +1,60 @@ +/* Copyright 2013-2021 MultiMC Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <memory> +#include "pages/BasePage.h" +#include <MultiMC.h> +#include <QWidget> + +class LanguageSelectionWidget; + +class LanguagePage : public QWidget, public BasePage +{ + Q_OBJECT + +public: + explicit LanguagePage(QWidget *parent = 0); + virtual ~LanguagePage(); + + QString displayName() const override + { + return tr("Language"); + } + QIcon icon() const override + { + return MMC->getThemedIcon("language"); + } + QString id() const override + { + return "language-settings"; + } + QString helpPage() const override + { + return "Language-settings"; + } + bool apply() override; + + void changeEvent(QEvent * ) override; + +private: + void applySettings(); + void loadSettings(); + void retranslate(); + +private: + LanguageSelectionWidget *mainWidget; +}; diff --git a/application/pages/global/MinecraftPage.cpp b/application/pages/global/MinecraftPage.cpp index 06429449..6c9bd307 100644 --- a/application/pages/global/MinecraftPage.cpp +++ b/application/pages/global/MinecraftPage.cpp @@ -1,4 +1,4 @@ -/* Copyright 2013-2018 MultiMC Contributors +/* Copyright 2013-2021 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,6 +63,14 @@ void MinecraftPage::applySettings() s->set("LaunchMaximized", ui->maximizedCheckBox->isChecked()); s->set("MinecraftWinWidth", ui->windowWidthSpinBox->value()); s->set("MinecraftWinHeight", ui->windowHeightSpinBox->value()); + + // Native library workarounds + s->set("UseNativeOpenAL", ui->useNativeOpenALCheck->isChecked()); + s->set("UseNativeGLFW", ui->useNativeGLFWCheck->isChecked()); + + // Game time + s->set("ShowGameTime", ui->showGameTime->isChecked()); + s->set("RecordGameTime", ui->recordGameTime->isChecked()); } void MinecraftPage::loadSettings() @@ -73,4 +81,10 @@ void MinecraftPage::loadSettings() ui->maximizedCheckBox->setChecked(s->get("LaunchMaximized").toBool()); ui->windowWidthSpinBox->setValue(s->get("MinecraftWinWidth").toInt()); ui->windowHeightSpinBox->setValue(s->get("MinecraftWinHeight").toInt()); + + ui->useNativeOpenALCheck->setChecked(s->get("UseNativeOpenAL").toBool()); + ui->useNativeGLFWCheck->setChecked(s->get("UseNativeGLFW").toBool()); + + ui->showGameTime->setChecked(s->get("ShowGameTime").toBool()); + ui->recordGameTime->setChecked(s->get("RecordGameTime").toBool()); } diff --git a/application/pages/global/MinecraftPage.h b/application/pages/global/MinecraftPage.h index e5d5f854..5e781aed 100644 --- a/application/pages/global/MinecraftPage.h +++ b/application/pages/global/MinecraftPage.h @@ -1,4 +1,4 @@ -/* Copyright 2013-2018 MultiMC Contributors +/* Copyright 2013-2021 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/application/pages/global/MinecraftPage.ui b/application/pages/global/MinecraftPage.ui index 9a18927a..2abd4bd4 100644 --- a/application/pages/global/MinecraftPage.ui +++ b/application/pages/global/MinecraftPage.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>545</width> - <height>195</height> + <width>936</width> + <height>1134</height> </rect> </property> <property name="sizePolicy"> @@ -112,6 +112,52 @@ </widget> </item> <item> + <widget class="QGroupBox" name="nativeLibWorkaroundGroupBox"> + <property name="title"> + <string>Native library workarounds</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <item> + <widget class="QCheckBox" name="useNativeGLFWCheck"> + <property name="text"> + <string>Use system installation of GLFW</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="useNativeOpenALCheck"> + <property name="text"> + <string>Use system installation of OpenAL</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="gameTimeGroupBox"> + <property name="title"> + <string>Game time</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_6"> + <item> + <widget class="QCheckBox" name="showGameTime"> + <property name="text"> + <string>Show time spent playing instances</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="recordGameTime"> + <property name="text"> + <string>Record time spent playing instances</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> <spacer name="verticalSpacerMinecraft"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -135,6 +181,8 @@ <tabstop>maximizedCheckBox</tabstop> <tabstop>windowWidthSpinBox</tabstop> <tabstop>windowHeightSpinBox</tabstop> + <tabstop>useNativeGLFWCheck</tabstop> + <tabstop>useNativeOpenALCheck</tabstop> </tabstops> <resources/> <connections/> diff --git a/application/pages/global/MultiMCPage.cpp b/application/pages/global/MultiMCPage.cpp index 1991c9ba..80d5c544 100644 --- a/application/pages/global/MultiMCPage.cpp +++ b/application/pages/global/MultiMCPage.cpp @@ -1,4 +1,4 @@ -/* Copyright 2013-2018 MultiMC Contributors +/* Copyright 2013-2021 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,12 +78,12 @@ MultiMCPage::MultiMCPage(QWidget *parent) : QWidget(parent), ui(new Ui::MultiMCP } connect(ui->fontSizeBox, SIGNAL(valueChanged(int)), SLOT(refreshFontPreview())); connect(ui->consoleFont, SIGNAL(currentFontChanged(QFont)), SLOT(refreshFontPreview())); - connect(ui->languageBox, SIGNAL(currentIndexChanged(int)), SLOT(languageIndexChanged(int))); } MultiMCPage::~MultiMCPage() { delete ui; + delete defaultFormat; } bool MultiMCPage::apply() @@ -147,19 +147,6 @@ void MultiMCPage::on_modsDirBrowseBtn_clicked() } } -void MultiMCPage::languageIndexChanged(int index) -{ - auto languageCode = ui->languageBox->itemData(ui->languageBox->currentIndex()).toString(); - if(languageCode.isEmpty()) - { - qWarning() << "Unknown language at index" << index; - return; - } - auto translations = MMC->translations(); - translations->selectLanguage(languageCode); - translations->updateLanguage(languageCode); -} - void MultiMCPage::refreshUpdateChannelList() { // Stop listening for selection changes. It's going to change a lot while we update it and @@ -236,9 +223,6 @@ void MultiMCPage::applySettings() { auto s = MMC->settings(); - // Language - s->set("Language", ui->languageBox->itemData(ui->languageBox->currentIndex()).toString()); - if (ui->resetNotificationsBtn->isChecked()) { s->set("ShownNotifications", QString()); @@ -331,12 +315,6 @@ void MultiMCPage::applySettings() void MultiMCPage::loadSettings() { auto s = MMC->settings(); - // Language - { - ui->languageBox->setModel(m_languageModel.get()); - ui->languageBox->setCurrentIndex(ui->languageBox->findData(s->get("Language").toString())); - } - // Updates ui->autoUpdateCheckBox->setChecked(s->get("AutoUpdate").toBool()); m_currentUpdateChannel = s->get("UpdateChannel").toString(); diff --git a/application/pages/global/MultiMCPage.h b/application/pages/global/MultiMCPage.h index bf21305e..e81832eb 100644 --- a/application/pages/global/MultiMCPage.h +++ b/application/pages/global/MultiMCPage.h @@ -1,4 +1,4 @@ -/* Copyright 2013-2018 MultiMC Contributors +/* Copyright 2013-2021 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,8 +68,6 @@ slots: void on_modsDirBrowseBtn_clicked(); void on_iconsDirBrowseBtn_clicked(); - void languageIndexChanged(int index); - /*! * Updates the list of update channels in the combo box. */ diff --git a/application/pages/global/MultiMCPage.ui b/application/pages/global/MultiMCPage.ui index 124401c3..ea034919 100644 --- a/application/pages/global/MultiMCPage.ui +++ b/application/pages/global/MultiMCPage.ui @@ -6,7 +6,7 @@ <rect> <x>0</x> <y>0</y> - <width>467</width> + <width>514</width> <height>629</height> </rect> </property> @@ -229,18 +229,6 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string>Language:</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QComboBox" name="languageBox"/> - </item> - </layout> - </widget> - </item> - <item> <widget class="QGroupBox" name="themeBox"> <property name="title"> <string>Theme</string> @@ -570,7 +558,6 @@ <tabstop>resetNotificationsBtn</tabstop> <tabstop>sortLastLaunchedBtn</tabstop> <tabstop>sortByNameBtn</tabstop> - <tabstop>languageBox</tabstop> <tabstop>themeComboBox</tabstop> <tabstop>themeComboBoxColors</tabstop> <tabstop>showConsoleCheck</tabstop> diff --git a/application/pages/global/PackagesPage.cpp b/application/pages/global/PackagesPage.cpp deleted file mode 100644 index b6a7887b..00000000 --- a/application/pages/global/PackagesPage.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/* Copyright 2015-2018 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "PackagesPage.h" -#include "ui_PackagesPage.h" - -#include <QDateTime> -#include <QSortFilterProxyModel> -#include <QRegularExpression> - -#include "dialogs/ProgressDialog.h" -#include "VersionProxyModel.h" - -#include "meta/Index.h" -#include "meta/VersionList.h" -#include "meta/Version.h" -#include "Env.h" -#include "MultiMC.h" - -using namespace Meta; - -static QString formatRequires(const VersionPtr &version) -{ - QStringList lines; - auto & reqs = version->requires(); - auto iter = reqs.begin(); - while (iter != reqs.end()) - { - auto &uid = iter->uid; - auto &version = iter->equalsVersion; - const QString readable = ENV.metadataIndex()->hasUid(uid) ? ENV.metadataIndex()->get(uid)->humanReadable() : uid; - if(!version.isEmpty()) - { - lines.append(QString("%1 (%2)").arg(readable, version)); - } - else - { - lines.append(QString("%1").arg(readable)); - } - iter++; - } - return lines.join('\n'); -} - -PackagesPage::PackagesPage(QWidget *parent) : - QWidget(parent), - ui(new Ui::PackagesPage) -{ - ui->setupUi(this); - ui->tabWidget->tabBar()->hide(); - - m_fileProxy = new QSortFilterProxyModel(this); - m_fileProxy->setSortRole(Qt::DisplayRole); - m_fileProxy->setSortCaseSensitivity(Qt::CaseInsensitive); - m_fileProxy->setFilterCaseSensitivity(Qt::CaseInsensitive); - m_fileProxy->setFilterRole(Qt::DisplayRole); - m_fileProxy->setFilterKeyColumn(0); - m_fileProxy->sort(0); - m_fileProxy->setSourceModel(ENV.metadataIndex().get()); - ui->indexView->setModel(m_fileProxy); - - m_filterProxy = new QSortFilterProxyModel(this); - m_filterProxy->setSortRole(VersionList::SortRole); - m_filterProxy->setFilterCaseSensitivity(Qt::CaseInsensitive); - m_filterProxy->setFilterRole(Qt::DisplayRole); - m_filterProxy->setFilterKeyColumn(0); - m_filterProxy->sort(0, Qt::DescendingOrder); - ui->versionsView->setModel(m_filterProxy); - - m_versionProxy = new VersionProxyModel(this); - m_filterProxy->setSourceModel(m_versionProxy); - - connect(ui->indexView->selectionModel(), &QItemSelectionModel::currentChanged, this, &PackagesPage::updateCurrentVersionList); - connect(ui->versionsView->selectionModel(), &QItemSelectionModel::currentChanged, this, &PackagesPage::updateVersion); - connect(m_filterProxy, &QSortFilterProxyModel::dataChanged, this, &PackagesPage::versionListDataChanged); - - updateCurrentVersionList(QModelIndex()); - updateVersion(); -} - -PackagesPage::~PackagesPage() -{ - delete ui; -} - -QIcon PackagesPage::icon() const -{ - return MMC->getThemedIcon("packages"); -} - -void PackagesPage::on_refreshIndexBtn_clicked() -{ - ENV.metadataIndex()->load(Net::Mode::Online); -} -void PackagesPage::on_refreshFileBtn_clicked() -{ - VersionListPtr list = ui->indexView->currentIndex().data(Index::ListPtrRole).value<VersionListPtr>(); - if (!list) - { - return; - } - list->load(Net::Mode::Online); -} -void PackagesPage::on_refreshVersionBtn_clicked() -{ - VersionPtr version = ui->versionsView->currentIndex().data(VersionList::VersionPtrRole).value<VersionPtr>(); - if (!version) - { - return; - } - version->load(Net::Mode::Online); -} - -void PackagesPage::on_fileSearchEdit_textChanged(const QString &search) -{ - if (search.isEmpty()) - { - m_fileProxy->setFilterFixedString(QString()); - } - else - { - QStringList parts = search.split(' '); - std::transform(parts.begin(), parts.end(), parts.begin(), &QRegularExpression::escape); - m_fileProxy->setFilterRegExp(".*" + parts.join(".*") + ".*"); - } -} -void PackagesPage::on_versionSearchEdit_textChanged(const QString &search) -{ - if (search.isEmpty()) - { - m_filterProxy->setFilterFixedString(QString()); - } - else - { - QStringList parts = search.split(' '); - std::transform(parts.begin(), parts.end(), parts.begin(), &QRegularExpression::escape); - m_filterProxy->setFilterRegExp(".*" + parts.join(".*") + ".*"); - } -} - -void PackagesPage::updateCurrentVersionList(const QModelIndex &index) -{ - if (index.isValid()) - { - VersionListPtr list = index.data(Index::ListPtrRole).value<VersionListPtr>(); - ui->versionsBox->setEnabled(true); - ui->refreshFileBtn->setEnabled(true); - ui->fileUidLabel->setEnabled(true); - ui->fileUid->setText(list->uid()); - ui->fileNameLabel->setEnabled(true); - ui->fileName->setText(list->name()); - m_versionProxy->setSourceModel(list.get()); - ui->refreshFileBtn->setText(tr("Refresh %1").arg(list->humanReadable())); - list->load(Net::Mode::Offline); - } - else - { - ui->versionsBox->setEnabled(false); - ui->refreshFileBtn->setEnabled(false); - ui->fileUidLabel->setEnabled(false); - ui->fileUid->clear(); - ui->fileNameLabel->setEnabled(false); - ui->fileName->clear(); - m_versionProxy->setSourceModel(nullptr); - ui->refreshFileBtn->setText(tr("Refresh")); - } -} - -void PackagesPage::versionListDataChanged(const QModelIndex &tl, const QModelIndex &br) -{ - if (QItemSelection(tl, br).contains(ui->versionsView->currentIndex())) - { - updateVersion(); - } -} - -void PackagesPage::updateVersion() -{ - VersionPtr version = std::dynamic_pointer_cast<Version>( - ui->versionsView->currentIndex().data(VersionList::VersionPointerRole).value<BaseVersionPtr>()); - if (version) - { - ui->refreshVersionBtn->setEnabled(true); - ui->versionVersionLabel->setEnabled(true); - ui->versionVersion->setText(version->version()); - ui->versionTimeLabel->setEnabled(true); - ui->versionTime->setText(version->time().toString("yyyy-MM-dd HH:mm")); - ui->versionTypeLabel->setEnabled(true); - ui->versionType->setText(version->type()); - ui->versionRequiresLabel->setEnabled(true); - ui->versionRequires->setText(formatRequires(version)); - ui->refreshVersionBtn->setText(tr("Refresh %1").arg(version->version())); - } - else - { - ui->refreshVersionBtn->setEnabled(false); - ui->versionVersionLabel->setEnabled(false); - ui->versionVersion->clear(); - ui->versionTimeLabel->setEnabled(false); - ui->versionTime->clear(); - ui->versionTypeLabel->setEnabled(false); - ui->versionType->clear(); - ui->versionRequiresLabel->setEnabled(false); - ui->versionRequires->clear(); - ui->refreshVersionBtn->setText(tr("Refresh")); - } -} - -void PackagesPage::openedImpl() -{ - ENV.metadataIndex()->load(Net::Mode::Offline); -} diff --git a/application/pages/global/PackagesPage.h b/application/pages/global/PackagesPage.h deleted file mode 100644 index c8aa6da6..00000000 --- a/application/pages/global/PackagesPage.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright 2015-2018 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include <QWidget> - -#include "pages/BasePage.h" - -namespace Ui { -class PackagesPage; -} - -class QSortFilterProxyModel; -class VersionProxyModel; - -class PackagesPage : public QWidget, public BasePage -{ - Q_OBJECT -public: - explicit PackagesPage(QWidget *parent = 0); - ~PackagesPage(); - - QString id() const override { return "packages-global"; } - QString displayName() const override { return tr("Packages"); } - QIcon icon() const override; - void openedImpl() override; - -private slots: - void on_refreshIndexBtn_clicked(); - void on_refreshFileBtn_clicked(); - void on_refreshVersionBtn_clicked(); - void on_fileSearchEdit_textChanged(const QString &search); - void on_versionSearchEdit_textChanged(const QString &search); - void updateCurrentVersionList(const QModelIndex &index); - void versionListDataChanged(const QModelIndex &tl, const QModelIndex &br); - -private: - Ui::PackagesPage *ui; - QSortFilterProxyModel *m_fileProxy; - QSortFilterProxyModel *m_filterProxy; - VersionProxyModel *m_versionProxy; - - void updateVersion(); -}; diff --git a/application/pages/global/PackagesPage.ui b/application/pages/global/PackagesPage.ui deleted file mode 100644 index 158bf1b4..00000000 --- a/application/pages/global/PackagesPage.ui +++ /dev/null @@ -1,252 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>PackagesPage</class> - <widget class="QWidget" name="PackagesPage"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>636</width> - <height>621</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QTabWidget" name="tabWidget"> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="tab"> - <attribute name="title"> - <string>Tab 1</string> - </attribute> - <layout class="QGridLayout" name="gridLayout"> - <item row="1" column="2"> - <widget class="QGroupBox" name="versionsBox"> - <property name="title"> - <string>Versions</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QLineEdit" name="versionSearchEdit"> - <property name="placeholderText"> - <string>Search...</string> - </property> - <property name="clearButtonEnabled"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QTreeView" name="versionsView"> - <property name="alternatingRowColors"> - <bool>true</bool> - </property> - <attribute name="headerVisible"> - <bool>false</bool> - </attribute> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <widget class="QPushButton" name="refreshVersionBtn"> - <property name="text"> - <string>Refresh</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QFormLayout" name="formLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="versionVersionLabel"> - <property name="text"> - <string>Version:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="versionVersion"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="versionTimeLabel"> - <property name="text"> - <string>Time:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="versionTime"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="versionTypeLabel"> - <property name="text"> - <string>Type:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLabel" name="versionType"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="versionRequiresLabel"> - <property name="text"> - <string>Dependencies:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLabel" name="versionRequires"> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer_2"> - <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> - </item> - <item row="1" column="1"> - <widget class="QGroupBox" name="versionListsBox"> - <property name="title"> - <string>Resources</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QLineEdit" name="fileSearchEdit"> - <property name="placeholderText"> - <string>Search...</string> - </property> - <property name="clearButtonEnabled"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QTreeView" name="indexView"> - <property name="alternatingRowColors"> - <bool>true</bool> - </property> - <attribute name="headerVisible"> - <bool>false</bool> - </attribute> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QPushButton" name="refreshFileBtn"> - <property name="text"> - <string>Refresh</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QFormLayout" name="formLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="fileUidLabel"> - <property name="text"> - <string>UID:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="fileUid"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="fileNameLabel"> - <property name="text"> - <string>Name:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="fileName"> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> - </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> - </item> - <item row="0" column="1" colspan="2"> - <widget class="QPushButton" name="refreshIndexBtn"> - <property name="text"> - <string>Refresh Index</string> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/application/pages/global/PasteEEPage.cpp b/application/pages/global/PasteEEPage.cpp index b144c832..f932dede 100644 --- a/application/pages/global/PasteEEPage.cpp +++ b/application/pages/global/PasteEEPage.cpp @@ -1,4 +1,4 @@ -/* Copyright 2013-2018 MultiMC Contributors +/* Copyright 2013-2021 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/application/pages/global/PasteEEPage.h b/application/pages/global/PasteEEPage.h index 5d64d567..001decdb 100644 --- a/application/pages/global/PasteEEPage.h +++ b/application/pages/global/PasteEEPage.h @@ -1,4 +1,4 @@ -/* Copyright 2013-2018 MultiMC Contributors +/* Copyright 2013-2021 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/application/pages/global/ProxyPage.cpp b/application/pages/global/ProxyPage.cpp index 6dbd0a5d..809059ff 100644 --- a/application/pages/global/ProxyPage.cpp +++ b/application/pages/global/ProxyPage.cpp @@ -1,4 +1,4 @@ -/* Copyright 2013-2018 MultiMC Contributors +/* Copyright 2013-2021 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ #include "settings/SettingsObject.h" #include "MultiMC.h" +#include "Env.h" ProxyPage::ProxyPage(QWidget *parent) : QWidget(parent), ui(new Ui::ProxyPage) { @@ -75,6 +76,9 @@ void ProxyPage::applySettings() s->set("ProxyPort", ui->proxyPortEdit->value()); s->set("ProxyUser", ui->proxyUserEdit->text()); s->set("ProxyPass", ui->proxyPassEdit->text()); + + ENV.updateProxySettings(proxyType, ui->proxyAddrEdit->text(), ui->proxyPortEdit->value(), + ui->proxyUserEdit->text(), ui->proxyPassEdit->text()); } void ProxyPage::loadSettings() { @@ -91,7 +95,7 @@ void ProxyPage::loadSettings() ui->proxyHTTPBtn->setChecked(true); ui->proxyAddrEdit->setText(s->get("ProxyAddr").toString()); - ui->proxyPortEdit->setValue(s->get("ProxyPort").value<qint16>()); + ui->proxyPortEdit->setValue(s->get("ProxyPort").value<uint16_t>()); ui->proxyUserEdit->setText(s->get("ProxyUser").toString()); ui->proxyPassEdit->setText(s->get("ProxyPass").toString()); } diff --git a/application/pages/global/ProxyPage.h b/application/pages/global/ProxyPage.h index 47b3004e..ff94ec49 100644 --- a/application/pages/global/ProxyPage.h +++ b/application/pages/global/ProxyPage.h @@ -1,4 +1,4 @@ -/* Copyright 2013-2018 MultiMC Contributors +/* Copyright 2013-2021 MultiMC Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. |