diff --git a/launcher/MTPixmapCache.h b/launcher/MTPixmapCache.h index e7f6dfbe3..87522ef95 100644 --- a/launcher/MTPixmapCache.h +++ b/launcher/MTPixmapCache.h @@ -46,7 +46,7 @@ class PixmapCache final : public QObject { Q_OBJECT public: - PixmapCache(QObject* parent) : QObject(parent) {} + explicit PixmapCache(QObject* parent) : QObject(parent) {} ~PixmapCache() override = default; static PixmapCache& instance() { return *s_instance; } @@ -90,8 +90,9 @@ class PixmapCache final : public QObject { } bool _replace(const QPixmapCache::Key& key, const QPixmap& pixmap) { - if (!key.isValid()) + if (!key.isValid()) { return false; + } remove(key); const_cast(key) = insert(pixmap); return key.isValid(); @@ -108,33 +109,33 @@ class PixmapCache final : public QObject { */ bool _markCacheMissByEviciton() { - static constexpr uint maxCache = static_cast(std::numeric_limits::max()) / 4; - static constexpr uint step = 10240; - static constexpr int oneSecond = 1000; + static constexpr uint s_maxCache = static_cast(std::numeric_limits::max()) / 4; + static constexpr uint s_step = 10240; + static constexpr int s_oneSecond = 1000; auto now = QTime::currentTime(); - if (!m_last_cache_miss_by_eviciton.isNull()) { - auto diff = m_last_cache_miss_by_eviciton.msecsTo(now); - if (diff < oneSecond) { // less than a second ago - ++m_consecutive_fast_evicitons; + if (!m_lastCacheMissByEviciton.isNull()) { + auto diff = m_lastCacheMissByEviciton.msecsTo(now); + if (diff < s_oneSecond) { // less than a second ago + ++m_consecutiveFastEvicitons; } else { - m_consecutive_fast_evicitons = 0; + m_consecutiveFastEvicitons = 0; } } - m_last_cache_miss_by_eviciton = now; - if (m_consecutive_fast_evicitons >= m_consecutive_fast_evicitons_threshold) { + m_lastCacheMissByEviciton = now; + if (m_consecutiveFastEvicitons >= m_consecutiveFastEvicitonsThreshold) { // increase the cache size - uint newSize = _cacheLimit() + step; - if (newSize >= maxCache) { // increase it until you overflow :D - newSize = maxCache; - qDebug() << m_consecutive_fast_evicitons + uint newSize = _cacheLimit() + s_step; + if (newSize >= s_maxCache) { // increase it until you overflow :D + newSize = s_maxCache; + qDebug() << m_consecutiveFastEvicitons << tr("pixmap cache misses by eviction happened too fast, doing nothing as the cache size reached it's limit"); } else { - qDebug() << m_consecutive_fast_evicitons - << tr("pixmap cache misses by eviction happened too fast, increasing cache size to") << static_cast(newSize); + qDebug() << m_consecutiveFastEvicitons << tr("pixmap cache misses by eviction happened too fast, increasing cache size to") + << static_cast(newSize); } _setCacheLimit(static_cast(newSize)); - m_consecutive_fast_evicitons = 0; + m_consecutiveFastEvicitons = 0; return true; } return false; @@ -142,13 +143,13 @@ class PixmapCache final : public QObject { bool _setFastEvictionThreshold(int threshold) { - m_consecutive_fast_evicitons_threshold = threshold; + m_consecutiveFastEvicitonsThreshold = threshold; return true; } private: static PixmapCache* s_instance; - QTime m_last_cache_miss_by_eviciton; - int m_consecutive_fast_evicitons = 0; - int m_consecutive_fast_evicitons_threshold = 15; + QTime m_lastCacheMissByEviciton; + int m_consecutiveFastEvicitons = 0; + int m_consecutiveFastEvicitonsThreshold = 15; }; diff --git a/launcher/VersionProxyModel.cpp b/launcher/VersionProxyModel.cpp index f38c56f95..d11e7a099 100644 --- a/launcher/VersionProxyModel.cpp +++ b/launcher/VersionProxyModel.cpp @@ -44,21 +44,21 @@ class VersionFilterModel : public QSortFilterProxyModel { Q_OBJECT public: - VersionFilterModel(VersionProxyModel* parent) : QSortFilterProxyModel(parent) + explicit VersionFilterModel(VersionProxyModel* parent) : QSortFilterProxyModel(parent), m_parent(parent) { - m_parent = parent; setSortRole(BaseVersionList::SortRole); sort(0, Qt::DescendingOrder); } - bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const + bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override { const auto& filters = m_parent->filters(); const QString& search = m_parent->search(); - const QModelIndex idx = sourceModel()->index(source_row, 0, source_parent); + const QModelIndex idx = sourceModel()->index(sourceRow, 0, sourceParent); - if (!search.isEmpty() && !sourceModel()->data(idx, BaseVersionList::VersionRole).toString().contains(search, Qt::CaseInsensitive)) + if (!search.isEmpty() && !sourceModel()->data(idx, BaseVersionList::VersionRole).toString().contains(search, Qt::CaseInsensitive)) { return false; + } for (auto it = filters.begin(); it != filters.end(); ++it) { auto data = sourceModel()->data(idx, it.key()); @@ -84,14 +84,13 @@ class VersionFilterModel : public QSortFilterProxyModel { VersionProxyModel* m_parent; }; -VersionProxyModel::VersionProxyModel(QObject* parent) : QAbstractProxyModel(parent) +VersionProxyModel::VersionProxyModel(QObject* parent) : QAbstractProxyModel(parent), m_filterModel(new VersionFilterModel(this)) { - filterModel = new VersionFilterModel(this); - connect(filterModel, &QAbstractItemModel::dataChanged, this, &VersionProxyModel::sourceDataChanged); - connect(filterModel, &QAbstractItemModel::rowsAboutToBeInserted, this, &VersionProxyModel::sourceRowsAboutToBeInserted); - connect(filterModel, &QAbstractItemModel::rowsInserted, this, &VersionProxyModel::sourceRowsInserted); - connect(filterModel, &QAbstractItemModel::rowsAboutToBeRemoved, this, &VersionProxyModel::sourceRowsAboutToBeRemoved); - connect(filterModel, &QAbstractItemModel::rowsRemoved, this, &VersionProxyModel::sourceRowsRemoved); + connect(m_filterModel, &QAbstractItemModel::dataChanged, this, &VersionProxyModel::sourceDataChanged); + connect(m_filterModel, &QAbstractItemModel::rowsAboutToBeInserted, this, &VersionProxyModel::sourceRowsAboutToBeInserted); + connect(m_filterModel, &QAbstractItemModel::rowsInserted, this, &VersionProxyModel::sourceRowsInserted); + connect(m_filterModel, &QAbstractItemModel::rowsAboutToBeRemoved, this, &VersionProxyModel::sourceRowsAboutToBeRemoved); + connect(m_filterModel, &QAbstractItemModel::rowsRemoved, this, &VersionProxyModel::sourceRowsRemoved); // FIXME: implement when needed /* connect(replacing, &QAbstractItemModel::rowsAboutToBeMoved, this, &VersionProxyModel::sourceRowsAboutToBeMoved); @@ -99,18 +98,20 @@ VersionProxyModel::VersionProxyModel(QObject* parent) : QAbstractProxyModel(pare connect(replacing, &QAbstractItemModel::layoutAboutToBeChanged, this, &VersionProxyModel::sourceLayoutAboutToBeChanged); connect(replacing, &QAbstractItemModel::layoutChanged, this, &VersionProxyModel::sourceLayoutChanged); */ - connect(filterModel, &QAbstractItemModel::modelAboutToBeReset, this, &VersionProxyModel::sourceAboutToBeReset); - connect(filterModel, &QAbstractItemModel::modelReset, this, &VersionProxyModel::sourceReset); + connect(m_filterModel, &QAbstractItemModel::modelAboutToBeReset, this, &VersionProxyModel::sourceAboutToBeReset); + connect(m_filterModel, &QAbstractItemModel::modelReset, this, &VersionProxyModel::sourceReset); - QAbstractProxyModel::setSourceModel(filterModel); + QAbstractProxyModel::setSourceModel(m_filterModel); } QVariant VersionProxyModel::headerData(int section, Qt::Orientation orientation, int role) const { - if (section < 0 || section >= m_columns.size()) - return QVariant(); - if (orientation != Qt::Horizontal) - return QVariant(); + if (section < 0 || section >= m_columns.size()) { + return {}; + } + if (orientation != Qt::Horizontal) { + return {}; + } auto column = m_columns[section]; if (role == Qt::DisplayRole) { switch (column) { @@ -161,7 +162,7 @@ QVariant VersionProxyModel::headerData(int section, Qt::Orientation orientation, QVariant VersionProxyModel::data(const QModelIndex& index, int role) const { if (!index.isValid()) { - return QVariant(); + return {}; } auto column = m_columns[index.column()]; auto parentIndex = mapToSource(index); @@ -196,11 +197,12 @@ QVariant VersionProxyModel::data(const QModelIndex& index, int role) const } } case Qt::ToolTipRole: { - if (column == Name && hasRecommended) { + if (column == Name && m_hasRecommended) { auto value = sourceModel()->data(parentIndex, BaseVersionList::RecommendedRole); if (value.toBool()) { return tr("Recommended"); - } else if (hasLatest) { + } + if (m_hasLatest) { auto latest = sourceModel()->data(parentIndex, BaseVersionList::LatestRole); if (latest.toBool()) { return tr("Latest"); @@ -210,11 +212,12 @@ QVariant VersionProxyModel::data(const QModelIndex& index, int role) const return sourceModel()->data(parentIndex, BaseVersionList::VersionIdRole); } case Qt::DecorationRole: { - if (column == Name && hasRecommended) { + if (column == Name && m_hasRecommended) { auto recommenced = sourceModel()->data(parentIndex, BaseVersionList::RecommendedRole); if (recommenced.toBool()) { return QIcon::fromTheme("star"); - } else if (hasLatest) { + } + if (m_hasLatest) { auto latest = sourceModel()->data(parentIndex, BaseVersionList::LatestRole); if (latest.toBool()) { return QIcon::fromTheme("bug"); @@ -233,7 +236,7 @@ QVariant VersionProxyModel::data(const QModelIndex& index, int role) const return QVariant(); } default: { - if (roles.contains((BaseVersionList::ModelRoles)role)) { + if (m_roles.contains((BaseVersionList::ModelRoles)role)) { return sourceModel()->data(parentIndex, role); } return QVariant(); @@ -266,18 +269,20 @@ QModelIndex VersionProxyModel::index(int row, int column, const QModelIndex& par { // no trees here... shoo if (parent.isValid()) { - return QModelIndex(); + return {}; + } + if (row < 0 || row >= sourceModel()->rowCount()) { + return {}; + } + if (column < 0 || column >= columnCount()) { + return {}; } - if (row < 0 || row >= sourceModel()->rowCount()) - return QModelIndex(); - if (column < 0 || column >= columnCount()) - return QModelIndex(); return QAbstractItemModel::createIndex(row, column); } int VersionProxyModel::columnCount(const QModelIndex& parent) const { - return parent.isValid() ? 0 : m_columns.size(); + return parent.isValid() ? 0 : static_cast(m_columns.size()); } int VersionProxyModel::rowCount(const QModelIndex& parent) const @@ -288,30 +293,31 @@ int VersionProxyModel::rowCount(const QModelIndex& parent) const return 0; } -void VersionProxyModel::sourceDataChanged(const QModelIndex& source_top_left, const QModelIndex& source_bottom_right) +void VersionProxyModel::sourceDataChanged(const QModelIndex& sourceTopLeft, const QModelIndex& sourceBottomRight) { - if (source_top_left.parent() != source_bottom_right.parent()) - return; - - // whole row is getting changed - auto topLeft = createIndex(source_top_left.row(), 0); - auto bottomRight = createIndex(source_bottom_right.row(), columnCount() - 1); - emit dataChanged(topLeft, bottomRight); -} - -void VersionProxyModel::setSourceModel(QAbstractItemModel* replacingRaw) -{ - auto replacing = dynamic_cast(replacingRaw); - - m_columns.clear(); - if (!replacing) { - roles.clear(); - filterModel->setSourceModel(replacing); + if (sourceTopLeft.parent() != sourceBottomRight.parent()) { return; } - roles = replacing->providesRoles(); - if (roles.contains(BaseVersionList::VersionRole)) { + // whole row is getting changed + auto topLeft = createIndex(sourceTopLeft.row(), 0); + auto bottomRight = createIndex(sourceBottomRight.row(), columnCount() - 1); + emit dataChanged(topLeft, bottomRight); +} + +void VersionProxyModel::setSourceModel(QAbstractItemModel* sourceModel) +{ + auto* replacing = dynamic_cast(sourceModel); + + m_columns.clear(); + if (!replacing) { + m_roles.clear(); + m_filterModel->setSourceModel(replacing); + return; + } + + m_roles = replacing->providesRoles(); + if (m_roles.contains(BaseVersionList::VersionRole)) { m_columns.push_back(Name); } /* @@ -320,39 +326,39 @@ void VersionProxyModel::setSourceModel(QAbstractItemModel* replacingRaw) m_columns.push_back(ParentVersion); } */ - if (roles.contains(BaseVersionList::CPUArchitectureRole)) { + if (m_roles.contains(BaseVersionList::CPUArchitectureRole)) { m_columns.push_back(CPUArchitecture); } - if (roles.contains(BaseVersionList::PathRole)) { + if (m_roles.contains(BaseVersionList::PathRole)) { m_columns.push_back(Path); } - if (roles.contains(BaseVersionList::JavaNameRole)) { + if (m_roles.contains(BaseVersionList::JavaNameRole)) { m_columns.push_back(JavaName); } - if (roles.contains(BaseVersionList::JavaMajorRole)) { + if (m_roles.contains(BaseVersionList::JavaMajorRole)) { m_columns.push_back(JavaMajor); } - if (roles.contains(Meta::VersionList::TimeRole)) { + if (m_roles.contains(Meta::VersionList::TimeRole)) { m_columns.push_back(Time); } - if (roles.contains(BaseVersionList::BranchRole)) { + if (m_roles.contains(BaseVersionList::BranchRole)) { m_columns.push_back(Branch); } - if (roles.contains(BaseVersionList::TypeRole)) { + if (m_roles.contains(BaseVersionList::TypeRole)) { m_columns.push_back(Type); } - if (roles.contains(BaseVersionList::RecommendedRole)) { - hasRecommended = true; + if (m_roles.contains(BaseVersionList::RecommendedRole)) { + m_hasRecommended = true; } - if (roles.contains(BaseVersionList::LatestRole)) { - hasLatest = true; + if (m_roles.contains(BaseVersionList::LatestRole)) { + m_hasLatest = true; } - filterModel->setSourceModel(replacing); + m_filterModel->setSourceModel(replacing); } QModelIndex VersionProxyModel::getRecommended() const { - if (!roles.contains(BaseVersionList::RecommendedRole)) { + if (!m_roles.contains(BaseVersionList::RecommendedRole)) { return index(0, 0); } int recommended = 0; @@ -384,19 +390,19 @@ void VersionProxyModel::clearFilters() { m_filters.clear(); m_search.clear(); - filterModel->filterChanged(); + m_filterModel->filterChanged(); } void VersionProxyModel::setFilter(const BaseVersionList::ModelRoles column, Filter f) { m_filters[column] = std::move(f); - filterModel->filterChanged(); + m_filterModel->filterChanged(); } void VersionProxyModel::setSearch(const QString& search) { m_search = search; - filterModel->filterChanged(); + m_filterModel->filterChanged(); } const VersionProxyModel::FilterMap& VersionProxyModel::filters() const diff --git a/launcher/VersionProxyModel.h b/launcher/VersionProxyModel.h index ddd5d2458..8be51d592 100644 --- a/launcher/VersionProxyModel.h +++ b/launcher/VersionProxyModel.h @@ -9,22 +9,22 @@ class VersionFilterModel; class VersionProxyModel : public QAbstractProxyModel { Q_OBJECT public: - enum Column { Name, ParentVersion, Branch, Type, CPUArchitecture, Path, Time, JavaName, JavaMajor }; + enum Column : std::uint8_t { Name, ParentVersion, Branch, Type, CPUArchitecture, Path, Time, JavaName, JavaMajor }; using FilterMap = QHash; public: - VersionProxyModel(QObject* parent = 0); - virtual ~VersionProxyModel() {}; + explicit VersionProxyModel(QObject* parent = nullptr); + ~VersionProxyModel() override = default; - virtual int columnCount(const QModelIndex& parent = QModelIndex()) const override; - virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override; - virtual QModelIndex mapFromSource(const QModelIndex& sourceIndex) const override; - virtual QModelIndex mapToSource(const QModelIndex& proxyIndex) const override; - virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override; - virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; - virtual QModelIndex parent(const QModelIndex& child) const override; - virtual void setSourceModel(QAbstractItemModel* sourceModel) override; + int columnCount(const QModelIndex& parent = QModelIndex()) const override; + int rowCount(const QModelIndex& parent = QModelIndex()) const override; + QModelIndex mapFromSource(const QModelIndex& sourceIndex) const override; + QModelIndex mapToSource(const QModelIndex& proxyIndex) const override; + QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override; + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + QModelIndex parent(const QModelIndex& child) const override; + void setSourceModel(QAbstractItemModel* sourceModel) override; const FilterMap& filters() const; const QString& search() const; @@ -36,7 +36,7 @@ class VersionProxyModel : public QAbstractProxyModel { void setCurrentVersion(const QString& version); private slots: - void sourceDataChanged(const QModelIndex& source_top_left, const QModelIndex& source_bottom_right); + void sourceDataChanged(const QModelIndex& sourceTopLeft, const QModelIndex& sourceBottomRight); void sourceAboutToBeReset(); void sourceReset(); @@ -51,9 +51,9 @@ class VersionProxyModel : public QAbstractProxyModel { QList m_columns; FilterMap m_filters; QString m_search; - BaseVersionList::RoleList roles; - VersionFilterModel* filterModel; - bool hasRecommended = false; - bool hasLatest = false; + BaseVersionList::RoleList m_roles; + VersionFilterModel* m_filterModel; + bool m_hasRecommended = false; + bool m_hasLatest = false; QString m_currentVersion; }; diff --git a/launcher/meta/Version.cpp b/launcher/meta/Version.cpp index 156dfc65a..c1782bba5 100644 --- a/launcher/meta/Version.cpp +++ b/launcher/meta/Version.cpp @@ -27,8 +27,9 @@ QString Meta::Version::descriptor() const } QString Meta::Version::name() const { - if (m_data) + if (m_data) { return m_data->name; + } return m_uid; } QString Meta::Version::typeString() const @@ -110,9 +111,9 @@ void Meta::Version::setRequires(const Meta::RequireSet& reqs, const Meta::Requir emit requiresChanged(); } -void Meta::Version::setVolatile(bool volatile_) +void Meta::Version::setVolatile(bool volatileVar) { - m_volatile = volatile_; + m_volatile = volatileVar; } void Meta::Version::setData(const VersionFilePtr& data) diff --git a/launcher/meta/Version.h b/launcher/meta/Version.h index a2bbc6176..55534f38b 100644 --- a/launcher/meta/Version.h +++ b/launcher/meta/Version.h @@ -38,7 +38,7 @@ class Version : public QObject, public BaseVersion, public BaseEntity { using Ptr = std::shared_ptr; explicit Version(const QString& uid, const QString& version); - virtual ~Version() = default; + ~Version() override = default; QString descriptor() const override; QString name() const override; @@ -66,7 +66,7 @@ class Version : public QObject, public BaseVersion, public BaseEntity { void setType(const QString& type); void setTime(qint64 time); void setRequires(const Meta::RequireSet& reqs, const Meta::RequireSet& conflicts); - void setVolatile(bool volatile_); + void setVolatile(bool volatileVar); void setRecommended(bool recommended); void setProvidesRecommendations(); void setData(const VersionFilePtr& data); diff --git a/launcher/minecraft/auth/AuthFlow.cpp b/launcher/minecraft/auth/AuthFlow.cpp index 5b8f98122..553d1587b 100644 --- a/launcher/minecraft/auth/AuthFlow.cpp +++ b/launcher/minecraft/auth/AuthFlow.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "minecraft/auth/AccountData.h" #include "minecraft/auth/steps/EntitlementsStep.h" @@ -17,7 +18,7 @@ #include -AuthFlow::AuthFlow(AccountData* data, Action action) : Task(), m_data(data) +AuthFlow::AuthFlow(AccountData* data, Action action) : m_data(data) { if (data->type == AccountType::MSA) { if (action == Action::DeviceCode) { @@ -75,11 +76,12 @@ void AuthFlow::nextStep() void AuthFlow::stepFinished(AccountTaskState resultingState, QString message) { - if (changeState(resultingState, message)) + if (changeState(resultingState, std::move(message))) { nextStep(); + } } -bool AuthFlow::changeState(AccountTaskState newState, QString reason) +bool AuthFlow::changeState(AccountTaskState newState, const QString& reason) { m_taskState = newState; setDetails(reason); @@ -148,8 +150,9 @@ bool AuthFlow::changeState(AccountTaskState newState, QString reason) } bool AuthFlow::abort() { - if (m_currentStep) + if (m_currentStep) { m_currentStep->abort(); + } emitAborted(); return true; } diff --git a/launcher/minecraft/auth/AuthFlow.h b/launcher/minecraft/auth/AuthFlow.h index b8a6db5ea..c1628a62b 100644 --- a/launcher/minecraft/auth/AuthFlow.h +++ b/launcher/minecraft/auth/AuthFlow.h @@ -13,10 +13,10 @@ class AuthFlow : public Task { Q_OBJECT public: - enum class Action { Refresh, Login, DeviceCode }; + enum class Action : std::uint8_t { Refresh, Login, DeviceCode }; explicit AuthFlow(AccountData* data, Action action = Action::Refresh); - virtual ~AuthFlow() = default; + ~AuthFlow() override = default; void executeTask() override; @@ -35,7 +35,7 @@ class AuthFlow : public Task { private slots: // NOTE: true -> non-terminal state, false -> terminal state - bool changeState(AccountTaskState newState, QString reason = QString()); + bool changeState(AccountTaskState newState, const QString& reason = {}); void stepFinished(AccountTaskState resultingState, QString message); private: diff --git a/launcher/minecraft/auth/steps/MSADeviceCodeStep.cpp b/launcher/minecraft/auth/steps/MSADeviceCodeStep.cpp index f2cdf8ed6..141d620a4 100644 --- a/launcher/minecraft/auth/steps/MSADeviceCodeStep.cpp +++ b/launcher/minecraft/auth/steps/MSADeviceCodeStep.cpp @@ -73,7 +73,7 @@ MSADeviceCodeStep::MSADeviceCodeStep(AccountData* data) : AuthStep(data) emit finished(state, message); }); connect(&m_oauth2, &QOAuth2DeviceAuthorizationFlow::serverReportedErrorOccurred, this, - [this](const QString& error, const QString& errorDescription, const QUrl& uri) { + [this](const QString& error, const QString& errorDescription, const QUrl& /*uri*/) { qWarning() << "Failed to login because" << error << errorDescription; emit finished(AccountTaskState::STATE_FAILED_HARD, errorDescription); }); @@ -97,21 +97,11 @@ void MSADeviceCodeStep::perform() m_oauth2.grant(); } -struct DeviceAuthorizationResponse { - QString device_code; - QString user_code; - QString verification_uri; - int expires_in; - int interval; - - QString error; - QString error_description; -}; - void MSADeviceCodeStep::abort() { - if (m_oauth2.isPolling()) + if (m_oauth2.isPolling()) { m_oauth2.stopTokenPolling(); + } emit finished(AccountTaskState::STATE_FAILED_HARD, tr("Task aborted")); } diff --git a/launcher/minecraft/auth/steps/MSADeviceCodeStep.h b/launcher/minecraft/auth/steps/MSADeviceCodeStep.h index fe9cff189..ca228d11d 100644 --- a/launcher/minecraft/auth/steps/MSADeviceCodeStep.h +++ b/launcher/minecraft/auth/steps/MSADeviceCodeStep.h @@ -44,7 +44,7 @@ class MSADeviceCodeStep : public AuthStep { Q_OBJECT public: explicit MSADeviceCodeStep(AccountData* data); - virtual ~MSADeviceCodeStep() noexcept = default; + ~MSADeviceCodeStep() noexcept override = default; void perform() override; diff --git a/launcher/minecraft/auth/steps/MSAStep.cpp b/launcher/minecraft/auth/steps/MSAStep.cpp index 93137f66f..c78077f17 100644 --- a/launcher/minecraft/auth/steps/MSAStep.cpp +++ b/launcher/minecraft/auth/steps/MSAStep.cpp @@ -36,19 +36,19 @@ #include "MSAStep.h" #include -#include #include +#include #include #include #include "Application.h" #include "BuildConfig.h" -#include "FileSystem.h" #include #include #include +namespace { bool isSchemeHandlerRegistered() { #ifdef Q_OS_LINUX @@ -110,6 +110,7 @@ class LoggingOAuthHttpServerReplyHandler final : public QOAuthHttpServerReplyHan QOAuthHttpServerReplyHandler::networkReplyFinished(reply); } }; +} // namespace MSAStep::MSAStep(AccountData* data, bool silent) : AuthStep(data), m_silent(silent) { @@ -117,7 +118,7 @@ MSAStep::MSAStep(AccountData* data, bool silent) : AuthStep(data), m_silent(sile if (QCoreApplication::applicationFilePath().startsWith("/tmp/.mount_") || APPLICATION->isPortable() || !isSchemeHandlerRegistered()) { - auto replyHandler = new LoggingOAuthHttpServerReplyHandler(this); + auto* replyHandler = new LoggingOAuthHttpServerReplyHandler(this); replyHandler->setCallbackText(QString(R"XXX(