chore: reformat

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu
2023-08-14 18:16:53 +02:00
parent 779f70057b
commit 91ba4cf75e
603 changed files with 15840 additions and 16257 deletions

View File

@ -37,8 +37,8 @@
#include "PrivatePackManager.h"
#include <QDomDocument>
#include "BuildConfig.h"
#include "Application.h"
#include "BuildConfig.h"
#include "net/ApiDownload.h"

View File

@ -1,22 +1,16 @@
#pragma once
#include <QList>
#include <QMetaType>
#include <QString>
#include <QStringList>
#include <QMetaType>
namespace LegacyFTB {
//Header for structs etc...
enum class PackType
{
Public,
ThirdParty,
Private
};
// Header for structs etc...
enum class PackType { Public, ThirdParty, Private };
struct Modpack
{
struct Modpack {
QString name;
QString description;
QString author;
@ -26,9 +20,9 @@ struct Modpack
QString mods;
QString logo;
//Technical data
// Technical data
QString dir;
QString file; //<- Url in the xml, but doesn't make much sense
QString file; //<- Url in the xml, but doesn't make much sense
bool bugged = false;
bool broken = false;
@ -39,7 +33,7 @@ struct Modpack
typedef QList<Modpack> ModpackList;
}
} // namespace LegacyFTB
//We need it for the proxy model
// We need it for the proxy model
Q_DECLARE_METATYPE(LegacyFTB::Modpack)

View File

@ -43,8 +43,7 @@ namespace LegacyFTB {
void PrivatePackManager::load()
{
try
{
try {
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
auto foo = QString::fromUtf8(FS::read(m_filename)).split('\n', Qt::SkipEmptyParts);
currentPacks = QSet<QString>(foo.begin(), foo.end());
@ -53,9 +52,7 @@ void PrivatePackManager::load()
#endif
dirty = false;
}
catch(...)
{
} catch (...) {
currentPacks = {};
qWarning() << "Failed to read third party FTB pack codes from" << m_filename;
}
@ -63,20 +60,16 @@ void PrivatePackManager::load()
void PrivatePackManager::save() const
{
if(!dirty)
{
if (!dirty) {
return;
}
try
{
try {
QStringList list = currentPacks.values();
FS::write(m_filename, list.join('\n').toUtf8());
dirty = false;
}
catch(...)
{
} catch (...) {
qWarning() << "Failed to write third party FTB pack codes to" << m_filename;
}
}
}
} // namespace LegacyFTB

View File

@ -1,43 +1,33 @@
#pragma once
#include <QFile>
#include <QSet>
#include <QString>
#include <QFile>
namespace LegacyFTB {
class PrivatePackManager
{
public:
~PrivatePackManager()
{
save();
}
class PrivatePackManager {
public:
~PrivatePackManager() { save(); }
void load();
void save() const;
bool empty() const
{
return currentPacks.empty();
}
const QSet<QString> &getCurrentPackCodes() const
{
return currentPacks;
}
void add(const QString &code)
bool empty() const { return currentPacks.empty(); }
const QSet<QString>& getCurrentPackCodes() const { return currentPacks; }
void add(const QString& code)
{
currentPacks.insert(code);
dirty = true;
}
void remove(const QString &code)
void remove(const QString& code)
{
currentPacks.remove(code);
dirty = true;
}
private:
private:
QSet<QString> currentPacks;
QString m_filename = "private_packs.txt";
mutable bool dirty = false;
};
}
} // namespace LegacyFTB