summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2020-01-09 15:31:32 +0100
committerPetr Mrázek <peterix@gmail.com>2020-01-09 15:31:32 +0100
commitbc98181ec274dfc933c5c0207943f9de1dbaf1d1 (patch)
treed74fd6ac1bbcff13cd8a8df63696f48c06a91544 /api
parent6a095deea62556eaa3c10b03a1426c751b22fc7c (diff)
downloadMultiMC-bc98181ec274dfc933c5c0207943f9de1dbaf1d1.tar
MultiMC-bc98181ec274dfc933c5c0207943f9de1dbaf1d1.tar.gz
MultiMC-bc98181ec274dfc933c5c0207943f9de1dbaf1d1.tar.lz
MultiMC-bc98181ec274dfc933c5c0207943f9de1dbaf1d1.tar.xz
MultiMC-bc98181ec274dfc933c5c0207943f9de1dbaf1d1.zip
GH-2769 add an option to not copy play time when copying instances
Diffstat (limited to 'api')
-rw-r--r--api/logic/InstanceCopyTask.cpp6
-rw-r--r--api/logic/InstanceCopyTask.h3
2 files changed, 7 insertions, 2 deletions
diff --git a/api/logic/InstanceCopyTask.cpp b/api/logic/InstanceCopyTask.cpp
index a576a0fd..35adeaf9 100644
--- a/api/logic/InstanceCopyTask.cpp
+++ b/api/logic/InstanceCopyTask.cpp
@@ -5,9 +5,10 @@
#include "pathmatcher/RegexpMatcher.h"
#include <QtConcurrentRun>
-InstanceCopyTask::InstanceCopyTask(InstancePtr origInstance, bool copySaves)
+InstanceCopyTask::InstanceCopyTask(InstancePtr origInstance, bool copySaves, bool keepPlaytime)
{
m_origInstance = origInstance;
+ m_keepPlaytime = keepPlaytime;
if(!copySaves)
{
@@ -46,6 +47,9 @@ void InstanceCopyTask::copyFinished()
InstancePtr inst(new NullInstance(m_globalSettings, instanceSettings, m_stagingPath));
inst->setName(m_instName);
inst->setIconKey(m_instIcon);
+ if(!m_keepPlaytime) {
+ inst->resetTimePlayed();
+ }
emitSucceeded();
}
diff --git a/api/logic/InstanceCopyTask.h b/api/logic/InstanceCopyTask.h
index 8dd55b40..6465e92d 100644
--- a/api/logic/InstanceCopyTask.h
+++ b/api/logic/InstanceCopyTask.h
@@ -15,7 +15,7 @@ class MULTIMC_LOGIC_EXPORT InstanceCopyTask : public InstanceTask
{
Q_OBJECT
public:
- explicit InstanceCopyTask(InstancePtr origInstance, bool copySaves);
+ explicit InstanceCopyTask(InstancePtr origInstance, bool copySaves, bool keepPlaytime);
protected:
//! Entry point for tasks.
@@ -28,4 +28,5 @@ private: /* data */
QFuture<bool> m_copyFuture;
QFutureWatcher<bool> m_copyFutureWatcher;
std::unique_ptr<IPathMatcher> m_matcher;
+ bool m_keepPlaytime;
};