on 551c708 help sign in
unity8/tests/mocks/Unity/Launcher/MockLauncherItem.cpp
150 lines 3.0 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"
23using namespace unity::shell::launcher;
25MockLauncherItem::MockLauncherItem(const QString &appId, const QString& desktopFile, const QString& name, const QString& icon, QObject* parent):
26 LauncherItemInterface(parent),
27 m_appId(appId),
28 m_desktopFile(desktopFile),
29 m_name(name),
30 m_icon(TOP_SRCDIR "/graphics/applicationIcons/" + icon + ".png"),
31 m_pinned(false),
32 m_running(false),
33 m_recent(false),
34 m_progress(-1),
35 m_count(0),
36 m_focused(false),
37 m_quickList(new MockQuickListModel(this))
42QString MockLauncherItem::appId() const
44 return m_appId;
47QString MockLauncherItem::desktopFile() const
49 return m_desktopFile;
52QString MockLauncherItem::name() const
54 return m_name;
57QString MockLauncherItem::icon() const
59 return m_icon;
62bool MockLauncherItem::pinned() const
64 return m_pinned;
67void MockLauncherItem::setPinned(bool pinned)
69 if (m_pinned != pinned)
70 {
71 m_pinned = pinned;
72 Q_EMIT pinnedChanged(m_pinned);
73 }
76bool MockLauncherItem::running() const
78 return m_running;
81void MockLauncherItem::setRunning(bool running)
83 if (m_running != running)
84 {
85 m_running = running;
86 Q_EMIT runningChanged(running);
87 }
90bool MockLauncherItem::recent() const
92 return m_recent;
95void MockLauncherItem::setRecent(bool recent)
97 if (m_recent != recent)
98 {
99 m_recent = recent;
100 Q_EMIT recentChanged(recent);
101 }
104int MockLauncherItem::progress() const
106 return m_progress;
109void MockLauncherItem::setProgress(int progress)
111 if (m_progress != progress)
112 {
113 m_progress = progress;
114 Q_EMIT progressChanged(progress);
115 }
118int MockLauncherItem::count() const
120 return m_count;
123void MockLauncherItem::setCount(int count)
125 if (m_count != count)
126 {
127 m_count = count;
128 Q_EMIT countChanged(count);
129 }
132bool MockLauncherItem::focused() const
134 return m_focused;
137void MockLauncherItem::setFocused(bool focused)
139 if (m_focused != focused)
140 {
141 m_focused = focused;
142 Q_EMIT focusedChanged(focused);
143 }
147unity::shell::launcher::QuickListModelInterface *MockLauncherItem::quickList() const
149 return m_quickList;