From 9913080a829acb4ca921c3a68e0caefad0ebcaa1 Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Thu, 4 May 2023 23:44:28 -0700
Subject: feat(modpage): mod icon in description and column
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
launcher/ui/widgets/InfoFrame.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/widgets/InfoFrame.cpp b/launcher/ui/widgets/InfoFrame.cpp
index fdc581b4..6f4036a2 100644
--- a/launcher/ui/widgets/InfoFrame.cpp
+++ b/launcher/ui/widgets/InfoFrame.cpp
@@ -88,7 +88,7 @@ void InfoFrame::updateWithMod(Mod const& m)
setDescription(m.description());
}
- setImage();
+ setImage(m.icon({64,64}));
}
void InfoFrame::updateWithResource(const Resource& resource)
--
cgit
From 3cfcc83ea99e8f42dba8848b5ef885c296b4566a Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Fri, 5 May 2023 13:46:01 -0700
Subject: change: don't toggle a resource's enabeling just by selecting it.
only if they are on the checkbox.
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
launcher/ui/pages/instance/ExternalResourcesPage.cpp | 1 -
1 file changed, 1 deletion(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/pages/instance/ExternalResourcesPage.cpp b/launcher/ui/pages/instance/ExternalResourcesPage.cpp
index 1115ddc3..6c11b85b 100644
--- a/launcher/ui/pages/instance/ExternalResourcesPage.cpp
+++ b/launcher/ui/pages/instance/ExternalResourcesPage.cpp
@@ -96,7 +96,6 @@ void ExternalResourcesPage::itemActivated(const QModelIndex&)
return;
auto selection = m_filterModel->mapSelectionToSource(ui->treeView->selectionModel()->selection());
- m_model->setResourceEnabled(selection.indexes(), EnableAction::TOGGLE);
}
void ExternalResourcesPage::filterTextChanged(const QString& newContents)
--
cgit
From 74e7c13a177afdb503a642cb9c97d71e72249291 Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Fri, 5 May 2023 13:46:38 -0700
Subject: feat: display license and issue tracker
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
launcher/ui/widgets/InfoFrame.cpp | 120 ++++++++++++++++++++++++++++++++++++--
launcher/ui/widgets/InfoFrame.h | 4 ++
launcher/ui/widgets/InfoFrame.ui | 92 +++++++++++++++++++++--------
3 files changed, 187 insertions(+), 29 deletions(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/widgets/InfoFrame.cpp b/launcher/ui/widgets/InfoFrame.cpp
index 6f4036a2..9c041bfe 100644
--- a/launcher/ui/widgets/InfoFrame.cpp
+++ b/launcher/ui/widgets/InfoFrame.cpp
@@ -47,6 +47,8 @@ InfoFrame::InfoFrame(QWidget *parent) :
ui->setupUi(this);
ui->descriptionLabel->setHidden(true);
ui->nameLabel->setHidden(true);
+ ui->licenseLabel->setHidden(true);
+ ui->issueTrackerLabel->setHidden(true);
updateHiddenState();
}
@@ -89,6 +91,40 @@ void InfoFrame::updateWithMod(Mod const& m)
}
setImage(m.icon({64,64}));
+
+ auto licenses = m.licenses();
+ QString licenseText = "";
+ if (!licenses.empty()) {
+ for (auto l : licenses) {
+ if (!licenseText.isEmpty()) {
+ licenseText += "\n"; // add newline between licenses
+ }
+ if (!l.name.isEmpty()) {
+ if (l.url.isEmpty()) {
+ licenseText += l.name;
+ } else {
+ licenseText += "" + l.name + "";
+ }
+ } else if (!l.url.isEmpty()) {
+ licenseText += "" + l.url + "";
+ }
+ if (!l.description.isEmpty() && l.description != l.name) {
+ licenseText += " " + l.description;
+ }
+ }
+ }
+ if (!licenseText.isEmpty()) {
+ setLicense(tr("License: %1").arg(licenseText));
+ } else {
+ setLicense();
+ }
+
+ QString issueTracker = "";
+ if (!m.issueTracker().isEmpty()) {
+ issueTracker += tr("Report issues to: ");
+ issueTracker += "" + m.issueTracker() + "";
+ }
+ setIssueTracker(issueTracker);
}
void InfoFrame::updateWithResource(const Resource& resource)
@@ -177,16 +213,16 @@ void InfoFrame::clear()
setName();
setDescription();
setImage();
+ setLicense();
+ setIssueTracker();
}
void InfoFrame::updateHiddenState()
{
- if(ui->descriptionLabel->isHidden() && ui->nameLabel->isHidden())
- {
+ if (ui->descriptionLabel->isHidden() && ui->nameLabel->isHidden() && ui->licenseLabel->isHidden() &&
+ ui->issueTrackerLabel->isHidden()) {
setHidden(true);
- }
- else
- {
+ } else {
setHidden(false);
}
}
@@ -251,6 +287,66 @@ void InfoFrame::setDescription(QString text)
ui->descriptionLabel->setText(labeltext);
}
+void InfoFrame::setLicense(QString text)
+{
+ if(text.isEmpty())
+ {
+ ui->licenseLabel->setHidden(true);
+ updateHiddenState();
+ return;
+ }
+ else
+ {
+ ui->licenseLabel->setHidden(false);
+ updateHiddenState();
+ }
+ ui->licenseLabel->setToolTip("");
+ QString intermediatetext = text.trimmed();
+ bool prev(false);
+ QChar rem('\n');
+ QString finaltext;
+ finaltext.reserve(intermediatetext.size());
+ foreach(const QChar& c, intermediatetext)
+ {
+ if(c == rem && prev){
+ continue;
+ }
+ prev = c == rem;
+ finaltext += c;
+ }
+ QString labeltext;
+ labeltext.reserve(300);
+ if(finaltext.length() > 290)
+ {
+ ui->licenseLabel->setOpenExternalLinks(false);
+ ui->licenseLabel->setTextFormat(Qt::TextFormat::RichText);
+ m_description = text;
+ // This allows injecting HTML here.
+ labeltext.append("
" + finaltext.left(287) + "...");
+ QObject::connect(ui->licenseLabel, &QLabel::linkActivated, this, &InfoFrame::licenseEllipsisHandler);
+ }
+ else
+ {
+ ui->licenseLabel->setTextFormat(Qt::TextFormat::AutoText);
+ labeltext.append(finaltext);
+ }
+ ui->licenseLabel->setText(labeltext);
+}
+
+void InfoFrame::setIssueTracker(QString text)
+{
+ if(text.isEmpty())
+ {
+ ui->issueTrackerLabel->setHidden(true);
+ }
+ else
+ {
+ ui->issueTrackerLabel->setText(text);
+ ui->issueTrackerLabel->setHidden(false);
+ }
+ updateHiddenState();
+}
+
void InfoFrame::setImage(QPixmap img)
{
if (img.isNull()) {
@@ -275,6 +371,20 @@ void InfoFrame::descriptionEllipsisHandler(QString link)
}
}
+void InfoFrame::licenseEllipsisHandler(QString link)
+{
+ if(!m_current_box)
+ {
+ m_current_box = CustomMessageBox::selectable(this, "", m_license);
+ connect(m_current_box, &QMessageBox::finished, this, &InfoFrame::boxClosed);
+ m_current_box->show();
+ }
+ else
+ {
+ m_current_box->setText(m_license);
+ }
+}
+
void InfoFrame::boxClosed(int result)
{
m_current_box = nullptr;
diff --git a/launcher/ui/widgets/InfoFrame.h b/launcher/ui/widgets/InfoFrame.h
index 84523e28..7eb679a9 100644
--- a/launcher/ui/widgets/InfoFrame.h
+++ b/launcher/ui/widgets/InfoFrame.h
@@ -36,6 +36,8 @@ class InfoFrame : public QFrame {
void setName(QString text = {});
void setDescription(QString text = {});
void setImage(QPixmap img = {});
+ void setLicense(QString text = {});
+ void setIssueTracker(QString text = {});
void clear();
@@ -48,6 +50,7 @@ class InfoFrame : public QFrame {
public slots:
void descriptionEllipsisHandler(QString link);
+ void licenseEllipsisHandler(QString link);
void boxClosed(int result);
private:
@@ -56,5 +59,6 @@ class InfoFrame : public QFrame {
private:
Ui::InfoFrame* ui;
QString m_description;
+ QString m_license;
class QMessageBox* m_current_box = nullptr;
};
diff --git a/launcher/ui/widgets/InfoFrame.ui b/launcher/ui/widgets/InfoFrame.ui
index 9e407ce9..c4d8c83d 100644
--- a/launcher/ui/widgets/InfoFrame.ui
+++ b/launcher/ui/widgets/InfoFrame.ui
@@ -35,8 +35,36 @@
0
- -
-
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 64
+ 64
+
+
+
+
+
+
+ false
+
+
+ 0
+
+
+
+ -
+
+
+
+
@@ -57,11 +85,8 @@
- -
-
-
-
-
+
-
+
@@ -82,28 +107,47 @@
- -
-
-
-
- 0
- 0
-
+
-
+
+
+
-
-
- 64
- 64
-
+
+ Qt::RichText
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+
+
+ true
+
+
+ true
+
+
+ Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
+
+
+
+ -
+
-
+
-
- false
+
+ Qt::RichText
-
- 0
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+
+
+ true
+
+
+ true
+
+
+ Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
--
cgit
From 086a7e19f099c6c9b9529afb2360300e534876bf Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Wed, 24 May 2023 20:15:34 -0700
Subject: feat: Column on left, hideable
- columns are hideable (saves to settings)
- image column moved to left
- datamodals can provide resize modes
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
launcher/ui/pages/instance/ExternalResourcesPage.cpp | 15 +++++++++++++++
launcher/ui/pages/instance/ExternalResourcesPage.h | 1 +
launcher/ui/widgets/ModListView.cpp | 9 +++++++++
launcher/ui/widgets/ModListView.h | 2 ++
4 files changed, 27 insertions(+)
(limited to 'launcher/ui')
diff --git a/launcher/ui/pages/instance/ExternalResourcesPage.cpp b/launcher/ui/pages/instance/ExternalResourcesPage.cpp
index 6c11b85b..bee11d9a 100644
--- a/launcher/ui/pages/instance/ExternalResourcesPage.cpp
+++ b/launcher/ui/pages/instance/ExternalResourcesPage.cpp
@@ -24,6 +24,8 @@ ExternalResourcesPage::ExternalResourcesPage(BaseInstance* instance, std::shared
m_filterModel->setSourceModel(m_model.get());
m_filterModel->setFilterKeyColumn(-1);
ui->treeView->setModel(m_filterModel);
+ // must come after setModel
+ ui->treeView->setResizeModes(m_model->columnResizeModes());
ui->treeView->installEventFilter(this);
ui->treeView->sortByColumn(1, Qt::AscendingOrder);
@@ -44,6 +46,13 @@ ExternalResourcesPage::ExternalResourcesPage(BaseInstance* instance, std::shared
auto selection_model = ui->treeView->selectionModel();
connect(selection_model, &QItemSelectionModel::currentChanged, this, &ExternalResourcesPage::current);
connect(ui->filterEdit, &QLineEdit::textChanged, this, &ExternalResourcesPage::filterTextChanged);
+
+ auto viewHeader = ui->treeView->header();
+ viewHeader->setContextMenuPolicy(Qt::CustomContextMenu);
+
+ connect(viewHeader, &QHeaderView::customContextMenuRequested, this, &ExternalResourcesPage::ShowHeaderContextMenu);
+
+ m_model->loadHiddenColumns(ui->treeView);
}
ExternalResourcesPage::~ExternalResourcesPage()
@@ -65,6 +74,12 @@ void ExternalResourcesPage::ShowContextMenu(const QPoint& pos)
delete menu;
}
+void ExternalResourcesPage::ShowHeaderContextMenu(const QPoint& pos)
+{
+ auto menu = m_model->createHeaderContextMenu(this, ui->treeView);
+ menu->exec(ui->treeView->mapToGlobal(pos));
+}
+
void ExternalResourcesPage::openedImpl()
{
m_model->startWatching();
diff --git a/launcher/ui/pages/instance/ExternalResourcesPage.h b/launcher/ui/pages/instance/ExternalResourcesPage.h
index d17fbb7f..906e6df7 100644
--- a/launcher/ui/pages/instance/ExternalResourcesPage.h
+++ b/launcher/ui/pages/instance/ExternalResourcesPage.h
@@ -60,6 +60,7 @@ class ExternalResourcesPage : public QMainWindow, public BasePage {
virtual void viewConfigs();
void ShowContextMenu(const QPoint& pos);
+ void ShowHeaderContextMenu(const QPoint& pos);
protected:
BaseInstance* m_instance = nullptr;
diff --git a/launcher/ui/widgets/ModListView.cpp b/launcher/ui/widgets/ModListView.cpp
index 09b03a76..893cd120 100644
--- a/launcher/ui/widgets/ModListView.cpp
+++ b/launcher/ui/widgets/ModListView.cpp
@@ -79,3 +79,12 @@ void ModListView::setModel ( QAbstractItemModel* model )
});
}
}
+
+void ModListView::setResizeModes(const QList &modes)
+{
+ auto head = header();
+ for(int i = 0; i < modes.count(); i++) {
+ head->setSectionResizeMode(i, modes[i]);
+ }
+}
+
diff --git a/launcher/ui/widgets/ModListView.h b/launcher/ui/widgets/ModListView.h
index 881e092f..3f0b3b0e 100644
--- a/launcher/ui/widgets/ModListView.h
+++ b/launcher/ui/widgets/ModListView.h
@@ -14,6 +14,7 @@
*/
#pragma once
+#include
#include
class ModListView: public QTreeView
@@ -22,4 +23,5 @@ class ModListView: public QTreeView
public:
explicit ModListView ( QWidget* parent = 0 );
virtual void setModel ( QAbstractItemModel* model );
+ virtual void setResizeModes (const QList& modes);
};
--
cgit
From 5fe9e30f394a8025cdb6aa11b4cc11b9a2bb6a64 Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Sun, 28 May 2023 14:53:15 -0700
Subject: fix: use instance settings, make image column user resizeable, fix
memory leak
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
launcher/ui/pages/instance/ExternalResourcesPage.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/pages/instance/ExternalResourcesPage.cpp b/launcher/ui/pages/instance/ExternalResourcesPage.cpp
index bee11d9a..2f824ffb 100644
--- a/launcher/ui/pages/instance/ExternalResourcesPage.cpp
+++ b/launcher/ui/pages/instance/ExternalResourcesPage.cpp
@@ -76,8 +76,9 @@ void ExternalResourcesPage::ShowContextMenu(const QPoint& pos)
void ExternalResourcesPage::ShowHeaderContextMenu(const QPoint& pos)
{
- auto menu = m_model->createHeaderContextMenu(this, ui->treeView);
+ auto menu = m_model->createHeaderContextMenu(ui->treeView);
menu->exec(ui->treeView->mapToGlobal(pos));
+ menu->deleteLater();
}
void ExternalResourcesPage::openedImpl()
--
cgit
From 1e702ee40f211286f85fa5353704e358e7fe14a9 Mon Sep 17 00:00:00 2001
From: Trial97
Date: Wed, 7 Jun 2023 00:16:23 +0300
Subject: Added dynamic page extra info
Signed-off-by: Trial97
---
launcher/ui/pages/BasePage.h | 24 +++++++++++-----------
.../ui/pages/instance/ExternalResourcesPage.cpp | 19 ++++++++++++++++-
launcher/ui/pages/instance/ExternalResourcesPage.h | 1 +
launcher/ui/widgets/PageContainer.cpp | 4 ++++
4 files changed, 35 insertions(+), 13 deletions(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/pages/BasePage.h b/launcher/ui/pages/BasePage.h
index ceb24040..5537c28f 100644
--- a/launcher/ui/pages/BasePage.h
+++ b/launcher/ui/pages/BasePage.h
@@ -35,15 +35,16 @@
#pragma once
-#include
#include
+#include
+#include
#include
#include "BasePageContainer.h"
-class BasePage
-{
-public:
+class BasePage {
+ public:
+ using updateExtraInfoFunc = std::function;
virtual ~BasePage() {}
virtual QString id() const = 0;
virtual QString displayName() const = 0;
@@ -63,17 +64,16 @@ public:
}
virtual void openedImpl() {}
virtual void closedImpl() {}
- virtual void setParentContainer(BasePageContainer * container)
- {
- m_container = container;
- };
- virtual void retranslate() { }
+ virtual void setParentContainer(BasePageContainer* container) { m_container = container; };
+ virtual void retranslate() {}
-public:
+ public:
int stackIndex = -1;
int listIndex = -1;
-protected:
- BasePageContainer * m_container = nullptr;
+ updateExtraInfoFunc updateExtraInfo;
+
+ protected:
+ BasePageContainer* m_container = nullptr;
bool isOpened = false;
};
diff --git a/launcher/ui/pages/instance/ExternalResourcesPage.cpp b/launcher/ui/pages/instance/ExternalResourcesPage.cpp
index 1115ddc3..e5567c80 100644
--- a/launcher/ui/pages/instance/ExternalResourcesPage.cpp
+++ b/launcher/ui/pages/instance/ExternalResourcesPage.cpp
@@ -9,6 +9,7 @@
#include
#include
+#include
ExternalResourcesPage::ExternalResourcesPage(BaseInstance* instance, std::shared_ptr model, QWidget* parent)
: QMainWindow(parent), m_instance(instance), ui(new Ui::ExternalResourcesPage), m_model(model)
@@ -43,6 +44,13 @@ ExternalResourcesPage::ExternalResourcesPage(BaseInstance* instance, std::shared
auto selection_model = ui->treeView->selectionModel();
connect(selection_model, &QItemSelectionModel::currentChanged, this, &ExternalResourcesPage::current);
+ auto updateExtra = [this]() {
+ if (updateExtraInfo)
+ updateExtraInfo(extraHeaderInfoString());
+ };
+ connect(selection_model, &QItemSelectionModel::selectionChanged, this, updateExtra);
+ connect(model.get(), &ResourceFolderModel::updateFinished, this, updateExtra);
+
connect(ui->filterEdit, &QLineEdit::textChanged, this, &ExternalResourcesPage::filterTextChanged);
}
@@ -248,6 +256,15 @@ bool ExternalResourcesPage::onSelectionChanged(const QModelIndex& current, const
int row = sourceCurrent.row();
Resource const& resource = m_model->at(row);
ui->frame->updateWithResource(resource);
-
return true;
}
+
+QString ExternalResourcesPage::extraHeaderInfoString()
+{
+ if (ui && ui->treeView && ui->treeView->selectionModel()) {
+ auto selection = m_filterModel->mapSelectionToSource(ui->treeView->selectionModel()->selection()).indexes();
+ if (auto count = std::count_if(selection.cbegin(), selection.cend(), [](auto v) { return v.column() == 0; }); count != 0)
+ return tr("[%1 installed, %2 selected]").arg(m_model->size()).arg(count);
+ }
+ return tr("[%1 installed]").arg(m_model->size());
+}
diff --git a/launcher/ui/pages/instance/ExternalResourcesPage.h b/launcher/ui/pages/instance/ExternalResourcesPage.h
index d17fbb7f..fd200193 100644
--- a/launcher/ui/pages/instance/ExternalResourcesPage.h
+++ b/launcher/ui/pages/instance/ExternalResourcesPage.h
@@ -29,6 +29,7 @@ class ExternalResourcesPage : public QMainWindow, public BasePage {
virtual QString helpPage() const override = 0;
virtual bool shouldDisplay() const override = 0;
+ QString extraHeaderInfoString();
void openedImpl() override;
void closedImpl() override;
diff --git a/launcher/ui/widgets/PageContainer.cpp b/launcher/ui/widgets/PageContainer.cpp
index 38a22897..34df42ec 100644
--- a/launcher/ui/widgets/PageContainer.cpp
+++ b/launcher/ui/widgets/PageContainer.cpp
@@ -93,6 +93,10 @@ PageContainer::PageContainer(BasePageProvider *pageProvider, QString defaultId,
page->listIndex = counter;
page->setParentContainer(this);
counter++;
+ page->updateExtraInfo = [this](QString info) {
+ if (m_currentPage)
+ m_header->setText(m_currentPage->displayName() + info);
+ };
}
m_model->setPages(pages);
--
cgit
From 6667ff9330cc080ca3c5fc2dd90af6b8420bf3fc Mon Sep 17 00:00:00 2001
From: Trial97
Date: Thu, 15 Jun 2023 12:32:48 +0300
Subject: Updated text and fixed mod page text update
Signed-off-by: Trial97
---
.../ui/pages/instance/ExternalResourcesPage.cpp | 39 ++++++++++++++++++++--
launcher/ui/pages/instance/ModFolderPage.cpp | 27 ++++++---------
2 files changed, 47 insertions(+), 19 deletions(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/pages/instance/ExternalResourcesPage.cpp b/launcher/ui/pages/instance/ExternalResourcesPage.cpp
index e5567c80..e50fa635 100644
--- a/launcher/ui/pages/instance/ExternalResourcesPage.cpp
+++ b/launcher/ui/pages/instance/ExternalResourcesPage.cpp
@@ -1,3 +1,38 @@
+// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * Prism Launcher - Minecraft Launcher
+ * Copyright (c) 2023 Trial97
+ *
+ * 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 .
+ *
+ * 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 "ExternalResourcesPage.h"
#include "ui/dialogs/CustomMessageBox.h"
#include "ui_ExternalResourcesPage.h"
@@ -264,7 +299,7 @@ QString ExternalResourcesPage::extraHeaderInfoString()
if (ui && ui->treeView && ui->treeView->selectionModel()) {
auto selection = m_filterModel->mapSelectionToSource(ui->treeView->selectionModel()->selection()).indexes();
if (auto count = std::count_if(selection.cbegin(), selection.cend(), [](auto v) { return v.column() == 0; }); count != 0)
- return tr("[%1 installed, %2 selected]").arg(m_model->size()).arg(count);
+ return tr(" (%1 installed, %2 selected)").arg(m_model->size()).arg(count);
}
- return tr("[%1 installed]").arg(m_model->size());
+ return tr(" (%1 installed)").arg(m_model->size());
}
diff --git a/launcher/ui/pages/instance/ModFolderPage.cpp b/launcher/ui/pages/instance/ModFolderPage.cpp
index 4548af59..1d090ef4 100644
--- a/launcher/ui/pages/instance/ModFolderPage.cpp
+++ b/launcher/ui/pages/instance/ModFolderPage.cpp
@@ -4,6 +4,7 @@
* Copyright (c) 2022 Jamie Mansfield
* Copyright (C) 2022 Sefa Eyeoglu
* Copyright (C) 2022 TheKodeToad
+ * Copyright (c) 2023 Trial97
*
* 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
@@ -86,28 +87,20 @@ ModFolderPage::ModFolderPage(BaseInstance* inst, std::shared_ptr
connect(ui->actionUpdateItem, &QAction::triggered, this, &ModFolderPage::updateMods);
auto check_allow_update = [this] {
- return (!m_instance || !m_instance->isRunning()) &&
- (ui->treeView->selectionModel()->hasSelection() || !m_model->empty());
+ return (!m_instance || !m_instance->isRunning()) && (ui->treeView->selectionModel()->hasSelection() || !m_model->empty());
};
- connect(ui->treeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, [this, check_allow_update] {
- ui->actionUpdateItem->setEnabled(check_allow_update());
- });
+ connect(ui->treeView->selectionModel(), &QItemSelectionModel::selectionChanged, this,
+ [this, check_allow_update] { ui->actionUpdateItem->setEnabled(check_allow_update()); });
- connect(mods.get(), &ModFolderModel::rowsInserted, this, [this, check_allow_update] {
- ui->actionUpdateItem->setEnabled(check_allow_update());
- });
+ connect(mods.get(), &ModFolderModel::rowsInserted, this,
+ [this, check_allow_update] { ui->actionUpdateItem->setEnabled(check_allow_update()); });
- connect(mods.get(), &ModFolderModel::rowsRemoved, this, [this, check_allow_update] {
- ui->actionUpdateItem->setEnabled(check_allow_update());
- });
+ connect(mods.get(), &ModFolderModel::rowsRemoved, this,
+ [this, check_allow_update] { ui->actionUpdateItem->setEnabled(check_allow_update()); });
- connect(mods.get(), &ModFolderModel::updateFinished, this, [this, check_allow_update, mods] {
- ui->actionUpdateItem->setEnabled(check_allow_update());
-
- // Prevent a weird crash when trying to open the mods page twice in a session o.O
- disconnect(mods.get(), &ModFolderModel::updateFinished, this, 0);
- });
+ connect(mods.get(), &ModFolderModel::updateFinished, this,
+ [this, check_allow_update, mods] { ui->actionUpdateItem->setEnabled(check_allow_update()); });
connect(m_instance, &BaseInstance::runningStatusChanged, this, &ModFolderPage::runningStateChanged);
ModFolderPage::runningStateChanged(m_instance && m_instance->isRunning());
--
cgit
From 3ee0fec7298d467d5b8b48a5144794f58bc2ce28 Mon Sep 17 00:00:00 2001
From: Trial97
Date: Mon, 19 Jun 2023 12:22:22 +0300
Subject: Removed mods from lambda
Signed-off-by: Trial97
---
launcher/ui/pages/instance/ModFolderPage.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/pages/instance/ModFolderPage.cpp b/launcher/ui/pages/instance/ModFolderPage.cpp
index 1d090ef4..90e7d0d6 100644
--- a/launcher/ui/pages/instance/ModFolderPage.cpp
+++ b/launcher/ui/pages/instance/ModFolderPage.cpp
@@ -100,7 +100,7 @@ ModFolderPage::ModFolderPage(BaseInstance* inst, std::shared_ptr
[this, check_allow_update] { ui->actionUpdateItem->setEnabled(check_allow_update()); });
connect(mods.get(), &ModFolderModel::updateFinished, this,
- [this, check_allow_update, mods] { ui->actionUpdateItem->setEnabled(check_allow_update()); });
+ [this, check_allow_update] { ui->actionUpdateItem->setEnabled(check_allow_update()); });
connect(m_instance, &BaseInstance::runningStatusChanged, this, &ModFolderPage::runningStateChanged);
ModFolderPage::runningStateChanged(m_instance && m_instance->isRunning());
--
cgit
From d02858040ef0d1f691b3456bb0ac271c484a7c57 Mon Sep 17 00:00:00 2001
From: Trial97
Date: Mon, 19 Jun 2023 13:09:37 +0300
Subject: Fixes #1212
Signed-off-by: Trial97
---
launcher/ui/pages/modplatform/ModPage.cpp | 16 ++++++-------
launcher/ui/pages/modplatform/ResourcePage.cpp | 31 +++++++++++++++-----------
2 files changed, 25 insertions(+), 22 deletions(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/pages/modplatform/ModPage.cpp b/launcher/ui/pages/modplatform/ModPage.cpp
index 95064d16..60a43128 100644
--- a/launcher/ui/pages/modplatform/ModPage.cpp
+++ b/launcher/ui/pages/modplatform/ModPage.cpp
@@ -89,17 +89,13 @@ void ModPage::filterMods()
void ModPage::triggerSearch()
{
- auto changed = m_filter_widget->changed();
m_filter = m_filter_widget->getFilter();
+ m_ui->packView->clearSelection();
+ m_ui->packDescription->clear();
+ m_ui->versionSelectionBox->clear();
+ updateSelectionButton();
- if (changed) {
- m_ui->packView->clearSelection();
- m_ui->packDescription->clear();
- m_ui->versionSelectionBox->clear();
- updateSelectionButton();
- }
-
- static_cast(m_model)->searchWithTerm(getSearchTerm(), m_ui->sortByBox->currentData().toUInt(), changed);
+ static_cast(m_model)->searchWithTerm(getSearchTerm(), m_ui->sortByBox->currentData().toUInt(), m_filter_widget->changed());
m_fetch_progress.watch(m_model->activeSearchJob().get());
}
@@ -122,6 +118,8 @@ void ModPage::updateVersionList()
QString mcVersion = packProfile->getComponentVersion("net.minecraft");
auto current_pack = getCurrentPack();
+ if (!current_pack)
+ return;
for (int i = 0; i < current_pack->versions.size(); i++) {
auto version = current_pack->versions[i];
bool valid = false;
diff --git a/launcher/ui/pages/modplatform/ResourcePage.cpp b/launcher/ui/pages/modplatform/ResourcePage.cpp
index 1d2509d8..aab2ee89 100644
--- a/launcher/ui/pages/modplatform/ResourcePage.cpp
+++ b/launcher/ui/pages/modplatform/ResourcePage.cpp
@@ -174,7 +174,11 @@ ModPlatform::IndexedPack::Ptr ResourcePage::getCurrentPack() const
void ResourcePage::updateUi()
{
auto current_pack = getCurrentPack();
-
+ if (!current_pack) {
+ m_ui->packDescription->setHtml({});
+ m_ui->packDescription->flush();
+ return;
+ }
QString text = "";
QString name = current_pack->name;
@@ -240,8 +244,8 @@ void ResourcePage::updateSelectionButton()
}
m_ui->resourceSelectionButton->setEnabled(true);
- if (getCurrentPack()) {
- if (!getCurrentPack()->isVersionSelected(m_selected_version_index))
+ if (auto current_pack = getCurrentPack(); current_pack) {
+ if (!current_pack->isVersionSelected(m_selected_version_index))
m_ui->resourceSelectionButton->setText(tr("Select %1 for download").arg(resourceString()));
else
m_ui->resourceSelectionButton->setText(tr("Deselect %1 for download").arg(resourceString()));
@@ -258,13 +262,14 @@ void ResourcePage::updateVersionList()
m_ui->versionSelectionBox->clear();
m_ui->versionSelectionBox->blockSignals(false);
- for (int i = 0; i < current_pack->versions.size(); i++) {
- auto& version = current_pack->versions[i];
- if (optedOut(version))
- continue;
+ if (current_pack)
+ for (int i = 0; i < current_pack->versions.size(); i++) {
+ auto& version = current_pack->versions[i];
+ if (optedOut(version))
+ continue;
- m_ui->versionSelectionBox->addItem(current_pack->versions[i].version, QVariant(i));
- }
+ m_ui->versionSelectionBox->addItem(current_pack->versions[i].version, QVariant(i));
+ }
if (m_ui->versionSelectionBox->count() == 0) {
m_ui->versionSelectionBox->addItem(tr("No valid version found."), QVariant(-1));
@@ -283,7 +288,7 @@ void ResourcePage::onSelectionChanged(QModelIndex curr, QModelIndex prev)
auto current_pack = getCurrentPack();
bool request_load = false;
- if (!current_pack->versionsLoaded) {
+ if (!current_pack || !current_pack->versionsLoaded) {
m_ui->resourceSelectionButton->setText(tr("Loading versions..."));
m_ui->resourceSelectionButton->setEnabled(false);
@@ -292,7 +297,7 @@ void ResourcePage::onSelectionChanged(QModelIndex curr, QModelIndex prev)
updateVersionList();
}
- if (!current_pack->extraDataLoaded)
+ if (current_pack && !current_pack->extraDataLoaded)
request_load = true;
if (request_load)
@@ -340,7 +345,7 @@ void ResourcePage::onResourceSelected()
return;
auto current_pack = getCurrentPack();
- if (!current_pack->versionsLoaded)
+ if (!current_pack || !current_pack->versionsLoaded)
return;
auto& version = current_pack->versions[m_selected_version_index];
@@ -386,7 +391,7 @@ void ResourcePage::openUrl(const QUrl& url)
const QString slug = match.captured(1);
// ensure the user isn't opening the same mod
- if (slug != getCurrentPack()->slug) {
+ if (auto current_pack = getCurrentPack(); current_pack && slug != current_pack->slug) {
m_parent_dialog->selectPage(page);
auto newPage = m_parent_dialog->getSelectedPage();
--
cgit
From f769b0b4c63888ac95416a4cc834aad2395f9b74 Mon Sep 17 00:00:00 2001
From: Alfio
Date: Tue, 20 Jun 2023 10:25:11 +0200
Subject: Remove inconsistent/unneeded question marks in UI
Signed-off-by: P2
---
launcher/ui/pages/global/LauncherPage.ui | 8 ++++----
launcher/ui/pages/global/MinecraftPage.ui | 2 +-
launcher/ui/pages/instance/InstanceSettingsPage.ui | 8 ++++----
3 files changed, 9 insertions(+), 9 deletions(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/pages/global/LauncherPage.ui b/launcher/ui/pages/global/LauncherPage.ui
index 55bd3eea..d9116bfc 100644
--- a/launcher/ui/pages/global/LauncherPage.ui
+++ b/launcher/ui/pages/global/LauncherPage.ui
@@ -172,7 +172,7 @@
Disable using metadata provided by mod providers (like Modrinth or Curseforge) for mods.
- Disable using metadata for mods?
+ Disable using metadata for mods
@@ -307,21 +307,21 @@
-
- Show console while the game is &running?
+ Show console while the game is &running
-
- &Automatically close console when the game quits?
+ &Automatically close console when the game quits
-
- Show console when the game &crashes?
+ Show console when the game &crashes
diff --git a/launcher/ui/pages/global/MinecraftPage.ui b/launcher/ui/pages/global/MinecraftPage.ui
index 103881b5..8f5de725 100644
--- a/launcher/ui/pages/global/MinecraftPage.ui
+++ b/launcher/ui/pages/global/MinecraftPage.ui
@@ -51,7 +51,7 @@
-
- Start Minecraft &maximized?
+ Start Minecraft &maximized
diff --git a/launcher/ui/pages/instance/InstanceSettingsPage.ui b/launcher/ui/pages/instance/InstanceSettingsPage.ui
index 19d6dc02..8427965d 100644
--- a/launcher/ui/pages/instance/InstanceSettingsPage.ui
+++ b/launcher/ui/pages/instance/InstanceSettingsPage.ui
@@ -269,7 +269,7 @@
-
- Start Minecraft maximized?
+ Start Minecraft maximized
@@ -341,21 +341,21 @@
-
- Show console while the game is running?
+ Show console while the game is running
-
- Automatically close console when the game quits?
+ Automatically close console when the game quits
-
- Show console when the game crashes?
+ Show console when the game crashes
--
cgit
From 470518eb3a3e0e43d67b7a15823c060755ad3284 Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Wed, 21 Jun 2023 02:31:40 -0700
Subject: fix: resize columns on hide ^& uniform heights
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
launcher/ui/pages/instance/ExternalResourcesPage.ui | 3 +++
1 file changed, 3 insertions(+)
(limited to 'launcher/ui')
diff --git a/launcher/ui/pages/instance/ExternalResourcesPage.ui b/launcher/ui/pages/instance/ExternalResourcesPage.ui
index 33a03336..f676361c 100644
--- a/launcher/ui/pages/instance/ExternalResourcesPage.ui
+++ b/launcher/ui/pages/instance/ExternalResourcesPage.ui
@@ -62,6 +62,9 @@
QAbstractItemView::DropOnly
+
+ true
+
--
cgit
From 2e82c1d40cd43aef4745726d51dd6a9df2d8f78b Mon Sep 17 00:00:00 2001
From: Trial97
Date: Wed, 21 Jun 2023 23:22:25 +0300
Subject: Added regex expresion to exclude .DS_Store files
Signed-off-by: Trial97
---
launcher/ui/dialogs/ExportMrPackDialog.cpp | 1 +
1 file changed, 1 insertion(+)
(limited to 'launcher/ui')
diff --git a/launcher/ui/dialogs/ExportMrPackDialog.cpp b/launcher/ui/dialogs/ExportMrPackDialog.cpp
index 239873f6..561b92e4 100644
--- a/launcher/ui/dialogs/ExportMrPackDialog.cpp
+++ b/launcher/ui/dialogs/ExportMrPackDialog.cpp
@@ -53,6 +53,7 @@ ExportMrPackDialog::ExportMrPackDialog(InstancePtr instance, QWidget* parent)
const QDir root(instance->gameRoot());
proxy = new FileIgnoreProxy(instance->gameRoot(), this);
proxy->setSourceModel(model);
+ proxy->setFilterRegularExpression("^(?!\\.DS_Store).+$");
const QDir::Filters filter(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs | QDir::Hidden);
--
cgit
From 03361e51efb20802c419e15228e8dc086c4d273b Mon Sep 17 00:00:00 2001
From: seth
Date: Thu, 22 Jun 2023 15:58:53 -0400
Subject: chore: add 'suggest a feature' message in help
Signed-off-by: seth
---
launcher/ui/MainWindow.ui | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/MainWindow.ui b/launcher/ui/MainWindow.ui
index f67fb185..113dfc1e 100644
--- a/launcher/ui/MainWindow.ui
+++ b/launcher/ui/MainWindow.ui
@@ -577,7 +577,7 @@
..
- Report a &Bug...
+ Report a Bug or Suggest a Feature
Open the bug tracker to report a bug with %1.
--
cgit
From a4521ac0bbd0472c0f8bbf184d1b2f5b54ed8e0b Mon Sep 17 00:00:00 2001
From: seth
Date: Thu, 22 Jun 2023 16:15:03 -0400
Subject: chore: avoid confusion in file/url import dialog
Signed-off-by: seth
---
launcher/ui/pages/modplatform/ImportPage.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'launcher/ui')
diff --git a/launcher/ui/pages/modplatform/ImportPage.h b/launcher/ui/pages/modplatform/ImportPage.h
index 8d13ac10..c2acb92d 100644
--- a/launcher/ui/pages/modplatform/ImportPage.h
+++ b/launcher/ui/pages/modplatform/ImportPage.h
@@ -57,7 +57,7 @@ public:
virtual ~ImportPage();
virtual QString displayName() const override
{
- return tr("Import from zip");
+ return tr("Import");
}
virtual QIcon icon() const override
{
--
cgit