aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/ui')
-rw-r--r--launcher/ui/GuiUtil.cpp2
-rw-r--r--launcher/ui/MainWindow.cpp68
-rw-r--r--launcher/ui/MainWindow.h54
-rw-r--r--launcher/ui/dialogs/ModDownloadDialog.cpp24
-rw-r--r--launcher/ui/dialogs/ModDownloadDialog.h3
-rw-r--r--launcher/ui/dialogs/ProgressDialog.cpp91
-rw-r--r--launcher/ui/dialogs/ProgressDialog.ui6
-rw-r--r--launcher/ui/dialogs/ReviewMessageBox.cpp27
-rw-r--r--launcher/ui/dialogs/ReviewMessageBox.h12
-rw-r--r--launcher/ui/dialogs/ReviewMessageBox.ui81
-rw-r--r--launcher/ui/dialogs/ScrollMessageBox.ui2
-rw-r--r--launcher/ui/pages/global/APIPage.cpp5
-rw-r--r--launcher/ui/pages/global/APIPage.ui129
-rw-r--r--launcher/ui/pages/global/JavaPage.cpp6
-rw-r--r--launcher/ui/pages/global/JavaPage.ui69
-rw-r--r--launcher/ui/pages/global/LanguagePage.cpp1
-rw-r--r--launcher/ui/pages/global/LanguagePage.h1
-rw-r--r--launcher/ui/pages/global/LauncherPage.cpp21
-rw-r--r--launcher/ui/pages/global/LauncherPage.h6
-rw-r--r--launcher/ui/pages/global/LauncherPage.ui78
-rw-r--r--launcher/ui/pages/instance/LogPage.cpp2
-rw-r--r--launcher/ui/pages/instance/ModFolderPage.cpp6
-rw-r--r--launcher/ui/pages/instance/ModFolderPage.h1
-rw-r--r--launcher/ui/pages/instance/ScreenshotsPage.cpp1
-rw-r--r--launcher/ui/pages/instance/ScreenshotsPage.h1
-rw-r--r--launcher/ui/pages/instance/ServersPage.cpp2
-rw-r--r--launcher/ui/pages/instance/WorldListPage.cpp2
-rw-r--r--launcher/ui/pages/modplatform/ImportPage.cpp11
-rw-r--r--launcher/ui/pages/modplatform/ModModel.cpp75
-rw-r--r--launcher/ui/pages/modplatform/ModModel.h4
-rw-r--r--launcher/ui/pages/modplatform/ModPage.cpp126
-rw-r--r--launcher/ui/pages/modplatform/ModPage.h5
-rw-r--r--launcher/ui/pages/modplatform/flame/FlamePage.cpp68
-rw-r--r--launcher/ui/pages/modplatform/flame/FlamePage.h2
-rw-r--r--launcher/ui/pages/modplatform/legacy_ftb/ListModel.cpp37
-rw-r--r--launcher/ui/pages/modplatform/legacy_ftb/Page.cpp2
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModModel.cpp5
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModModel.h1
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp1
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModel.h1
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp32
-rw-r--r--launcher/ui/pages/modplatform/technic/TechnicPage.ui6
-rw-r--r--launcher/ui/widgets/MCModInfoFrame.cpp2
43 files changed, 766 insertions, 313 deletions
diff --git a/launcher/ui/GuiUtil.cpp b/launcher/ui/GuiUtil.cpp
index 320f1502..b1ea5ee9 100644
--- a/launcher/ui/GuiUtil.cpp
+++ b/launcher/ui/GuiUtil.cpp
@@ -2,6 +2,7 @@
/*
* PolyMC - Minecraft Launcher
* Copyright (C) 2022 Lenny McLennington <lenny@sneed.church>
+ * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
*
* 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
@@ -38,6 +39,7 @@
#include <QClipboard>
#include <QApplication>
#include <QFileDialog>
+#include <QStandardPaths>
#include "ui/dialogs/ProgressDialog.h"
#include "ui/dialogs/CustomMessageBox.h"
diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp
index 7e152b96..210442df 100644
--- a/launcher/ui/MainWindow.cpp
+++ b/launcher/ui/MainWindow.cpp
@@ -1,21 +1,42 @@
-/* Copyright 2013-2021 MultiMC Contributors
+// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * PolyMC - Minecraft Launcher
+ * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
+ *
+ * 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 <https://www.gnu.org/licenses/>.
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
*
- * Authors: Andrew Okin
- * Peterix
- * Orochimarufan <orochimarufan.x3@gmail.com>
+ * 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
+ * Authors: Andrew Okin
+ * Peterix
+ * Orochimarufan <orochimarufan.x3@gmail.com>
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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
*
- * 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.
+ * 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 "Application.h"
#include "BuildConfig.h"
@@ -1010,6 +1031,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
}
+#ifdef LAUNCHER_WITH_UPDATER
if(BuildConfig.UPDATER_ENABLED)
{
bool updatesAllowed = APPLICATION->updatesAreAllowed();
@@ -1028,6 +1050,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
updater->checkForUpdate(APPLICATION->settings()->get("UpdateChannel").toString(), false);
}
}
+#endif
setSelectedInstanceById(APPLICATION->settings()->get("SelectedInstance").toString());
@@ -1337,6 +1360,7 @@ void MainWindow::repopulateAccountsMenu()
ui->profileMenu->addAction(ui->actionManageAccounts);
}
+#ifdef LAUNCHER_WITH_UPDATER
void MainWindow::updatesAllowedChanged(bool allowed)
{
if(!BuildConfig.UPDATER_ENABLED)
@@ -1345,6 +1369,7 @@ void MainWindow::updatesAllowedChanged(bool allowed)
}
ui->actionCheckUpdate->setEnabled(allowed);
}
+#endif
/*
* Assumes the sender is a QAction
@@ -1450,6 +1475,7 @@ void MainWindow::updateNewsLabel()
}
}
+#ifdef LAUNCHER_WITH_UPDATER
void MainWindow::updateAvailable(GoUpdate::Status status)
{
if(!APPLICATION->updatesAreAllowed())
@@ -1475,6 +1501,7 @@ void MainWindow::updateNotAvailable()
UpdateDialog dlg(false, this);
dlg.exec();
}
+#endif
QList<int> stringToIntList(const QString &string)
{
@@ -1496,6 +1523,7 @@ QString intListToString(const QList<int> &list)
return slist.join(',');
}
+#ifdef LAUNCHER_WITH_UPDATER
void MainWindow::downloadUpdates(GoUpdate::Status status)
{
if(!APPLICATION->updatesAreAllowed())
@@ -1529,6 +1557,7 @@ void MainWindow::downloadUpdates(GoUpdate::Status status)
CustomMessageBox::selectable(this, tr("Error"), updateTask.failReason(), QMessageBox::Warning)->show();
}
}
+#endif
void MainWindow::onCatToggled(bool state)
{
@@ -1841,6 +1870,7 @@ void MainWindow::on_actionConfig_Folder_triggered()
}
}
+#ifdef LAUNCHER_WITH_UPDATER
void MainWindow::checkForUpdates()
{
if(BuildConfig.UPDATER_ENABLED)
@@ -1853,6 +1883,7 @@ void MainWindow::checkForUpdates()
qWarning() << "Updater not set up. Cannot check for updates.";
}
}
+#endif
void MainWindow::on_actionSettings_triggered()
{
@@ -2101,6 +2132,9 @@ void MainWindow::instanceChanged(const QModelIndex &current, 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 +2161,8 @@ void MainWindow::instanceChanged(const QModelIndex &current, const QModelIndex &
updateToolsMenu();
APPLICATION->settings()->set("SelectedInstance", m_selectedInstance->id());
+
+ connect(m_selectedInstance.get(), &BaseInstance::runningStatusChanged, this, &MainWindow::refreshCurrentInstance);
}
else
{
@@ -2216,3 +2252,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..6c64756f 100644
--- a/launcher/ui/MainWindow.h
+++ b/launcher/ui/MainWindow.h
@@ -1,16 +1,40 @@
-/* Copyright 2013-2021 MultiMC Contributors
+// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * PolyMC - Minecraft Launcher
+ * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
*
- * 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
+ * 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.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
*
- * 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.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 2013-2021 MultiMC Contributors
+ *
+ * Authors: Andrew Okin
+ * Peterix
+ * Orochimarufan <orochimarufan.x3@gmail.com>
+ *
+ * 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
@@ -54,7 +78,9 @@ public:
void checkInstancePathForProblems();
+#ifdef LAUNCHER_WITH_UPDATER
void updatesAllowedChanged(bool allowed);
+#endif
void droppedURLs(QList<QUrl> urls);
signals:
@@ -100,7 +126,9 @@ private slots:
void on_actionViewCentralModsFolder_triggered();
+#ifdef LAUNCHER_WITH_UPDATER
void checkForUpdates();
+#endif
void on_actionSettings_triggered();
@@ -167,9 +195,11 @@ private slots:
void startTask(Task *task);
+#ifdef LAUNCHER_WITH_UPDATER
void updateAvailable(GoUpdate::Status status);
void updateNotAvailable();
+#endif
void defaultAccountChanged();
@@ -179,10 +209,12 @@ private slots:
void updateNewsLabel();
+#ifdef LAUNCHER_WITH_UPDATER
/*!
* Runs the DownloadTask and installs updates.
*/
void downloadUpdates(GoUpdate::Status status);
+#endif
void konamiTriggered();
@@ -192,6 +224,8 @@ private slots:
void keyReleaseEvent(QKeyEvent *event) override;
#endif
+ void refreshCurrentInstance(bool running);
+
private:
void retranslateUi();
diff --git a/launcher/ui/dialogs/ModDownloadDialog.cpp b/launcher/ui/dialogs/ModDownloadDialog.cpp
index 305e85c0..f01c9c07 100644
--- a/launcher/ui/dialogs/ModDownloadDialog.cpp
+++ b/launcher/ui/dialogs/ModDownloadDialog.cpp
@@ -77,18 +77,20 @@ void ModDownloadDialog::confirm()
auto keys = modTask.keys();
keys.sort(Qt::CaseInsensitive);
- auto confirm_dialog = ReviewMessageBox::create(
- this,
- tr("Confirm mods to download")
- );
+ auto confirm_dialog = ReviewMessageBox::create(this, tr("Confirm mods to download"));
- for(auto& task : keys){
- confirm_dialog->appendMod(task, modTask.find(task).value()->getFilename());
+ for (auto& task : keys) {
+ confirm_dialog->appendMod({ task, modTask.find(task).value()->getFilename() });
}
- connect(confirm_dialog, &QDialog::accepted, this, &ModDownloadDialog::accept);
+ if (confirm_dialog->exec()) {
+ auto deselected = confirm_dialog->deselectedMods();
+ for (auto name : deselected) {
+ modTask.remove(name);
+ }
- confirm_dialog->open();
+ this->accept();
+ }
}
void ModDownloadDialog::accept()
@@ -132,6 +134,12 @@ bool ModDownloadDialog::isModSelected(const QString &name, const QString& filena
return iter != modTask.end() && (iter.value()->getFilename() == filename);
}
+bool ModDownloadDialog::isModSelected(const QString &name) const
+{
+ auto iter = modTask.find(name);
+ return iter != modTask.end();
+}
+
ModDownloadDialog::~ModDownloadDialog()
{
}
diff --git a/launcher/ui/dialogs/ModDownloadDialog.h b/launcher/ui/dialogs/ModDownloadDialog.h
index 782dc361..5c565ad3 100644
--- a/launcher/ui/dialogs/ModDownloadDialog.h
+++ b/launcher/ui/dialogs/ModDownloadDialog.h
@@ -32,6 +32,7 @@ public:
void addSelectedMod(const QString & name = QString(), ModDownloadTask * task = nullptr);
void removeSelectedMod(const QString & name = QString());
bool isModSelected(const QString & name, const QString & filename) const;
+ bool isModSelected(const QString & name) const;
const QList<ModDownloadTask*> getTasks();
const std::shared_ptr<ModFolderModel> &mods;
@@ -41,8 +42,6 @@ public slots:
void accept() override;
void reject() override;
-//private slots:
-
private:
Ui::ModDownloadDialog *ui = nullptr;
PageContainer * m_container = nullptr;
diff --git a/launcher/ui/dialogs/ProgressDialog.cpp b/launcher/ui/dialogs/ProgressDialog.cpp
index 648bd88b..e5226016 100644
--- a/launcher/ui/dialogs/ProgressDialog.cpp
+++ b/launcher/ui/dialogs/ProgressDialog.cpp
@@ -16,12 +16,12 @@
#include "ProgressDialog.h"
#include "ui_ProgressDialog.h"
-#include <QKeyEvent>
#include <QDebug>
+#include <QKeyEvent>
#include "tasks/Task.h"
-ProgressDialog::ProgressDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ProgressDialog)
+ProgressDialog::ProgressDialog(QWidget* parent) : QDialog(parent), ui(new Ui::ProgressDialog)
{
ui->setupUi(this);
this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
@@ -44,6 +44,7 @@ void ProgressDialog::on_skipButton_clicked(bool checked)
{
Q_UNUSED(checked);
task->abort();
+ QDialog::reject();
}
ProgressDialog::~ProgressDialog()
@@ -53,24 +54,22 @@ ProgressDialog::~ProgressDialog()
void ProgressDialog::updateSize()
{
- QSize qSize = QSize(480, minimumSizeHint().height());
+ QSize qSize = QSize(480, minimumSizeHint().height());
resize(qSize);
- setFixedSize(qSize);
+ setFixedSize(qSize);
}
-int ProgressDialog::execWithTask(Task *task)
+int ProgressDialog::execWithTask(Task* task)
{
this->task = task;
QDialog::DialogCode result;
- if(!task)
- {
+ if (!task) {
qDebug() << "Programmer error: progress dialog created with null task.";
return Accepted;
}
- if(handleImmediateResult(result))
- {
+ if (handleImmediateResult(result)) {
return result;
}
@@ -78,58 +77,51 @@ int ProgressDialog::execWithTask(Task *task)
connect(task, SIGNAL(started()), SLOT(onTaskStarted()));
connect(task, SIGNAL(failed(QString)), SLOT(onTaskFailed(QString)));
connect(task, SIGNAL(succeeded()), SLOT(onTaskSucceeded()));
- connect(task, SIGNAL(status(QString)), SLOT(changeStatus(const QString &)));
+ connect(task, SIGNAL(status(QString)), SLOT(changeStatus(const QString&)));
+ connect(task, SIGNAL(stepStatus(QString)), SLOT(changeStatus(const QString&)));
connect(task, SIGNAL(progress(qint64, qint64)), SLOT(changeProgress(qint64, qint64)));
+ connect(task, &Task::aborted, [this] { onTaskFailed(tr("Aborted by user")); });
+
m_is_multi_step = task->isMultiStep();
- if(!m_is_multi_step){
+ if (!m_is_multi_step) {
ui->globalStatusLabel->setHidden(true);
ui->globalProgressBar->setHidden(true);
}
// if this didn't connect to an already running task, invoke start
- if(!task->isRunning())
- {
+ if (!task->isRunning()) {
task->start();
}
- if(task->isRunning())
- {
+ if (task->isRunning()) {
changeProgress(task->getProgress(), task->getTotalProgress());
changeStatus(task->getStatus());
return QDialog::exec();
- }
- else if(handleImmediateResult(result))
- {
+ } else if (handleImmediateResult(result)) {
return result;
- }
- else
- {
+ } else {
return QDialog::Rejected;
}
}
// TODO: only provide the unique_ptr overloads
-int ProgressDialog::execWithTask(std::unique_ptr<Task> &&task)
+int ProgressDialog::execWithTask(std::unique_ptr<Task>&& task)
{
connect(this, &ProgressDialog::destroyed, task.get(), &Task::deleteLater);
return execWithTask(task.release());
}
-int ProgressDialog::execWithTask(std::unique_ptr<Task> &task)
+int ProgressDialog::execWithTask(std::unique_ptr<Task>& task)
{
connect(this, &ProgressDialog::destroyed, task.get(), &Task::deleteLater);
return execWithTask(task.release());
}
-bool ProgressDialog::handleImmediateResult(QDialog::DialogCode &result)
+bool ProgressDialog::handleImmediateResult(QDialog::DialogCode& result)
{
- if(task->isFinished())
- {
- if(task->wasSuccessful())
- {
+ if (task->isFinished()) {
+ if (task->wasSuccessful()) {
result = QDialog::Accepted;
- }
- else
- {
+ } else {
result = QDialog::Rejected;
}
return true;
@@ -137,14 +129,12 @@ bool ProgressDialog::handleImmediateResult(QDialog::DialogCode &result)
return false;
}
-Task *ProgressDialog::getTask()
+Task* ProgressDialog::getTask()
{
return task;
}
-void ProgressDialog::onTaskStarted()
-{
-}
+void ProgressDialog::onTaskStarted() {}
void ProgressDialog::onTaskFailed(QString failure)
{
@@ -156,10 +146,11 @@ void ProgressDialog::onTaskSucceeded()
accept();
}
-void ProgressDialog::changeStatus(const QString &status)
+void ProgressDialog::changeStatus(const QString& status)
{
+ ui->globalStatusLabel->setText(task->getStatus());
ui->statusLabel->setText(task->getStepStatus());
- ui->globalStatusLabel->setText(status);
+
updateSize();
}
@@ -168,27 +159,22 @@ void ProgressDialog::changeProgress(qint64 current, qint64 total)
ui->globalProgressBar->setMaximum(total);
ui->globalProgressBar->setValue(current);
- if(!m_is_multi_step){
+ if (!m_is_multi_step) {
ui->taskProgressBar->setMaximum(total);
ui->taskProgressBar->setValue(current);
- }
- else{
+ } else {
ui->taskProgressBar->setMaximum(task->getStepProgress());
ui->taskProgressBar->setValue(task->getStepTotalProgress());
}
}
-void ProgressDialog::keyPressEvent(QKeyEvent *e)
+void ProgressDialog::keyPressEvent(QKeyEvent* e)
{
- if(ui->skipButton->isVisible())
- {
- if (e->key() == Qt::Key_Escape)
- {
+ if (ui->skipButton->isVisible()) {
+ if (e->key() == Qt::Key_Escape) {
on_skipButton_clicked(true);
return;
- }
- else if(e->key() == Qt::Key_Tab)
- {
+ } else if (e->key() == Qt::Key_Tab) {
ui->skipButton->setFocusPolicy(Qt::StrongFocus);
ui->skipButton->setFocus();
ui->skipButton->setAutoDefault(true);
@@ -199,14 +185,11 @@ void ProgressDialog::keyPressEvent(QKeyEvent *e)
QDialog::keyPressEvent(e);
}
-void ProgressDialog::closeEvent(QCloseEvent *e)
+void ProgressDialog::closeEvent(QCloseEvent* e)
{
- if (task && task->isRunning())
- {
+ if (task && task->isRunning()) {
e->ignore();
- }
- else
- {
+ } else {
QDialog::closeEvent(e);
}
}
diff --git a/launcher/ui/dialogs/ProgressDialog.ui b/launcher/ui/dialogs/ProgressDialog.ui
index bf119a78..34ab71e3 100644
--- a/launcher/ui/dialogs/ProgressDialog.ui
+++ b/launcher/ui/dialogs/ProgressDialog.ui
@@ -40,6 +40,12 @@
</item>
<item row="2" column="0">
<widget class="QLabel" name="statusLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="text">
<string>Task Status...</string>
</property>
diff --git a/launcher/ui/dialogs/ReviewMessageBox.cpp b/launcher/ui/dialogs/ReviewMessageBox.cpp
index 2bfd02e0..c92234a4 100644
--- a/launcher/ui/dialogs/ReviewMessageBox.cpp
+++ b/launcher/ui/dialogs/ReviewMessageBox.cpp
@@ -5,6 +5,9 @@ ReviewMessageBox::ReviewMessageBox(QWidget* parent, QString const& title, QStrin
: QDialog(parent), ui(new Ui::ReviewMessageBox)
{
ui->setupUi(this);
+
+ connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &ReviewMessageBox::accept);
+ connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &ReviewMessageBox::reject);
}
ReviewMessageBox::~ReviewMessageBox()
@@ -17,15 +20,33 @@ auto ReviewMessageBox::create(QWidget* parent, QString&& title, QString&& icon)
return new ReviewMessageBox(parent, title, icon);
}
-void ReviewMessageBox::appendMod(const QString& name, const QString& filename)
+void ReviewMessageBox::appendMod(ModInformation&& info)
{
auto itemTop = new QTreeWidgetItem(ui->modTreeWidget);
- itemTop->setText(0, name);
+ itemTop->setCheckState(0, Qt::CheckState::Checked);
+ itemTop->setText(0, info.name);
auto filenameItem = new QTreeWidgetItem(itemTop);
- filenameItem->setText(0, tr("Filename: %1").arg(filename));
+ filenameItem->setText(0, tr("Filename: %1").arg(info.filename));
itemTop->insertChildren(0, { filenameItem });
ui->modTreeWidget->addTopLevelItem(itemTop);
}
+
+auto ReviewMessageBox::deselectedMods() -> QStringList
+{
+ QStringList list;
+
+ auto* item = ui->modTreeWidget->topLevelItem(0);
+
+ for (int i = 0; item != nullptr; ++i) {
+ if (item->checkState(0) == Qt::CheckState::Unchecked) {
+ list.append(item->text(0));
+ }
+
+ item = ui->modTreeWidget->topLevelItem(i);
+ }
+
+ return list;
+}
diff --git a/launcher/ui/dialogs/ReviewMessageBox.h b/launcher/ui/dialogs/ReviewMessageBox.h
index 48742cd9..9cfa679a 100644
--- a/