+
+
+ 0
+ 0
+
+
Optional Info
diff --git a/launcher/ui/dialogs/MSALoginDialog.cpp b/launcher/ui/dialogs/MSALoginDialog.cpp
index 74fff9fd3..7df423412 100644
--- a/launcher/ui/dialogs/MSALoginDialog.cpp
+++ b/launcher/ui/dialogs/MSALoginDialog.cpp
@@ -105,8 +105,16 @@ void MSALoginDialog::showVerificationUriAndCode(const QUrl& uri, const QString&
QString urlString = uri.toString();
QString linkString = QString("%2").arg(urlString, urlString);
- ui->label->setText(
- tr("Please open up %1 in a browser and put in the code %2 to proceed with login.
").arg(linkString, code));
+ if (urlString == "https://www.microsoft.com/link" && !code.isEmpty()) {
+ urlString += QString("?otc=%1").arg(code);
+ DesktopServices::openUrl(urlString);
+ ui->label->setText(tr("Please login in the opened browser. If no browser was opened, please open up %1 in "
+ "a browser and put in the code %2 to proceed with login.
")
+ .arg(linkString, code));
+ } else {
+ ui->label->setText(
+ tr("Please open up %1 in a browser and put in the code %2 to proceed with login.
").arg(linkString, code));
+ }
ui->actionButton->setVisible(true);
connect(ui->actionButton, &QPushButton::clicked, [=]() {
DesktopServices::openUrl(uri);
diff --git a/launcher/ui/dialogs/ModUpdateDialog.cpp b/launcher/ui/dialogs/ModUpdateDialog.cpp
index 1a70ea59a..cbaaf88b9 100644
--- a/launcher/ui/dialogs/ModUpdateDialog.cpp
+++ b/launcher/ui/dialogs/ModUpdateDialog.cpp
@@ -39,7 +39,8 @@ static std::optional mcLoaders(BaseInstance* inst)
ModUpdateDialog::ModUpdateDialog(QWidget* parent,
BaseInstance* instance,
const std::shared_ptr mods,
- QList& search_for)
+ QList& search_for,
+ bool includeDeps)
: ReviewMessageBox(parent, tr("Confirm mods to update"), "")
, m_parent(parent)
, m_mod_model(mods)
@@ -47,6 +48,7 @@ ModUpdateDialog::ModUpdateDialog(QWidget* parent,
, m_second_try_metadata(
new ConcurrentTask(nullptr, "Second Metadata Search", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()))
, m_instance(instance)
+ , m_include_deps(includeDeps)
{
ReviewMessageBox::setGeometry(0, 0, 800, 600);
@@ -186,7 +188,7 @@ void ModUpdateDialog::checkCandidates()
}
}
- { // dependencies
+ if (m_include_deps && !APPLICATION->settings()->get("ModDependenciesDisabled").toBool()) { // dependencies
auto depTask = makeShared(this, m_instance, m_mod_model.get(), selectedVers);
connect(depTask.get(), &Task::failed, this,
diff --git a/launcher/ui/dialogs/ModUpdateDialog.h b/launcher/ui/dialogs/ModUpdateDialog.h
index b79aa4943..98f6780bf 100644
--- a/launcher/ui/dialogs/ModUpdateDialog.h
+++ b/launcher/ui/dialogs/ModUpdateDialog.h
@@ -19,7 +19,8 @@ class ModUpdateDialog final : public ReviewMessageBox {
explicit ModUpdateDialog(QWidget* parent,
BaseInstance* instance,
const std::shared_ptr mod_model,
- QList& search_for);
+ QList& search_for,
+ bool includeDeps);
void checkCandidates();
@@ -61,4 +62,5 @@ class ModUpdateDialog final : public ReviewMessageBox {
bool m_no_updates = false;
bool m_aborted = false;
+ bool m_include_deps = false;
};
diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.cpp b/launcher/ui/dialogs/ResourceDownloadDialog.cpp
index f21502365..e434b8184 100644
--- a/launcher/ui/dialogs/ResourceDownloadDialog.cpp
+++ b/launcher/ui/dialogs/ResourceDownloadDialog.cpp
@@ -271,13 +271,15 @@ QList ModDownloadDialog::getPages()
GetModDependenciesTask::Ptr ModDownloadDialog::getModDependenciesTask()
{
- if (auto model = dynamic_cast(getBaseModel().get()); model) {
- QList> selectedVers;
- for (auto& selected : getTasks()) {
- selectedVers.append(std::make_shared(selected->getPack(), selected->getVersion()));
- }
+ if (!APPLICATION->settings()->get("ModDependenciesDisabled").toBool()) { // dependencies
+ if (auto model = dynamic_cast(getBaseModel().get()); model) {
+ QList> selectedVers;
+ for (auto& selected : getTasks()) {
+ selectedVers.append(std::make_shared(selected->getPack(), selected->getVersion()));
+ }
- return makeShared(this, m_instance, model, selectedVers);
+ return makeShared(this, m_instance, model, selectedVers);
+ }
}
return nullptr;
}
diff --git a/launcher/ui/instanceview/AccessibleInstanceView_p.h b/launcher/ui/instanceview/AccessibleInstanceView_p.h
index e99f85069..1a3a62d9f 100644
--- a/launcher/ui/instanceview/AccessibleInstanceView_p.h
+++ b/launcher/ui/instanceview/AccessibleInstanceView_p.h
@@ -59,7 +59,7 @@ class AccessibleInstanceView : public QAccessibleTableInterface, public QAccessi
protected:
// maybe vector
- typedef QHash ChildCache;
+ using ChildCache = QHash;
mutable ChildCache childToId;
virtual ~AccessibleInstanceView();
diff --git a/launcher/ui/instanceview/InstanceView.cpp b/launcher/ui/instanceview/InstanceView.cpp
index 690dc917b..e665097f4 100644
--- a/launcher/ui/instanceview/InstanceView.cpp
+++ b/launcher/ui/instanceview/InstanceView.cpp
@@ -39,6 +39,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -277,12 +278,14 @@ void InstanceView::mousePressEvent(QMouseEvent* event)
m_pressedAlreadySelected = selectionModel()->isSelected(m_pressedIndex);
m_pressedPosition = geometryPos;
- VisualGroup::HitResults hitResult;
- m_pressedCategory = categoryAt(geometryPos, hitResult);
- if (m_pressedCategory && hitResult & VisualGroup::CheckboxHit) {
- setState(m_pressedCategory->collapsed ? ExpandingState : CollapsingState);
- event->accept();
- return;
+ if (event->button() == Qt::LeftButton) {
+ VisualGroup::HitResults hitResult;
+ m_pressedCategory = categoryAt(geometryPos, hitResult);
+ if (m_pressedCategory && hitResult & VisualGroup::CheckboxHit) {
+ setState(m_pressedCategory->collapsed ? ExpandingState : CollapsingState);
+ event->accept();
+ return;
+ }
}
if (index.isValid() && (index.flags() & Qt::ItemIsEnabled)) {
@@ -365,10 +368,7 @@ void InstanceView::mouseReleaseEvent(QMouseEvent* event)
VisualGroup::HitResults hitResult;
- bool click =
- (index == m_pressedIndex && index.isValid()) || (m_pressedCategory && m_pressedCategory == categoryAt(geometryPos, hitResult));
-
- if (click && m_pressedCategory) {
+ if (event->button() == Qt::LeftButton && m_pressedCategory != nullptr && m_pressedCategory == categoryAt(geometryPos, hitResult)) {
if (state() == ExpandingState) {
m_pressedCategory->collapsed = false;
emit groupStateChanged(m_pressedCategory->text, false);
@@ -396,7 +396,7 @@ void InstanceView::mouseReleaseEvent(QMouseEvent* event)
setState(NoState);
- if (click) {
+ if (index == m_pressedIndex && index.isValid()) {
if (event->button() == Qt::LeftButton) {
emit clicked(index);
}
@@ -478,6 +478,38 @@ void InstanceView::paintEvent([[maybe_unused]] QPaintEvent* event)
#endif
option.widget = this;
+ if (model()->rowCount() == 0) {
+ painter.save();
+ const QString line1 = tr("Welcome!");
+ const QString line2 = tr("Click \"Add Instance\" to get started.");
+ auto rect = this->viewport()->rect();
+ auto font = option.font;
+ font.setPointSize(37);
+ painter.setFont(font);
+ auto fm = painter.fontMetrics();
+
+ if (rect.height() <= (fm.height() * 5) || rect.width() <= fm.horizontalAdvance(line2)) {
+ auto s = rect.height() / (5. * fm.height());
+ auto sx = rect.width() * 1. / fm.horizontalAdvance(line2);
+ if (s >= sx)
+ s = sx;
+ auto ps = font.pointSize() * s;
+ if (ps <= 0)
+ ps = 1;
+ font.setPointSize(ps);
+ painter.setFont(font);
+ fm = painter.fontMetrics();
+ }
+
+ // text
+ rect.setTop(rect.top() + fm.height() * 1.5);
+ painter.drawText(rect, Qt::AlignHCenter, line1);
+ rect.setTop(rect.top() + fm.height());
+ painter.drawText(rect, Qt::AlignHCenter, line2);
+ painter.restore();
+ return;
+ }
+
int wpWidth = viewport()->width();
option.rect.setWidth(wpWidth);
for (int i = 0; i < m_groups.size(); ++i) {
diff --git a/launcher/ui/pages/BasePage.h b/launcher/ui/pages/BasePage.h
index d35206a08..cb3a7633d 100644
--- a/launcher/ui/pages/BasePage.h
+++ b/launcher/ui/pages/BasePage.h
@@ -77,4 +77,4 @@ class BasePage {
bool isOpened = false;
};
-typedef std::shared_ptr BasePagePtr;
+using BasePagePtr = std::shared_ptr;
diff --git a/launcher/ui/pages/BasePageProvider.h b/launcher/ui/pages/BasePageProvider.h
index 4c3ecd6c1..422891e6b 100644
--- a/launcher/ui/pages/BasePageProvider.h
+++ b/launcher/ui/pages/BasePageProvider.h
@@ -26,7 +26,7 @@ class BasePageProvider {
};
class GenericPageProvider : public BasePageProvider {
- typedef std::function PageCreator;
+ using PageCreator = std::function;
public:
explicit GenericPageProvider(const QString& dialogTitle) : m_dialogTitle(dialogTitle) {}
diff --git a/launcher/ui/pages/global/AccountListPage.cpp b/launcher/ui/pages/global/AccountListPage.cpp
index 50f3ff2b6..2fd8a0402 100644
--- a/launcher/ui/pages/global/AccountListPage.cpp
+++ b/launcher/ui/pages/global/AccountListPage.cpp
@@ -42,22 +42,17 @@
#include
-#include "net/NetJob.h"
-
#include "ui/dialogs/CustomMessageBox.h"
#include "ui/dialogs/MSALoginDialog.h"
#include "ui/dialogs/OfflineLoginDialog.h"
#include "ui/dialogs/ProgressDialog.h"
#include "ui/dialogs/SkinUploadDialog.h"
-#include "minecraft/auth/AccountTask.h"
#include "minecraft/services/SkinDelete.h"
#include "tasks/Task.h"
#include "Application.h"
-#include "BuildConfig.h"
-
AccountListPage::AccountListPage(QWidget* parent) : QMainWindow(parent), ui(new Ui::AccountListPage)
{
ui->setupUi(this);
@@ -172,6 +167,12 @@ void AccountListPage::on_actionAddOffline_triggered()
void AccountListPage::on_actionRemove_triggered()
{
+ auto response = CustomMessageBox::selectable(this, tr("Remove account?"), tr("Do you really want to delete this account?"),
+ QMessageBox::Question, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
+ ->exec();
+ if (response != QMessageBox::Yes) {
+ return;
+ }
QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes();
if (selection.size() > 0) {
QModelIndex selected = selection.first();
@@ -230,6 +231,7 @@ void AccountListPage::updateButtonStates()
ui->actionNoDefault->setEnabled(true);
ui->actionNoDefault->setChecked(false);
}
+ ui->listView->resizeColumnToContents(3);
}
void AccountListPage::on_actionUploadSkin_triggered()
diff --git a/launcher/ui/pages/global/EnvironmentVariablesPage.cpp b/launcher/ui/pages/global/EnvironmentVariablesPage.cpp
new file mode 100644
index 000000000..2d44ed624
--- /dev/null
+++ b/launcher/ui/pages/global/EnvironmentVariablesPage.cpp
@@ -0,0 +1,71 @@
+// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * Prism Launcher - Minecraft Launcher
+ * Copyright (C) 2023 TheKodeToad
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include
+#include
+#include
+
+#include "EnvironmentVariablesPage.h"
+
+EnvironmentVariablesPage::EnvironmentVariablesPage(QWidget* parent) : QWidget(parent)
+{
+ auto verticalLayout = new QVBoxLayout(this);
+ verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
+ verticalLayout->setContentsMargins(0, 0, 0, 0);
+
+ auto tabWidget = new QTabWidget(this);
+ tabWidget->setObjectName(QStringLiteral("tabWidget"));
+ variables = new EnvironmentVariables(this);
+ variables->setContentsMargins(6, 6, 6, 6);
+ tabWidget->addTab(variables, "Foo");
+ tabWidget->tabBar()->hide();
+ verticalLayout->addWidget(tabWidget);
+
+ variables->initialize(false, false, APPLICATION->settings()->get("Env").toMap());
+}
+
+QString EnvironmentVariablesPage::displayName() const
+{
+ return tr("Environment Variables");
+}
+
+QIcon EnvironmentVariablesPage::icon() const
+{
+ return APPLICATION->getThemedIcon("environment-variables");
+}
+
+QString EnvironmentVariablesPage::id() const
+{
+ return "environment-variables";
+}
+
+QString EnvironmentVariablesPage::helpPage() const
+{
+ return "Environment-variables";
+}
+
+bool EnvironmentVariablesPage::apply()
+{
+ APPLICATION->settings()->set("Env", variables->value());
+ return true;
+}
+
+void EnvironmentVariablesPage::retranslate()
+{
+ variables->retranslate();
+}
diff --git a/launcher/ui/pages/global/EnvironmentVariablesPage.h b/launcher/ui/pages/global/EnvironmentVariablesPage.h
new file mode 100644
index 000000000..6e80775ec
--- /dev/null
+++ b/launcher/ui/pages/global/EnvironmentVariablesPage.h
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * Prism Launcher - Minecraft Launcher
+ * Copyright (C) 2023 TheKodeToad
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#pragma once
+
+#include
+
+#include "ui/pages/BasePage.h"
+#include "ui/widgets/EnvironmentVariables.h"
+
+class EnvironmentVariablesPage : public QWidget, public BasePage {
+ Q_OBJECT
+
+ public:
+ explicit EnvironmentVariablesPage(QWidget* parent = nullptr);
+
+ QString displayName() const override;
+ QIcon icon() const override;
+ QString id() const override;
+ QString helpPage() const override;
+
+ bool apply() override;
+ void retranslate() override;
+
+ private:
+ EnvironmentVariables* variables;
+};
diff --git a/launcher/ui/pages/global/LauncherPage.cpp b/launcher/ui/pages/global/LauncherPage.cpp
index 6d8c65ec5..d15883db5 100644
--- a/launcher/ui/pages/global/LauncherPage.cpp
+++ b/launcher/ui/pages/global/LauncherPage.cpp
@@ -223,6 +223,7 @@ void LauncherPage::applySettings()
// Mods
s->set("ModMetadataDisabled", ui->metadataDisableBtn->isChecked());
+ s->set("ModDependenciesDisabled", ui->dependenciesDisableBtn->isChecked());
}
void LauncherPage::loadSettings()
{
@@ -278,6 +279,7 @@ void LauncherPage::loadSettings()
// Mods
ui->metadataDisableBtn->setChecked(s->get("ModMetadataDisabled").toBool());
ui->metadataWarningLabel->setHidden(!ui->metadataDisableBtn->isChecked());
+ ui->dependenciesDisableBtn->setChecked(s->get("ModDependenciesDisabled").toBool());
}
void LauncherPage::refreshFontPreview()
diff --git a/launcher/ui/pages/global/LauncherPage.ui b/launcher/ui/pages/global/LauncherPage.ui
index 250a8bc88..83897f7a7 100644
--- a/launcher/ui/pages/global/LauncherPage.ui
+++ b/launcher/ui/pages/global/LauncherPage.ui
@@ -186,6 +186,16 @@