summaryrefslogtreecommitdiff
path: root/src/modlist.h
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2014-04-05 15:36:42 +0200
committerTannin <devnull@localhost>2014-04-05 15:36:42 +0200
commitcabed9b268c9f095d5e3b98a6797b0bcdcd38b1f (patch)
tree454b03b0c5664e90fe586e7b39603e34a526d35b /src/modlist.h
parent98e5e57a845541acddf519a81957261f58008cb9 (diff)
parentc017f4a0d50b67a44e276bd5ae8929ed3990c62c (diff)
Merge with branch1.1
Diffstat (limited to 'src/modlist.h')
-rw-r--r--src/modlist.h46
1 files changed, 44 insertions, 2 deletions
diff --git a/src/modlist.h b/src/modlist.h
index 069de40b..cc5955d0 100644
--- a/src/modlist.h
+++ b/src/modlist.h
@@ -26,11 +26,13 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "modinfo.h"
#include "profile.h"
+#include <imodlist.h>
+
#include <QFile>
#include <QListWidget>
#include <QNetworkReply>
#include <QNetworkAccessManager>
-
+#include <boost/signals2.hpp>
#include <set>
#include <vector>
#include <QVector>
@@ -41,7 +43,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
* This is used in a view in the main window of MO. It combines general information about
* the mods from ModInfo with status information from the Profile
**/
-class ModList : public QAbstractItemModel
+class ModList : public QAbstractItemModel, public MOBase::IModList
{
Q_OBJECT
@@ -59,6 +61,8 @@ public:
COL_LASTCOLUMN = COL_PRIORITY
};
+ typedef boost::signals2::signal<void (const QString &, ModStates)> SignalModStateChanged;
+
public:
/**
@@ -92,6 +96,23 @@ public:
void changeModPriority(int sourceIndex, int newPriority);
+ void modInfoAboutToChange(ModInfo::Ptr info);
+ void modInfoChanged(ModInfo::Ptr info);
+
+public:
+
+ /// \copydoc MOBase::IModList::state
+ virtual ModStates state(const QString &name) const;
+
+ /// \copydoc MOBase::IModList::priority
+ virtual int priority(const QString &name) const;
+
+ /// \copydoc MOBase::IModList::setPriority
+ virtual bool setPriority(const QString &name, int newPriority);
+
+ /// \copydoc MOBase::IModList::onModStateChanged
+ virtual bool onModStateChanged(const std::function<void (const QString &, ModStates)> &func);
+
public: // implementation of virtual functions of QAbstractItemModel
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
@@ -182,6 +203,14 @@ signals:
*/
void removeSelectedMods();
+ /**
+ * @brief fileMoved emitted when a file is moved from one mod to another
+ * @param relativePath relative path of the file moved
+ * @param oldOriginName name of the origin that previously contained the file
+ * @param newOriginName name of the origin that now contains the file
+ */
+ void fileMoved(const QString &relativePath, const QString &oldOriginName, const QString &newOriginName);
+
protected:
// event filter, handles event from the header and the tree view itself
@@ -224,6 +253,11 @@ private:
unsigned int categoryOrder;
};
+ struct TModInfoChange {
+ QString name;
+ QFlags<IModList::ModStates> state;
+ };
+
private:
Profile *m_Profile;
@@ -237,6 +271,14 @@ private:
bool m_DropOnItems;
+ TModInfoChange m_ChangeInfo;
+
+ SignalModStateChanged m_ModStateChanged;
+
+
+ // QAbstractItemModel interface
+
+ // IModList interface
};
#endif // MODLIST_H