tsdevicedialog/tsdevicedialogplugin/inc/tsmodel.h
changeset 124 e36b2f4799c0
parent 121 0b3699f6c654
equal deleted inserted replaced
121:0b3699f6c654 124:e36b2f4799c0
    32 {
    32 {
    33     Q_OBJECT
    33     Q_OBJECT
    34 
    34 
    35 public:
    35 public:
    36     TsModel(TsTaskMonitor &applicationSrv,
    36     TsModel(TsTaskMonitor &applicationSrv,
    37             QObject &activitySrv,
       
    38             QObject *parent = 0);
    37             QObject *parent = 0);
    39     ~TsModel();
    38     ~TsModel();
    40 
    39 
    41     int rowCount(const QModelIndex &parent = QModelIndex()) const;
    40     int rowCount(const QModelIndex &parent = QModelIndex()) const;
    42     QVariant data(const QModelIndex &index,
    41     QVariant data(const QModelIndex &index,
    43                   int role = Qt::DisplayRole) const;
    42                   int role = Qt::DisplayRole) const;
    44     int maxRowCount()const;
       
    45     // from QAbstractModel
    43     // from QAbstractModel
    46     virtual bool insertRows(int row, int count, TsModelItem *item,
    44     virtual bool insertRows(int row, int count, TsModelItem *item,
    47                             const QModelIndex &parent = QModelIndex());
    45                             const QModelIndex &parent = QModelIndex());
    48     virtual bool removeRows(int row, int count,
    46     virtual bool removeRows(int row, int count,
    49                             const QModelIndex &parent = QModelIndex());
    47                             const QModelIndex &parent = QModelIndex());
    56 
    54 
    57 public slots:
    55 public slots:
    58     void openApplication(const QModelIndex &index);
    56     void openApplication(const QModelIndex &index);
    59     void closeApplication(const QModelIndex &index);
    57     void closeApplication(const QModelIndex &index);
    60     void updateApplications();
    58     void updateApplications();
    61     void updateActivities();
    59     
    62     void entryChanged(TsModelItem *);
       
    63 private:
    60 private:
    64     TsModelItem *entry(const QModelIndex &index) const;
    61     TsModelItem *entry(const QModelIndex &index) const;
    65     void getApplications();
    62     void getApplications();
    66     void getActivities(bool fullUpdate = true);
       
    67 
    63 
    68 private:
    64 private:
    69     /*
    65     /*
    70      * List containing result
    66      * List containing result
    71      */
    67      */
    72     QList<TsModelItem *> mEntries;
    68     QList<TsModelItem *> mEntries;
    73 
    69 
    74     TsTaskMonitor &mApplicationService;
    70     TsTaskMonitor &mApplicationService;
    75 
    71 
    76     /*
       
    77      * Activity Service
       
    78      */
       
    79     QObject &mActivityService;
       
    80 
       
    81     /*
       
    82      * Maximum number of items (only for running apps + activities)
       
    83      */
       
    84     int mMaxItems;
       
    85     int mActivitiesCount;
       
    86 
       
    87     Q_DISABLE_COPY(TsModel)
    72     Q_DISABLE_COPY(TsModel)
    88 };
    73 };
    89 
    74 
    90 #endif // TSMODEL_H
    75 #endif // TSMODEL_H