Merge branch 'develop' into launcher-log-page

This commit is contained in:
Yihe Li 2025-06-05 23:20:46 +08:00
commit dea8de01e3
No known key found for this signature in database
48 changed files with 163 additions and 182 deletions

View file

@ -158,12 +158,12 @@ LogPage::LogPage(InstancePtr instance, QWidget* parent) : QWidget(parent), ui(ne
}
auto findShortcut = new QShortcut(QKeySequence(QKeySequence::Find), this);
connect(findShortcut, SIGNAL(activated()), SLOT(findActivated()));
connect(findShortcut, &QShortcut::activated, this, &LogPage::findActivated);
auto findNextShortcut = new QShortcut(QKeySequence(QKeySequence::FindNext), this);
connect(findNextShortcut, SIGNAL(activated()), SLOT(findNextActivated()));
connect(ui->searchBar, SIGNAL(returnPressed()), SLOT(on_findButton_clicked()));
connect(findNextShortcut, &QShortcut::activated, this, &LogPage::findNextActivated);
connect(ui->searchBar, &QLineEdit::returnPressed, this, &LogPage::on_findButton_clicked);
auto findPreviousShortcut = new QShortcut(QKeySequence(QKeySequence::FindPrevious), this);
connect(findPreviousShortcut, SIGNAL(activated()), SLOT(findPreviousActivated()));
connect(findPreviousShortcut, &QShortcut::activated, this, &LogPage::findPreviousActivated);
}
LogPage::~LogPage()

View file

@ -239,7 +239,7 @@ ModrinthManagedPackPage::ModrinthManagedPackPage(BaseInstance* inst, InstanceWin
: ManagedPackPage(inst, instance_window, parent)
{
Q_ASSERT(inst->isManagedPack());
connect(ui->versionsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(suggestVersion()));
connect(ui->versionsComboBox, &QComboBox::currentIndexChanged, this, &ModrinthManagedPackPage::suggestVersion);
connect(ui->updateButton, &QPushButton::clicked, this, &ModrinthManagedPackPage::update);
connect(ui->updateFromFileButton, &QPushButton::clicked, this, &ModrinthManagedPackPage::updateFromFile);
}
@ -264,7 +264,7 @@ void ModrinthManagedPackPage::parseManagedPack()
m_fetch_job->addNetAction(
Net::ApiDownload::makeByteArray(QString("%1/project/%2/version").arg(BuildConfig.MODRINTH_PROD_URL, id), response));
QObject::connect(m_fetch_job.get(), &NetJob::succeeded, this, [this, response, id] {
connect(m_fetch_job.get(), &NetJob::succeeded, this, [this, response, id] {
QJsonParseError parse_error{};
QJsonDocument doc = QJsonDocument::fromJson(*response, &parse_error);
if (parse_error.error != QJsonParseError::NoError) {
@ -310,8 +310,8 @@ void ModrinthManagedPackPage::parseManagedPack()
m_loaded = true;
});
QObject::connect(m_fetch_job.get(), &NetJob::failed, this, &ModrinthManagedPackPage::setFailState);
QObject::connect(m_fetch_job.get(), &NetJob::aborted, this, &ModrinthManagedPackPage::setFailState);
connect(m_fetch_job.get(), &NetJob::failed, this, &ModrinthManagedPackPage::setFailState);
connect(m_fetch_job.get(), &NetJob::aborted, this, &ModrinthManagedPackPage::setFailState);
ui->changelogTextBrowser->setText(tr("Fetching changelogs..."));
@ -418,7 +418,7 @@ FlameManagedPackPage::FlameManagedPackPage(BaseInstance* inst, InstanceWindow* i
: ManagedPackPage(inst, instance_window, parent)
{
Q_ASSERT(inst->isManagedPack());
connect(ui->versionsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(suggestVersion()));
connect(ui->versionsComboBox, &QComboBox::currentIndexChanged, this, &FlameManagedPackPage::suggestVersion);
connect(ui->updateButton, &QPushButton::clicked, this, &FlameManagedPackPage::update);
connect(ui->updateFromFileButton, &QPushButton::clicked, this, &FlameManagedPackPage::updateFromFile);
}
@ -459,7 +459,7 @@ void FlameManagedPackPage::parseManagedPack()
m_fetch_job->addNetAction(Net::ApiDownload::makeByteArray(QString("%1/mods/%2/files").arg(BuildConfig.FLAME_BASE_URL, id), response));
QObject::connect(m_fetch_job.get(), &NetJob::succeeded, this, [this, response, id] {
connect(m_fetch_job.get(), &NetJob::succeeded, this, [this, response, id] {
QJsonParseError parse_error{};
QJsonDocument doc = QJsonDocument::fromJson(*response, &parse_error);
if (parse_error.error != QJsonParseError::NoError) {
@ -502,8 +502,8 @@ void FlameManagedPackPage::parseManagedPack()
m_loaded = true;
});
QObject::connect(m_fetch_job.get(), &NetJob::failed, this, &FlameManagedPackPage::setFailState);
QObject::connect(m_fetch_job.get(), &NetJob::aborted, this, &FlameManagedPackPage::setFailState);
connect(m_fetch_job.get(), &NetJob::failed, this, &FlameManagedPackPage::setFailState);
connect(m_fetch_job.get(), &NetJob::aborted, this, &FlameManagedPackPage::setFailState);
m_fetch_job->start();
}

View file

@ -135,7 +135,7 @@ class FilterModel : public QIdentityProxyModel {
m_thumbnailingPool.setMaxThreadCount(4);
m_thumbnailCache = std::make_shared<SharedIconCache>();
m_thumbnailCache->add("placeholder", APPLICATION->getThemedIcon("screenshot-placeholder"));
connect(&watcher, SIGNAL(fileChanged(QString)), SLOT(fileChanged(QString)));
connect(&watcher, &QFileSystemWatcher::fileChanged, this, &FilterModel::fileChanged);
}
virtual ~FilterModel()
{
@ -191,9 +191,9 @@ class FilterModel : public QIdentityProxyModel {
void thumbnailImage(QString path)
{
auto runnable = new ThumbnailRunnable(path, m_thumbnailCache);
connect(&(runnable->m_resultEmitter), SIGNAL(resultsReady(QString)), SLOT(thumbnailReady(QString)));
connect(&(runnable->m_resultEmitter), SIGNAL(resultsFailed(QString)), SLOT(thumbnailFailed(QString)));
((QThreadPool&)m_thumbnailingPool).start(runnable);
connect(&runnable->m_resultEmitter, &ThumbnailingResult::resultsReady, this, &FilterModel::thumbnailReady);
connect(&runnable->m_resultEmitter, &ThumbnailingResult::resultsFailed, this, &FilterModel::thumbnailFailed);
m_thumbnailingPool.start(runnable);
}
private slots:
void thumbnailReady(QString path) { emit layoutChanged(); }
@ -266,7 +266,7 @@ ScreenshotsPage::ScreenshotsPage(QString path, QWidget* parent) : QMainWindow(pa
ui->listView->setItemDelegate(new CenteredEditingDelegate(this));
ui->listView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->listView, &QListView::customContextMenuRequested, this, &ScreenshotsPage::ShowContextMenu);
connect(ui->listView, SIGNAL(activated(QModelIndex)), SLOT(onItemActivated(QModelIndex)));
connect(ui->listView, &QAbstractItemView::activated, this, &ScreenshotsPage::onItemActivated);
}
bool ScreenshotsPage::eventFilter(QObject* obj, QEvent* evt)

View file

@ -16,26 +16,26 @@ void ServerPingTask::executeTask()
// Resolve the actual IP and port for the server
McResolver* resolver = new McResolver(nullptr, m_domain, m_port);
QObject::connect(resolver, &McResolver::succeeded, this, [this](QString ip, int port) {
connect(resolver, &McResolver::succeeded, this, [this](QString ip, int port) {
qDebug() << "Resolved Address for" << m_domain << ": " << ip << ":" << port;
// Now that we have the IP and port, query the server
McClient* client = new McClient(nullptr, m_domain, ip, port);
QObject::connect(client, &McClient::succeeded, this, [this](QJsonObject data) {
connect(client, &McClient::succeeded, this, [this](QJsonObject data) {
m_outputOnlinePlayers = getOnlinePlayers(data);
qDebug() << "Online players: " << m_outputOnlinePlayers;
emitSucceeded();
});
QObject::connect(client, &McClient::failed, this, [this](QString error) { emitFailed(error); });
connect(client, &McClient::failed, this, [this](QString error) { emitFailed(error); });
// Delete McClient object when done
QObject::connect(client, &McClient::finished, this, [client]() { client->deleteLater(); });
connect(client, &McClient::finished, this, [client]() { client->deleteLater(); });
client->getStatusData();
});
QObject::connect(resolver, &McResolver::failed, this, [this](QString error) { emitFailed(error); });
connect(resolver, &McResolver::failed, this, [this](QString error) { emitFailed(error); });
// Delete McResolver object when done
QObject::connect(resolver, &McResolver::finished, [resolver]() { resolver->deleteLater(); });
connect(resolver, &McResolver::finished, [resolver]() { resolver->deleteLater(); });
resolver->ping();
}

View file

@ -578,7 +578,7 @@ ServersPage::ServersPage(InstancePtr inst, QWidget* parent) : QMainWindow(parent
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)));
connect(ui->resourceComboBox, &QComboBox::currentIndexChanged, this, &ServersPage::resourceIndexChanged);
connect(m_model, &QAbstractItemModel::rowsRemoved, this, &ServersPage::rowsRemoved);
m_locked = m_inst->isRunning();