Loading...
Searching...
No Matches
NavigationInterface.h
/*
* Copyright (C) 2014 Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UNITY_SHELL_SCOPES_NAVIGATIONINTERFACE_H
#define UNITY_SHELL_SCOPES_NAVIGATIONINTERFACE_H
#include <unity/SymbolExport.h>
#include <QAbstractListModel>
namespace unity
{
namespace shell
{
namespace scopes
{
class UNITY_API NavigationInterface : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(QString navigationId READ navigationId NOTIFY navigationIdChanged)
Q_PROPERTY(QString label READ label NOTIFY labelChanged)
Q_PROPERTY(QString allLabel READ allLabel NOTIFY allLabelChanged)
Q_PROPERTY(QString parentNavigationId READ parentNavigationId NOTIFY parentNavigationIdChanged)
Q_PROPERTY(QString parentLabel READ parentLabel NOTIFY parentLabelChanged)
Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)
Q_PROPERTY(bool isRoot READ isRoot NOTIFY isRootChanged)
Q_PROPERTY(bool hidden READ hidden NOTIFY hiddenChanged)
Q_PROPERTY(int count READ count NOTIFY countChanged)
protected:
explicit NavigationInterface(QObject* parent = 0) : QAbstractListModel(parent) { }
public:
enum Roles {
RoleNavigationId,
RoleLabel,
RoleAllLabel,
RoleHasChildren,
RoleIsActive
};
Q_ENUM(Roles)
// @cond
virtual QString navigationId() const = 0;
virtual QString label() const = 0;
virtual QString allLabel() const = 0;
virtual QString parentNavigationId() const = 0;
virtual QString parentLabel() const = 0;
virtual bool loaded() const = 0;
virtual bool isRoot() const = 0;
virtual bool hidden() const = 0;
virtual int count() const = 0;
QHash<int, QByteArray> roleNames() const override
{
QHash<int, QByteArray> roles;
roles[RoleNavigationId] = "navigationId";
roles[RoleLabel] = "label";
roles[RoleAllLabel] = "allLabel";
roles[RoleHasChildren] = "hasChildren";
roles[RoleIsActive] = "isActive";
return roles;
}
// @endcond
Q_SIGNALS:
// @cond
void navigationIdChanged();
void labelChanged();
void allLabelChanged();
void parentNavigationIdChanged();
void parentLabelChanged();
void loadedChanged();
void isRootChanged();
void hiddenChanged();
void countChanged();
// @endcond
};
}
}
}
Q_DECLARE_METATYPE(unity::shell::scopes::NavigationInterface*)
#endif
unity
Top-level namespace for all things Unity-related.
Definition Version.h:38