on e700c19 help sign in
unity8/tests/mocks/Unity/Launcher/MockLauncherItem.cpp
152 lines 3.1 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_focused(false),
39 m_quickList(new MockQuickListModel(this))
44QString MockLauncherItem::appId() const
46 return m_appId;
49QString MockLauncherItem::desktopFile() const
51 return m_desktopFile;
54QString MockLauncherItem::name() const
56 return m_name;
59QString MockLauncherItem::icon() const
61 return m_icon;
64bool MockLauncherItem::pinned() const
66 return m_pinned;
69void MockLauncherItem::setPinned(bool pinned)
71 if (m_pinned != pinned)
72 {
73 m_pinned = pinned;
74 Q_EMIT pinnedChanged(m_pinned);
75 }
78bool MockLauncherItem::running() const
80 return m_running;
83void MockLauncherItem::setRunning(bool running)
85 if (m_running != running)
86 {
87 m_running = running;
88 Q_EMIT runningChanged(running);
89 }
92bool MockLauncherItem::recent() const
94 return m_recent;
97void MockLauncherItem::setRecent(bool recent)
99 if (m_recent != recent)
100 {
101 m_recent = recent;
102 Q_EMIT recentChanged(recent);
103 }
106int MockLauncherItem::progress() const
108 return m_progress;
111void MockLauncherItem::setProgress(int progress)
113 if (m_progress != progress)
114 {
115 m_progress = progress;
116 Q_EMIT progressChanged(progress);
117 }
120int MockLauncherItem::count() const
122 return m_count;
125void MockLauncherItem::setCount(int count)
127 if (m_count != count)
128 {
129 m_count = count;
130 Q_EMIT countChanged(count);
131 }
134bool MockLauncherItem::focused() const
136 return m_focused;
139void MockLauncherItem::setFocused(bool focused)
141 if (m_focused != focused)
142 {
143 m_focused = focused;
144 Q_EMIT focusedChanged(focused);
145 }
149unity::shell::launcher::QuickListModelInterface *MockLauncherItem::quickList() const
151 return m_quickList;