diff options
author | Orochimarufan <orochimarufan.x3@gmail.com> | 2013-03-22 14:01:54 +0100 |
---|---|---|
committer | Orochimarufan <orochimarufan.x3@gmail.com> | 2013-03-22 14:01:54 +0100 |
commit | cd1fdbbbc2953c5e34d8c0ae6861bec4a7f6532e (patch) | |
tree | a4148d6bb1704e635807c37b36013e9a33820a80 /libmultimc/include/instancelist.h | |
parent | f4c9cb8c1d395422b7e4f1c27ac92b6df08a39bb (diff) | |
parent | e4806ab08d0293d395c1718ab16d28ba2ae9d0ed (diff) | |
download | PrismLauncher-cd1fdbbbc2953c5e34d8c0ae6861bec4a7f6532e.tar.gz PrismLauncher-cd1fdbbbc2953c5e34d8c0ae6861bec4a7f6532e.tar.bz2 PrismLauncher-cd1fdbbbc2953c5e34d8c0ae6861bec4a7f6532e.zip |
Merge branch 'master' of http://github.com/peterix/MultiMC5
Conflicts:
CMakeLists.txt
main.cpp
Diffstat (limited to 'libmultimc/include/instancelist.h')
-rw-r--r-- | libmultimc/include/instancelist.h | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/libmultimc/include/instancelist.h b/libmultimc/include/instancelist.h index d4e7556a..a0d8788a 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,46 @@ 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(); + +private slots: + void propertiesChanged(Instance * inst); + protected: QString m_instDir; + QList< InstancePtr > m_instances; }; #endif // INSTANCELIST_H |