From c206064976e00a5ca448ba1dbd82ca40ea73ad1b Mon Sep 17 00:00:00 2001 From: Trial97 Date: Mon, 3 Mar 2025 23:55:43 +0200 Subject: [PATCH] rename some variables Signed-off-by: Trial97 (cherry picked from commit 162bbcfe19e67f23bf8d21142fdad253500a3b64) --- launcher/Application.cpp | 2 +- launcher/Application.h | 4 +- launcher/minecraft/auth/steps/MSAStep.cpp | 48 +++++++++++------------ launcher/minecraft/auth/steps/MSAStep.h | 2 +- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 038444b3a..348ca1722 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -228,7 +228,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv) setApplicationDisplayName(QString("%1 %2").arg(BuildConfig.LAUNCHER_DISPLAYNAME, BuildConfig.printableVersionString())); setApplicationVersion(BuildConfig.printableVersionString() + "\n" + BuildConfig.GIT_COMMIT); setDesktopFileName(BuildConfig.LAUNCHER_DESKTOPFILENAME); - startTime = QDateTime::currentDateTime(); + m_startTime = QDateTime::currentDateTime(); // Don't quit on hiding the last window this->setQuitOnLastWindowClosed(false); diff --git a/launcher/Application.h b/launcher/Application.h index 164ec3a4f..ba26dc607 100644 --- a/launcher/Application.h +++ b/launcher/Application.h @@ -112,7 +112,7 @@ class Application : public QApplication { std::shared_ptr settings() const { return m_settings; } - qint64 timeSinceStart() const { return startTime.msecsTo(QDateTime::currentDateTime()); } + qint64 timeSinceStart() const { return m_startTime.msecsTo(QDateTime::currentDateTime()); } QIcon getThemedIcon(const QString& name); @@ -236,7 +236,7 @@ class Application : public QApplication { bool shouldExitNow() const; private: - QDateTime startTime; + QDateTime m_startTime; shared_qobject_ptr m_network; diff --git a/launcher/minecraft/auth/steps/MSAStep.cpp b/launcher/minecraft/auth/steps/MSAStep.cpp index 151ee4e68..87a0f8f08 100644 --- a/launcher/minecraft/auth/steps/MSAStep.cpp +++ b/launcher/minecraft/auth/steps/MSAStep.cpp @@ -99,29 +99,29 @@ MSAStep::MSAStep(AccountData* data, bool silent) : AuthStep(data), m_silent(sile )XXX") .arg(BuildConfig.LOGIN_CALLBACK_URL)); - oauth2.setReplyHandler(replyHandler); + m_oauth2.setReplyHandler(replyHandler); } else { - oauth2.setReplyHandler(new CustomOAuthOobReplyHandler(this)); + m_oauth2.setReplyHandler(new CustomOAuthOobReplyHandler(this)); } - oauth2.setAuthorizationUrl(QUrl("https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize")); - oauth2.setAccessTokenUrl(QUrl("https://login.microsoftonline.com/consumers/oauth2/v2.0/token")); - oauth2.setScope("XboxLive.SignIn XboxLive.offline_access"); - oauth2.setClientIdentifier(m_clientId); - oauth2.setNetworkAccessManager(APPLICATION->network().get()); + m_oauth2.setAuthorizationUrl(QUrl("https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize")); + m_oauth2.setAccessTokenUrl(QUrl("https://login.microsoftonline.com/consumers/oauth2/v2.0/token")); + m_oauth2.setScope("XboxLive.SignIn XboxLive.offline_access"); + m_oauth2.setClientIdentifier(m_clientId); + m_oauth2.setNetworkAccessManager(APPLICATION->network().get()); - connect(&oauth2, &QOAuth2AuthorizationCodeFlow::granted, this, [this] { - m_data->msaClientID = oauth2.clientIdentifier(); + connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::granted, this, [this] { + m_data->msaClientID = m_oauth2.clientIdentifier(); m_data->msaToken.issueInstant = QDateTime::currentDateTimeUtc(); - m_data->msaToken.notAfter = oauth2.expirationAt(); - m_data->msaToken.extra = oauth2.extraTokens(); - m_data->msaToken.refresh_token = oauth2.refreshToken(); - m_data->msaToken.token = oauth2.token(); + m_data->msaToken.notAfter = m_oauth2.expirationAt(); + m_data->msaToken.extra = m_oauth2.extraTokens(); + m_data->msaToken.refresh_token = m_oauth2.refreshToken(); + m_data->msaToken.token = m_oauth2.token(); emit finished(AccountTaskState::STATE_WORKING, tr("Got ")); }); - connect(&oauth2, &QOAuth2AuthorizationCodeFlow::authorizeWithBrowser, this, &MSAStep::authorizeWithBrowser); - connect(&oauth2, &QOAuth2AuthorizationCodeFlow::requestFailed, this, [this, silent](const QAbstractOAuth2::Error err) { + connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::authorizeWithBrowser, this, &MSAStep::authorizeWithBrowser); + connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::requestFailed, this, [this, silent](const QAbstractOAuth2::Error err) { auto state = AccountTaskState::STATE_FAILED_HARD; - if (oauth2.status() == QAbstractOAuth::Status::Granted || silent) { + if (m_oauth2.status() == QAbstractOAuth::Status::Granted || silent) { if (err == QAbstractOAuth2::Error::NetworkError) { state = AccountTaskState::STATE_OFFLINE; } else { @@ -135,16 +135,16 @@ MSAStep::MSAStep(AccountData* data, bool silent) : AuthStep(data), m_silent(sile qWarning() << message; emit finished(state, message); }); - connect(&oauth2, &QOAuth2AuthorizationCodeFlow::error, this, + connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::error, this, [this](const QString& error, const QString& errorDescription, const QUrl& uri) { qWarning() << "Failed to login because" << error << errorDescription; emit finished(AccountTaskState::STATE_FAILED_HARD, errorDescription); }); - connect(&oauth2, &QOAuth2AuthorizationCodeFlow::extraTokensChanged, this, + connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::extraTokensChanged, this, [this](const QVariantMap& tokens) { m_data->msaToken.extra = tokens; }); - connect(&oauth2, &QOAuth2AuthorizationCodeFlow::clientIdentifierChanged, this, + connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::clientIdentifierChanged, this, [this](const QString& clientIdentifier) { m_data->msaClientID = clientIdentifier; }); } @@ -165,20 +165,20 @@ void MSAStep::perform() emit finished(AccountTaskState::STATE_DISABLED, tr("Microsoft user authentication failed - refresh token is empty.")); return; } - oauth2.setRefreshToken(m_data->msaToken.refresh_token); - oauth2.refreshAccessToken(); + m_oauth2.setRefreshToken(m_data->msaToken.refresh_token); + m_oauth2.refreshAccessToken(); } else { #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) // QMultiMap param changed in 6.0 - oauth2.setModifyParametersFunction( + m_oauth2.setModifyParametersFunction( [](QAbstractOAuth::Stage stage, QMultiMap* map) { map->insert("prompt", "select_account"); }); #else - oauth2.setModifyParametersFunction( + m_oauth2.setModifyParametersFunction( [](QAbstractOAuth::Stage stage, QMap* map) { map->insert("prompt", "select_account"); }); #endif *m_data = AccountData(); m_data->msaClientID = m_clientId; - oauth2.grant(); + m_oauth2.grant(); } } diff --git a/launcher/minecraft/auth/steps/MSAStep.h b/launcher/minecraft/auth/steps/MSAStep.h index 675cfb2ca..2f4e7812b 100644 --- a/launcher/minecraft/auth/steps/MSAStep.h +++ b/launcher/minecraft/auth/steps/MSAStep.h @@ -55,5 +55,5 @@ class MSAStep : public AuthStep { private: bool m_silent; QString m_clientId; - QOAuth2AuthorizationCodeFlow oauth2; + QOAuth2AuthorizationCodeFlow m_oauth2; };