2 * Copyright (C) 2013 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
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 General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 * Author: Nick Dedekind <nick.dedekind@canonical.com>
20#include "fake_scopes.h"
22// TODO: Implement remaining pieces, like Categories (i.e. LensView now gives warnings)
27Scopes::Scopes(QObject *parent)
28 : unity::shell::scopes::ScopesInterface(parent)
32 timer.setSingleShot(true);
33 timer.setInterval(100);
34 QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(updateScopes()));
42void Scopes::updateScopes()
45 addScope(new Scope("MockScope1", "People", true, this));
46 addScope(new Scope("MockScope2", "Music", false, this));
47 addScope(new Scope("clickscope", "Apps", true, this));
48 addScope(new Scope("MockScope5", "Videos", true, this));
49 addScope(new Scope("SingleCategoryScope", "Single", true, this, 1));
53 Q_EMIT loadedChanged();
60 if (m_scopes.size() > 0) {
61 beginRemoveRows(QModelIndex(), 0, m_scopes.count()-1);
69 Q_EMIT loadedChanged();
78int Scopes::rowCount(const QModelIndex&) const
80 return m_scopes.count();
83QVariant Scopes::data(const QModelIndex& index, int role) const
85 if (!index.isValid() || index.row() >= m_scopes.size()) {
89 Scope* scope = m_scopes.at(index.row());
91 if (role == Scopes::RoleScope) {
92 return QVariant::fromValue(scope);
93 } else if (role == Scopes::RoleId) {
94 return QVariant::fromValue(scope->id());
95 } else if (role == Scopes::RoleVisible) {
96 return QVariant::fromValue(scope->visible());
97 } else if (role == Scopes::RoleTitle) {
98 return QVariant::fromValue(scope->name());
104unity::shell::scopes::ScopeInterface* Scopes::getScope(int row) const
106 if (row < 0 || row >= m_scopes.size()) {
110 return m_scopes[row];
113unity::shell::scopes::ScopeInterface* Scopes::getScope(QString const&) const
118QModelIndex Scopes::parent(const QModelIndex&) const
120 return QModelIndex();
123bool Scopes::loaded() const
128void Scopes::addScope(Scope* scope)
130 int index = rowCount();
131 beginInsertRows(QModelIndex(), index, index);
132 m_scopes.append(scope);
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list