on e82ecc9 help sign in
unity8/tests/mocks/Unity/Launcher/MockLauncherItem.cpp
134 lines 2.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"
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(icon),
31 m_pinned(false),
32 m_running(false),
33 m_recent(false),
34 m_progress(8),
35 m_count(8),
36 m_quickList(new MockQuickListModel(this))
41QString MockLauncherItem::appId() const
43 return m_appId;
46QString MockLauncherItem::desktopFile() const
48 return m_desktopFile;
51QString MockLauncherItem::name() const
53 return m_name;
56QString MockLauncherItem::icon() const
58 return m_icon;
61bool MockLauncherItem::pinned() const
63 return m_pinned;
66void MockLauncherItem::setPinned(bool pinned)
68 if (m_pinned != pinned)
69 {
70 m_pinned = pinned;
71 Q_EMIT pinnedChanged(m_pinned);
72 }
75bool MockLauncherItem::running() const
77 return m_running;
80void MockLauncherItem::setRunning(bool running)
82 if (m_running != running)
83 {
84 m_running = running;
85 Q_EMIT runningChanged(running);
86 }
89bool MockLauncherItem::recent() const
91 return m_recent;
94void MockLauncherItem::setRecent(bool recent)
96 if (m_recent != recent)
97 {
98 m_recent = recent;
99 Q_EMIT recentChanged(recent);
100 }
103int MockLauncherItem::progress() const
105 return m_progress;
108void MockLauncherItem::setProgress(int progress)
110 if (m_progress != progress)
111 {
112 m_progress = progress;
113 Q_EMIT progressChanged(progress);
114 }
117int MockLauncherItem::count() const
119 return m_count;
122void MockLauncherItem::setCount(int count)
124 if (m_count != count)
125 {
126 m_count = count;
127 Q_EMIT countChanged(count);
128 }
131unity::shell::launcher::QuickListModelInterface *MockLauncherItem::quickList() const
133 return m_quickList;