diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-08-18 20:52:17 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-08-18 20:52:17 +0200 |
commit | c92ad7dcf86f2e5e71d71a68e24e79fbdeceb56d (patch) | |
tree | 7be301a5123e216a41646f9639ec887609497a87 /logic/ModList.h | |
parent | 253067c782955380bbf66ac0475dc954375b1ff4 (diff) | |
download | MultiMC-c92ad7dcf86f2e5e71d71a68e24e79fbdeceb56d.tar MultiMC-c92ad7dcf86f2e5e71d71a68e24e79fbdeceb56d.tar.gz MultiMC-c92ad7dcf86f2e5e71d71a68e24e79fbdeceb56d.tar.lz MultiMC-c92ad7dcf86f2e5e71d71a68e24e79fbdeceb56d.tar.xz MultiMC-c92ad7dcf86f2e5e71d71a68e24e79fbdeceb56d.zip |
Drag and Drop, mod management.
Diffstat (limited to 'logic/ModList.h')
-rw-r--r-- | logic/ModList.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/logic/ModList.h b/logic/ModList.h index 41d26491..0e172efd 100644 --- a/logic/ModList.h +++ b/logic/ModList.h @@ -26,7 +26,7 @@ class ModList : public QAbstractListModel { Q_OBJECT public: - ModList(const QString& dir, const QString& list_file); + ModList(const QString& dir, const QString& list_file = QString()); virtual QVariant data ( const QModelIndex& index, int role = Qt::DisplayRole ) const; virtual int rowCount ( const QModelIndex& parent = QModelIndex() ) const @@ -56,12 +56,34 @@ public: */ virtual bool moveMod(size_t from, size_t to); + /// flags, mostly to support drag&drop + virtual Qt::ItemFlags flags(const QModelIndex& index) const; + /// get data for drag action + virtual QMimeData* mimeData(const QModelIndexList& indexes) const; + /// get the supported mime types + virtual QStringList mimeTypes() const; + /// process data from drop action + virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent); + /// what drag actions do we support? + virtual Qt::DropActions supportedDragActions() const; + /// what drop actions do we support? + virtual Qt::DropActions supportedDropActions() const; + virtual bool isValid(); + QDir dir() + { + return m_dir; + } +private: + QStringList readListFile(); + bool saveListFile(); + signals: void changed(); protected: QDir m_dir; QString m_list_file; + QString m_list_id; QList<Mod> mods; }; |