2 * Copyright (C) 2015 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/>.
18#include <unity/shell/application/ApplicationManagerInterface.h>
19#include <unity/shell/application/ApplicationInfoInterface.h>
21#include "applicationsfiltermodel.h"
23using namespace unity::shell::application;
25ApplicationsFilterModel::ApplicationsFilterModel(QObject *parent):
26 QSortFilterProxyModel(parent),
28 m_filterTouchApps(false),
29 m_filterLegacyApps(false)
33ApplicationManagerInterface *ApplicationsFilterModel::applicationsModel() const
38void ApplicationsFilterModel::setApplicationsModel(ApplicationManagerInterface *applicationsModel)
40 if (m_appModel != applicationsModel) {
42 disconnect(m_appModel, &ApplicationManagerInterface::countChanged, this, &ApplicationsFilterModel::countChanged);
44 m_appModel = applicationsModel;
45 setSourceModel(m_appModel);
46 Q_EMIT applicationsModelChanged();
47 connect(m_appModel, &ApplicationManagerInterface::countChanged, this, &ApplicationsFilterModel::countChanged);
51bool ApplicationsFilterModel::filterTouchApps() const
53 return m_filterTouchApps;
56void ApplicationsFilterModel::setFilterTouchApps(bool filterTouchApps)
58 if (m_filterTouchApps != filterTouchApps) {
59 m_filterTouchApps = filterTouchApps;
60 Q_EMIT filterTouchAppsChanged();
63 Q_EMIT countChanged();
67bool ApplicationsFilterModel::filterLegacyApps() const
69 return m_filterLegacyApps;
72void ApplicationsFilterModel::setFilterLegacyApps(bool filterLegacyApps)
74 if (m_filterLegacyApps != filterLegacyApps) {
75 m_filterLegacyApps = filterLegacyApps;
76 Q_EMIT filterLegacyAppsChanged();
79 Q_EMIT countChanged();
83bool ApplicationsFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
85 Q_UNUSED(source_parent);
87 ApplicationInfoInterface *app = m_appModel->get(source_row);
89 if (m_filterLegacyApps && !app->isTouchApp()) {
92 if (m_filterTouchApps && app->isTouchApp()) {
98ApplicationInfoInterface *ApplicationsFilterModel::get(int index) const
100 return m_appModel->get(mapToSource(this->index(index, 0)).row());
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