Loading...
Searching...
No Matches
CategoriesInterface.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_CATEGORESINTERFACE_H
#define UNITY_SHELL_SCOPES_CATEGORESINTERFACE_H
#include <unity/SymbolExport.h>
#include <QAbstractListModel>
namespace unity
{
namespace shell
{
namespace scopes
{
class UNITY_API CategoriesInterface : public QAbstractListModel
{
Q_OBJECT
protected:
explicit CategoriesInterface(QObject* parent = 0) : QAbstractListModel(parent) { }
public:
enum Roles {
RoleCategoryId,
RoleName,
RoleIcon,
RoleRawRendererTemplate,
RoleRenderer,
RoleComponents,
RoleHeaderLink,
RoleResults,
RoleCount
};
Q_ENUM(Roles)
Q_INVOKABLE virtual bool overrideCategoryJson(QString const& categoryId, QString const& json) = 0;
// @cond
QHash<int, QByteArray> roleNames() const override
{
QHash<int, QByteArray> roles;
roles[RoleCategoryId] = "categoryId";
roles[RoleName] = "name";
roles[RoleIcon] = "icon";
roles[RoleRawRendererTemplate] = "rawRendererTemplate";
roles[RoleRenderer] = "renderer";
roles[RoleComponents] = "components";
roles[RoleHeaderLink] = "headerLink";
roles[RoleResults] = "results";
roles[RoleCount] = "count";
return roles;
}
// @endcond
};
}
}
}
Q_DECLARE_METATYPE(unity::shell::scopes::CategoriesInterface*)
#endif
unity::shell::scopes::CategoriesInterface
A list of categories for a particular search.
Definition CategoriesInterface.h:38
unity::shell::scopes::CategoriesInterface::Roles
Roles
The roles supported by this model.
Definition CategoriesInterface.h:50
unity::shell::scopes::CategoriesInterface::overrideCategoryJson
virtual Q_INVOKABLE bool overrideCategoryJson(QString const &categoryId, QString const &json)=0
Override definition of a category by passing a custom JSON string.
unity
Top-level namespace for all things Unity-related.
Definition Version.h:38