chore: reformat
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
ce2ca13815
commit
1d468ac35a
594 changed files with 16040 additions and 16536 deletions
|
@ -14,95 +14,57 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include <QFileInfo>
|
||||
#include <QDateTime>
|
||||
#include <QFileInfo>
|
||||
#include <optional>
|
||||
|
||||
struct GameType {
|
||||
GameType() = default;
|
||||
GameType (std::optional<int> original);
|
||||
GameType(std::optional<int> original);
|
||||
|
||||
QString toTranslatedString() const;
|
||||
QString toLogString() const;
|
||||
|
||||
enum
|
||||
{
|
||||
Unknown = -1,
|
||||
Survival,
|
||||
Creative,
|
||||
Adventure,
|
||||
Spectator
|
||||
} type = Unknown;
|
||||
enum { Unknown = -1, Survival, Creative, Adventure, Spectator } type = Unknown;
|
||||
std::optional<int> original;
|
||||
};
|
||||
|
||||
class World
|
||||
{
|
||||
public:
|
||||
World(const QFileInfo &file);
|
||||
QString folderName() const
|
||||
{
|
||||
return m_folderName;
|
||||
}
|
||||
QString name() const
|
||||
{
|
||||
return m_actualName;
|
||||
}
|
||||
QString iconFile() const
|
||||
{
|
||||
return m_iconFile;
|
||||
}
|
||||
int64_t bytes() const
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
QDateTime lastPlayed() const
|
||||
{
|
||||
return m_lastPlayed;
|
||||
}
|
||||
GameType gameType() const
|
||||
{
|
||||
return m_gameType;
|
||||
}
|
||||
int64_t seed() const
|
||||
{
|
||||
return m_randomSeed;
|
||||
}
|
||||
bool isValid() const
|
||||
{
|
||||
return is_valid;
|
||||
}
|
||||
bool isOnFS() const
|
||||
{
|
||||
return m_containerFile.isDir();
|
||||
}
|
||||
QFileInfo container() const
|
||||
{
|
||||
return m_containerFile;
|
||||
}
|
||||
class World {
|
||||
public:
|
||||
World(const QFileInfo& file);
|
||||
QString folderName() const { return m_folderName; }
|
||||
QString name() const { return m_actualName; }
|
||||
QString iconFile() const { return m_iconFile; }
|
||||
int64_t bytes() const { return m_size; }
|
||||
QDateTime lastPlayed() const { return m_lastPlayed; }
|
||||
GameType gameType() const { return m_gameType; }
|
||||
int64_t seed() const { return m_randomSeed; }
|
||||
bool isValid() const { return is_valid; }
|
||||
bool isOnFS() const { return m_containerFile.isDir(); }
|
||||
QFileInfo container() const { return m_containerFile; }
|
||||
// delete all the files of this world
|
||||
bool destroy();
|
||||
// replace this world with a copy of the other
|
||||
bool replace(World &with);
|
||||
bool replace(World& with);
|
||||
// change the world's filesystem path (used by world lists for *MAGIC* purposes)
|
||||
void repath(const QFileInfo &file);
|
||||
void repath(const QFileInfo& file);
|
||||
// remove the icon file, if any
|
||||
bool resetIcon();
|
||||
|
||||
bool rename(const QString &to);
|
||||
bool install(const QString &to, const QString &name= QString());
|
||||
bool rename(const QString& to);
|
||||
bool install(const QString& to, const QString& name = QString());
|
||||
|
||||
// WEAK compare operator - used for replacing worlds
|
||||
bool operator==(const World &other) const;
|
||||
bool operator==(const World& other) const;
|
||||
|
||||
[[nodiscard]] auto isSymLink() const -> bool{ return m_containerFile.isSymLink(); }
|
||||
[[nodiscard]] auto isSymLink() const -> bool { return m_containerFile.isSymLink(); }
|
||||
|
||||
/**
|
||||
* @brief Take a instance path, checks if the file pointed to by the resource is a symlink or under a symlink in that instance
|
||||
*
|
||||
*
|
||||
* @param instPath path to an instance directory
|
||||
* @return true
|
||||
* @return false
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
[[nodiscard]] bool isSymLinkUnder(const QString& instPath) const;
|
||||
|
||||
|
@ -110,13 +72,12 @@ public:
|
|||
|
||||
QString canonicalFilePath() const { return m_containerFile.canonicalFilePath(); }
|
||||
|
||||
private:
|
||||
void readFromZip(const QFileInfo &file);
|
||||
void readFromFS(const QFileInfo &file);
|
||||
private:
|
||||
void readFromZip(const QFileInfo& file);
|
||||
void readFromFS(const QFileInfo& file);
|
||||
void loadFromLevelDat(QByteArray data);
|
||||
|
||||
protected:
|
||||
|
||||
protected:
|
||||
QFileInfo m_containerFile;
|
||||
QString m_containerOffsetPath;
|
||||
QString m_folderName;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue