~ps-jenkins/qtubuntu/latestsnapshot-0.52+13.10.20130912.1-0ubuntu1

« back to all changes in this revision

Viewing changes to src/modules/application/application_list_model.h

  • Committer: Tarmac
  • Author(s): Gerry Boland
  • Date: 2013-09-10 13:12:34 UTC
  • mfrom: (170.2.15 using-new-api)
  • Revision ID: tarmac-20130910131234-bzowv55avwej97i5
Implement ApplicationManager API as defined in unity-api. This requires renaming QML plugin to Unity.Application, removing the ApplicationListModel class and supplying just one model of applications running.

Approved by PS Jenkins bot, Daniel d'Andrada.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// This file is part of QtUbuntu, a set of Qt components for Ubuntu.
2
 
// Copyright © 2013 Canonical Ltd.
3
 
//
4
 
// This program is free software: you can redistribute it and/or modify it under
5
 
// the terms of the GNU Lesser General Public License version 3, as published by
6
 
// the Free Software Foundation.
7
 
//
8
 
// This program is distributed in the hope that it will be useful, but WITHOUT
9
 
// ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10
 
// SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
 
// Lesser General Public License for more details.
12
 
//
13
 
// You should have received a copy of the GNU Lesser General Public License
14
 
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
 
16
 
#ifndef APPLICATION_LIST_MODEL_H
17
 
#define APPLICATION_LIST_MODEL_H
18
 
 
19
 
#include <QtCore/QAbstractListModel>
20
 
 
21
 
class Application;
22
 
 
23
 
class ApplicationListModel : public QAbstractListModel {
24
 
  Q_OBJECT
25
 
 
26
 
  Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
27
 
 
28
 
 public:
29
 
  explicit ApplicationListModel(QObject* parent = 0);
30
 
  ~ApplicationListModel();
31
 
 
32
 
  // QAbstractItemModel methods.
33
 
  int rowCount(const QModelIndex& parent = QModelIndex()) const;
34
 
  QVariant data(const QModelIndex& index, int role) const;
35
 
  QHash<int,QByteArray> roleNames() const { return roleNames_; }
36
 
  Q_INVOKABLE QVariant get(int index) const;
37
 
  Q_INVOKABLE void move(int from, int to);
38
 
 
39
 
 Q_SIGNALS:
40
 
  void countChanged();
41
 
 
42
 
 private:
43
 
  Q_DISABLE_COPY(ApplicationListModel)
44
 
 
45
 
  void add(Application* application);
46
 
  void remove(Application* application);
47
 
  Application* findFromTimerId(int timerId);
48
 
#if !defined(QT_NO_DEBUG)
49
 
  bool contains(Application* application) const { return applications_.contains(application); }
50
 
#endif
51
 
 
52
 
  QHash<int,QByteArray> roleNames_;
53
 
  QList<Application*> applications_;
54
 
 
55
 
  friend class ApplicationManager;
56
 
};
57
 
 
58
 
Q_DECLARE_METATYPE(ApplicationListModel*)
59
 
 
60
 
#endif  // APPLICATION_LIST_MODEL_H