Merge remote-tracking branch 'origin/develop' into download-all-blocked

Signed-off-by: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com>
This commit is contained in:
kumquat-ir
2022-07-31 14:54:50 -04:00
60 changed files with 1019 additions and 1299 deletions

View File

@ -252,6 +252,9 @@ public:
TranslatedAction actionViewInstanceFolder;
TranslatedAction actionViewCentralModsFolder;
QMenu * editMenu = nullptr;
TranslatedAction actionUndoTrashInstance;
QMenu * helpMenu = nullptr;
TranslatedToolButton helpMenuButton;
TranslatedAction actionReportBug;
@ -335,6 +338,14 @@ public:
actionSettings->setShortcut(QKeySequence::Preferences);
all_actions.append(&actionSettings);
actionUndoTrashInstance = TranslatedAction(MainWindow);
connect(actionUndoTrashInstance, SIGNAL(triggered(bool)), MainWindow, SLOT(undoTrashInstance()));
actionUndoTrashInstance->setObjectName(QStringLiteral("actionUndoTrashInstance"));
actionUndoTrashInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "&Undo Last Instance Deletion"));
actionUndoTrashInstance->setEnabled(APPLICATION->instances()->trashedSomething());
actionUndoTrashInstance->setShortcut(QKeySequence("Ctrl+Z"));
all_actions.append(&actionUndoTrashInstance);
if (!BuildConfig.BUG_TRACKER_URL.isEmpty()) {
actionReportBug = TranslatedAction(MainWindow);
actionReportBug->setObjectName(QStringLiteral("actionReportBug"));
@ -508,6 +519,9 @@ public:
fileMenu->addSeparator();
fileMenu->addAction(actionSettings);
editMenu = menuBar->addMenu(tr("&Edit"));
editMenu->addAction(actionUndoTrashInstance);
viewMenu = menuBar->addMenu(tr("&View"));
viewMenu->setSeparatorsCollapsible(false);
viewMenu->addAction(actionCAT);
@ -732,9 +746,10 @@ public:
actionDeleteInstance = TranslatedAction(MainWindow);
actionDeleteInstance->setObjectName(QStringLiteral("actionDeleteInstance"));
actionDeleteInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Dele&te Instance..."));
actionDeleteInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Dele&te Instance"));
actionDeleteInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Delete the selected instance."));
actionDeleteInstance->setShortcuts({QKeySequence(tr("Backspace")), QKeySequence::Delete});
actionDeleteInstance->setAutoRepeat(false);
all_actions.append(&actionDeleteInstance);
actionCopyInstance = TranslatedAction(MainWindow);
@ -1150,6 +1165,11 @@ void MainWindow::showInstanceContextMenu(const QPoint &pos)
connect(actionDeleteGroup, SIGNAL(triggered(bool)), SLOT(deleteGroup()));
actions.append(actionDeleteGroup);
}
QAction *actionUndoTrashInstance = new QAction("Undo last trash instance", this);
connect(actionUndoTrashInstance, SIGNAL(triggered(bool)), SLOT(undoTrashInstance()));
actionUndoTrashInstance->setEnabled(APPLICATION->instances()->trashedSomething());
actions.append(actionUndoTrashInstance);
}
QMenu myMenu;
myMenu.addActions(actions);
@ -1832,6 +1852,11 @@ void MainWindow::deleteGroup()
}
}
void MainWindow::undoTrashInstance()
{
APPLICATION->instances()->undoTrashInstance();
}
void MainWindow::on_actionViewInstanceFolder_triggered()
{
QString str = APPLICATION->settings()->get("InstanceDir").toString();
@ -1957,7 +1982,12 @@ void MainWindow::on_actionDeleteInstance_triggered()
{
return;
}
auto id = m_selectedInstance->id();
if (APPLICATION->instances()->trashInstance(id)) {
return;
}
auto response = CustomMessageBox::selectable(
this,
tr("CAREFUL!"),

View File

@ -145,6 +145,7 @@ private slots:
void on_actionDeleteInstance_triggered();
void deleteGroup();
void undoTrashInstance();
void on_actionExportInstance_triggered();

View File

@ -158,8 +158,9 @@ void ModUpdateDialog::checkCandidates()
if (!reason.isEmpty())
text += tr("Reason: %1").arg(reason) + "<br>";
if (!recover_url.isEmpty())
text += tr("Possible solution: ") + tr("Getting the latest version manually:") + "<br>" +
QString("<a href='%1'>").arg(recover_url.toString()) + recover_url.toString() + "</a><br>";
//: %1 is the link to download it manually
text += tr("Possible solution: Getting the latest version manually:<br>%1<br>")
.arg(QString("<a href='%1'>%1</a>").arg(recover_url.toString()));
text += "<br>";
}
@ -241,9 +242,9 @@ auto ModUpdateDialog::ensureMetadata() -> bool
}
ChooseProviderDialog chooser(this);
chooser.setDescription(tr("This mod (%1) does not have a metadata yet. We need to create one in order to keep relevant "
"information on how to update this "
"mod. To do this, please select a mod provider from which we can search for updates for %1.")
chooser.setDescription(tr("The mod '%1' does not have a metadata yet. We need to generate it in order to track relevant "
"information on how to update this mod. "
"To do this, please select a mod provider which we can use to check for updates for this mod.")
.arg(candidate->name()));
auto confirmed = chooser.exec() == QDialog::DialogCode::Accepted;
@ -330,7 +331,7 @@ void ModUpdateDialog::onMetadataFailed(Mod* mod, bool try_others, ModPlatform::P
m_second_try_metadata->addTask(task);
} else {
QString reason{ tr("Didn't find a valid version on the selected mod provider(s)") };
QString reason{ tr("Couldn't find a valid version on the selected mod provider(s)") };
m_failed_metadata.append({mod, reason});
}

View File

@ -43,8 +43,8 @@ void ProgressDialog::setSkipButton(bool present, QString label)
void ProgressDialog::on_skipButton_clicked(bool checked)
{
Q_UNUSED(checked);
task->abort();
QDialog::reject();
if (task->abort())
QDialog::reject();
}
ProgressDialog::~ProgressDialog()

View File

@ -32,13 +32,13 @@ class SortProxy : public QSortFilterProxyModel {
const auto& mod = model->at(source_row);
if (mod.name().contains(filterRegularExpression()))
if (filterRegularExpression().match(mod.name()).hasMatch())
return true;
if (mod.description().contains(filterRegularExpression()))
if (filterRegularExpression().match(mod.description()).hasMatch())
return true;
for (auto& author : mod.authors()) {
if (author.contains(filterRegularExpression())) {
if (filterRegularExpression().match(author).hasMatch()) {
return true;
}
}
@ -182,7 +182,7 @@ void ExternalResourcesPage::retranslate()
void ExternalResourcesPage::filterTextChanged(const QString& newContents)
{
m_viewFilter = newContents;
m_filterModel->setFilterFixedString(m_viewFilter);
m_filterModel->setFilterRegularExpression(m_viewFilter);
}
void ExternalResourcesPage::runningStateChanged(bool running)

View File

@ -155,7 +155,7 @@
<string>Check for &amp;Updates</string>
</property>
<property name="toolTip">
<string>"Tries to find / update all selected resources (all resources if none is selected)"</string>
<string>Try to check or update all selected resources (all resources if none are selected)</string>
</property>
</action>
</widget>

View File

@ -349,7 +349,7 @@ void InstanceSettingsPage::loadSettings()
ui->useDiscreteGpuCheck->setChecked(m_settings->get("UseDiscreteGpu").toBool());
#if !defined(Q_OS_LINUX)
ui->perfomanceGroupBox->setVisible(false);
ui->settingsTabs->setTabVisible(ui->settingsTabs->indexOf(ui->performancePage), false);
#endif
// Miscellanous

View File

@ -80,7 +80,7 @@ ModFolderPage::ModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolderModel>
connect(ui->actionDownloadItem, &QAction::triggered, this, &ModFolderPage::installMods);
ui->actionUpdateItem->setToolTip(tr("Tries to find / update all selected mods (all mods if none is selected)"));
ui->actionUpdateItem->setToolTip(tr("Try to check or update all selected mods (all mods if none are selected)"));
ui->actionsToolbar->insertActionAfter(ui->actionAddItem, ui->actionUpdateItem);
connect(ui->actionUpdateItem, &QAction::triggered, this, &ModFolderPage::updateMods);
@ -190,10 +190,15 @@ void ModFolderPage::updateMods()
return;
}
if (update_dialog.noUpdates()) {
CustomMessageBox::selectable(this, tr("Update checker"),
(mods_list.size() == 1)
? tr("'%1' is up-to-date! :)").arg(mods_list.front()->name())
: tr("All %1mods are up-to-date! :)").arg(use_all ? "" : (tr("selected") + " ")))
QString message{ tr("'%1' is up-to-date! :)").arg(mods_list.front()->name()) };
if (mods_list.size() > 1) {
if (use_all) {
message = tr("All mods are up-to-date! :)");
} else {
message = tr("All selected mods are up-to-date! :)");
}
}
CustomMessageBox::selectable(this, tr("Update checker"), message)
->exec();
return;
}

View File

@ -2,6 +2,7 @@
/*
* PolyMC - Minecraft Launcher
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
* 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
@ -126,7 +127,7 @@ void FtbPage::suggestCurrent()
return;
}
dialog->setSuggestedPack(selected.name + " " + selectedVersion, new ModpacksCH::PackInstallTask(selected, selectedVersion));
dialog->setSuggestedPack(selected.name + " " + selectedVersion, new ModpacksCH::PackInstallTask(selected, selectedVersion, this));
for(auto art : selected.art) {
if(art.type == "square") {
QString editedLogoName;

View File

@ -31,6 +31,7 @@ QPalette DarkTheme::colorScheme()
darkPalette.setColor(QPalette::Link, QColor(42, 130, 218));
darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
darkPalette.setColor(QPalette::HighlightedText, Qt::black);
darkPalette.setColor(QPalette::PlaceholderText, Qt::darkGray);
return fadeInactive(darkPalette, fadeAmount(), fadeColor());
}