huge nit: added const refs, everywhere
Signed-off-by: timoreo <contact@timoreo.fr>
This commit is contained in:
@ -184,7 +184,7 @@ auto FlameAPI::getProjects(QStringList addonIds, QByteArray* response) const ->
|
||||
return netJob;
|
||||
}
|
||||
|
||||
auto FlameAPI::getFiles(QStringList fileIds, QByteArray* response) const -> NetJob*
|
||||
auto FlameAPI::getFiles(const QStringList& fileIds, QByteArray* response) const -> NetJob*
|
||||
{
|
||||
auto* netJob = new NetJob(QString("Flame::GetFiles"), APPLICATION->network());
|
||||
|
||||
|
@ -12,7 +12,7 @@ class FlameAPI : public NetworkModAPI {
|
||||
auto getLatestVersion(VersionSearchArgs&& args) -> ModPlatform::IndexedVersion;
|
||||
|
||||
auto getProjects(QStringList addonIds, QByteArray* response) const -> NetJob* override;
|
||||
auto getFiles(QStringList fileIds, QByteArray* response) const -> NetJob*;
|
||||
auto getFiles(const QStringList& fileIds, QByteArray* response) const -> NetJob*;
|
||||
|
||||
private:
|
||||
inline auto getSortFieldInt(QString sortString) const -> int
|
||||
|
@ -126,7 +126,7 @@ bool FlameCreationTask::updateInstance()
|
||||
// TODO: Currently 'overrides' will always override the stuff on update. How do we preserve unchanged overrides?
|
||||
// FIXME: We may want to do something about disabled mods.
|
||||
auto old_overrides = Override::readOverrides("overrides", old_index_folder);
|
||||
for (auto entry : old_overrides) {
|
||||
for (const auto& entry : old_overrides) {
|
||||
if (entry.isEmpty())
|
||||
continue;
|
||||
qDebug() << "Scheduling" << entry << "for removal";
|
||||
@ -320,7 +320,7 @@ bool FlameCreationTask::createInstance()
|
||||
qDebug() << "Found jarmods:";
|
||||
QDir jarmodsDir(jarmodsPath);
|
||||
QStringList jarMods;
|
||||
for (auto info : jarmodsDir.entryInfoList(QDir::NoDotAndDotDot | QDir::Files)) {
|
||||
for (const auto& info : jarmodsDir.entryInfoList(QDir::NoDotAndDotDot | QDir::Files)) {
|
||||
qDebug() << info.fileName();
|
||||
jarMods.push_back(info.absoluteFilePath());
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ class FlameCreationTask final : public InstanceCreationTask {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FlameCreationTask(QString staging_path, SettingsObjectPtr global_settings, QWidget* parent)
|
||||
FlameCreationTask(const QString& staging_path, SettingsObjectPtr global_settings, QWidget* parent)
|
||||
: InstanceCreationTask(), m_parent(parent)
|
||||
{
|
||||
setStagingPath(staging_path);
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
namespace Override {
|
||||
|
||||
void createOverrides(QString name, QString parent_folder, QString override_path)
|
||||
void createOverrides(const QString& name, const QString& parent_folder, const QString& override_path)
|
||||
{
|
||||
QString file_path(FS::PathCombine(parent_folder, name + ".txt"));
|
||||
if (QFile::exists(file_path))
|
||||
@ -33,7 +33,7 @@ void createOverrides(QString name, QString parent_folder, QString override_path)
|
||||
file.close();
|
||||
}
|
||||
|
||||
QStringList readOverrides(QString name, QString parent_folder)
|
||||
QStringList readOverrides(const QString& name, const QString& parent_folder)
|
||||
{
|
||||
QString file_path(FS::PathCombine(parent_folder, name + ".txt"));
|
||||
|
||||
|
@ -9,12 +9,12 @@ namespace Override {
|
||||
*
|
||||
* If there's already an existing such file, it will be ovewritten.
|
||||
*/
|
||||
void createOverrides(QString name, QString parent_folder, QString override_path);
|
||||
void createOverrides(const QString& name, const QString& parent_folder, const QString& override_path);
|
||||
|
||||
/** This reads an existing overrides archive, returning a list of overrides.
|
||||
*
|
||||
* If there's no such file in `parent_folder`, it will return an empty list.
|
||||
*/
|
||||
QStringList readOverrides(QString name, QString parent_folder);
|
||||
QStringList readOverrides(const QString& name, const QString& parent_folder);
|
||||
|
||||
} // namespace Override
|
||||
|
@ -121,7 +121,7 @@ bool ModrinthCreationTask::updateInstance()
|
||||
// TODO: Currently 'overrides' will always override the stuff on update. How do we preserve unchanged overrides?
|
||||
// FIXME: We may want to do something about disabled mods.
|
||||
auto old_overrides = Override::readOverrides("overrides", old_index_folder);
|
||||
for (auto entry : old_overrides) {
|
||||
for (const auto& entry : old_overrides) {
|
||||
if (entry.isEmpty())
|
||||
continue;
|
||||
qDebug() << "Scheduling" << entry << "for removal";
|
||||
@ -129,7 +129,7 @@ bool ModrinthCreationTask::updateInstance()
|
||||
}
|
||||
|
||||
auto old_client_overrides = Override::readOverrides("client-overrides", old_index_folder);
|
||||
for (auto entry : old_overrides) {
|
||||
for (const auto& entry : old_overrides) {
|
||||
if (entry.isEmpty())
|
||||
continue;
|
||||
qDebug() << "Scheduling" << entry << "for removal";
|
||||
@ -235,7 +235,7 @@ bool ModrinthCreationTask::createInstance()
|
||||
dl->addValidator(new Net::ChecksumValidator(file.hashAlgorithm, file.hash));
|
||||
m_files_job->addNetAction(dl);
|
||||
|
||||
if (file.downloads.size() > 0) {
|
||||
if (!file.downloads.empty()) {
|
||||
// FIXME: This really needs to be put into a ConcurrentTask of
|
||||
// MultipleOptionsTask's , once those exist :)
|
||||
connect(dl.get(), &NetAction::failed, [this, &file, path, dl] {
|
||||
@ -281,7 +281,7 @@ bool ModrinthCreationTask::createInstance()
|
||||
return ended_well;
|
||||
}
|
||||
|
||||
bool ModrinthCreationTask::parseManifest(QString index_path, std::vector<Modrinth::File>& files, bool set_managed_info, bool show_optional_dialog)
|
||||
bool ModrinthCreationTask::parseManifest(const QString& index_path, std::vector<Modrinth::File>& files, bool set_managed_info, bool show_optional_dialog)
|
||||
{
|
||||
try {
|
||||
auto doc = Json::requireDocument(index_path);
|
||||
@ -300,7 +300,7 @@ bool ModrinthCreationTask::parseManifest(QString index_path, std::vector<Modrint
|
||||
|
||||
auto jsonFiles = Json::requireIsArrayOf<QJsonObject>(obj, "files", "modrinth.index.json");
|
||||
bool had_optional = false;
|
||||
for (auto modInfo : jsonFiles) {
|
||||
for (const auto& modInfo : jsonFiles) {
|
||||
Modrinth::File file;
|
||||
file.path = Json::requireString(modInfo, "path");
|
||||
|
||||
|
@ -27,7 +27,7 @@ class ModrinthCreationTask final : public InstanceCreationTask {
|
||||
bool createInstance() override;
|
||||
|
||||
private:
|
||||
bool parseManifest(QString, std::vector<Modrinth::File>&, bool set_managed_info = true, bool show_optional_dialog = true);
|
||||
bool parseManifest(const QString&, std::vector<Modrinth::File>&, bool set_managed_info = true, bool show_optional_dialog = true);
|
||||
QString getManagedPackID() const;
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user