aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages/instance/ModFolderPage.cpp
diff options
context:
space:
mode:
authorseth <getchoo@tuta.io>2023-06-20 19:56:38 -0400
committerGitHub <noreply@github.com>2023-06-20 19:56:38 -0400
commitca659136e2dc5f987bb5646eff0d8a7dd1b90774 (patch)
treeabb3fcbe7eb19025299d54418f0527bd6416e6d1 /launcher/ui/pages/instance/ModFolderPage.cpp
parentf1a6dc5332e0cecf07650d3611c780f013bc495f (diff)
parent3ee0fec7298d467d5b8b48a5144794f58bc2ce28 (diff)
downloadPrismLauncher-ca659136e2dc5f987bb5646eff0d8a7dd1b90774.tar.gz
PrismLauncher-ca659136e2dc5f987bb5646eff0d8a7dd1b90774.tar.bz2
PrismLauncher-ca659136e2dc5f987bb5646eff0d8a7dd1b90774.zip
Merge pull request #1119 from Trial97/mods_txt
Added dynamic page extra info
Diffstat (limited to 'launcher/ui/pages/instance/ModFolderPage.cpp')
-rw-r--r--launcher/ui/pages/instance/ModFolderPage.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/launcher/ui/pages/instance/ModFolderPage.cpp b/launcher/ui/pages/instance/ModFolderPage.cpp
index 4548af59..90e7d0d6 100644
--- a/launcher/ui/pages/instance/ModFolderPage.cpp
+++ b/launcher/ui/pages/instance/ModFolderPage.cpp
@@ -4,6 +4,7 @@
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
* Copyright (C) 2022 TheKodeToad <TheKodeToad@proton.me>
+ * Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.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
@@ -86,28 +87,20 @@ ModFolderPage::ModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolderModel>
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] { ui->actionUpdateItem->setEnabled(check_allow_update()); });
connect(m_instance, &BaseInstance::runningStatusChanged, this, &ModFolderPage::runningStateChanged);
ModFolderPage::runningStateChanged(m_instance && m_instance->isRunning());