chore: reformat code
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
65b960f904
commit
ff7e984198
@ -40,8 +40,8 @@
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QMimeData>
|
||||
#include <QSet>
|
||||
#include <QPair>
|
||||
#include <QSet>
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
#include <QUuid>
|
||||
@ -51,11 +51,11 @@
|
||||
#include "FileSystem.h"
|
||||
#include "InstanceList.h"
|
||||
#include "InstanceTask.h"
|
||||
#include "MMCTime.h"
|
||||
#include "NullInstance.h"
|
||||
#include "WatchLock.h"
|
||||
#include "minecraft/MinecraftInstance.h"
|
||||
#include "settings/INISettingsObject.h"
|
||||
#include "MMCTime.h"
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
#include <Windows.h>
|
||||
@ -366,11 +366,13 @@ bool InstanceList::trashInstance(const InstanceId& id)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InstanceList::trashedSomething() {
|
||||
bool InstanceList::trashedSomething()
|
||||
{
|
||||
return !m_trashHistory.empty();
|
||||
}
|
||||
|
||||
void InstanceList::undoTrashInstance() {
|
||||
void InstanceList::undoTrashInstance()
|
||||
{
|
||||
if (m_trashHistory.empty()) {
|
||||
qWarning() << "Nothing to recover from trash.";
|
||||
return;
|
||||
@ -638,13 +640,11 @@ InstancePtr InstanceList::loadInstance(const InstanceId& id)
|
||||
|
||||
QString inst_type = instanceSettings->get("InstanceType").toString();
|
||||
|
||||
// NOTE: Some PolyMC versions didn't save the InstanceType properly. We will just bank on the probability that this is probably a OneSix instance
|
||||
if (inst_type == "OneSix" || inst_type.isEmpty())
|
||||
{
|
||||
// NOTE: Some PolyMC versions didn't save the InstanceType properly. We will just bank on the probability that this is probably a OneSix
|
||||
// instance
|
||||
if (inst_type == "OneSix" || inst_type.isEmpty()) {
|
||||
inst.reset(new MinecraftInstance(m_globalSettings, instanceSettings, instanceRoot));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
inst.reset(new NullInstance(m_globalSettings, instanceSettings, instanceRoot));
|
||||
}
|
||||
qDebug() << "Loaded instance " << inst->name() << " from " << inst->instanceRoot();
|
||||
@ -828,9 +828,14 @@ class InstanceStaging : public Task {
|
||||
Q_OBJECT
|
||||
const unsigned minBackoff = 1;
|
||||
const unsigned maxBackoff = 16;
|
||||
|
||||
public:
|
||||
InstanceStaging(InstanceList* parent, InstanceTask* child, QString stagingPath, InstanceName const& instanceName, QString groupName)
|
||||
: m_parent(parent), backoff(minBackoff, maxBackoff), m_stagingPath(std::move(stagingPath)), m_instance_name(std::move(instanceName)), m_groupName(std::move(groupName))
|
||||
: m_parent(parent)
|
||||
, backoff(minBackoff, maxBackoff)
|
||||
, m_stagingPath(std::move(stagingPath))
|
||||
, m_instance_name(std::move(instanceName))
|
||||
, m_groupName(std::move(groupName))
|
||||
{
|
||||
m_child.reset(child);
|
||||
connect(child, &Task::succeeded, this, &InstanceStaging::childSucceded);
|
||||
@ -854,10 +859,7 @@ class InstanceStaging : public Task {
|
||||
|
||||
return Task::abort();
|
||||
}
|
||||
bool canAbort() const override
|
||||
{
|
||||
return (m_child && m_child->canAbort());
|
||||
}
|
||||
bool canAbort() const override { return (m_child && m_child->canAbort()); }
|
||||
|
||||
protected:
|
||||
virtual void executeTask() override { m_child->start(); }
|
||||
@ -867,8 +869,7 @@ class InstanceStaging : public Task {
|
||||
void childSucceded()
|
||||
{
|
||||
unsigned sleepTime = backoff();
|
||||
if (m_parent->commitStagedInstance(m_stagingPath, m_instance_name, m_groupName, m_child->shouldOverride()))
|
||||
{
|
||||
if (m_parent->commitStagedInstance(m_stagingPath, m_instance_name, m_groupName, m_child->shouldOverride())) {
|
||||
emitSucceeded();
|
||||
return;
|
||||
}
|
||||
@ -886,10 +887,7 @@ class InstanceStaging : public Task {
|
||||
emitFailed(reason);
|
||||
}
|
||||
|
||||
void childAborted()
|
||||
{
|
||||
emitAborted();
|
||||
}
|
||||
void childAborted() { emitAborted(); }
|
||||
|
||||
private:
|
||||
InstanceList* m_parent;
|
||||
@ -931,7 +929,10 @@ QString InstanceList::getStagedInstancePath()
|
||||
return path;
|
||||
}
|
||||
|
||||
bool InstanceList::commitStagedInstance(const QString& path, InstanceName const& instanceName, const QString& groupName, bool should_override)
|
||||
bool InstanceList::commitStagedInstance(const QString& path,
|
||||
InstanceName const& instanceName,
|
||||
const QString& groupName,
|
||||
bool should_override)
|
||||
{
|
||||
QDir dir;
|
||||
QString instID;
|
||||
|
@ -15,12 +15,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QAbstractTableModel>
|
||||
#include <QSet>
|
||||
#include <QList>
|
||||
#include <QStack>
|
||||
#include <QObject>
|
||||
#include <QPair>
|
||||
#include <QSet>
|
||||
#include <QStack>
|
||||
|
||||
#include "BaseInstance.h"
|
||||
|
||||
@ -32,21 +32,9 @@ using InstanceId = QString;
|
||||
using GroupId = QString;
|
||||
using InstanceLocator = std::pair<InstancePtr, int>;
|
||||
|
||||
enum class InstCreateError
|
||||
{
|
||||
NoCreateError = 0,
|
||||
NoSuchVersion,
|
||||
UnknownCreateError,
|
||||
InstExists,
|
||||
CantCreateDir
|
||||
};
|
||||
enum class InstCreateError { NoCreateError = 0, NoSuchVersion, UnknownCreateError, InstExists, CantCreateDir };
|
||||
|
||||
enum class GroupsState
|
||||
{
|
||||
NotLoaded,
|
||||
Steady,
|
||||
Dirty
|
||||
};
|
||||
enum class GroupsState { NotLoaded, Steady, Dirty };
|
||||
|
||||
struct TrashHistoryItem {
|
||||
QString id;
|
||||
@ -55,8 +43,7 @@ struct TrashHistoryItem {
|
||||
QString groupName;
|
||||
};
|
||||
|
||||
class InstanceList : public QAbstractTableModel
|
||||
{
|
||||
class InstanceList : public QAbstractTableModel {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
@ -73,8 +60,7 @@ public:
|
||||
|
||||
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||
|
||||
enum Column
|
||||
{
|
||||
enum Column {
|
||||
IconColumn = 0,
|
||||
NameColumn,
|
||||
GameVersionColumn,
|
||||
@ -84,32 +70,17 @@ public:
|
||||
ColumnCount
|
||||
};
|
||||
|
||||
enum AdditionalRoles
|
||||
{
|
||||
SortRole = Qt::UserRole + 1,
|
||||
GroupRole,
|
||||
InstanceIDRole
|
||||
};
|
||||
enum AdditionalRoles { SortRole = Qt::UserRole + 1, GroupRole, InstanceIDRole };
|
||||
/*!
|
||||
* \brief Error codes returned by functions in the InstanceList class.
|
||||
* NoError Indicates that no error occurred.
|
||||
* UnknownError indicates that an unspecified error occurred.
|
||||
*/
|
||||
enum InstListError
|
||||
{
|
||||
NoError = 0,
|
||||
UnknownError
|
||||
};
|
||||
enum InstListError { NoError = 0, UnknownError };
|
||||
|
||||
InstancePtr at(int i) const
|
||||
{
|
||||
return m_instances.at(i);
|
||||
}
|
||||
InstancePtr at(int i) const { return m_instances.at(i); }
|
||||
|
||||
int count() const
|
||||
{
|
||||
return m_instances.count();
|
||||
}
|
||||
int count() const { return m_instances.count(); }
|
||||
|
||||
InstListError loadList();
|
||||
void saveNow();
|
||||
|
Loading…
x
Reference in New Issue
Block a user