diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-06-22 23:34:33 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-06-22 23:34:33 +0200 |
commit | 929698ff15bdd44a5bd8d8b5c1e13be9c55a1cac (patch) | |
tree | 0539b50931ef14776ac1fea44d7d5e8d5a8f5dee /libmultimc/include | |
parent | 3b38e5f92496cb932d14c9a4492292b057d2f431 (diff) | |
download | MultiMC-929698ff15bdd44a5bd8d8b5c1e13be9c55a1cac.tar MultiMC-929698ff15bdd44a5bd8d8b5c1e13be9c55a1cac.tar.gz MultiMC-929698ff15bdd44a5bd8d8b5c1e13be9c55a1cac.tar.lz MultiMC-929698ff15bdd44a5bd8d8b5c1e13be9c55a1cac.tar.xz MultiMC-929698ff15bdd44a5bd8d8b5c1e13be9c55a1cac.zip |
Use shared pointers to fix incompatibility with new Qt
Diffstat (limited to 'libmultimc/include')
-rw-r--r-- | libmultimc/include/gameupdatetask.h | 14 | ||||
-rw-r--r-- | libmultimc/include/lwjglversionlist.h | 22 |
2 files changed, 24 insertions, 12 deletions
diff --git a/libmultimc/include/gameupdatetask.h b/libmultimc/include/gameupdatetask.h index 47f6c007..63d11113 100644 --- a/libmultimc/include/gameupdatetask.h +++ b/libmultimc/include/gameupdatetask.h @@ -28,6 +28,8 @@ #include "instance.h" #include "libmmc_config.h" +class FileToDownload; +typedef QSharedPointer<FileToDownload> PtrFileToDownload; class FileToDownload : public QObject { @@ -43,9 +45,11 @@ class FileToDownload : public QObject * This path is relative to the instance's root directory. */ Q_PROPERTY(QString path READ path WRITE setPath) -public: + +private: FileToDownload(const QUrl &url, const QString &path, QObject *parent = 0); - FileToDownload(const FileToDownload &other); +public: + static PtrFileToDownload Create(const QUrl &url, const QString &path, QObject *parent = 0); virtual QUrl url() const { return m_dlURL; } virtual void setURL(const QUrl &url) { m_dlURL = url; } @@ -58,6 +62,8 @@ private: QString m_dlPath; }; + + /*! * The game update task is the task that handles downloading instances' files. */ @@ -86,7 +92,7 @@ public: virtual void executeTask(); - virtual bool downloadFile(const FileToDownload &file); + virtual bool downloadFile(const PtrFileToDownload file); ////////////////////// @@ -149,7 +155,7 @@ private: //////////////////////// // List of URLs that the game updater will need to download. - QList<FileToDownload> m_downloadList; + QList<PtrFileToDownload> m_downloadList; int m_currentDownload; diff --git a/libmultimc/include/lwjglversionlist.h b/libmultimc/include/lwjglversionlist.h index 700c93d4..25b5c4c3 100644 --- a/libmultimc/include/lwjglversionlist.h +++ b/libmultimc/include/lwjglversionlist.h @@ -18,7 +18,7 @@ #include <QObject> #include <QAbstractListModel> - +#include <QSharedPointer> #include <QUrl> #include <QNetworkAccessManager> @@ -26,6 +26,9 @@ #include "libmmc_config.h" +class LWJGLVersion; +typedef QSharedPointer<LWJGLVersion> PtrLWJGLVersion; + class LIBMULTIMC_EXPORT LWJGLVersion : public QObject { Q_OBJECT @@ -39,12 +42,15 @@ class LIBMULTIMC_EXPORT LWJGLVersion : public QObject * The URL for this version of LWJGL. */ Q_PROPERTY(QUrl url READ url) -public: + LWJGLVersion(const QString &name, const QUrl &url, QObject *parent = 0) : QObject(parent), m_name(name), m_url(url) { } +public: - LWJGLVersion(const LWJGLVersion &other) : - QObject(other.parent()), m_name(other.name()), m_url(other.url()) { } + static PtrLWJGLVersion Create(const QString &name, const QUrl &url, QObject *parent = 0) + { + return PtrLWJGLVersion(new LWJGLVersion(name, url, parent)); + }; QString name() const { return m_name; } @@ -65,9 +71,9 @@ public: bool isLoaded() { return m_vlist.length() > 0; } - const LWJGLVersion *getVersion(const QString &versionName); - LWJGLVersion &at(int index) { return m_vlist[index]; } - const LWJGLVersion &at(int index) const { return m_vlist[index]; } + const PtrLWJGLVersion getVersion(const QString &versionName); + PtrLWJGLVersion at(int index) { return m_vlist[index]; } + const PtrLWJGLVersion at(int index) const { return m_vlist[index]; } int count() const { return m_vlist.length(); } @@ -104,7 +110,7 @@ signals: void loadListFailed(QString msg); private: - QList<LWJGLVersion> m_vlist; + QList<PtrLWJGLVersion> m_vlist; QNetworkReply *m_netReply; |