Skip to content

Commit 0de4d89

Browse files
committed
Remove top-level const qualifiers in function declarations
Signed-off-by: LocalSpook <[email protected]>
1 parent 736246e commit 0de4d89

37 files changed

+46
-52
lines changed

.clang-tidy

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Checks:
22
- modernize-use-using
3+
- readability-avoid-const-params-in-decls
34

45
SystemHeaders: false

launcher/DataMigrationTask.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
class DataMigrationTask : public Task {
1919
Q_OBJECT
2020
public:
21-
explicit DataMigrationTask(QObject* parent, const QString& sourcePath, const QString& targetPath, const IPathMatcher::Ptr pathmatcher);
21+
explicit DataMigrationTask(QObject* parent, const QString& sourcePath, const QString& targetPath, IPathMatcher::Ptr pathmatcher);
2222
~DataMigrationTask() override = default;
2323

2424
protected:

launcher/InstanceImportTask.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
#include <quazip/quazipdir.h>
6161

62-
InstanceImportTask::InstanceImportTask(const QUrl sourceUrl, QWidget* parent, QMap<QString, QString>&& extra_info)
62+
InstanceImportTask::InstanceImportTask(const QUrl& sourceUrl, QWidget* parent, QMap<QString, QString>&& extra_info)
6363
: m_sourceUrl(sourceUrl), m_extra_info(extra_info), m_parent(parent)
6464
{}
6565

launcher/InstanceImportTask.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class FileResolvingTask;
5454
class InstanceImportTask : public InstanceTask {
5555
Q_OBJECT
5656
public:
57-
explicit InstanceImportTask(const QUrl sourceUrl, QWidget* parent = nullptr, QMap<QString, QString>&& extra_info = {});
57+
explicit InstanceImportTask(const QUrl& sourceUrl, QWidget* parent = nullptr, QMap<QString, QString>&& extra_info = {});
5858

5959
bool abort() override;
6060
const QVector<Flame::File>& getBlockedFiles() const { return m_blockedMods; }

launcher/MMCZip.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
namespace MMCZip {
5252
// ours
53-
bool mergeZipFiles(QuaZip* into, QFileInfo from, QSet<QString>& contained, const FilterFunction filter)
53+
bool mergeZipFiles(QuaZip* into, QFileInfo from, QSet<QString>& contained, const FilterFunction& filter)
5454
{
5555
QuaZip modZip(from.filePath());
5656
modZip.open(QuaZip::mdUnzip);

launcher/MMCZip.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ using FilterFunction = std::function<bool(const QString&)>;
6060
/**
6161
* Merge two zip files, using a filter function
6262
*/
63-
bool mergeZipFiles(QuaZip* into, QFileInfo from, QSet<QString>& contained, const FilterFunction filter = nullptr);
63+
bool mergeZipFiles(QuaZip* into, QFileInfo from, QSet<QString>& contained, const FilterFunction& filter = nullptr);
6464

6565
/**
6666
* Compress directory, by providing a list of files to compress

launcher/RecursiveFileSystemWatcher.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class RecursiveFileSystemWatcher : public QObject {
1313
QDir rootDir() const { return m_root; }
1414

1515
// WARNING: setting this to true may be bad for performance
16-
void setWatchFiles(const bool watchFiles);
16+
void setWatchFiles(bool watchFiles);
1717
bool watchFiles() const { return m_watchFiles; }
1818

1919
void setMatcher(IPathMatcher::Ptr matcher) { m_matcher = matcher; }

launcher/ResourceDownloadTask.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ResourceDownloadTask : public SequentialTask {
3232
public:
3333
explicit ResourceDownloadTask(ModPlatform::IndexedPack::Ptr pack,
3434
ModPlatform::IndexedVersion version,
35-
const std::shared_ptr<ResourceFolderModel> packs,
35+
std::shared_ptr<ResourceFolderModel> packs,
3636
bool is_indexed = true,
3737
QString custom_target_folder = {});
3838
const QString& getFilename() const { return m_pack_version.fileName; }

launcher/VersionProxyModel.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class VersionProxyModel : public QAbstractProxyModel {
2828

2929
const FilterMap& filters() const;
3030
const QString& search() const;
31-
void setFilter(const BaseVersionList::ModelRoles column, Filter* filter);
31+
void setFilter(BaseVersionList::ModelRoles column, Filter* filter);
3232
void setSearch(const QString& search);
3333
void clearFilters();
3434
QModelIndex getRecommended() const;

launcher/icons/IconList.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class IconList : public QAbstractListModel {
6767
virtual Qt::ItemFlags flags(const QModelIndex& index) const override;
6868

6969
bool addThemeIcon(const QString& key);
70-
bool addIcon(const QString& key, const QString& name, const QString& path, const IconType type);
70+
bool addIcon(const QString& key, const QString& name, const QString& path, IconType type);
7171
void saveIcon(const QString& key, const QString& path, const char* format) const;
7272
bool deleteIcon(const QString& key);
7373
bool trashIcon(const QString& key);

launcher/meta/Index.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ class Index : public QAbstractListModel, public BaseEntity {
5555
QVector<VersionList::Ptr> m_lists;
5656
QHash<QString, VersionList::Ptr> m_uids;
5757

58-
void connectVersionList(const int row, const VersionList::Ptr& list);
58+
void connectVersionList(int row, const VersionList::Ptr& list);
5959
};
6060
} // namespace Meta

launcher/meta/Version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class Version : public QObject, public BaseVersion, public BaseEntity {
6464

6565
public: // for usage by format parsers only
6666
void setType(const QString& type);
67-
void setTime(const qint64 time);
67+
void setTime(qint64 time);
6868
void setRequires(const Meta::RequireSet& reqs, const Meta::RequireSet& conflicts);
6969
void setVolatile(bool volatile_);
7070
void setRecommended(bool recommended);

launcher/meta/VersionList.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class VersionList : public BaseVersionList, public BaseEntity {
7979

8080
Version::Ptr m_recommended;
8181

82-
void setupAddedVersion(const int row, const Version::Ptr& version);
82+
void setupAddedVersion(int row, const Version::Ptr& version);
8383
};
8484
} // namespace Meta
8585
Q_DECLARE_METATYPE(Meta::VersionList::Ptr)

launcher/minecraft/OneSixVersionFormat.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class OneSixVersionFormat {
1010
public:
1111
// version files / profile patches
12-
static VersionFilePtr versionFileFromJson(const QJsonDocument& doc, const QString& filename, const bool requireOrder);
12+
static VersionFilePtr versionFileFromJson(const QJsonDocument& doc, const QString& filename, bool requireOrder);
1313
static QJsonDocument versionFileToJson(const VersionFilePtr& patch);
1414

1515
// libraries

launcher/minecraft/PackProfile.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ bool PackProfile::remove(const int index)
430430
return true;
431431
}
432432

433-
bool PackProfile::remove(const QString id)
433+
bool PackProfile::remove(const QString& id)
434434
{
435435
int i = 0;
436436
for (auto patch : d->components) {

launcher/minecraft/PackProfile.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ class PackProfile : public QAbstractListModel {
8989

9090
enum MoveDirection { MoveUp, MoveDown };
9191
/// move component file # up or down the list
92-
void move(const int index, const MoveDirection direction);
92+
void move(int index, MoveDirection direction);
9393

9494
/// remove component file # - including files/records
95-
bool remove(const int index);
95+
bool remove(int index);
9696

9797
/// remove component file by id - including files/records
98-
bool remove(const QString id);
98+
bool remove(const QString& id);
9999

100100
bool customize(int index);
101101

launcher/minecraft/ProfileUtils.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ VersionFilePtr parseJsonFile(const QFileInfo& fileInfo, const bool requireOrder)
140140
return guardedParseJson(doc, fileInfo.completeBaseName(), fileInfo.absoluteFilePath(), requireOrder);
141141
}
142142

143-
bool saveJsonFile(const QJsonDocument doc, const QString& filename)
143+
bool saveJsonFile(const QJsonDocument& doc, const QString& filename)
144144
{
145145
auto data = doc.toJson();
146146
QSaveFile jsonFile(filename);

launcher/minecraft/ProfileUtils.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ bool readOverrideOrders(QString path, PatchOrder& order);
4747
bool writeOverrideOrders(QString path, const PatchOrder& order);
4848

4949
/// Parse a version file in JSON format
50-
VersionFilePtr parseJsonFile(const QFileInfo& fileInfo, const bool requireOrder);
50+
VersionFilePtr parseJsonFile(const QFileInfo& fileInfo, bool requireOrder);
5151

5252
/// Save a JSON file (in any format)
53-
bool saveJsonFile(const QJsonDocument doc, const QString& filename);
53+
bool saveJsonFile(const QJsonDocument& doc, const QString& filename);
5454

5555
/// Remove LWJGL from a patch file. This is applied to all Mojang-like profile files.
5656
void removeLwjglFromPatch(VersionFilePtr patch);

launcher/minecraft/auth/AccountList.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class AccountList : public QAbstractListModel {
7575
virtual Qt::ItemFlags flags(const QModelIndex& index) const override;
7676
virtual bool setData(const QModelIndex& index, const QVariant& value, int role) override;
7777

78-
void addAccount(const MinecraftAccountPtr account);
78+
void addAccount(MinecraftAccountPtr account);
7979
void removeAccount(QModelIndex index);
8080
int findAccountByProfileId(const QString& profileId) const;
8181
MinecraftAccountPtr getAccountByProfileName(const QString& profileName) const;

launcher/minecraft/mod/ResourceFolderModel.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ResourceFolderModel::~ResourceFolderModel()
4545
QCoreApplication::processEvents();
4646
}
4747

48-
bool ResourceFolderModel::startWatching(const QStringList paths)
48+
bool ResourceFolderModel::startWatching(const QStringList& paths)
4949
{
5050
if (m_is_watching)
5151
return false;
@@ -64,7 +64,7 @@ bool ResourceFolderModel::startWatching(const QStringList paths)
6464
return m_is_watching;
6565
}
6666

67-
bool ResourceFolderModel::stopWatching(const QStringList paths)
67+
bool ResourceFolderModel::stopWatching(const QStringList& paths)
6868
{
6969
if (!m_is_watching)
7070
return false;

launcher/minecraft/mod/ResourceFolderModel.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ class ResourceFolderModel : public QAbstractListModel {
3939
* Returns whether starting to watch all the paths was successful.
4040
* If one or more fails, it returns false.
4141
*/
42-
bool startWatching(const QStringList paths);
42+
bool startWatching(const QStringList& paths);
4343

4444
/** Stops watching the paths for changes.
4545
*
4646
* Returns whether stopping to watch all the paths was successful.
4747
* If one or more fails, it returns false.
4848
*/
49-
bool stopWatching(const QStringList paths);
49+
bool stopWatching(const QStringList& paths);
5050

5151
/* Helper methods for subclasses, using a predetermined list of paths. */
5252
virtual bool startWatching() { return startWatching({ m_dir.absolutePath() }); }

launcher/minecraft/mod/tasks/GetModDependenciesTask.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ Task::Ptr GetModDependenciesTask::prepareDependencyTask(const ModPlatform::Depen
238238
return tasks;
239239
}
240240

241-
void GetModDependenciesTask::removePack(const QVariant addonId)
241+
void GetModDependenciesTask::removePack(const QVariant& addonId)
242242
{
243243
auto pred = [addonId](const std::shared_ptr<PackDependency>& v) { return v->pack->addonId == addonId; };
244244
#if QT_VERSION >= QT_VERSION_CHECK(6, 1, 0)

launcher/minecraft/mod/tasks/GetModDependenciesTask.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ class GetModDependenciesTask : public SequentialTask {
6565
QHash<QString, QStringList> getRequiredBy();
6666

6767
protected slots:
68-
Task::Ptr prepareDependencyTask(const ModPlatform::Dependency&, const ModPlatform::ResourceProvider, int);
68+
Task::Ptr prepareDependencyTask(const ModPlatform::Dependency&, ModPlatform::ResourceProvider, int);
6969
QList<ModPlatform::Dependency> getDependenciesForVersion(const ModPlatform::IndexedVersion&,
70-
const ModPlatform::ResourceProvider providerName);
70+
ModPlatform::ResourceProvider providerName);
7171
void prepare();
7272
Task::Ptr getProjectInfoTask(std::shared_ptr<PackDependency> pDep);
73-
ModPlatform::Dependency getOverride(const ModPlatform::Dependency&, const ModPlatform::ResourceProvider providerName);
74-
void removePack(const QVariant addonId);
73+
ModPlatform::Dependency getOverride(const ModPlatform::Dependency&, ModPlatform::ResourceProvider providerName);
74+
void removePack(const QVariant& addonId);
7575

7676
private:
7777
QList<std::shared_ptr<PackDependency>> m_pack_dependencies;

launcher/modplatform/modrinth/ModrinthPackExportTask.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class ModrinthPackExportTask : public Task {
6868
void collectFiles();
6969
void collectHashes();
7070
void makeApiRequest();
71-
void parseApiResponse(const std::shared_ptr<QByteArray> response);
71+
void parseApiResponse(std::shared_ptr<QByteArray> response);
7272
void buildZip();
7373

7474
QByteArray generateIndex();

launcher/modplatform/technic/TechnicPackProcessor.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ class TechnicPackProcessor : public QObject {
3333
const QString& instIcon,
3434
const QString& stagingPath,
3535
const QString& minecraftVersion = QString(),
36-
const bool isSolder = false);
36+
bool isSolder = false);
3737
};
3838
} // namespace Technic

launcher/ui/dialogs/ModUpdateDialog.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ class ConcurrentTask;
1616
class ModUpdateDialog final : public ReviewMessageBox {
1717
Q_OBJECT
1818
public:
19-
explicit ModUpdateDialog(QWidget* parent,
20-
BaseInstance* instance,
21-
const std::shared_ptr<ModFolderModel> mod_model,
22-
QList<Mod*>& search_for);
19+
explicit ModUpdateDialog(QWidget* parent, BaseInstance* instance, std::shared_ptr<ModFolderModel> mod_model, QList<Mod*>& search_for);
2320

2421
void checkCandidates();
2522

launcher/ui/dialogs/ResourceDownloadDialog.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class ResourceDownloadDialog : public QDialog, public BasePageProvider {
5050
public:
5151
using DownloadTaskPtr = shared_qobject_ptr<ResourceDownloadTask>;
5252

53-
ResourceDownloadDialog(QWidget* parent, const std::shared_ptr<ResourceFolderModel> base_model);
53+
ResourceDownloadDialog(QWidget* parent, std::shared_ptr<ResourceFolderModel> base_model);
5454

5555
void initializeContainer();
5656
void connectButtons();

launcher/ui/instanceview/InstanceView.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class InstanceView : public QAbstractItemView {
6565
/// get the model index at the specified visual point
6666
virtual QModelIndex indexAt(const QPoint& point) const override;
6767
QString groupNameAt(const QPoint& point);
68-
void setSelection(const QRect& rect, const QItemSelectionModel::SelectionFlags commands) override;
68+
void setSelection(const QRect& rect, QItemSelectionModel::SelectionFlags commands) override;
6969

7070
virtual int horizontalOffset() const override;
7171
virtual int verticalOffset() const override;

launcher/ui/pages/instance/OtherLogsPage.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class OtherLogsPage : public QWidget, public BasePage {
6565

6666
private slots:
6767
void populateSelectLogBox();
68-
void on_selectLogBox_currentIndexChanged(const int index);
68+
void on_selectLogBox_currentIndexChanged(int index);
6969
void on_btnReload_clicked();
7070
void on_btnPaste_clicked();
7171
void on_btnCopy_clicked();
@@ -78,7 +78,7 @@ class OtherLogsPage : public QWidget, public BasePage {
7878
void findPreviousActivated();
7979

8080
private:
81-
void setControlsEnabled(const bool enabled);
81+
void setControlsEnabled(bool enabled);
8282

8383
private:
8484
Ui::OtherLogsPage* ui;

launcher/ui/pages/modplatform/ModPage.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ class ModPage : public ResourcePage {
4949

5050
[[nodiscard]] QMap<QString, QString> urlHandlers() const override;
5151

52-
void addResourceToPage(ModPlatform::IndexedPack::Ptr,
53-
ModPlatform::IndexedVersion&,
54-
const std::shared_ptr<ResourceFolderModel>) override;
52+
void addResourceToPage(ModPlatform::IndexedPack::Ptr, ModPlatform::IndexedVersion&, std::shared_ptr<ResourceFolderModel>) override;
5553

5654
virtual auto validateVersion(ModPlatform::IndexedVersion& ver,
5755
QString mineVer,

launcher/ui/pages/modplatform/ResourceModel.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class ResourceModel : public QAbstractListModel {
8888

8989
void addPack(ModPlatform::IndexedPack::Ptr pack,
9090
ModPlatform::IndexedVersion& version,
91-
const std::shared_ptr<ResourceFolderModel> packs,
91+
std::shared_ptr<ResourceFolderModel> packs,
9292
bool is_indexed = false,
9393
QString custom_target_folder = {});
9494
void removePack(const QString& rem);

launcher/ui/pages/modplatform/ResourcePage.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class ResourcePage : public QWidget, public BasePage {
7878
void addResourceToDialog(ModPlatform::IndexedPack::Ptr, ModPlatform::IndexedVersion&);
7979
void removeResourceFromDialog(const QString& pack_name);
8080
virtual void removeResourceFromPage(const QString& name);
81-
virtual void addResourceToPage(ModPlatform::IndexedPack::Ptr, ModPlatform::IndexedVersion&, const std::shared_ptr<ResourceFolderModel>);
81+
virtual void addResourceToPage(ModPlatform::IndexedPack::Ptr, ModPlatform::IndexedVersion&, std::shared_ptr<ResourceFolderModel>);
8282

8383
QList<DownloadTaskPtr> selectedPacks() { return m_model->selectedPacks(); }
8484
bool hasSelectedPacks() { return !(m_model->selectedPacks().isEmpty()); }

launcher/ui/pages/modplatform/ShaderPackPage.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ class ShaderPackResourcePage : public ResourcePage {
3838

3939
[[nodiscard]] bool supportsFiltering() const override { return false; };
4040

41-
void addResourceToPage(ModPlatform::IndexedPack::Ptr,
42-
ModPlatform::IndexedVersion&,
43-
const std::shared_ptr<ResourceFolderModel>) override;
41+
void addResourceToPage(ModPlatform::IndexedPack::Ptr, ModPlatform::IndexedVersion&, std::shared_ptr<ResourceFolderModel>) override;
4442

4543
[[nodiscard]] QMap<QString, QString> urlHandlers() const override;
4644

launcher/ui/pages/modplatform/flame/FlameModel.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ListModel : public QAbstractListModel {
3838
void fetchMore(const QModelIndex& parent) override;
3939

4040
void getLogo(const QString& logo, const QString& logoUrl, LogoCallback callback);
41-
void searchWithTerm(const QString& term, const int sort);
41+
void searchWithTerm(const QString& term, int sort);
4242

4343
[[nodiscard]] bool hasActiveSearchJob() const { return jobPtr && jobPtr->isRunning(); }
4444
[[nodiscard]] Task::Ptr activeSearchJob() { return hasActiveSearchJob() ? jobPtr : nullptr; }

launcher/ui/pages/modplatform/modrinth/ModrinthModel.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class ModpackListModel : public QAbstractListModel {
7171
/* Ask the API for more information */
7272
void fetchMore(const QModelIndex& parent) override;
7373
void refresh();
74-
void searchWithTerm(const QString& term, const int sort);
74+
void searchWithTerm(const QString& term, int sort);
7575

7676
[[nodiscard]] bool hasActiveSearchJob() const { return jobPtr && jobPtr->isRunning(); }
7777
[[nodiscard]] Task::Ptr activeSearchJob() { return hasActiveSearchJob() ? jobPtr : nullptr; }

launcher/ui/widgets/LanguageSelectionWidget.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void LanguageSelectionWidget::languageRowChanged(const QModelIndex& current, con
7676
translations->updateLanguage(key);
7777
}
7878

79-
void LanguageSelectionWidget::languageSettingChanged(const Setting&, const QVariant)
79+
void LanguageSelectionWidget::languageSettingChanged(const Setting&, const QVariant&)
8080
{
8181
auto translations = APPLICATION->translations();
8282
auto index = translations->selectedIndex();

launcher/ui/widgets/LanguageSelectionWidget.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class LanguageSelectionWidget : public QWidget {
3434

3535
protected slots:
3636
void languageRowChanged(const QModelIndex& current, const QModelIndex& previous);
37-
void languageSettingChanged(const Setting&, const QVariant);
37+
void languageSettingChanged(const Setting&, const QVariant&);
3838

3939
private:
4040
QVBoxLayout* verticalLayout = nullptr;

0 commit comments

Comments
 (0)