Unity 8
launcheritem.h
1 /*
2  * Copyright 2013 Canonical Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation; version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU 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  * Authors:
17  * Michael Zanetti <michael.zanetti@canonical.com>
18  */
19 
20 #ifndef LAUNCHERITEM_H
21 #define LAUNCHERITEM_H
22 
23 #include "quicklistmodel.h"
24 
25 #include <unity/shell/launcher/LauncherItemInterface.h>
26 #include <unity/shell/application/MirSurfaceInterface.h>
27 
28 class QuickListModel;
29 
30 using namespace unity::shell::launcher;
31 
32 class LauncherItem: public LauncherItemInterface
33 {
34  Q_OBJECT
35 public:
36  LauncherItem(const QString &appId, const QString &name, const QString &icon, QObject *parent);
37 
38  QString appId() const override;
39  QString name() const override;
40  QString icon() const override;
41  QStringList keywords() const override;
42  bool pinned() const override;
43  bool running() const override;
44  bool recent() const override;
45  int progress() const override;
46  int count() const override;
47  bool countVisible() const override;
48  bool focused() const override;
49  bool alerting() const override;
50  int surfaceCount() const override;
51 
52  unity::shell::launcher::QuickListModelInterface *quickList() const override;
53 
54 private:
55  void setName(const QString &name);
56  void setIcon(const QString &icon);
57  void setKeywords(const QStringList &keywords);
58  void setPinned(bool pinned);
59  void setRunning(bool running);
60  void setRecent(bool recent);
61  void setProgress(int progress);
62  void setCount(int count);
63  void setCountVisible(bool countVisible);
64  void setFocused(bool focused);
65  void setAlerting(bool alerting);
66  void setSurfaces(const QList<QPair<QString, QString >> &surfaces);
67 
68 private:
69  QString m_appId;
70  QString m_name;
71  QString m_icon;
72  QStringList m_keywords;
73  bool m_pinned;
74  bool m_running;
75  bool m_recent;
76  int m_progress;
77  int m_count;
78  bool m_countVisible;
79  bool m_focused;
80  bool m_alerting;
81  QList<QPair<QString, QString> > m_surfaces;
82  QuickListModel *m_quickList;
83  QuickListEntry m_quitAction;
84 
85  friend class LauncherModel;
86  friend class AppDrawerModel;
87 };
88 
89 #endif // LAUNCHERITEM_H