summaryrefslogtreecommitdiffstats
path: root/api/logic
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-05-03 21:09:36 +0200
committerPetr Mrázek <peterix@gmail.com>2017-05-03 21:09:36 +0200
commit0efa714ba55a33ea6dbcbd08b50c0b09675ce83b (patch)
treece808691e468d1a82a65dbcc9ed76cb29e59489e /api/logic
parent907aa367046bde6ad05893917cff11320019ddda (diff)
downloadMultiMC-0efa714ba55a33ea6dbcbd08b50c0b09675ce83b.tar
MultiMC-0efa714ba55a33ea6dbcbd08b50c0b09675ce83b.tar.gz
MultiMC-0efa714ba55a33ea6dbcbd08b50c0b09675ce83b.tar.lz
MultiMC-0efa714ba55a33ea6dbcbd08b50c0b09675ce83b.tar.xz
MultiMC-0efa714ba55a33ea6dbcbd08b50c0b09675ce83b.zip
NOISSUE replace std::shared_ptr with shared_qobject_ptr for all download tasks
Diffstat (limited to 'api/logic')
-rw-r--r--api/logic/minecraft/Library.cpp2
-rw-r--r--api/logic/minecraft/forge/ForgeXzDownload.h3
-rw-r--r--api/logic/minecraft/onesix/OneSixUpdate.cpp10
-rw-r--r--api/logic/minecraft/onesix/OneSixUpdate.h2
-rw-r--r--api/logic/net/Download.cpp6
-rw-r--r--api/logic/net/Download.h2
-rw-r--r--api/logic/net/NetAction.h2
-rw-r--r--api/logic/screenshots/ImgurAlbumCreation.h2
-rw-r--r--api/logic/screenshots/ImgurUpload.h3
-rw-r--r--api/logic/translations/TranslationsModel.cpp2
10 files changed, 18 insertions, 16 deletions
diff --git a/api/logic/minecraft/Library.cpp b/api/logic/minecraft/Library.cpp
index 22e1bd33..0fdc2e12 100644
--- a/api/logic/minecraft/Library.cpp
+++ b/api/logic/minecraft/Library.cpp
@@ -51,7 +51,7 @@ void Library::getApplicableFiles(OpSys system, QStringList& jar, QStringList& na
}
}
-QList< std::shared_ptr< NetAction > > Library::getDownloads(OpSys system, class HttpMetaCache* cache,
+QList<NetActionPtr> Library::getDownloads(OpSys system, class HttpMetaCache* cache,
QStringList& failedFiles, const QString & overridePath) const
{
QList<NetActionPtr> out;
diff --git a/api/logic/minecraft/forge/ForgeXzDownload.h b/api/logic/minecraft/forge/ForgeXzDownload.h
index ede4e6ce..8d6ad74a 100644
--- a/api/logic/minecraft/forge/ForgeXzDownload.h
+++ b/api/logic/minecraft/forge/ForgeXzDownload.h
@@ -19,8 +19,9 @@
#include "net/HttpMetaCache.h"
#include <QFile>
#include <QTemporaryFile>
+#include "QObjectPtr.h"
-typedef std::shared_ptr<class ForgeXzDownload> ForgeXzDownloadPtr;
+typedef shared_qobject_ptr<class ForgeXzDownload> ForgeXzDownloadPtr;
class ForgeXzDownload : public NetAction
{
diff --git a/api/logic/minecraft/onesix/OneSixUpdate.cpp b/api/logic/minecraft/onesix/OneSixUpdate.cpp
index c45dada1..163cb1a3 100644
--- a/api/logic/minecraft/onesix/OneSixUpdate.cpp
+++ b/api/logic/minecraft/onesix/OneSixUpdate.cpp
@@ -41,7 +41,7 @@ OneSixUpdate::OneSixUpdate(OneSixInstance *inst, QObject *parent) : Task(parent)
{
// create folders
{
- m_tasks.append(std::make_shared<FoldersTask>(m_inst));
+ m_tasks.append(new FoldersTask(m_inst));
}
// add metadata update tasks, if necessary
@@ -66,7 +66,7 @@ OneSixUpdate::OneSixUpdate(OneSixInstance *inst, QObject *parent) : Task(parent)
if(task)
{
qDebug() << "Loading remote meta patch" << id;
- m_tasks.append(task.unwrap());
+ m_tasks.append(task);
}
}
else
@@ -78,17 +78,17 @@ OneSixUpdate::OneSixUpdate(OneSixInstance *inst, QObject *parent) : Task(parent)
// libraries download
{
- m_tasks.append(std::make_shared<LibrariesTask>(m_inst));
+ m_tasks.append(new LibrariesTask(m_inst));
}
// FML libraries download and copy into the instance
{
- m_tasks.append(std::make_shared<FMLLibrariesTask>(m_inst));
+ m_tasks.append(new FMLLibrariesTask(m_inst));
}
// assets update
{
- m_tasks.append(std::make_shared<AssetUpdateTask>(m_inst));
+ m_tasks.append(new AssetUpdateTask(m_inst));
}
}
diff --git a/api/logic/minecraft/onesix/OneSixUpdate.h b/api/logic/minecraft/onesix/OneSixUpdate.h
index 6bcfd41a..7b6fa5ca 100644
--- a/api/logic/minecraft/onesix/OneSixUpdate.h
+++ b/api/logic/minecraft/onesix/OneSixUpdate.h
@@ -46,7 +46,7 @@ private:
private:
OneSixInstance *m_inst = nullptr;
- QList<std::shared_ptr<Task>> m_tasks;
+ QList<shared_qobject_ptr<Task>> m_tasks;
QString m_preFailure;
int m_currentTask = -1;
bool m_abort = false;
diff --git a/api/logic/net/Download.cpp b/api/logic/net/Download.cpp
index 97b03ac2..12c4d7e0 100644
--- a/api/logic/net/Download.cpp
+++ b/api/logic/net/Download.cpp
@@ -40,7 +40,7 @@ Download::Ptr Download::makeCached(QUrl url, MetaEntryPtr entry, Options options
auto cachedNode = new MetaCacheSink(entry, md5Node);
dl->m_sink.reset(cachedNode);
dl->m_target_path = entry->getFullPath();
- return std::shared_ptr<Download>(dl);
+ return dl;
}
Download::Ptr Download::makeByteArray(QUrl url, QByteArray *output, Options options)
@@ -49,7 +49,7 @@ Download::Ptr Download::makeByteArray(QUrl url, QByteArray *output, Options opti
dl->m_url = url;
dl->m_options = options;
dl->m_sink.reset(new ByteArraySink(output));
- return std::shared_ptr<Download>(dl);
+ return dl;
}
Download::Ptr Download::makeFile(QUrl url, QString path, Options options)
@@ -58,7 +58,7 @@ Download::Ptr Download::makeFile(QUrl url, QString path, Options options)
dl->m_url = url;
dl->m_options = options;
dl->m_sink.reset(new FileSink(path));
- return std::shared_ptr<Download>(dl);
+ return dl;
}
void Download::addValidator(Validator * v)
diff --git a/api/logic/net/Download.h b/api/logic/net/Download.h
index 0188a8ae..fdc83d5e 100644
--- a/api/logic/net/Download.h
+++ b/api/logic/net/Download.h
@@ -27,7 +27,7 @@ class MULTIMC_LOGIC_EXPORT Download : public NetAction
Q_OBJECT
public: /* types */
- typedef std::shared_ptr<class Download> Ptr;
+ typedef shared_qobject_ptr<class Download> Ptr;
enum class Option
{
NoOptions = 0,
diff --git a/api/logic/net/NetAction.h b/api/logic/net/NetAction.h
index bbd4a4be..667484d1 100644
--- a/api/logic/net/NetAction.h
+++ b/api/logic/net/NetAction.h
@@ -25,7 +25,7 @@
#include "multimc_logic_export.h"
-typedef std::shared_ptr<class NetAction> NetActionPtr;
+typedef shared_qobject_ptr<class NetAction> NetActionPtr;
class MULTIMC_LOGIC_EXPORT NetAction : public Task
{
Q_OBJECT
diff --git a/api/logic/screenshots/ImgurAlbumCreation.h b/api/logic/screenshots/ImgurAlbumCreation.h
index af5b9a2f..dd398491 100644
--- a/api/logic/screenshots/ImgurAlbumCreation.h
+++ b/api/logic/screenshots/ImgurAlbumCreation.h
@@ -4,7 +4,7 @@
#include "multimc_logic_export.h"
-typedef std::shared_ptr<class ImgurAlbumCreation> ImgurAlbumCreationPtr;
+typedef shared_qobject_ptr<class ImgurAlbumCreation> ImgurAlbumCreationPtr;
class MULTIMC_LOGIC_EXPORT ImgurAlbumCreation : public NetAction
{
public:
diff --git a/api/logic/screenshots/ImgurUpload.h b/api/logic/screenshots/ImgurUpload.h
index 4fcf5233..fed650f0 100644
--- a/api/logic/screenshots/ImgurUpload.h
+++ b/api/logic/screenshots/ImgurUpload.h
@@ -1,10 +1,11 @@
#pragma once
#include "net/NetAction.h"
#include "Screenshot.h"
+#include "QObjectPtr.h"
#include "multimc_logic_export.h"
-typedef std::shared_ptr<class ImgurUpload> ImgurUploadPtr;
+typedef shared_qobject_ptr<class ImgurUpload> ImgurUploadPtr;
class MULTIMC_LOGIC_EXPORT ImgurUpload : public NetAction
{
public:
diff --git a/api/logic/translations/TranslationsModel.cpp b/api/logic/translations/TranslationsModel.cpp
index 868aa98f..bbd4b47d 100644
--- a/api/logic/translations/TranslationsModel.cpp
+++ b/api/logic/translations/TranslationsModel.cpp
@@ -30,7 +30,7 @@ struct TranslationsModel::Private
std::unique_ptr<QTranslator> m_qt_translator;
std::unique_ptr<QTranslator> m_app_translator;
- std::shared_ptr<Net::Download> m_index_task;
+ Net::Download::Ptr m_index_task;
QString m_downloadingTranslation;
NetJobPtr m_dl_job;
NetJobPtr m_index_job;