From 4c013e59f0e9a481bc63281c0d9e349827419d37 Mon Sep 17 00:00:00 2001
From: DioEgizio <83089242+DioEgizio@users.noreply.github.com>
Date: Sat, 25 Mar 2023 10:45:34 +0100
Subject: divide minecraftpage into tabs
this way small screen users can use the launcher settings without having window a bigger than their actual screens
Signed-off-by: DioEgizio <83089242+DioEgizio@users.noreply.github.com>
---
launcher/ui/pages/global/MinecraftPage.cpp | 1 -
launcher/ui/pages/global/MinecraftPage.ui | 133 ++++++++++++++++-------------
2 files changed, 74 insertions(+), 60 deletions(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/pages/global/MinecraftPage.cpp b/launcher/ui/pages/global/MinecraftPage.cpp
index cc597fe0..eca3e865 100644
--- a/launcher/ui/pages/global/MinecraftPage.cpp
+++ b/launcher/ui/pages/global/MinecraftPage.cpp
@@ -46,7 +46,6 @@
MinecraftPage::MinecraftPage(QWidget *parent) : QWidget(parent), ui(new Ui::MinecraftPage)
{
ui->setupUi(this);
- ui->tabWidget->tabBar()->hide();
loadSettings();
updateCheckboxStuff();
}
diff --git a/launcher/ui/pages/global/MinecraftPage.ui b/launcher/ui/pages/global/MinecraftPage.ui
index 640f436d..cff071bf 100644
--- a/launcher/ui/pages/global/MinecraftPage.ui
+++ b/launcher/ui/pages/global/MinecraftPage.ui
@@ -7,7 +7,7 @@
0
0
936
- 1134
+ 541
@@ -39,7 +39,7 @@
- Minecraft
+ General
-
@@ -112,22 +112,29 @@
-
-
+
- Native library workarounds
+ Game time
-
+
-
-
+
- Use system installation of &GLFW
+ Show time spent &playing instances
-
-
+
- Use system installation of &OpenAL
+ Show time spent playing across &all instances
+
+
+
+ -
+
+
+ &Record time spent playing instances
@@ -135,38 +142,28 @@
-
-
+
- Performance
+ Miscellaneous
-
-
-
-
-
- <html><head/><body><p>Enable Feral Interactive's GameMode, to potentially improve gaming performance.</p></body></html>
-
-
- Enable Feral GameMode
-
-
-
+
-
-
+
- <html><head/><body><p>Enable MangoHud's advanced performance overlay.</p></body></html>
+ <html><head/><body><p>The launcher will automatically reopen when the game crashes or exits.</p></body></html>
- Enable MangoHud
+ &Close the launcher after game window opens
-
-
+
- <html><head/><body><p>Use the discrete GPU instead of the primary GPU.</p></body></html>
+ <html><head/><body><p>The launcher will automatically quit after the game exits or crashes.</p></body></html>
- Use discrete GPU
+ &Quit the launcher after game window closes
@@ -174,29 +171,42 @@
-
-
+
+
+ Qt::Vertical
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+
+ System-related tweaks
+
+
+ -
+
- Game time
+ Native library workarounds
-
+
-
-
-
- Show time spent &playing instances
-
-
-
- -
-
+
- Show time spent playing across &all instances
+ Use system installation of &GLFW
-
-
+
- &Record time spent playing instances
+ Use system installation of &OpenAL
@@ -204,28 +214,38 @@
-
-
+
- Miscellaneous
+ Performance
-
+
-
-
+
- <html><head/><body><p>The launcher will automatically reopen when the game crashes or exits.</p></body></html>
+ <html><head/><body><p>Enable Feral Interactive's GameMode, to potentially improve gaming performance.</p></body></html>
- &Close the launcher after game window opens
+ Enable Feral GameMode
-
-
+
- <html><head/><body><p>The launcher will automatically quit after the game exits or crashes.</p></body></html>
+ <html><head/><body><p>Enable MangoHud's advanced performance overlay.</p></body></html>
- &Quit the launcher after game window closes
+ Enable MangoHud
+
+
+
+ -
+
+
+ <html><head/><body><p>Use the discrete GPU instead of the primary GPU.</p></body></html>
+
+
+ Use discrete GPU
@@ -233,14 +253,14 @@
-
-
+
Qt::Vertical
- 0
- 0
+ 20
+ 40
@@ -255,11 +275,6 @@
maximizedCheckBox
windowWidthSpinBox
windowHeightSpinBox
- useNativeGLFWCheck
- useNativeOpenALCheck
- enableFeralGamemodeCheck
- enableMangoHud
- useDiscreteGpuCheck
--
cgit
From 12f0d51c0cd03d660425566264b502736b104310 Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Mon, 17 Apr 2023 17:51:34 -0700
Subject: Fix: signal/slot macro -> func pointer & network fixes - convert qt
connect calls to use function pointers instead of the signal/slot macros
wherever practical (UI classes were mostly left alone, target was tasks and
processes) - give signals an explicit receivers to use the static method over
the instance method wherever practical - ensure networks tasks are using the
`errorOccured` signal added in Qt5.15 over the deprecated `error` signal -
ensure all networks tasks have an sslErrors signal connected - add seemingly
missing `MinecraftAccount::authSucceeded` connection for `MSAInteractive`
login flow
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
launcher/ui/pages/instance/VersionPage.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/pages/instance/VersionPage.cpp b/launcher/ui/pages/instance/VersionPage.cpp
index 7fff3b93..fffb96f2 100644
--- a/launcher/ui/pages/instance/VersionPage.cpp
+++ b/launcher/ui/pages/instance/VersionPage.cpp
@@ -501,7 +501,7 @@ void VersionPage::on_actionDownload_All_triggered()
return;
}
ProgressDialog tDialog(this);
- connect(updateTask.get(), SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString)));
+ connect(updateTask.get(), &Task::failed, this, &VersionPage::onGameUpdateError);
// FIXME: unused return value
tDialog.execWithTask(updateTask.get());
updateButtons();
--
cgit
From f997529cd4fb077b06d05da9c6ff0c23b85b4ebb Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Thu, 30 Mar 2023 11:22:55 -0700
Subject: feat: better task tracking
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
launcher/ui/dialogs/ProgressDialog.cpp | 109 ++++++++++++++++++++++++-----
launcher/ui/dialogs/ProgressDialog.h | 54 +++++++++++---
launcher/ui/dialogs/ProgressDialog.ui | 61 ++++++++--------
launcher/ui/widgets/SubTaskProgressBar.cpp | 58 +++++++++++++++
launcher/ui/widgets/SubTaskProgressBar.h | 50 +++++++++++++
launcher/ui/widgets/SubTaskProgressBar.ui | 70 ++++++++++++++++++
6 files changed, 341 insertions(+), 61 deletions(-)
create mode 100644 launcher/ui/widgets/SubTaskProgressBar.cpp
create mode 100644 launcher/ui/widgets/SubTaskProgressBar.h
create mode 100644 launcher/ui/widgets/SubTaskProgressBar.ui
(limited to 'launcher/ui')
diff --git a/launcher/ui/dialogs/ProgressDialog.cpp b/launcher/ui/dialogs/ProgressDialog.cpp
index da73a449..da627af3 100644
--- a/launcher/ui/dialogs/ProgressDialog.cpp
+++ b/launcher/ui/dialogs/ProgressDialog.cpp
@@ -1,26 +1,66 @@
-/* Copyright 2013-2021 MultiMC Contributors
+/// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * PrismLaucher - Minecraft Launcher
+ * Copyright (C) 2023 Rachel Powers <508861+Ryex@users.noreply.github.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
+ * 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 .
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * 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.
*/
#include "ProgressDialog.h"
#include "ui_ProgressDialog.h"
+#include
#include
#include
#include "tasks/Task.h"
+#include "ui/widgets/SubTaskProgressBar.h"
+
+
+template
+int map_int_range(T value)
+{
+ auto type_min = std::numeric_limits::min();
+ auto type_max = std::numeric_limits::max();
+
+ auto int_min = std::numeric_limits::min();
+ auto int_max = std::numeric_limits::max();
+
+ auto type_range = type_max - type_min;
+ auto int_range = int_max - int_min;
+
+ return static_cast((value - type_min) * int_range / type_range + int_min);
+}
+
+
ProgressDialog::ProgressDialog(QWidget* parent) : QDialog(parent), ui(new Ui::ProgressDialog)
{
ui->setupUi(this);
@@ -79,7 +119,7 @@ int ProgressDialog::execWithTask(Task* task)
connect(task, &Task::failed, this, &ProgressDialog::onTaskFailed);
connect(task, &Task::succeeded, this, &ProgressDialog::onTaskSucceeded);
connect(task, &Task::status, this, &ProgressDialog::changeStatus);
- connect(task, &Task::stepStatus, this, &ProgressDialog::changeStatus);
+ connect(task, &Task::stepProgress, this, &ProgressDialog::changeStepProgress);
connect(task, &Task::progress, this, &ProgressDialog::changeProgress);
connect(task, &Task::aborted, this, &ProgressDialog::hide);
@@ -149,23 +189,54 @@ void ProgressDialog::onTaskSucceeded()
void ProgressDialog::changeStatus(const QString& status)
{
ui->globalStatusLabel->setText(task->getStatus());
- ui->statusLabel->setText(task->getStepStatus());
+ // ui->statusLabel->setText(task->getStepStatus());
updateSize();
}
+void ProgressDialog::addTaskProgress(TaskStepProgress progress)
+{
+ SubTaskProgressBar* task_bar = new SubTaskProgressBar(this);
+ taskProgress.insert(progress.uid, task_bar);
+ ui->taskProgressLayout->addWidget(task_bar);
+}
+
+void ProgressDialog::changeStepProgress(QList task_progress)
+{
+ for (auto tp : task_progress) {
+ if (!taskProgress.contains(tp.uid))
+ addTaskProgress(tp);
+ auto task_bar = taskProgress.value(tp.uid);
+
+ if (tp.total < 0) {
+ task_bar->setRange(0, 0);
+ } else {
+ task_bar->setRange(0, map_int_range(tp.total));
+ }
+
+ task_bar->setValue(map_int_range(tp.current));
+ task_bar->setStatus(tp.status);
+ task_bar->setDetails(tp.details);
+
+ if (tp.isDone()) {
+ task_bar->setVisible(false);
+ }
+
+ }
+}
+
void ProgressDialog::changeProgress(qint64 current, qint64 total)
{
ui->globalProgressBar->setMaximum(total);
ui->globalProgressBar->setValue(current);
- if (!m_is_multi_step) {
- ui->taskProgressBar->setMaximum(total);
- ui->taskProgressBar->setValue(current);
- } else {
- ui->taskProgressBar->setMaximum(task->getStepProgress());
- ui->taskProgressBar->setValue(task->getStepTotalProgress());
- }
+ // if (!m_is_multi_step) {
+ // ui->taskProgressBar->setMaximum(total);
+ // ui->taskProgressBar->setValue(current);
+ // } else {
+ // ui->taskProgressBar->setMaximum(task->getStepProgress());
+ // ui->taskProgressBar->setValue(task->getStepTotalProgress());
+ // }
}
void ProgressDialog::keyPressEvent(QKeyEvent* e)
diff --git a/launcher/ui/dialogs/ProgressDialog.h b/launcher/ui/dialogs/ProgressDialog.h
index 0b4b78a4..a7e203fb 100644
--- a/launcher/ui/dialogs/ProgressDialog.h
+++ b/launcher/ui/dialogs/ProgressDialog.h
@@ -1,22 +1,50 @@
-/* Copyright 2013-2021 MultiMC Contributors
+/// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * PrismLaucher - Minecraft Launcher
+ * Copyright (C) 2023 Rachel Powers <508861+Ryex@users.noreply.github.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
+ * 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 .
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * 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
#include
+#include
+#include
+
+#include "QObjectPtr.h"
+#include "tasks/Task.h"
+
+#include "ui/widgets/SubTaskProgressBar.h"
class Task;
class SequentialTask;
@@ -52,6 +80,7 @@ slots:
void changeStatus(const QString &status);
void changeProgress(qint64 current, qint64 total);
+ void changeStepProgress(QList task_progress);
private
@@ -64,6 +93,7 @@ protected:
private:
bool handleImmediateResult(QDialog::DialogCode &result);
+ void addTaskProgress(TaskStepProgress progress);
private:
Ui::ProgressDialog *ui;
@@ -71,4 +101,8 @@ private:
Task *task;
bool m_is_multi_step = false;
+ QHash taskProgress;
+
+
};
+
diff --git a/launcher/ui/dialogs/ProgressDialog.ui b/launcher/ui/dialogs/ProgressDialog.ui
index 34ab71e3..0a998987 100644
--- a/launcher/ui/dialogs/ProgressDialog.ui
+++ b/launcher/ui/dialogs/ProgressDialog.ui
@@ -2,6 +2,20 @@
ProgressDialog
+
+
+ 0
+ 0
+ 400
+ 109
+
+
+
+
+ 0
+ 0
+
+
400
@@ -18,6 +32,16 @@
Please wait...
+
-
+
+
+ true
+
+
+ 24
+
+
+
-
@@ -31,15 +55,11 @@
- -
-
-
- Global Task Status...
-
-
+
-
+
- -
-
+
-
+
0
@@ -47,30 +67,7 @@
- Task Status...
-
-
- true
-
-
-
- -
-
-
- 24
-
-
- false
-
-
-
- -
-
-
- true
-
-
- 24
+ Global Task Status...
diff --git a/launcher/ui/widgets/SubTaskProgressBar.cpp b/launcher/ui/widgets/SubTaskProgressBar.cpp
new file mode 100644
index 00000000..84ea5f20
--- /dev/null
+++ b/launcher/ui/widgets/SubTaskProgressBar.cpp
@@ -0,0 +1,58 @@
+// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * PrismLaucher - Minecraft Launcher
+ * Copyright (C) 2022 Rachel Powers <508861+Ryex@users.noreply.github.com>
+ *
+ * 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 "SubTaskProgressBar.h"
+#include "ui_SubTaskProgressBar.h"
+
+unique_qobject_ptr SubTaskProgressBar::create(QWidget* parent)
+{
+ auto progress_bar = new SubTaskProgressBar(parent);
+ return unique_qobject_ptr(progress_bar);
+}
+
+SubTaskProgressBar::SubTaskProgressBar(QWidget* parent)
+ : ui(new Ui::SubTaskProgressBar)
+{
+ ui->setupUi(this);
+}
+SubTaskProgressBar::~SubTaskProgressBar()
+{
+ delete ui;
+}
+
+void SubTaskProgressBar::setRange(int min, int max)
+{
+ ui->progressBar->setRange(min, max);
+}
+
+void SubTaskProgressBar::setValue(int value)
+{
+ ui->progressBar->setValue(value);
+}
+
+void SubTaskProgressBar::setStatus(QString status)
+{
+ ui->statusLabel->setText(status);
+}
+
+void SubTaskProgressBar::setDetails(QString details)
+{
+ ui->statusDetailsLabel->setText(details);
+}
+
diff --git a/launcher/ui/widgets/SubTaskProgressBar.h b/launcher/ui/widgets/SubTaskProgressBar.h
new file mode 100644
index 00000000..3375a0bc
--- /dev/null
+++ b/launcher/ui/widgets/SubTaskProgressBar.h
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * PrismLaucher - Minecraft Launcher
+ * Copyright (C) 2022 Rachel Powers <508861+Ryex@users.noreply.github.com>
+ *
+ * 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
+#include
+#include "QObjectPtr.h"
+
+namespace Ui {
+class SubTaskProgressBar;
+}
+
+class SubTaskProgressBar : public QWidget
+{
+ Q_OBJECT
+
+public:
+ static unique_qobject_ptr create(QWidget* parent = nullptr);
+
+ SubTaskProgressBar(QWidget* parent = nullptr);
+ ~SubTaskProgressBar();
+
+ void setRange(int min, int max);
+ void setValue(int value);
+ void setStatus(QString status);
+ void setDetails(QString details);
+
+
+
+private:
+ Ui::SubTaskProgressBar* ui;
+
+};
diff --git a/launcher/ui/widgets/SubTaskProgressBar.ui b/launcher/ui/widgets/SubTaskProgressBar.ui
new file mode 100644
index 00000000..966fdb88
--- /dev/null
+++ b/launcher/ui/widgets/SubTaskProgressBar.ui
@@ -0,0 +1,70 @@
+
+
+ SubTaskProgressBar
+
+
+
+ 0
+ 0
+ 265
+ 65
+
+
+
+
+ 0
+ 0
+
+
+
+ Form
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Sub Task Status...
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Status Details
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+
+
+ -
+
+
+ 24
+
+
+ true
+
+
+
+
+
+
+
+
--
cgit
From 9d2f0e4dc8fc3995052770c6a7948cb0372fdcbb Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Thu, 30 Mar 2023 23:50:29 -0700
Subject: feat: Propogated subtask progress
Oh boy this is big.
> TaskStepProgress struct is now QMetaObject compatabile and can be sent through signals
> Task now has a method to propogates sub task progress it must be signal bound by each task containing a task wishing to report progress of it's children.
> Downloads report speed
> Tasks now have UUIDS to track them
- use when reporting
- use when logging
- use when storeing them or objects related to them
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
launcher/ui/dialogs/ProgressDialog.cpp | 65 ++++++++++--------
launcher/ui/dialogs/ProgressDialog.h | 4 +-
launcher/ui/dialogs/ProgressDialog.ui | 108 ++++++++++++++++++++++++------
launcher/ui/widgets/SubTaskProgressBar.ui | 31 +++++++--
4 files changed, 152 insertions(+), 56 deletions(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/dialogs/ProgressDialog.cpp b/launcher/ui/dialogs/ProgressDialog.cpp
index da627af3..f7a3a862 100644
--- a/launcher/ui/dialogs/ProgressDialog.cpp
+++ b/launcher/ui/dialogs/ProgressDialog.cpp
@@ -48,10 +48,12 @@
template
int map_int_range(T value)
{
- auto type_min = std::numeric_limits::min();
+ // auto type_min = std::numeric_limits::min();
+ auto type_min = 0;
auto type_max = std::numeric_limits::max();
- auto int_min = std::numeric_limits::min();
+ // auto int_min = std::numeric_limits::min();
+ auto int_min = 0;
auto int_max = std::numeric_limits::max();
auto type_range = type_max - type_min;
@@ -64,6 +66,7 @@ int map_int_range(T value)
ProgressDialog::ProgressDialog(QWidget* parent) : QDialog(parent), ui(new Ui::ProgressDialog)
{
ui->setupUi(this);
+ ui->taskProgressScrollArea->setHidden(true);
this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
setAttribute(Qt::WidgetAttribute::WA_QuitOnClose, true);
setSkipButton(false);
@@ -94,10 +97,17 @@ ProgressDialog::~ProgressDialog()
}
void ProgressDialog::updateSize()
-{
+{
+ QSize lastSize = this->size();
QSize qSize = QSize(480, minimumSizeHint().height());
resize(qSize);
setFixedSize(qSize);
+ // keep the dialog in the center after a resize
+ if (lastSize != qSize)
+ this->move(
+ this->parentWidget()->x() + (this->parentWidget()->width() - this->width()) / 2,
+ this->parentWidget()->y() + (this->parentWidget()->height() - this->height()) / 2
+ );
}
int ProgressDialog::execWithTask(Task* task)
@@ -126,10 +136,8 @@ int ProgressDialog::execWithTask(Task* task)
connect(task, &Task::abortStatusChanged, ui->skipButton, &QPushButton::setEnabled);
m_is_multi_step = task->isMultiStep();
- if (!m_is_multi_step) {
- ui->globalStatusLabel->setHidden(true);
- ui->globalProgressBar->setHidden(true);
- }
+ ui->taskProgressScrollArea->setHidden(!m_is_multi_step);
+ updateSize();
// It's a good idea to start the task after we entered the dialog's event loop :^)
if (!task->isRunning()) {
@@ -139,6 +147,9 @@ int ProgressDialog::execWithTask(Task* task)
changeProgress(task->getProgress(), task->getTotalProgress());
}
+ // auto size_hint = ui->verticalLayout->sizeHint();
+ // resize(size_hint.width(), size_hint.height());
+
return QDialog::exec();
}
@@ -189,40 +200,45 @@ void ProgressDialog::onTaskSucceeded()
void ProgressDialog::changeStatus(const QString& status)
{
ui->globalStatusLabel->setText(task->getStatus());
- // ui->statusLabel->setText(task->getStepStatus());
+ ui->globalStatusDetailsLabel->setText(task->getDetails());
updateSize();
}
-void ProgressDialog::addTaskProgress(TaskStepProgress progress)
+void ProgressDialog::addTaskProgress(TaskStepProgress* progress)
{
SubTaskProgressBar* task_bar = new SubTaskProgressBar(this);
- taskProgress.insert(progress.uid, task_bar);
- ui->taskProgressLayout->addWidget(task_bar);
+ taskProgress.insert(progress->uid, task_bar);
+ ui->taskProgressLayout->insertWidget(0, task_bar);
}
-void ProgressDialog::changeStepProgress(QList task_progress)
+void ProgressDialog::changeStepProgress(TaskStepProgressList task_progress)
{
+ m_is_multi_step = true;
+ ui->taskProgressScrollArea->setHidden(false);
+
for (auto tp : task_progress) {
- if (!taskProgress.contains(tp.uid))
- addTaskProgress(tp);
- auto task_bar = taskProgress.value(tp.uid);
+ if (!taskProgress.contains(tp->uid))
+ addTaskProgress(tp.get());
+ auto task_bar = taskProgress.value(tp->uid);
- if (tp.total < 0) {
+ if (tp->total < 0) {
task_bar->setRange(0, 0);
} else {
- task_bar->setRange(0, map_int_range(tp.total));
+ task_bar->setRange(0, map_int_range(tp->total));
}
- task_bar->setValue(map_int_range(tp.current));
- task_bar->setStatus(tp.status);
- task_bar->setDetails(tp.details);
+ task_bar->setValue(map_int_range(tp->current));
+ task_bar->setStatus(tp->status);
+ task_bar->setDetails(tp->details);
- if (tp.isDone()) {
+ if (tp->isDone()) {
task_bar->setVisible(false);
}
}
+
+ updateSize();
}
void ProgressDialog::changeProgress(qint64 current, qint64 total)
@@ -230,13 +246,6 @@ void ProgressDialog::changeProgress(qint64 current, qint64 total)
ui->globalProgressBar->setMaximum(total);
ui->globalProgressBar->setValue(current);
- // if (!m_is_multi_step) {
- // ui->taskProgressBar->setMaximum(total);
- // ui->taskProgressBar->setValue(current);
- // } else {
- // ui->taskProgressBar->setMaximum(task->getStepProgress());
- // ui->taskProgressBar->setValue(task->getStepTotalProgress());
- // }
}
void ProgressDialog::keyPressEvent(QKeyEvent* e)
diff --git a/launcher/ui/dialogs/ProgressDialog.h b/launcher/ui/dialogs/ProgressDialog.h
index a7e203fb..95a4db16 100644
--- a/launcher/ui/dialogs/ProgressDialog.h
+++ b/launcher/ui/dialogs/ProgressDialog.h
@@ -80,7 +80,7 @@ slots:
void changeStatus(const QString &status);
void changeProgress(qint64 current, qint64 total);
- void changeStepProgress(QList task_progress);
+ void changeStepProgress(TaskStepProgressList task_progress);
private
@@ -93,7 +93,7 @@ protected:
private:
bool handleImmediateResult(QDialog::DialogCode &result);
- void addTaskProgress(TaskStepProgress progress);
+ void addTaskProgress(TaskStepProgress* progress);
private:
Ui::ProgressDialog *ui;
diff --git a/launcher/ui/dialogs/ProgressDialog.ui b/launcher/ui/dialogs/ProgressDialog.ui
index 0a998987..47597689 100644
--- a/launcher/ui/dialogs/ProgressDialog.ui
+++ b/launcher/ui/dialogs/ProgressDialog.ui
@@ -6,20 +6,20 @@
0
0
- 400
- 109
+ 600
+ 260
-
- 0
- 0
+
+ 1
+ 1
- 400
- 0
+ 600
+ 260
@@ -31,43 +31,109 @@
Please wait...
-
- -
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 15
+
+
+
+ Global Task Status...
+
+
+
+ -
+
+
+ Global Status Details...
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+
+
+ -
true
+
+
+ 0
+ 24
+
+
24
- -
-
+
-
+
-
+
0
0
-
- Skip
+
+
+ 0
+ 100
+
+
+
+ QFrame::StyledPanel
+
+ Qt::ScrollBarAsNeeded
+
+
+ QAbstractScrollArea::AdjustToContents
+
+
+ true
+
+
+
+
+ 0
+ 0
+ 584
+ 146
+
+
+
+
+ 2
+
+
+
- -
-
-
- -
-
+
-
+
-
+
0
0
- Global Task Status...
+ Skip
diff --git a/launcher/ui/widgets/SubTaskProgressBar.ui b/launcher/ui/widgets/SubTaskProgressBar.ui
index 966fdb88..ceae5e26 100644
--- a/launcher/ui/widgets/SubTaskProgressBar.ui
+++ b/launcher/ui/widgets/SubTaskProgressBar.ui
@@ -6,12 +6,12 @@
0
0
- 265
- 65
+ 597
+ 61
-
+
0
0
@@ -20,29 +20,45 @@
Form
+
+ 0
+
-
-
-
+
0
0
+
+
+ 8
+
+
Sub Task Status...
+
+ true
+
-
-
+
0
0
+
+
+ 8
+
+
Status Details
@@ -55,6 +71,11 @@
-
+
+
+ 8
+
+
24
--
cgit
From f1028fa66d556b024765ba4e21ac76d4510a3e3e Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Fri, 31 Mar 2023 12:29:59 -0700
Subject: fix: properly map progress range - doument PCRE used for URL
compacting
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
launcher/ui/dialogs/ProgressDialog.cpp | 56 ++++++++++++++++++----------------
launcher/ui/dialogs/ProgressDialog.ui | 21 ++++++-------
2 files changed, 39 insertions(+), 38 deletions(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/dialogs/ProgressDialog.cpp b/launcher/ui/dialogs/ProgressDialog.cpp
index f7a3a862..7ab766e4 100644
--- a/launcher/ui/dialogs/ProgressDialog.cpp
+++ b/launcher/ui/dialogs/ProgressDialog.cpp
@@ -45,21 +45,18 @@
#include "ui/widgets/SubTaskProgressBar.h"
-template
-int map_int_range(T value)
+// map a value in a numaric range of an arbatray type to between 0 and INT_MAX
+// for getting the best percision out of the qt progress bar
+template::value, T>::type>
+std::tuple map_int_zero_max(T current, T range_max, T range_min)
{
- // auto type_min = std::numeric_limits::min();
- auto type_min = 0;
- auto type_max = std::numeric_limits::max();
+ int int_max = std::numeric_limits::max();
- // auto int_min = std::numeric_limits::min();
- auto int_min = 0;
- auto int_max = std::numeric_limits::max();
+ auto type_range = range_max - range_min;
+ double percentage = static_cast(current - range_min) / static_cast(type_range);
+ int mapped_current = percentage * int_max;
- auto type_range = type_max - type_min;
- auto int_range = int_max - int_min;
-
- return static_cast((value - type_min) * int_range / type_range + int_min);
+ return {mapped_current, int_max};
}
@@ -100,14 +97,21 @@ void ProgressDialog::updateSize()
{
QSize lastSize = this->size();
QSize qSize = QSize(480, minimumSizeHint().height());
- resize(qSize);
- setFixedSize(qSize);
- // keep the dialog in the center after a resize
- if (lastSize != qSize)
+
+ // if the current window is too small
+ if ((lastSize != qSize) && (lastSize.height() < qSize.height()))
+ {
+ resize(qSize);
+
+ // keep the dialog in the center after a resize
this->move(
this->parentWidget()->x() + (this->parentWidget()->width() - this->width()) / 2,
this->parentWidget()->y() + (this->parentWidget()->height() - this->height()) / 2
);
+ }
+
+ setMinimumSize(qSize);
+
}
int ProgressDialog::execWithTask(Task* task)
@@ -147,9 +151,6 @@ int ProgressDialog::execWithTask(Task* task)
changeProgress(task->getProgress(), task->getTotalProgress());
}
- // auto size_hint = ui->verticalLayout->sizeHint();
- // resize(size_hint.width(), size_hint.height());
-
return QDialog::exec();
}
@@ -209,26 +210,31 @@ void ProgressDialog::addTaskProgress(TaskStepProgress* progress)
{
SubTaskProgressBar* task_bar = new SubTaskProgressBar(this);
taskProgress.insert(progress->uid, task_bar);
- ui->taskProgressLayout->insertWidget(0, task_bar);
+ ui->taskProgressLayout->addWidget(task_bar);
}
void ProgressDialog::changeStepProgress(TaskStepProgressList task_progress)
{
m_is_multi_step = true;
- ui->taskProgressScrollArea->setHidden(false);
+ if(ui->taskProgressScrollArea->isHidden()) {
+ ui->taskProgressScrollArea->setHidden(false);
+ updateSize();
+ }
for (auto tp : task_progress) {
if (!taskProgress.contains(tp->uid))
addTaskProgress(tp.get());
auto task_bar = taskProgress.value(tp->uid);
- if (tp->total < 0) {
+
+ auto const [mapped_current, mapped_total] = map_int_zero_max(tp->current, tp->total, 0);
+ if (tp->total <= 0) {
task_bar->setRange(0, 0);
} else {
- task_bar->setRange(0, map_int_range(tp->total));
+ task_bar->setRange(0, mapped_total);
}
- task_bar->setValue(map_int_range(tp->current));
+ task_bar->setValue(mapped_current);
task_bar->setStatus(tp->status);
task_bar->setDetails(tp->details);
@@ -237,8 +243,6 @@ void ProgressDialog::changeStepProgress(TaskStepProgressList task_progress)
}
}
-
- updateSize();
}
void ProgressDialog::changeProgress(qint64 current, qint64 total)
diff --git a/launcher/ui/dialogs/ProgressDialog.ui b/launcher/ui/dialogs/ProgressDialog.ui
index 47597689..a4d08124 100644
--- a/launcher/ui/dialogs/ProgressDialog.ui
+++ b/launcher/ui/dialogs/ProgressDialog.ui
@@ -6,8 +6,8 @@
0
0
- 600
- 260
+ 480
+ 210
@@ -18,19 +18,16 @@
- 600
- 260
-
-
-
-
- 600
- 16777215
+ 480
+ 210
Please wait...
+
+ true
+
-
@@ -112,8 +109,8 @@
0
0
- 584
- 146
+ 464
+ 96
--
cgit
From b6452215c16f6b1ee45fea746f9498767e48d049 Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Fri, 31 Mar 2023 19:25:01 -0700
Subject: feat: add `details` signal to `Task` feat: add details to mod pack
downloading feat: add logging rule sloading form `ligging.ini at data path
root feat: add `launcher.task` `launcher.task.net` and
`launcher.task.net.[down|up]load` logging categories fix: add new subtask
progress to the end of the lay out not the beginning (cuts down on
flickering)
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
launcher/ui/dialogs/ProgressDialog.cpp | 2 +-
launcher/ui/widgets/ProgressWidget.cpp | 1 +
launcher/ui/widgets/SubTaskProgressBar.ui | 7 +++++--
3 files changed, 7 insertions(+), 3 deletions(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/dialogs/ProgressDialog.cpp b/launcher/ui/dialogs/ProgressDialog.cpp
index 7ab766e4..1937c553 100644
--- a/launcher/ui/dialogs/ProgressDialog.cpp
+++ b/launcher/ui/dialogs/ProgressDialog.cpp
@@ -133,9 +133,9 @@ int ProgressDialog::execWithTask(Task* task)
connect(task, &Task::failed, this, &ProgressDialog::onTaskFailed);
connect(task, &Task::succeeded, this, &ProgressDialog::onTaskSucceeded);
connect(task, &Task::status, this, &ProgressDialog::changeStatus);
+ connect(task, &Task::details, this, &ProgressDialog::changeStatus);
connect(task, &Task::stepProgress, this, &ProgressDialog::changeStepProgress);
connect(task, &Task::progress, this, &ProgressDialog::changeProgress);
-
connect(task, &Task::aborted, this, &ProgressDialog::hide);
connect(task, &Task::abortStatusChanged, ui->skipButton, &QPushButton::setEnabled);
diff --git a/launcher/ui/widgets/ProgressWidget.cpp b/launcher/ui/widgets/ProgressWidget.cpp
index f736af08..9181de7f 100644
--- a/launcher/ui/widgets/ProgressWidget.cpp
+++ b/launcher/ui/widgets/ProgressWidget.cpp
@@ -51,6 +51,7 @@ void ProgressWidget::watch(const Task* task)
connect(m_task, &Task::finished, this, &ProgressWidget::handleTaskFinish);
connect(m_task, &Task::status, this, &ProgressWidget::handleTaskStatus);
+ // TODO: should we connect &Task::details
connect(m_task, &Task::progress, this, &ProgressWidget::handleTaskProgress);
connect(m_task, &Task::destroyed, this, &ProgressWidget::taskDestroyed);
diff --git a/launcher/ui/widgets/SubTaskProgressBar.ui b/launcher/ui/widgets/SubTaskProgressBar.ui
index ceae5e26..5431eab6 100644
--- a/launcher/ui/widgets/SubTaskProgressBar.ui
+++ b/launcher/ui/widgets/SubTaskProgressBar.ui
@@ -6,8 +6,8 @@
0
0
- 597
- 61
+ 312
+ 86
@@ -25,6 +25,9 @@
-
+
+ 8
+
-
--
cgit
From 0fb6a2836be2fe51e27a47595950923dca329006 Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Sun, 2 Apr 2023 21:51:07 -0700
Subject: refactor: propogate only only one StepProgress at a time
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
launcher/ui/dialogs/ProgressDialog.cpp | 38 ++++++++++++++++------------------
launcher/ui/dialogs/ProgressDialog.h | 2 +-
2 files changed, 19 insertions(+), 21 deletions(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/dialogs/ProgressDialog.cpp b/launcher/ui/dialogs/ProgressDialog.cpp
index 1937c553..7594484e 100644
--- a/launcher/ui/dialogs/ProgressDialog.cpp
+++ b/launcher/ui/dialogs/ProgressDialog.cpp
@@ -46,8 +46,8 @@
// map a value in a numaric range of an arbatray type to between 0 and INT_MAX
-// for getting the best percision out of the qt progress bar
-template::value, T>::type>
+// for getting the best precision out of the qt progress bar
+template, bool> = true>
std::tuple map_int_zero_max(T current, T range_max, T range_min)
{
int int_max = std::numeric_limits::max();
@@ -213,7 +213,7 @@ void ProgressDialog::addTaskProgress(TaskStepProgress* progress)
ui->taskProgressLayout->addWidget(task_bar);
}
-void ProgressDialog::changeStepProgress(TaskStepProgressList task_progress)
+void ProgressDialog::changeStepProgress(TaskStepProgress task_progress)
{
m_is_multi_step = true;
if(ui->taskProgressScrollArea->isHidden()) {
@@ -221,28 +221,26 @@ void ProgressDialog::changeStepProgress(TaskStepProgressList task_progress)
updateSize();
}
- for (auto tp : task_progress) {
- if (!taskProgress.contains(tp->uid))
- addTaskProgress(tp.get());
- auto task_bar = taskProgress.value(tp->uid);
+ if (!taskProgress.contains(task_progress.uid))
+ addTaskProgress(&task_progress);
+ auto task_bar = taskProgress.value(task_progress.uid);
- auto const [mapped_current, mapped_total] = map_int_zero_max(tp->current, tp->total, 0);
- if (tp->total <= 0) {
- task_bar->setRange(0, 0);
- } else {
- task_bar->setRange(0, mapped_total);
- }
-
- task_bar->setValue(mapped_current);
- task_bar->setStatus(tp->status);
- task_bar->setDetails(tp->details);
+ auto const [mapped_current, mapped_total] = map_int_zero_max(task_progress.current, task_progress.total, 0);
+ if (task_progress.total <= 0) {
+ task_bar->setRange(0, 0);
+ } else {
+ task_bar->setRange(0, mapped_total);
+ }
- if (tp->isDone()) {
- task_bar->setVisible(false);
- }
+ task_bar->setValue(mapped_current);
+ task_bar->setStatus(task_progress.status);
+ task_bar->setDetails(task_progress.details);
+ if (task_progress.isDone()) {
+ task_bar->setVisible(false);
}
+
}
void ProgressDialog::changeProgress(qint64 current, qint64 total)
diff --git a/launcher/ui/dialogs/ProgressDialog.h b/launcher/ui/dialogs/ProgressDialog.h
index 95a4db16..6779b949 100644
--- a/launcher/ui/dialogs/ProgressDialog.h
+++ b/launcher/ui/dialogs/ProgressDialog.h
@@ -80,7 +80,7 @@ slots:
void changeStatus(const QString &status);
void changeProgress(qint64 current, qint64 total);
- void changeStepProgress(TaskStepProgressList task_progress);
+ void changeStepProgress(TaskStepProgress task_progress);
private
--
cgit
From 236764adf6cb985dfc6d00b9cbcba8eb176510ed Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Fri, 7 Apr 2023 19:44:57 -0700
Subject: refactor: Qt can handle const& in signals and slots
While most Qt types cna use implicit data sharing
pasing our own structs means copies. const& ensure
it's only copied as needed by Qt.
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
launcher/ui/dialogs/ProgressDialog.cpp | 8 ++++----
launcher/ui/dialogs/ProgressDialog.h | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/dialogs/ProgressDialog.cpp b/launcher/ui/dialogs/ProgressDialog.cpp
index 7594484e..94feee44 100644
--- a/launcher/ui/dialogs/ProgressDialog.cpp
+++ b/launcher/ui/dialogs/ProgressDialog.cpp
@@ -206,14 +206,14 @@ void ProgressDialog::changeStatus(const QString& status)
updateSize();
}
-void ProgressDialog::addTaskProgress(TaskStepProgress* progress)
+void ProgressDialog::addTaskProgress(TaskStepProgress const& progress)
{
SubTaskProgressBar* task_bar = new SubTaskProgressBar(this);
- taskProgress.insert(progress->uid, task_bar);
+ taskProgress.insert(progress.uid, task_bar);
ui->taskProgressLayout->addWidget(task_bar);
}
-void ProgressDialog::changeStepProgress(TaskStepProgress task_progress)
+void ProgressDialog::changeStepProgress(TaskStepProgress const& task_progress)
{
m_is_multi_step = true;
if(ui->taskProgressScrollArea->isHidden()) {
@@ -222,7 +222,7 @@ void ProgressDialog::changeStepProgress(TaskStepProgress task_progress)
}
if (!taskProgress.contains(task_progress.uid))
- addTaskProgress(&task_progress);
+ addTaskProgress(task_progress);
auto task_bar = taskProgress.value(task_progress.uid);
diff --git a/launcher/ui/dialogs/ProgressDialog.h b/launcher/ui/dialogs/ProgressDialog.h
index 6779b949..fc9a0fbc 100644
--- a/launcher/ui/dialogs/ProgressDialog.h
+++ b/launcher/ui/dialogs/ProgressDialog.h
@@ -80,7 +80,7 @@ slots:
void changeStatus(const QString &status);
void changeProgress(qint64 current, qint64 total);
- void changeStepProgress(TaskStepProgress task_progress);
+ void changeStepProgress(TaskStepProgress const& task_progress);
private
@@ -93,7 +93,7 @@ protected:
private:
bool handleImmediateResult(QDialog::DialogCode &result);
- void addTaskProgress(TaskStepProgress* progress);
+ void addTaskProgress(TaskStepProgress const& progress);
private:
Ui::ProgressDialog *ui;
--
cgit
From 5ec4cbf1cbf660d992ddd73c67d31de27c097f54 Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Wed, 3 May 2023 20:31:15 -0700
Subject: fix add an addtion lax file name match with ` ` replaced with `+`
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
launcher/ui/dialogs/BlockedModsDialog.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/dialogs/BlockedModsDialog.cpp b/launcher/ui/dialogs/BlockedModsDialog.cpp
index ba453df6..3e1137c2 100644
--- a/launcher/ui/dialogs/BlockedModsDialog.cpp
+++ b/launcher/ui/dialogs/BlockedModsDialog.cpp
@@ -305,6 +305,9 @@ bool BlockedModsDialog::checkValidPath(QString path)
QString laxFilename(filename);
laxFilename.replace('+', ' ');
+ QString laxFilename2(filename);
+ laxFilename.replace(' ', '+');
+
auto compare = [](QString fsfilename, QString metadataFilename) {
return metadataFilename.compare(fsfilename, Qt::CaseInsensitive) == 0;
};
@@ -314,7 +317,7 @@ bool BlockedModsDialog::checkValidPath(QString path)
qDebug() << "[Blocked Mods Dialog] Name match found:" << mod.name << "| From path:" << path;
return true;
}
- if (compare(laxFilename, mod.name)) {
+ if (compare(laxFilename, mod.name) || compare(laxFilename2, mod.name)) {
qDebug() << "[Blocked Mods Dialog] Lax name match found:" << mod.name << "| From path:" << path;
return true;
}
--
cgit
From e0635955df2d1bf79e1ba61eb02074801b60953f Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Thu, 4 May 2023 13:30:39 -0700
Subject: fix: super lax compare
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
launcher/ui/dialogs/BlockedModsDialog.cpp | 40 +++++++++++++++++++++++--------
1 file changed, 30 insertions(+), 10 deletions(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/dialogs/BlockedModsDialog.cpp b/launcher/ui/dialogs/BlockedModsDialog.cpp
index 3e1137c2..fdfae597 100644
--- a/launcher/ui/dialogs/BlockedModsDialog.cpp
+++ b/launcher/ui/dialogs/BlockedModsDialog.cpp
@@ -195,7 +195,7 @@ void BlockedModsDialog::watchPath(QString path, bool watch_recursive)
auto to_watch = QFileInfo(path);
auto to_watch_path = to_watch.canonicalFilePath();
if (m_watcher.directories().contains(to_watch_path))
- return; // don't watch the same path twice (no loops!)
+ return; // don't watch the same path twice (no loops!)
qDebug() << "[Blocked Mods Dialog] Adding Watch Path:" << path;
m_watcher.addPath(to_watch_path);
@@ -203,10 +203,9 @@ void BlockedModsDialog::watchPath(QString path, bool watch_recursive)
if (!to_watch.isDir() || !watch_recursive)
return;
-
QDirIterator it(to_watch_path, QDir::Filter::Dirs | QDir::Filter::NoDotAndDotDot, QDirIterator::NoIteratorFlags);
while (it.hasNext()) {
- QString watch_dir = QDir(it.next()).canonicalPath(); // resolve symlinks and relative paths
+ QString watch_dir = QDir(it.next()).canonicalPath(); // resolve symlinks and relative paths
watchPath(watch_dir, watch_recursive);
}
}
@@ -302,14 +301,35 @@ bool BlockedModsDialog::checkValidPath(QString path)
{
const QFileInfo file = QFileInfo(path);
const QString filename = file.fileName();
- QString laxFilename(filename);
- laxFilename.replace('+', ' ');
- QString laxFilename2(filename);
- laxFilename.replace(' ', '+');
+ auto compare = [](QString fsFilename, QString metadataFilename) {
+ return metadataFilename.compare(fsFilename, Qt::CaseInsensitive) == 0;
+ };
+
+ // super lax compare (but not fuzzy)
+ // convert to lowercase
+ // convert all speratores to whitespace
+ // simplify sequence of internal whitespace to a single space
+ // efectivly compare two strings ignoring all separators and case
+ auto laxCompare = [](QString fsfilename, QString metadataFilename) {
+ // allowed character seperators
+ QList allowedSeperators = { '-', '+', '.' , '_'};
+
+ // copy in lowercase
+ auto fsName = fsfilename.toLower();
+ auto metaName = metadataFilename.toLower();
+
+ // replace all potential allowed seperato