From 5c8481a118c8fefbfe901001d7828eaf6866eac4 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Tue, 29 Apr 2025 10:34:42 +0300 Subject: [PATCH 1/2] chore: reformat Signed-off-by: Trial97 --- launcher/Application.cpp | 1 + launcher/launch/LogModel.cpp | 4 +- launcher/logs/LogParser.cpp | 2 +- launcher/minecraft/MinecraftInstance.cpp | 1 - launcher/minecraft/mod/Mod.h | 2 +- .../minecraft/mod/TexturePackFolderModel.cpp | 3 +- launcher/net/HttpMetaCache.cpp | 4 +- launcher/tasks/Task.h | 5 +- launcher/ui/MainWindow.cpp | 2 +- launcher/ui/pages/global/JavaPage.cpp | 2 +- launcher/ui/pages/global/JavaPage.h | 2 +- .../ui/pages/instance/InstanceSettingsPage.h | 5 +- .../ui/pages/instance/ManagedPackPage.cpp | 15 ++- launcher/ui/pages/instance/McClient.cpp | 91 ++++++++++--------- launcher/ui/pages/instance/McClient.h | 27 +++--- launcher/ui/pages/instance/McResolver.cpp | 31 ++++--- launcher/ui/pages/instance/McResolver.h | 14 +-- launcher/ui/pages/instance/ServerPingTask.cpp | 32 +++---- launcher/ui/pages/instance/ServerPingTask.h | 7 +- launcher/ui/themes/HintOverrideProxyStyle.cpp | 3 +- 20 files changed, 134 insertions(+), 119 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 33d700772..0daab026c 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -128,6 +128,7 @@ #include #include +#include #include "SysInfo.h" #ifdef Q_OS_LINUX diff --git a/launcher/launch/LogModel.cpp b/launcher/launch/LogModel.cpp index 53a450ff7..90af9787d 100644 --- a/launcher/launch/LogModel.cpp +++ b/launcher/launch/LogModel.cpp @@ -167,8 +167,8 @@ bool LogModel::isOverFlow() return m_numLines >= m_maxLines && m_stopOnOverflow; } - -MessageLevel::Enum LogModel::previousLevel() { +MessageLevel::Enum LogModel::previousLevel() +{ if (!m_content.isEmpty()) { return m_content.last().level; } diff --git a/launcher/logs/LogParser.cpp b/launcher/logs/LogParser.cpp index 6e33b24dd..0790dec4d 100644 --- a/launcher/logs/LogParser.cpp +++ b/launcher/logs/LogParser.cpp @@ -107,7 +107,7 @@ std::optional LogParser::parseNext() if (m_buffer.trimmed().isEmpty()) { auto text = QString(m_buffer); m_buffer.clear(); - return LogParser::PlainText { text }; + return LogParser::PlainText{ text }; } // check if we have a full xml log4j event diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp index b8ab93d5b..991afce89 100644 --- a/launcher/minecraft/MinecraftInstance.cpp +++ b/launcher/minecraft/MinecraftInstance.cpp @@ -1003,7 +1003,6 @@ QMap MinecraftInstance::createCensorFilterFromSession(AuthSess return filter; } - QStringList MinecraftInstance::getLogFileSearchPaths() { return { FS::PathCombine(gameRoot(), "crash-reports"), FS::PathCombine(gameRoot(), "logs"), gameRoot() }; diff --git a/launcher/minecraft/mod/Mod.h b/launcher/minecraft/mod/Mod.h index deb1859de..553af92f3 100644 --- a/launcher/minecraft/mod/Mod.h +++ b/launcher/minecraft/mod/Mod.h @@ -84,7 +84,7 @@ class Mod : public Resource { bool valid() const override; - [[nodiscard]] int compare(const Resource & other, SortType type) const override; + [[nodiscard]] int compare(const Resource& other, SortType type) const override; [[nodiscard]] bool applyFilter(QRegularExpression filter) const override; // Delete all the files of this mod diff --git a/launcher/minecraft/mod/TexturePackFolderModel.cpp b/launcher/minecraft/mod/TexturePackFolderModel.cpp index 073ea7ca7..4d7c71359 100644 --- a/launcher/minecraft/mod/TexturePackFolderModel.cpp +++ b/launcher/minecraft/mod/TexturePackFolderModel.cpp @@ -48,7 +48,8 @@ TexturePackFolderModel::TexturePackFolderModel(const QDir& dir, BaseInstance* in m_column_names = QStringList({ "Enable", "Image", "Name", "Last Modified", "Provider", "Size" }); m_column_names_translated = QStringList({ tr("Enable"), tr("Image"), tr("Name"), tr("Last Modified"), tr("Provider"), tr("Size") }); m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::NAME, SortType::DATE, SortType::PROVIDER, SortType::SIZE }; - m_column_resize_modes = { QHeaderView::Interactive, QHeaderView::Interactive, QHeaderView::Stretch, QHeaderView::Interactive, QHeaderView::Interactive, QHeaderView::Interactive }; + m_column_resize_modes = { QHeaderView::Interactive, QHeaderView::Interactive, QHeaderView::Stretch, + QHeaderView::Interactive, QHeaderView::Interactive, QHeaderView::Interactive }; m_columnsHideable = { false, true, false, true, true, true }; m_columnsHiddenByDefault = { false, false, false, false, false, true }; } diff --git a/launcher/net/HttpMetaCache.cpp b/launcher/net/HttpMetaCache.cpp index 5a3a451b7..77c1de47d 100644 --- a/launcher/net/HttpMetaCache.cpp +++ b/launcher/net/HttpMetaCache.cpp @@ -166,7 +166,7 @@ auto HttpMetaCache::evictEntry(MetaEntryPtr entry) -> bool return true; } -//returns true on success, false otherwise +// returns true on success, false otherwise auto HttpMetaCache::evictAll() -> bool { bool ret = true; @@ -178,7 +178,7 @@ auto HttpMetaCache::evictAll() -> bool qCWarning(taskHttpMetaCacheLogC) << "Unexpected missing cache entry" << entry->m_basePath; } map.entry_list.clear(); - //AND all return codes together so the result is true iff all runs of deletePath() are true + // AND all return codes together so the result is true iff all runs of deletePath() are true ret &= FS::deletePath(map.base_path); } return ret; diff --git a/launcher/tasks/Task.h b/launcher/tasks/Task.h index 503d6a6b6..fcd075150 100644 --- a/launcher/tasks/Task.h +++ b/launcher/tasks/Task.h @@ -79,7 +79,6 @@ Q_DECLARE_METATYPE(TaskStepProgress) using TaskStepProgressList = QList>; - /*! * Represents a task that has to be done. * To create a task, you need to subclass this class, implement the executeTask() method and call @@ -177,9 +176,9 @@ class Task : public QObject, public QRunnable { virtual void executeTask() = 0; protected slots: - //! The Task subclass must call this method when the task has succeeded + //! The Task subclass must call this method when the task has succeeded virtual void emitSucceeded(); - //! **The Task subclass** must call this method when the task has aborted. External code should call abort() instead. + //! **The Task subclass** must call this method when the task has aborted. External code should call abort() instead. virtual void emitAborted(); //! The Task subclass must call this method when the task has failed virtual void emitFailed(QString reason = ""); diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index d190c6a02..d9275a7ab 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -1311,7 +1311,7 @@ void MainWindow::on_actionReportBug_triggered() void MainWindow::on_actionClearMetadata_triggered() { - //This if contains side effects! + // This if contains side effects! if (!APPLICATION->metacache()->evictAll()) { CustomMessageBox::selectable(this, tr("Error"), tr("Metadata cache clear Failed!\nTo clear the metadata cache manually, press Folders -> View " diff --git a/launcher/ui/pages/global/JavaPage.cpp b/launcher/ui/pages/global/JavaPage.cpp index b99d0c63e..6a44c9290 100644 --- a/launcher/ui/pages/global/JavaPage.cpp +++ b/launcher/ui/pages/global/JavaPage.cpp @@ -62,7 +62,7 @@ JavaPage::JavaPage(QWidget* parent) : QWidget(parent), ui(new Ui::JavaPage) { ui->setupUi(this); - + if (BuildConfig.JAVA_DOWNLOADER_ENABLED) { ui->managedJavaList->initialize(new JavaInstallList(this, true)); ui->managedJavaList->setResizeOn(2); diff --git a/launcher/ui/pages/global/JavaPage.h b/launcher/ui/pages/global/JavaPage.h index ea7724c1d..b30fa22e3 100644 --- a/launcher/ui/pages/global/JavaPage.h +++ b/launcher/ui/pages/global/JavaPage.h @@ -37,11 +37,11 @@ #include #include -#include "ui/widgets/JavaSettingsWidget.h" #include #include #include "JavaCommon.h" #include "ui/pages/BasePage.h" +#include "ui/widgets/JavaSettingsWidget.h" class SettingsObject; diff --git a/launcher/ui/pages/instance/InstanceSettingsPage.h b/launcher/ui/pages/instance/InstanceSettingsPage.h index fa1dce3dc..de173937b 100644 --- a/launcher/ui/pages/instance/InstanceSettingsPage.h +++ b/launcher/ui/pages/instance/InstanceSettingsPage.h @@ -35,17 +35,18 @@ #pragma once +#include #include "Application.h" #include "BaseInstance.h" #include "ui/pages/BasePage.h" #include "ui/widgets/MinecraftSettingsWidget.h" -#include class InstanceSettingsPage : public MinecraftSettingsWidget, public BasePage { Q_OBJECT public: - explicit InstanceSettingsPage(MinecraftInstancePtr instance, QWidget* parent = nullptr) : MinecraftSettingsWidget(std::move(instance), parent) + explicit InstanceSettingsPage(MinecraftInstancePtr instance, QWidget* parent = nullptr) + : MinecraftSettingsWidget(std::move(instance), parent) { connect(APPLICATION, &Application::globalSettingsAboutToOpen, this, &InstanceSettingsPage::saveSettings); connect(APPLICATION, &Application::globalSettingsClosed, this, &InstanceSettingsPage::loadSettings); diff --git a/launcher/ui/pages/instance/ManagedPackPage.cpp b/launcher/ui/pages/instance/ManagedPackPage.cpp index 0fccd1d33..1738c9cde 100644 --- a/launcher/ui/pages/instance/ManagedPackPage.cpp +++ b/launcher/ui/pages/instance/ManagedPackPage.cpp @@ -347,13 +347,18 @@ void ManagedPackPage::onUpdateTaskCompleted(bool did_succeed) const if (m_instance_window != nullptr) m_instance_window->close(); - CustomMessageBox::selectable(nullptr, tr("Update Successful"), tr("The instance updated to pack version %1 successfully.").arg(m_inst->getManagedPackVersionName()), QMessageBox::Information) - ->show(); + CustomMessageBox::selectable(nullptr, tr("Update Successful"), + tr("The instance updated to pack version %1 successfully.").arg(m_inst->getManagedPackVersionName()), + QMessageBox::Information) + ->show(); } else { - CustomMessageBox::selectable(nullptr, tr("Update Failed"), tr("The instance failed to update to pack version %1. Please check launcher logs for more information.").arg(m_inst->getManagedPackVersionName()), QMessageBox::Critical) - ->show(); + CustomMessageBox::selectable( + nullptr, tr("Update Failed"), + tr("The instance failed to update to pack version %1. Please check launcher logs for more information.") + .arg(m_inst->getManagedPackVersionName()), + QMessageBox::Critical) + ->show(); } - } void ModrinthManagedPackPage::update() diff --git a/launcher/ui/pages/instance/McClient.cpp b/launcher/ui/pages/instance/McClient.cpp index 90813ac18..11b3a22d1 100644 --- a/launcher/ui/pages/instance/McClient.cpp +++ b/launcher/ui/pages/instance/McClient.cpp @@ -1,21 +1,22 @@ -#include -#include +#include #include #include -#include +#include +#include #include -#include "McClient.h" #include "Json.h" +#include "McClient.h" -// 7 first bits +// 7 first bits #define SEGMENT_BITS 0x7F // last bit #define CONTINUE_BIT 0x80 -McClient::McClient(QObject *parent, QString domain, QString ip, short port): QObject(parent), m_domain(domain), m_ip(ip), m_port(port) {} +McClient::McClient(QObject* parent, QString domain, QString ip, short port) : QObject(parent), m_domain(domain), m_ip(ip), m_port(port) {} -void McClient::getStatusData() { +void McClient::getStatusData() +{ qDebug() << "Connecting to socket.."; connect(&m_socket, &QTcpSocket::connected, this, [this]() { @@ -25,28 +26,28 @@ void McClient::getStatusData() { connect(&m_socket, &QTcpSocket::readyRead, this, &McClient::readRawResponse); }); - connect(&m_socket, &QTcpSocket::errorOccurred, this, [this]() { - emitFail("Socket disconnected: " + m_socket.errorString()); - }); + connect(&m_socket, &QTcpSocket::errorOccurred, this, [this]() { emitFail("Socket disconnected: " + m_socket.errorString()); }); m_socket.connectToHost(m_ip, m_port); } -void McClient::sendRequest() { +void McClient::sendRequest() +{ QByteArray data; - writeVarInt(data, 0x00); // packet ID - writeVarInt(data, 763); // hardcoded protocol version (763 = 1.20.1) - writeVarInt(data, m_domain.size()); // server address length - writeString(data, m_domain.toStdString()); // server address - writeFixedInt(data, m_port, 2); // server port - writeVarInt(data, 0x01); // next state - writePacketToSocket(data); // send handshake packet + writeVarInt(data, 0x00); // packet ID + writeVarInt(data, 763); // hardcoded protocol version (763 = 1.20.1) + writeVarInt(data, m_domain.size()); // server address length + writeString(data, m_domain.toStdString()); // server address + writeFixedInt(data, m_port, 2); // server port + writeVarInt(data, 0x01); // next state + writePacketToSocket(data); // send handshake packet - writeVarInt(data, 0x00); // packet ID - writePacketToSocket(data); // send status packet + writeVarInt(data, 0x00); // packet ID + writePacketToSocket(data); // send status packet } -void McClient::readRawResponse() { +void McClient::readRawResponse() +{ if (m_responseReadState == 2) { return; } @@ -56,28 +57,27 @@ void McClient::readRawResponse() { m_wantedRespLength = readVarInt(m_resp); m_responseReadState = 1; } - + if (m_responseReadState == 1 && m_resp.size() >= m_wantedRespLength) { if (m_resp.size() > m_wantedRespLength) { - qDebug() << "Warning: Packet length doesn't match actual packet size (" << m_wantedRespLength << " expected vs " << m_resp.size() << " received)"; + qDebug() << "Warning: Packet length doesn't match actual packet size (" << m_wantedRespLength << " expected vs " + << m_resp.size() << " received)"; } parseResponse(); m_responseReadState = 2; } } -void McClient::parseResponse() { +void McClient::parseResponse() +{ qDebug() << "Received response successfully"; int packetID = readVarInt(m_resp); if (packetID != 0x00) { - throw Exception( - QString("Packet ID doesn't match expected value (0x00 vs 0x%1)") - .arg(packetID, 0, 16) - ); + throw Exception(QString("Packet ID doesn't match expected value (0x00 vs 0x%1)").arg(packetID, 0, 16)); } - Q_UNUSED(readVarInt(m_resp)); // json length + Q_UNUSED(readVarInt(m_resp)); // json length // 'resp' should now be the JSON string QJsonDocument doc = QJsonDocument::fromJson(m_resp); @@ -85,8 +85,9 @@ void McClient::parseResponse() { } // From https://wiki.vg/Protocol#VarInt_and_VarLong -void McClient::writeVarInt(QByteArray &data, int value) { - while ((value & ~SEGMENT_BITS)) { // check if the value is too big to fit in 7 bits +void McClient::writeVarInt(QByteArray& data, int value) +{ + while ((value & ~SEGMENT_BITS)) { // check if the value is too big to fit in 7 bits // Write 7 bits data.append((value & SEGMENT_BITS) | CONTINUE_BIT); @@ -98,7 +99,8 @@ void McClient::writeVarInt(QByteArray &data, int value) { } // From https://wiki.vg/Protocol#VarInt_and_VarLong -int McClient::readVarInt(QByteArray &data) { +int McClient::readVarInt(QByteArray& data) +{ int value = 0; int position = 0; char currentByte; @@ -107,17 +109,20 @@ int McClient::readVarInt(QByteArray &data) { currentByte = readByte(data); value |= (currentByte & SEGMENT_BITS) << position; - if ((currentByte & CONTINUE_BIT) == 0) break; + if ((currentByte & CONTINUE_BIT) == 0) + break; position += 7; } - if (position >= 32) throw Exception("VarInt is too big"); + if (position >= 32) + throw Exception("VarInt is too big"); return value; } -char McClient::readByte(QByteArray &data) { +char McClient::readByte(QByteArray& data) +{ if (data.isEmpty()) { throw Exception("No more bytes to read"); } @@ -128,17 +133,20 @@ char McClient::readByte(QByteArray &data) { } // write number with specified size in big endian format -void McClient::writeFixedInt(QByteArray &data, int value, int size) { +void McClient::writeFixedInt(QByteArray& data, int value, int size) +{ for (int i = size - 1; i >= 0; i--) { data.append((value >> (i * 8)) & 0xFF); } } -void McClient::writeString(QByteArray &data, const std::string &value) { +void McClient::writeString(QByteArray& data, const std::string& value) +{ data.append(value.c_str()); } -void McClient::writePacketToSocket(QByteArray &data) { +void McClient::writePacketToSocket(QByteArray& data) +{ // we prefix the packet with its length QByteArray dataWithSize; writeVarInt(dataWithSize, data.size()); @@ -151,14 +159,15 @@ void McClient::writePacketToSocket(QByteArray &data) { data.clear(); } - -void McClient::emitFail(QString error) { +void McClient::emitFail(QString error) +{ qDebug() << "Minecraft server ping for status error:" << error; emit failed(error); emit finished(); } -void McClient::emitSucceed(QJsonObject data) { +void McClient::emitSucceed(QJsonObject data) +{ emit succeeded(data); emit finished(); } diff --git a/launcher/ui/pages/instance/McClient.h b/launcher/ui/pages/instance/McClient.h index 59834dfb7..832b70d40 100644 --- a/launcher/ui/pages/instance/McClient.h +++ b/launcher/ui/pages/instance/McClient.h @@ -1,8 +1,8 @@ -#include -#include +#include #include #include -#include +#include +#include #include @@ -22,29 +22,30 @@ class McClient : public QObject { unsigned m_wantedRespLength = 0; QByteArray m_resp; -public: - explicit McClient(QObject *parent, QString domain, QString ip, short port); + public: + explicit McClient(QObject* parent, QString domain, QString ip, short port); //! Read status data of the server, and calls the succeeded() signal with the parsed JSON data void getStatusData(); -private: + + private: void sendRequest(); //! Accumulate data until we have a full response, then call parseResponse() once void readRawResponse(); void parseResponse(); - void writeVarInt(QByteArray &data, int value); - int readVarInt(QByteArray &data); - char readByte(QByteArray &data); + void writeVarInt(QByteArray& data, int value); + int readVarInt(QByteArray& data); + char readByte(QByteArray& data); //! write number with specified size in big endian format - void writeFixedInt(QByteArray &data, int value, int size); - void writeString(QByteArray &data, const std::string &value); + void writeFixedInt(QByteArray& data, int value, int size); + void writeString(QByteArray& data, const std::string& value); - void writePacketToSocket(QByteArray &data); + void writePacketToSocket(QByteArray& data); void emitFail(QString error); void emitSucceed(QJsonObject data); -signals: + signals: void succeeded(QJsonObject data); void failed(QString error); void finished(); diff --git a/launcher/ui/pages/instance/McResolver.cpp b/launcher/ui/pages/instance/McResolver.cpp index 48c2a72fd..2a769762c 100644 --- a/launcher/ui/pages/instance/McResolver.cpp +++ b/launcher/ui/pages/instance/McResolver.cpp @@ -1,23 +1,25 @@ -#include -#include #include +#include #include +#include #include "McResolver.h" -McResolver::McResolver(QObject *parent, QString domain, int port): QObject(parent), m_constrDomain(domain), m_constrPort(port) {} +McResolver::McResolver(QObject* parent, QString domain, int port) : QObject(parent), m_constrDomain(domain), m_constrPort(port) {} -void McResolver::ping() { +void McResolver::ping() +{ pingWithDomainSRV(m_constrDomain, m_constrPort); } -void McResolver::pingWithDomainSRV(QString domain, int port) { - QDnsLookup *lookup = new QDnsLookup(this); +void McResolver::pingWithDomainSRV(QString domain, int port) +{ + QDnsLookup* lookup = new QDnsLookup(this); lookup->setName(QString("_minecraft._tcp.%1").arg(domain)); lookup->setType(QDnsLookup::SRV); connect(lookup, &QDnsLookup::finished, this, [this, domain, port]() { - QDnsLookup *lookup = qobject_cast(sender()); + QDnsLookup* lookup = qobject_cast(sender()); lookup->deleteLater(); @@ -43,8 +45,9 @@ void McResolver::pingWithDomainSRV(QString domain, int port) { lookup->lookup(); } -void McResolver::pingWithDomainA(QString domain, int port) { - QHostInfo::lookupHost(domain, this, [this, port](const QHostInfo &hostInfo){ +void McResolver::pingWithDomainA(QString domain, int port) +{ + QHostInfo::lookupHost(domain, this, [this, port](const QHostInfo& hostInfo) { if (hostInfo.error() != QHostInfo::NoError) { emitFail("A record lookup failed"); return; @@ -55,19 +58,21 @@ void McResolver::pingWithDomainA(QString domain, int port) { emitFail("No A entries found for domain"); return; } - + const auto& firstRecord = records.at(0); emitSucceed(firstRecord.toString(), port); - }); + }); } -void McResolver::emitFail(QString error) { +void McResolver::emitFail(QString error) +{ qDebug() << "DNS resolver error:" << error; emit failed(error); emit finished(); } -void McResolver::emitSucceed(QString ip, int port) { +void McResolver::emitSucceed(QString ip, int port) +{ emit succeeded(ip, port); emit finished(); } diff --git a/launcher/ui/pages/instance/McResolver.h b/launcher/ui/pages/instance/McResolver.h index 06b4b7b38..3dfeddc6a 100644 --- a/launcher/ui/pages/instance/McResolver.h +++ b/launcher/ui/pages/instance/McResolver.h @@ -1,8 +1,8 @@ +#include +#include +#include #include #include -#include -#include -#include // resolve the IP and port of a Minecraft server class McResolver : public QObject { @@ -11,17 +11,17 @@ class McResolver : public QObject { QString m_constrDomain; int m_constrPort; -public: - explicit McResolver(QObject *parent, QString domain, int port); + public: + explicit McResolver(QObject* parent, QString domain, int port); void ping(); -private: + private: void pingWithDomainSRV(QString domain, int port); void pingWithDomainA(QString domain, int port); void emitFail(QString error); void emitSucceed(QString ip, int port); -signals: + signals: void succeeded(QString ip, int port); void failed(QString error); void finished(); diff --git a/launcher/ui/pages/instance/ServerPingTask.cpp b/launcher/ui/pages/instance/ServerPingTask.cpp index 3ec9308ca..b39f3d117 100644 --- a/launcher/ui/pages/instance/ServerPingTask.cpp +++ b/launcher/ui/pages/instance/ServerPingTask.cpp @@ -1,47 +1,41 @@ #include -#include "ServerPingTask.h" -#include "McResolver.h" -#include "McClient.h" #include +#include "McClient.h" +#include "McResolver.h" +#include "ServerPingTask.h" -unsigned getOnlinePlayers(QJsonObject data) { +unsigned getOnlinePlayers(QJsonObject data) +{ return Json::requireInteger(Json::requireObject(data, "players"), "online"); } -void ServerPingTask::executeTask() { +void ServerPingTask::executeTask() +{ qDebug() << "Querying status of " << QString("%1:%2").arg(m_domain).arg(m_port); // Resolve the actual IP and port for the server - McResolver *resolver = new McResolver(nullptr, m_domain, m_port); + McResolver* resolver = new McResolver(nullptr, m_domain, m_port); QObject::connect(resolver, &McResolver::succeeded, this, [this, resolver](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); + McClient* client = new McClient(nullptr, m_domain, ip, port); QObject::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); - }); + QObject::connect(client, &McClient::failed, this, [this](QString error) { emitFailed(error); }); // Delete McClient object when done - QObject::connect(client, &McClient::finished, this, [this, client]() { - client->deleteLater(); - }); + QObject::connect(client, &McClient::finished, this, [this, client]() { client->deleteLater(); }); client->getStatusData(); }); - QObject::connect(resolver, &McResolver::failed, this, [this](QString error) { - emitFailed(error); - }); + QObject::connect(resolver, &McResolver::failed, this, [this](QString error) { emitFailed(error); }); // Delete McResolver object when done - QObject::connect(resolver, &McResolver::finished, [resolver]() { - resolver->deleteLater(); - }); + QObject::connect(resolver, &McResolver::finished, [resolver]() { resolver->deleteLater(); }); resolver->ping(); } \ No newline at end of file diff --git a/launcher/ui/pages/instance/ServerPingTask.h b/launcher/ui/pages/instance/ServerPingTask.h index 0956a4f63..6f03b92ad 100644 --- a/launcher/ui/pages/instance/ServerPingTask.h +++ b/launcher/ui/pages/instance/ServerPingTask.h @@ -5,18 +5,17 @@ #include - class ServerPingTask : public Task { Q_OBJECT - public: + public: explicit ServerPingTask(QString domain, int port) : Task(), m_domain(domain), m_port(port) {} ~ServerPingTask() override = default; int m_outputOnlinePlayers = -1; - private: + private: QString m_domain; int m_port; - protected: + protected: virtual void executeTask() override; }; diff --git a/launcher/ui/themes/HintOverrideProxyStyle.cpp b/launcher/ui/themes/HintOverrideProxyStyle.cpp index f31969fce..f5b8232a8 100644 --- a/launcher/ui/themes/HintOverrideProxyStyle.cpp +++ b/launcher/ui/themes/HintOverrideProxyStyle.cpp @@ -18,7 +18,8 @@ #include "HintOverrideProxyStyle.h" -HintOverrideProxyStyle::HintOverrideProxyStyle(QStyle* style) : QProxyStyle(style) { +HintOverrideProxyStyle::HintOverrideProxyStyle(QStyle* style) : QProxyStyle(style) +{ setObjectName(style->objectName()); } From 8bb79cefacef4616304eae958dcef5b8281b0d23 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Tue, 29 Apr 2025 10:47:00 +0300 Subject: [PATCH 2/2] chore: add format commits to the git-blame-ignore Signed-off-by: Trial97 --- .git-blame-ignore-revs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 528b128b1..c7d36db27 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -5,3 +5,9 @@ bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9 # (nix) alejandra -> nixfmt 4c81d8c53d09196426568c4a31a4e752ed05397a + +# reformat codebase +1d468ac35ad88d8c77cc83f25e3704d9bd7df01b + +# format a part of codebase +5c8481a118c8fefbfe901001d7828eaf6866eac4