on af18ef9 help sign in
unity8/tests/mocks/Unity/Launcher/MockLauncherItem.cpp
182 lines 3.7 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>
24#include <iostream>
26using namespace unity::shell::launcher;
28MockLauncherItem::MockLauncherItem(const QString &appId, const QString& desktopFile, const QString& name, const QString& icon, QObject* parent):
29 LauncherItemInterface(parent),
30 m_appId(appId),
31 m_desktopFile(desktopFile),
32 m_name(name),
33 m_icon(qmlDirectory() + "graphics/applicationIcons/" + icon + ".png"),
34 m_pinned(false),
35 m_running(false),
36 m_recent(false),
37 m_progress(-1),
38 m_count(0),
39 m_countVisible(false),
40 m_focused(false),
41 m_alerting(false),
42 m_quickList(new MockQuickListModel(this))
47QString MockLauncherItem::appId() const
49 return m_appId;
52QString MockLauncherItem::desktopFile() const
54 return m_desktopFile;
57QString MockLauncherItem::name() const
59 return m_name;
62QString MockLauncherItem::icon() const
64 return m_icon;
67bool MockLauncherItem::pinned() const
69 return m_pinned;
72void MockLauncherItem::setPinned(bool pinned)
74 if (m_pinned != pinned)
75 {
76 m_pinned = pinned;
77 Q_EMIT pinnedChanged(m_pinned);
78 }
81bool MockLauncherItem::running() const
83 return m_running;
86void MockLauncherItem::setRunning(bool running)
88 if (m_running != running)
89 {
90 m_running = running;
91 Q_EMIT runningChanged(running);
92 }
95bool MockLauncherItem::recent() const
97 return m_recent;
100void MockLauncherItem::setRecent(bool recent)
102 if (m_recent != recent)
103 {
104 m_recent = recent;
105 Q_EMIT recentChanged(recent);
106 }
109int MockLauncherItem::progress() const
111 return m_progress;
114void MockLauncherItem::setProgress(int progress)
116 if (m_progress != progress)
117 {
118 m_progress = progress;
119 Q_EMIT progressChanged(progress);
120 }
123int MockLauncherItem::count() const
125 return m_count;
128void MockLauncherItem::setCount(int count)
130 if (m_count != count)
131 {
132 m_count = count;
133 Q_EMIT countChanged(count);
134 }
137bool MockLauncherItem::countVisible() const
139 return m_countVisible;
142void MockLauncherItem::setCountVisible(bool countVisible)
144 if (m_countVisible != countVisible) {
145 m_countVisible = countVisible;
146 Q_EMIT countVisibleChanged(countVisible);
147 }
150bool MockLauncherItem::focused() const
152 return m_focused;
155void MockLauncherItem::setFocused(bool focused)
157 if (m_focused != focused)
158 {
159 m_focused = focused;
160 Q_EMIT focusedChanged(focused);
161 }
164bool MockLauncherItem::alerting() const
166 return m_alerting;
169void MockLauncherItem::setAlerting(bool alerting)
171 if (m_alerting != alerting)
172 {
173 std::cout << "MockLauncherItem::setAlerting()" << std::endl;
174 m_alerting = alerting;
175 Q_EMIT alertingChanged(alerting);
176 }
179unity::shell::launcher::QuickListModelInterface *MockLauncherItem::quickList() const
181 return m_quickList;