diff options
Diffstat (limited to 'launcher/ui')
-rw-r--r-- | launcher/ui/MainWindow.cpp | 11 | ||||
-rw-r--r-- | launcher/ui/MainWindow.h | 2 | ||||
-rw-r--r-- | launcher/ui/pages/global/APIPage.cpp | 5 | ||||
-rw-r--r-- | launcher/ui/pages/global/APIPage.ui | 129 | ||||
-rw-r--r-- | launcher/ui/pages/global/LauncherPage.cpp | 12 | ||||
-rw-r--r-- | launcher/ui/pages/global/LauncherPage.h | 1 | ||||
-rw-r--r-- | launcher/ui/pages/global/LauncherPage.ui | 75 | ||||
-rw-r--r-- | launcher/ui/pages/modplatform/ImportPage.cpp | 11 | ||||
-rw-r--r-- | launcher/ui/pages/modplatform/ModPage.cpp | 2 | ||||
-rw-r--r-- | launcher/ui/pages/modplatform/technic/TechnicPage.ui | 6 | ||||
-rw-r--r-- | launcher/ui/widgets/MCModInfoFrame.cpp | 2 |
11 files changed, 193 insertions, 63 deletions
diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index 7e152b96..0a5f2000 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -2101,6 +2101,9 @@ void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex & selectionBad(); return; } + if (m_selectedInstance) { + disconnect(m_selectedInstance.get(), &BaseInstance::runningStatusChanged, this, &MainWindow::refreshCurrentInstance); + } QString id = current.data(InstanceList::InstanceIDRole).toString(); m_selectedInstance = APPLICATION->instances()->getInstanceById(id); if (m_selectedInstance) @@ -2127,6 +2130,8 @@ void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex & updateToolsMenu(); APPLICATION->settings()->set("SelectedInstance", m_selectedInstance->id()); + + connect(m_selectedInstance.get(), &BaseInstance::runningStatusChanged, this, &MainWindow::refreshCurrentInstance); } else { @@ -2216,3 +2221,9 @@ void MainWindow::updateStatusCenter() m_statusCenter->setText(tr("Total playtime: %1").arg(Time::prettifyDuration(timePlayed))); } } + +void MainWindow::refreshCurrentInstance(bool running) +{ + auto current = view->selectionModel()->currentIndex(); + instanceChanged(current, current); +} diff --git a/launcher/ui/MainWindow.h b/launcher/ui/MainWindow.h index 2032acba..61a75c45 100644 --- a/launcher/ui/MainWindow.h +++ b/launcher/ui/MainWindow.h @@ -192,6 +192,8 @@ private slots: void keyReleaseEvent(QKeyEvent *event) override; #endif + void refreshCurrentInstance(bool running); + private: void retranslateUi(); diff --git a/launcher/ui/pages/global/APIPage.cpp b/launcher/ui/pages/global/APIPage.cpp index 5d812d07..b889e6f7 100644 --- a/launcher/ui/pages/global/APIPage.cpp +++ b/launcher/ui/pages/global/APIPage.cpp @@ -75,9 +75,9 @@ APIPage::APIPage(QWidget *parent) : // This function needs to be called even when the ComboBox's index is still in its default state. updateBaseURLPlaceholder(ui->pasteTypeComboBox->currentIndex()); ui->baseURLEntry->setValidator(new QRegularExpressionValidator(validUrlRegExp, ui->baseURLEntry)); - ui->tabWidget->tabBar()->hide(); ui->metaURL->setPlaceholderText(BuildConfig.META_URL); + ui->userAgentLineEdit->setPlaceholderText(BuildConfig.USER_AGENT); loadSettings(); @@ -139,6 +139,8 @@ void APIPage::loadSettings() ui->metaURL->setText(metaURL); QString curseKey = s->get("CFKeyOverride").toString(); ui->curseKey->setText(curseKey); + QString customUserAgent = s->get("UserAgentOverride").toString(); + ui->userAgentLineEdit->setText(customUserAgent); } void APIPage::applySettings() @@ -167,6 +169,7 @@ void APIPage::applySettings() s->set("MetaURLOverride", metaURL); QString curseKey = ui->curseKey->text(); s->set("CFKeyOverride", curseKey); + s->set("UserAgentOverride", ui->userAgentLineEdit->text()); } bool APIPage::apply() diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui index 5c927391..5327771c 100644 --- a/launcher/ui/pages/global/APIPage.ui +++ b/launcher/ui/pages/global/APIPage.ui @@ -30,7 +30,7 @@ </property> <widget class="QWidget" name="tab"> <attribute name="title"> - <string notr="true">Tab 1</string> + <string notr="true">Services</string> </attribute> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> @@ -86,15 +86,15 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_msa"> + <widget class="QGroupBox" name="groupBox_meta"> <property name="title"> - <string>&Microsoft Authentication</string> + <string>Meta&data Server</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_4"> + <layout class="QVBoxLayout" name="verticalLayout_5"> <item> - <widget class="QLabel" name="label_3"> + <widget class="QLabel" name="label_5"> <property name="text"> - <string>Note: you probably don't need to set this if logging in via Microsoft Authentication already works.</string> + <string>You can set this to a third-party metadata server to use patched libraries or other hacks.</string> </property> <property name="textFormat"> <enum>Qt::RichText</enum> @@ -105,16 +105,16 @@ </widget> </item> <item> - <widget class="QLineEdit" name="msaClientID"> + <widget class="QLineEdit" name="metaURL"> <property name="placeholderText"> - <string>(Default)</string> + <string/> </property> </widget> </item> <item> - <widget class="QLabel" name="label_4"> + <widget class="QLabel" name="label_6"> <property name="text"> - <string>Enter a custom client ID for Microsoft Authentication here. </string> + <string>Enter a custom URL for meta here.</string> </property> <property name="textFormat"> <enum>Qt::RichText</enum> @@ -131,15 +131,35 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_meta"> + <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> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>API Keys</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_8"> + <item> + <widget class="QGroupBox" name="groupBox_msa"> <property name="title"> - <string>Meta&data Server</string> + <string>&Microsoft Authentication</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_5"> + <layout class="QVBoxLayout" name="verticalLayout_4"> <item> - <widget class="QLabel" name="label_5"> + <widget class="QLabel" name="label_3"> <property name="text"> - <string>You can set this to a third-party metadata server to use patched libraries or other hacks.</string> + <string>Note: you probably don't need to set this if logging in via Microsoft Authentication already works.</string> </property> <property name="textFormat"> <enum>Qt::RichText</enum> @@ -150,16 +170,16 @@ </widget> </item> <item> - <widget class="QLineEdit" name="metaURL"> + <widget class="QLineEdit" name="msaClientID"> <property name="placeholderText"> - <string/> + <string>(Default)</string> </property> </widget> </item> <item> - <widget class="QLabel" name="label_6"> + <widget class="QLabel" name="label_4"> <property name="text"> - <string>Enter a custom URL for meta here.</string> + <string>Enter a custom client ID for Microsoft Authentication here. </string> </property> <property name="textFormat"> <enum>Qt::RichText</enum> @@ -183,25 +203,15 @@ <property name="title"> <string>&CurseForge Core API</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_6"> - <item> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> <widget class="QLabel" name="label_8"> <property name="text"> <string>Note: you probably don't need to set this if CurseForge already works.</string> </property> </widget> </item> - <item> - <widget class="QLineEdit" name="curseKey"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="placeholderText"> - <string>(Default)</string> - </property> - </widget> - </item> - <item> + <item row="2" column="0"> <widget class="QLabel" name="label_7"> <property name="text"> <string>Enter a custom API Key for CurseForge here. </string> @@ -217,6 +227,16 @@ </property> </widget> </item> + <item row="1" column="0"> + <widget class="QLineEdit" name="curseKey"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="placeholderText"> + <string>(Default)</string> + </property> + </widget> + </item> </layout> </widget> </item> @@ -235,6 +255,51 @@ </item> </layout> </widget> + <widget class="QWidget" name="tab_3"> + <attribute name="title"> + <string>Miscellaneous</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_6"> + <item> + <widget class="QGroupBox" name="groupBox_ua"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="title"> + <string>User Agent</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_7"> + <item> + <widget class="QLineEdit" name="userAgentLineEdit"/> + </item> + <item> + <widget class="QLabel" name="userAgentLabel"> + <property name="text"> + <string>Enter a custom User Agent here. The special string $LAUNCHER_VER will be replaced with the version of the launcher.</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer_3"> + <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> </item> </layout> diff --git a/launcher/ui/pages/global/LauncherPage.cpp b/launcher/ui/pages/global/LauncherPage.cpp index af2e2cd1..faf9272d 100644 --- a/launcher/ui/pages/global/LauncherPage.cpp +++ b/launcher/ui/pages/global/LauncherPage.cpp @@ -184,6 +184,11 @@ void LauncherPage::on_modsDirBrowseBtn_clicked() } } +void LauncherPage::on_metadataDisableBtn_clicked() +{ + ui->metadataWarningLabel->setHidden(!ui->metadataDisableBtn->isChecked()); +} + void LauncherPage::refreshUpdateChannelList() { // Stop listening for selection changes. It's going to change a lot while we update it and @@ -338,6 +343,9 @@ void LauncherPage::applySettings() s->set("InstSortMode", "Name"); break; } + + // Mods + s->set("ModMetadataDisabled", ui->metadataDisableBtn->isChecked()); } void LauncherPage::loadSettings() { @@ -440,6 +448,10 @@ void LauncherPage::loadSettings() { ui->sortByNameBtn->setChecked(true); } + + // Mods + ui->metadataDisableBtn->setChecked(s->get("DontUseModMetadata").toBool()); + ui->metadataWarningLabel->setHidden(!ui->metadataDisableBtn->isChecked()); } void LauncherPage::refreshFontPreview() diff --git a/launcher/ui/pages/global/LauncherPage.h b/launcher/ui/pages/global/LauncherPage.h index bbf5d2fe..f38c922e 100644 --- a/launcher/ui/pages/global/LauncherPage.h +++ b/launcher/ui/pages/global/LauncherPage.h @@ -88,6 +88,7 @@ slots: void on_instDirBrowseBtn_clicked(); void on_modsDirBrowseBtn_clicked(); void on_iconsDirBrowseBtn_clicked(); + void on_metadataDisableBtn_clicked(); /*! * Updates the list of update channels in the combo box. diff --git a/launcher/ui/pages/global/LauncherPage.ui b/launcher/ui/pages/global/LauncherPage.ui index ae7eb73f..417bbe05 100644 --- a/launcher/ui/pages/global/LauncherPage.ui +++ b/launcher/ui/pages/global/LauncherPage.ui @@ -94,19 +94,13 @@ <string>Folders</string> </property> <layout class="QGridLayout" name="foldersBoxLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="labelInstDir"> + <item row="1" column="2"> + <widget class="QToolButton" name="modsDirBrowseBtn"> <property name="text"> - <string>I&nstances:</string> - </property> - <property name="buddy"> - <cstring>instDirTextBox</cstring> + <string notr="true">...</string> </property> </widget> </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="instDirTextBox"/> - </item> <item row="0" column="2"> <widget class="QToolButton" name="instDirBrowseBtn"> <property name="text"> @@ -114,43 +108,78 @@ </property> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="labelModsDir"> + <item row="2" column="2"> + <widget class="QToolButton" name="iconsDirBrowseBtn"> <property name="text"> - <string>&Mods:</string> + <string notr="true">...</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="instDirTextBox"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="labelIconsDir"> + <property name="text"> + <string>&Icons:</string> </property> <property name="buddy"> - <cstring>modsDirTextBox</cstring> + <cstring>iconsDirTextBox</cstring> </property> </widget> </item> <item row="1" column="1"> <widget class="QLineEdit" name="modsDirTextBox"/> </item> - <item row="1" column="2"> - <widget class="QToolButton" name="modsDirBrowseBtn"> + <item row="0" column="0"> + <widget class="QLabel" name="labelInstDir"> <property name="text"> - <string notr="true">...</string> + <string>I&nstances:</string> + </property> + <property name="buddy"> + <cstring>instDirTextBox</cstring> </property> </widget> </item> <item row="2" column="1"> <widget class="QLineEdit" name="iconsDirTextBox"/> </item> - <item row="2" column="0"> - <widget class="QLabel" name="labelIconsDir"> + <item row="1" column="0"> + <widget class="QLabel" name="labelModsDir"> <property name="text"> - <string>&Icons:</string> + <string>&Mods:</string> </property> <property name="buddy"> - <cstring>iconsDirTextBox</cstring> + <cstring>modsDirTextBox</cstring> </property> </widget> </item> - <item row="2" column="2"> - <widget class="QToolButton" name="iconsDirBrowseBtn"> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="modsBox"> + <property name="title"> + <string>Mods</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QCheckBox" name="metadataDisableBtn"> + <property name="toolTip"> + <string>Disable using metadata provided by mod providers (like Modrinth or Curseforge) for mods.</string> + </property> <property name="text"> - <string notr="true">...</string> + <string>Disable using metadata for mods?</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="metadataWarningLabel"> + <property name="text"> + <string><html><head/><body><p><span style=" font-weight:600; color:#f5c211;">Warning</span><span style=" color:#f5c211;">: Disabling mod metadata may also disable some upcoming QoL features, such as mod updating!</span></p></body></html></string> + </property> + <property name="wordWrap"> + <bool>true</bool> </property> </widget> </item> diff --git a/launcher/ui/pages/modplatform/ImportPage.cpp b/launcher/ui/pages/modplatform/ImportPage.cpp index b3ed1b73..0b8577b1 100644 --- a/launcher/ui/pages/modplatform/ImportPage.cpp +++ b/launcher/ui/pages/modplatform/ImportPage.cpp @@ -110,11 +110,13 @@ void ImportPage::updateState() { // FIXME: actually do some validation of what's inside here... this is fake AF QFileInfo fi(input); - // mrpack is a modrinth pack // Allow non-latin people to use ZIP files! - auto zip = QMimeDatabase().mimeTypeForUrl(url).suffixes().contains("zip"); - if(fi.exists() && (zip || fi.suffix() == "mrpack")) + bool isZip = QMimeDatabase().mimeTypeForUrl(url).suffixes().contains("zip"); + // mrpack is a modrinth pack + bool isMRPack = fi.suffix() == "mrpack"; + + if(fi.exists() && (isZip || isMRPack)) { QFileInfo fi(url.fileName()); dialog->setSuggestedPack(fi.completeBaseName(), new InstanceImportTask(url,this)); @@ -149,7 +151,8 @@ void ImportPage::setUrl(const QString& url) void ImportPage::on_modpackBtn_clicked() { auto filter = QMimeDatabase().mimeTypeForName("application/zip").filterString(); - filter += ";;" + tr("Modrinth pack (*.mrpack)"); + //: Option for filtering for *.mrpack files when importing + filter += ";;" + tr("Modrinth pack") + " (*.mrpack)"; const QUrl url = QFileDialog::getOpenFileUrl(this, tr("Choose modpack"), modpackUrl(), filter); if (url.isValid()) { diff --git a/launcher/ui/pages/modplatform/ModPage.cpp b/launcher/ui/pages/modplatform/ModPage.cpp index ad36cf2f..5020d44c 100644 --- a/launcher/ui/pages/modplatform/ModPage.cpp +++ b/launcher/ui/pages/modplatform/ModPage.cpp @@ -150,7 +150,7 @@ void ModPage::onModSelected() if (dialog->isModSelected(current.name, version.fileName)) { dialog->removeSelectedMod(current.name); } else { - dialog->addSelectedMod(current.name, new ModDownloadTask(version.downloadUrl, version.fileName, dialog->mods)); + dialog->addSelectedMod(current.name, new ModDownloadTask(current, version, dialog->mods)); } updateSelectionButton(); diff --git a/launcher/ui/pages/modplatform/technic/TechnicPage.ui b/launcher/ui/pages/modplatform/technic/TechnicPage.ui index ca6a9b7e..15bf645f 100644 --- a/launcher/ui/pages/modplatform/technic/TechnicPage.ui +++ b/launcher/ui/pages/modplatform/technic/TechnicPage.ui @@ -60,7 +60,11 @@ </widget> </item> <item row="0" column="1"> - <widget class="QTextBrowser" name="packDescription"/> + <widget class="QTextBrowser" name="packDescription"> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> </item> </layout> </item> diff --git a/launcher/ui/widgets/MCModInfoFrame.cpp b/launcher/ui/widgets/MCModInfoFrame.cpp index 8c4bd690..7d78006b 100644 --- a/launcher/ui/widgets/MCModInfoFrame.cpp +++ b/launcher/ui/widgets/MCModInfoFrame.cpp @@ -32,7 +32,7 @@ void MCModInfoFrame::updateWithMod(Mod &m) QString text = ""; QString name = ""; if (m.name().isEmpty()) - name = m.mmc_id(); + name = m.internal_id(); else name = m.name(); |