fix: fix slots for Qt 6

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu
2022-05-16 20:34:07 +02:00
parent c363423718
commit 15c5bbcf22
18 changed files with 71 additions and 62 deletions

View File

@ -97,9 +97,9 @@ InstanceWindow::InstanceWindow(InstancePtr instance, QWidget *parent)
// set up instance and launch process recognition
{
auto launchTask = m_instance->getLaunchTask();
on_InstanceLaunchTask_changed(launchTask);
connect(m_instance.get(), &BaseInstance::launchTaskChanged, this, &InstanceWindow::on_InstanceLaunchTask_changed);
connect(m_instance.get(), &BaseInstance::runningStatusChanged, this, &InstanceWindow::on_RunningState_changed);
instanceLaunchTaskChanged(launchTask);
connect(m_instance.get(), &BaseInstance::launchTaskChanged, this, &InstanceWindow::instanceLaunchTaskChanged);
connect(m_instance.get(), &BaseInstance::runningStatusChanged, this, &InstanceWindow::runningStateChanged);
}
// set up instance destruction detection
@ -152,12 +152,12 @@ void InstanceWindow::on_btnLaunchMinecraftOffline_clicked()
APPLICATION->launch(m_instance, false, nullptr);
}
void InstanceWindow::on_InstanceLaunchTask_changed(shared_qobject_ptr<LaunchTask> proc)
void InstanceWindow::instanceLaunchTaskChanged(shared_qobject_ptr<LaunchTask> proc)
{
m_proc = proc;
}
void InstanceWindow::on_RunningState_changed(bool running)
void InstanceWindow::runningStateChanged(bool running)
{
updateLaunchButtons();
m_container->refreshContainer();

View File

@ -55,8 +55,8 @@ slots:
void on_btnKillMinecraft_clicked();
void on_btnLaunchMinecraftOffline_clicked();
void on_InstanceLaunchTask_changed(shared_qobject_ptr<LaunchTask> proc);
void on_RunningState_changed(bool running);
void instanceLaunchTaskChanged(shared_qobject_ptr<LaunchTask> proc);
void runningStateChanged(bool running);
void on_instanceStatusChanged(BaseInstance::Status, BaseInstance::Status newStatus);
protected:

View File

@ -235,7 +235,6 @@ public:
TranslatedAction actionMods;
TranslatedAction actionViewSelectedInstFolder;
TranslatedAction actionViewSelectedMCFolder;
TranslatedAction actionViewSelectedModsFolder;
TranslatedAction actionDeleteInstance;
TranslatedAction actionConfig_Folder;
TranslatedAction actionCAT;
@ -709,14 +708,6 @@ public:
actionViewSelectedMCFolder->setShortcut(QKeySequence(tr("Ctrl+M")));
all_actions.append(&actionViewSelectedMCFolder);
/*
actionViewSelectedModsFolder = TranslatedAction(MainWindow);
actionViewSelectedModsFolder->setObjectName(QStringLiteral("actionViewSelectedModsFolder"));
actionViewSelectedModsFolder.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Mods Folder"));
actionViewSelectedModsFolder.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open the selected instance's mods folder in a file browser."));
all_actions.append(&actionViewSelectedModsFolder);
*/
actionConfig_Folder = TranslatedAction(MainWindow);
actionConfig_Folder->setObjectName(QStringLiteral("actionConfig_Folder"));
actionConfig_Folder.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Confi&g Folder"));
@ -793,9 +784,6 @@ public:
instanceToolBar->addSeparator();
instanceToolBar->addAction(actionViewSelectedMCFolder);
/*
instanceToolBar->addAction(actionViewSelectedModsFolder);
*/
instanceToolBar->addAction(actionConfig_Folder);
instanceToolBar->addAction(actionViewSelectedInstFolder);
@ -1894,11 +1882,6 @@ void MainWindow::globalSettingsClosed()
update();
}
void MainWindow::on_actionInstanceSettings_triggered()
{
APPLICATION->showInstanceWindow(m_selectedInstance, "settings");
}
void MainWindow::on_actionEditInstNotes_triggered()
{
APPLICATION->showInstanceWindow(m_selectedInstance, "notes");
@ -2021,20 +2004,6 @@ void MainWindow::on_actionViewSelectedMCFolder_triggered()
}
}
void MainWindow::on_actionViewSelectedModsFolder_triggered()
{
if (m_selectedInstance)
{
QString str = m_selectedInstance->modsRoot();
if (!FS::ensureFilePathExists(str))
{
// TODO: report error
return;
}
DesktopServices::openDirectory(QDir(str).absolutePath());
}
}
void MainWindow::closeEvent(QCloseEvent *event)
{
// Save the window state and geometry.

View File

@ -118,8 +118,6 @@ private slots:
void on_actionViewSelectedMCFolder_triggered();
void on_actionViewSelectedModsFolder_triggered();
void refreshInstances();
void on_actionViewCentralModsFolder_triggered();
@ -128,8 +126,6 @@ private slots:
void on_actionSettings_triggered();
void on_actionInstanceSettings_triggered();
void on_actionManageAccounts_triggered();
void on_actionReportBug_triggered();

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
@ -36,11 +37,11 @@
#include "ProxyPage.h"
#include "ui_ProxyPage.h"
#include <QButtonGroup>
#include <QTabBar>
#include "settings/SettingsObject.h"
#include "Application.h"
#include "Application.h"
ProxyPage::ProxyPage(QWidget *parent) : QWidget(parent), ui(new Ui::ProxyPage)
{
@ -49,7 +50,8 @@ ProxyPage::ProxyPage(QWidget *parent) : QWidget(parent), ui(new Ui::ProxyPage)
loadSettings();
updateCheckboxStuff();
connect(ui->proxyGroup, SIGNAL(buttonClicked(int)), SLOT(proxyChanged(int)));
connect(ui->proxyGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked),
this, &ProxyPage::proxyGroupChanged);
}
ProxyPage::~ProxyPage()
@ -65,13 +67,13 @@ bool ProxyPage::apply()
void ProxyPage::updateCheckboxStuff()
{
ui->proxyAddrBox->setEnabled(!ui->proxyNoneBtn->isChecked() &&
!ui->proxyDefaultBtn->isChecked());
ui->proxyAuthBox->setEnabled(!ui->proxyNoneBtn->isChecked() &&
!ui->proxyDefaultBtn->isChecked());
bool enableEditing = ui->proxyHTTPBtn->isChecked()
|| ui->proxySOCKS5Btn->isChecked();
ui->proxyAddrBox->setEnabled(enableEditing);
ui->proxyAuthBox->setEnabled(enableEditing);
}
void ProxyPage::proxyChanged(int)
void ProxyPage::proxyGroupChanged(QAbstractButton *button)
{
updateCheckboxStuff();
}

View File

@ -36,6 +36,7 @@
#pragma once
#include <memory>
#include <QAbstractButton>
#include <QDialog>
#include "ui/pages/BasePage.h"
@ -73,15 +74,14 @@ public:
bool apply() override;
void retranslate() override;
private slots:
void proxyGroupChanged(QAbstractButton *button);
private:
void updateCheckboxStuff();
void applySettings();
void loadSettings();
private
slots:
void proxyChanged(int);
private:
Ui::ProxyPage *ui;
};

View File

@ -623,7 +623,7 @@ ServersPage::ServersPage(InstancePtr inst, QWidget* parent)
auto selectionModel = ui->serversView->selectionModel();
connect(selectionModel, &QItemSelectionModel::currentChanged, this, &ServersPage::currentChanged);
connect(m_inst.get(), &MinecraftInstance::runningStatusChanged, this, &ServersPage::on_RunningState_changed);
connect(m_inst.get(), &MinecraftInstance::runningStatusChanged, this, &ServersPage::runningStateChanged);
connect(ui->nameLine, &QLineEdit::textEdited, this, &ServersPage::nameEdited);
connect(ui->addressLine, &QLineEdit::textEdited, this, &ServersPage::addressEdited);
connect(ui->resourceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(resourceIndexChanged(int)));
@ -663,7 +663,7 @@ QMenu * ServersPage::createPopupMenu()
return filteredMenu;
}
void ServersPage::on_RunningState_changed(bool running)
void ServersPage::runningStateChanged(bool running)
{
if(m_locked == running)
{

View File

@ -97,7 +97,7 @@ private slots:
void on_actionMove_Down_triggered();
void on_actionJoin_triggered();
void on_RunningState_changed(bool running);
void runningStateChanged(bool running);
void nameEdited(const QString & name);
void addressEdited(const QString & address);