summaryrefslogtreecommitdiffstats
path: root/libmultimc/include
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-03-18 23:00:46 +0100
committerPetr Mrázek <peterix@gmail.com>2013-03-18 23:00:46 +0100
commit65faabeed48584c461ca21d784c3f1d46f67f832 (patch)
treee814006279d0c56246e61e5c8f3bd29bc0e1c541 /libmultimc/include
parentb84dfddd1b24e82dccb5a20d9c30570d26846e76 (diff)
downloadMultiMC-65faabeed48584c461ca21d784c3f1d46f67f832.tar
MultiMC-65faabeed48584c461ca21d784c3f1d46f67f832.tar.gz
MultiMC-65faabeed48584c461ca21d784c3f1d46f67f832.tar.lz
MultiMC-65faabeed48584c461ca21d784c3f1d46f67f832.tar.xz
MultiMC-65faabeed48584c461ca21d784c3f1d46f67f832.zip
Connect instance list to model.
Diffstat (limited to 'libmultimc/include')
-rw-r--r--libmultimc/include/instancelist.h41
1 files changed, 34 insertions, 7 deletions
diff --git a/libmultimc/include/instancelist.h b/libmultimc/include/instancelist.h
index d4e7556a..3eef8bdc 100644
--- a/libmultimc/include/instancelist.h
+++ b/libmultimc/include/instancelist.h
@@ -17,16 +17,14 @@
#define INSTANCELIST_H
#include <QObject>
-
#include <QSharedPointer>
-#include "siglist.h"
-
+#include "instance.h"
#include "libmmc_config.h"
class Instance;
-class LIBMULTIMC_EXPORT InstanceList : public QObject, public SigList< QSharedPointer<Instance> >
+class LIBMULTIMC_EXPORT InstanceList : public QObject
{
Q_OBJECT
public:
@@ -46,14 +44,43 @@ public:
QString instDir() const { return m_instDir; }
/*!
- * \brief Loads the instance list.
+ * \brief Loads the instance list. Triggers notifications.
*/
InstListError loadList();
- DEFINE_SIGLIST_SIGNALS(QSharedPointer<Instance>);
- SETUP_SIGLIST_SIGNALS(QSharedPointer<Instance>);
+ /*!
+ * \brief Get the instance at index
+ */
+ InstancePtr at(int i) const
+ {
+ return m_instances.at(i);
+ };
+
+ /*!
+ * \brief Get the count of loaded instances
+ */
+ int count() const
+ {
+ return m_instances.count();
+ };
+
+ /// Clear all instances. Triggers notifications.
+ void clear();
+
+ /// Add an instance. Triggers notifications, returns the new index
+ int add(InstancePtr t);
+
+ /// Get an instance by ID
+ InstancePtr getInstanceById (QString id);
+
+signals:
+ void instanceAdded(int index);
+ void instanceChanged(int index);
+ void invalidated();
+
protected:
QString m_instDir;
+ QList< InstancePtr > m_instances;
};
#endif // INSTANCELIST_H