#ifndef APPLISTMODEL_H #define APPLISTMODEL_H #include #include #include #include #include #include "appmodel.h" class AppListModel : public QAbstractListModel { Q_OBJECT public: AppListModel(QObject* parent = 0); ~AppListModel(); void push_back(uint64_t id, const QString& name); void removeElement(uint64_t id); AppModel* getApp(uint64_t id); void clear(); QVariant data(const QModelIndex &i, int role = Qt::DisplayRole) const; int rowCount(const QModelIndex &parent = QModelIndex()) const; bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); void setConnectable(uint64_t id, bool value); void setConnected(uint64_t id, bool value); void setLaunchable(uint64_t id, bool value); void setLaunched(uint64_t id, bool value); void setEditable(uint64_t id, bool value); void setName(uint64_t id, const QString& name); void setAttribute(uint64_t id, const QString& key, const QString& value); void addCommand(uint64_t id, const QString& key, const QMap& arguments); void removeCommand(uint64_t id, const QString& key); void clearCommands(uint64_t id); void clearLog(uint64_t id); private: typedef QMap Map; typedef QMap IndexHelper; typedef std::deque Index; typedef std::pair Pair; typedef std::list List; Index index; IndexHelper helper; Map map; List toInsert; public slots: void logMessage(uint64_t id, const QString& msg); }; #endif // APPLISTMODEL_H