aboutsummaryrefslogtreecommitdiff
path: root/launcher/InstanceList.h
diff options
context:
space:
mode:
authorRyan Cao <70191398+ryanccn@users.noreply.github.com>2022-07-31 01:42:33 +0800
committerGitHub <noreply@github.com>2022-07-30 14:42:33 -0300
commitb15544c163ccbca08ea498b3b3a51c82d7fb3e12 (patch)
treea2a129505f5932f082c0a348a583c859af1030a2 /launcher/InstanceList.h
parent94a63e3859e576658d832c62cffacbb6963ad1e6 (diff)
downloadPrismLauncher-b15544c163ccbca08ea498b3b3a51c82d7fb3e12.tar.gz
PrismLauncher-b15544c163ccbca08ea498b3b3a51c82d7fb3e12.tar.bz2
PrismLauncher-b15544c163ccbca08ea498b3b3a51c82d7fb3e12.zip
Trash instances instead of deleting (when possible) (#549)
Squashed because of :pofat: commit history
Diffstat (limited to 'launcher/InstanceList.h')
-rw-r--r--launcher/InstanceList.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/launcher/InstanceList.h b/launcher/InstanceList.h
index bc6c3af0..62282f04 100644
--- a/launcher/InstanceList.h
+++ b/launcher/InstanceList.h
@@ -19,6 +19,8 @@
#include <QAbstractListModel>
#include <QSet>
#include <QList>
+#include <QStack>
+#include <QPair>
#include "BaseInstance.h"
@@ -46,6 +48,12 @@ enum class GroupsState
Dirty
};
+struct TrashHistoryItem {
+ QString id;
+ QString polyPath;
+ QString trashPath;
+ QString groupName;
+};
class InstanceList : public QAbstractListModel
{
@@ -102,6 +110,9 @@ public:
void setInstanceGroup(const InstanceId & id, const GroupId& name);
void deleteGroup(const GroupId & name);
+ bool trashInstance(const InstanceId &id);
+ bool trashedSomething();
+ void undoTrashInstance();
void deleteInstance(const InstanceId & id);
// Wrap an instance creation task in some more task machinery and make it ready to be used
@@ -180,4 +191,6 @@ private:
QSet<InstanceId> instanceSet;
bool m_groupsLoaded = false;
bool m_instancesProbed = false;
+
+ QStack<TrashHistoryItem> m_trashHistory;
};