on 436b607 help sign in
unity8/tests/mocks/Unity/Launcher/MockLauncherItem.cpp
166 lines 3.4 kB history raw
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 */
20#include "MockLauncherItem.h"
21#include "MockQuickListModel.h"
23#include <paths.h>
25using namespace unity::shell::launcher;
27MockLauncherItem::MockLauncherItem(const QString &appId, const QString& desktopFile, const QString& name, const QString& icon, QObject* parent):
28 LauncherItemInterface(parent),
29 m_appId(appId),
30 m_desktopFile(desktopFile),
31 m_name(name),
32 m_icon(qmlDirectory() + "graphics/applicationIcons/" + icon + ".png"),
33 m_pinned(false),
34 m_running(false),
35 m_recent(false),
36 m_progress(-1),
37 m_count(0),
38 m_countVisible(false),
39 m_focused(false),
40 m_quickList(new MockQuickListModel(this))
45QString MockLauncherItem::appId() const
47 return m_appId;
50QString MockLauncherItem::desktopFile() const
52 return m_desktopFile;
55QString MockLauncherItem::name() const
57 return m_name;
60QString MockLauncherItem::icon() const
62 return m_icon;
65bool MockLauncherItem::pinned() const
67 return m_pinned;
70void MockLauncherItem::setPinned(bool pinned)
72 if (m_pinned != pinned)
73 {
74 m_pinned = pinned;
75 Q_EMIT pinnedChanged(m_pinned);
76 }
79bool MockLauncherItem::running() const
81 return m_running;
84void MockLauncherItem::setRunning(bool running)
86 if (m_running != running)
87 {
88 m_running = running;
89 Q_EMIT runningChanged(running);
90 }
93bool MockLauncherItem::recent() const
95 return m_recent;
98void MockLauncherItem::setRecent(bool recent)
100 if (m_recent != recent)
101 {
102 m_recent = recent;
103 Q_EMIT recentChanged(recent);
104 }
107int MockLauncherItem::progress() const
109 return m_progress;
112void MockLauncherItem::setProgress(int progress)
114 if (m_progress != progress)
115 {
116 m_progress = progress;
117 Q_EMIT progressChanged(progress);
118 }
121int MockLauncherItem::count() const
123 return m_count;
126void MockLauncherItem::setCount(int count)
128 if (m_count != count)
129 {
130 m_count = count;
131 Q_EMIT countChanged(count);
132 }
135bool MockLauncherItem::countVisible() const
137 return m_countVisible;
140void MockLauncherItem::setCountVisible(bool countVisible)
142 if (m_countVisible != countVisible) {
143 m_countVisible = countVisible;
144 Q_EMIT countVisibleChanged(countVisible);
145 }
148bool MockLauncherItem::focused() const
150 return m_focused;
153void MockLauncherItem::setFocused(bool focused)
155 if (m_focused != focused)
156 {
157 m_focused = focused;
158 Q_EMIT focusedChanged(focused);
159 }
163unity::shell::launcher::QuickListModelInterface *MockLauncherItem::quickList() const
165 return m_quickList;