aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/winget.yml2
-rw-r--r--CMakeLists.txt2
-rw-r--r--launcher/ApplicationMessage.cpp8
-rw-r--r--launcher/ApplicationMessage.h4
-rw-r--r--launcher/icons/IconList.cpp19
-rw-r--r--launcher/icons/IconList.h1
-rw-r--r--launcher/ui/MainWindow.cpp2
-rw-r--r--launcher/ui/dialogs/IconPickerDialog.cpp6
-rw-r--r--launcher/ui/dialogs/IconPickerDialog.h1
-rw-r--r--launcher/ui/pages/instance/ManagedPackPage.cpp19
-rw-r--r--launcher/ui/widgets/VariableSizedImageObject.cpp2
11 files changed, 38 insertions, 28 deletions
diff --git a/.github/workflows/winget.yml b/.github/workflows/winget.yml
index 5c34040f..b4136df5 100644
--- a/.github/workflows/winget.yml
+++ b/.github/workflows/winget.yml
@@ -11,5 +11,5 @@ jobs:
with:
identifier: PrismLauncher.PrismLauncher
version: ${{ github.event.release.tag_name }}
- installers-regex: 'PrismLauncher-Windows-Setup-.+\.exe$'
+ installers-regex: 'PrismLauncher-Windows-MSVC(:?-arm64)?-Setup-.+\.exe$'
token: ${{ secrets.WINGET_TOKEN }}
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2bdd4811..75360f86 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -129,7 +129,7 @@ set(Launcher_NEWS_OPEN_URL "https://prismlauncher.org/news" CACHE STRING "URL th
set(Launcher_HELP_URL "https://prismlauncher.org/wiki/help-pages/%1" CACHE STRING "URL (with arg %1 to be substituted with page-id) that gets opened when the user requests help")
######## Set version numbers ########
-set(Launcher_VERSION_MAJOR 6)
+set(Launcher_VERSION_MAJOR 7)
set(Launcher_VERSION_MINOR 0)
set(Launcher_VERSION_NAME "${Launcher_VERSION_MAJOR}.${Launcher_VERSION_MINOR}")
diff --git a/launcher/ApplicationMessage.cpp b/launcher/ApplicationMessage.cpp
index ca276b89..700e43ce 100644
--- a/launcher/ApplicationMessage.cpp
+++ b/launcher/ApplicationMessage.cpp
@@ -47,8 +47,8 @@ void ApplicationMessage::parse(const QByteArray & input) {
args.clear();
auto parsedArgs = root.value("args").toObject();
- for(auto iter = parsedArgs.begin(); iter != parsedArgs.end(); iter++) {
- args[iter.key()] = iter.value().toString();
+ for(auto iter = parsedArgs.constBegin(); iter != parsedArgs.constEnd(); iter++) {
+ args.insert(iter.key(), iter.value().toString());
}
}
@@ -56,8 +56,8 @@ QByteArray ApplicationMessage::serialize() {
QJsonObject root;
root.insert("command", command);
QJsonObject outArgs;
- for (auto iter = args.begin(); iter != args.end(); iter++) {
- outArgs[iter.key()] = iter.value();
+ for (auto iter = args.constBegin(); iter != args.constEnd(); iter++) {
+ outArgs.insert(iter.key(), iter.value());
}
root.insert("args", outArgs);
diff --git a/launcher/ApplicationMessage.h b/launcher/ApplicationMessage.h
index 745bdead..d66456eb 100644
--- a/launcher/ApplicationMessage.h
+++ b/launcher/ApplicationMessage.h
@@ -1,12 +1,12 @@
#pragma once
#include <QString>
-#include <QMap>
+#include <QHash>
#include <QByteArray>
struct ApplicationMessage {
QString command;
- QMap<QString, QString> args;
+ QHash<QString, QString> args;
QByteArray serialize();
void parse(const QByteArray & input);
diff --git a/launcher/icons/IconList.cpp b/launcher/icons/IconList.cpp
index 01043ad2..1dfc6432 100644
--- a/launcher/icons/IconList.cpp
+++ b/launcher/icons/IconList.cpp
@@ -354,15 +354,18 @@ const MMCIcon *IconList::icon(const QString &key) const
bool IconList::deleteIcon(const QString &key)
{
- int iconIdx = getIconIndex(key);
- if (iconIdx == -1)
+ if (!iconFileExists(key))
return false;
- auto &iconEntry = icons[iconIdx];
- if (iconEntry.has(IconType::FileBased))
- {
- return QFile::remove(iconEntry.m_images[IconType::FileBased].filename);
- }
- return false;
+
+ return QFile::remove(icon(key)->getFilePath());
+}
+
+bool IconList::trashIcon(const QString &key)
+{
+ if (!iconFileExists(key))
+ return false;
+
+ return FS::trash(icon(key)->getFilePath(), nullptr);
}
bool IconList::addThemeIcon(const QString& key)
diff --git a/launcher/icons/IconList.h b/launcher/icons/IconList.h
index f9f49e7f..97141e4a 100644
--- a/launcher/icons/IconList.h
+++ b/launcher/icons/IconList.h
@@ -52,6 +52,7 @@ public:
bool addIcon(const QString &key, const QString &name, const QString &path, const IconType type);
void saveIcon(const QString &key, const QString &path, const char * format) const;
bool deleteIcon(const QString &key);
+ bool trashIcon(const QString &key);
bool iconFileExists(const QString &key) const;
void installIcons(const QStringList &iconFiles);
diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp
index 2f1976cc..3651aa15 100644
--- a/launcher/ui/MainWindow.cpp
+++ b/launcher/ui/MainWindow.cpp
@@ -1683,7 +1683,7 @@ InstanceView
background-image: url(:/backgrounds/%1);
background-attachment: fixed;
background-clip: padding;
- background-position: bottom left;
+ background-position: bottom right;
background-repeat: none;
background-color:palette(base);
})")
diff --git a/launcher/ui/dialogs/IconPickerDialog.cpp b/launcher/ui/dialogs/IconPickerDialog.cpp
index fcb645db..0551a1ef 100644
--- a/launcher/ui/dialogs/IconPickerDialog.cpp
+++ b/launcher/ui/dialogs/IconPickerDialog.cpp
@@ -63,7 +63,7 @@ IconPickerDialog::IconPickerDialog(QWidget *parent)
// NOTE: ResetRole forces the button to be on the left, while the OK/Cancel ones are on the right. We win.
auto buttonAdd = ui->buttonBox->addButton(tr("Add Icon"), QDialogButtonBox::ResetRole);
- auto buttonRemove = ui->buttonBox->addButton(tr("Remove Icon"), QDialogButtonBox::ResetRole);
+ buttonRemove = ui->buttonBox->addButton(tr("Remove Icon"), QDialogButtonBox::ResetRole);
connect(buttonAdd, SIGNAL(clicked(bool)), SLOT(addNewIcon()));
connect(buttonRemove, SIGNAL(clicked(bool)), SLOT(removeSelectedIcon()));
@@ -111,6 +111,9 @@ void IconPickerDialog::addNewIcon()
void IconPickerDialog::removeSelectedIcon()
{
+ if (APPLICATION->icons()->trashIcon(selectedIconKey))
+ return;
+
APPLICATION->icons()->deleteIcon(selectedIconKey);
}
@@ -129,6 +132,7 @@ void IconPickerDialog::selectionChanged(QItemSelection selected, QItemSelection
if (!key.isEmpty()) {
selectedIconKey = key;
}
+ buttonRemove->setEnabled(APPLICATION->icons()->iconFileExists(selectedIconKey));
}
int IconPickerDialog::execWithSelection(QString selection)
diff --git a/launcher/ui/dialogs/IconPickerDialog.h b/launcher/ui/dialogs/IconPickerDialog.h
index 9af6a678..c93f565f 100644
--- a/launcher/ui/dialogs/IconPickerDialog.h
+++ b/launcher/ui/dialogs/IconPickerDialog.h
@@ -37,6 +37,7 @@ protected:
private:
Ui::IconPickerDialog *ui;
+ QPushButton *buttonRemove;
private
slots:
diff --git a/launcher/ui/pages/instance/ManagedPackPage.cpp b/launcher/ui/pages/instance/ManagedPackPage.cpp
index 7a0d234c..4de80468 100644
--- a/launcher/ui/pages/instance/ManagedPackPage.cpp
+++ b/launcher/ui/pages/instance/ManagedPackPage.cpp
@@ -7,6 +7,7 @@
#include <QListView>
#include <QProxyStyle>
+#include <QStyleFactory>
#include <HoeDown.h>
@@ -60,7 +61,10 @@ ManagedPackPage::ManagedPackPage(BaseInstance* inst, InstanceWindow* instance_wi
ui->setupUi(this);
- ui->versionsComboBox->setStyle(new NoBigComboBoxStyle(ui->versionsComboBox->style()));
+ // NOTE: GTK2 themes crash with the proxy style.
+ // This seems like an upstream bug, so there's not much else that can be done.
+ if (!QStyleFactory::keys().contains("gtk2"))
+ ui->versionsComboBox->setStyle(new NoBigComboBoxStyle(ui->versionsComboBox->style()));
ui->reloadButton->setVisible(false);
connect(ui->reloadButton, &QPushButton::clicked, this, [this](bool){
@@ -223,17 +227,16 @@ void ModrinthManagedPackPage::parseManagedPack()
ui->versionsComboBox->blockSignals(false);
for (auto version : m_pack.versions) {
- QString name;
+ QString name = version.version;
if (!version.name.contains(version.version))
name = QString("%1 — %2").arg(version.name, version.version);
- else
- name = version.name;
// NOTE: the id from version isn't the same id in the modpack format spec...
// e.g. HexMC's 4.4.0 has versionId 4.0.0 in the modpack index..............
if (version.version == m_inst->getManagedPackVersionName())
- name.append(tr(" (Current)"));
+ name = tr("%1 (Current)").arg(name);
+
ui->versionsComboBox->addItem(name, QVariant(version.id));
}
@@ -370,12 +373,10 @@ void FlameManagedPackPage::parseManagedPack()
ui->versionsComboBox->blockSignals(false);
for (auto version : m_pack.versions) {
- QString name;
-
- name = version.version;
+ QString name = version.version;
if (version.fileId == m_inst->getManagedPackVersionID().toInt())
- name.append(tr(" (Current)"));
+ name = tr("%1 (Current)").arg(name);
ui->versionsComboBox->addItem(name, QVariant(version.fileId));
}
diff --git a/launcher/ui/widgets/VariableSizedImageObject.cpp b/launcher/ui/widgets/VariableSizedImageObject.cpp
index e57f7e95..991b4a04 100644
--- a/launcher/ui/widgets/VariableSizedImageObject.cpp
+++ b/launcher/ui/widgets/VariableSizedImageObject.cpp
@@ -101,7 +101,7 @@ void VariableSizedImageObject::loadImage(QTextDocument* doc, const QUrl& source,
auto full_entry_path = entry->getFullPath();
auto source_url = source;
- connect(job, &NetJob::succeeded, [this, doc, full_entry_path, source_url, posInDocument] {
+ connect(job, &NetJob::succeeded, this, [this, doc, full_entry_path, source_url, posInDocument] {
qDebug() << "Loaded resource at" << full_entry_path;
// If we flushed, don't proceed.