Loading...
Searching...
No Matches
ResultsModelInterface.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_RESULTSMODELINTERFACE_H
#define UNITY_SHELL_SCOPES_RESULTSMODELINTERFACE_H
#include <unity/SymbolExport.h>
#include <QAbstractListModel>
namespace unity
{
namespace shell
{
namespace scopes
{
class UNITY_API ResultsModelInterface : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(QString categoryId READ categoryId WRITE setCategoryId NOTIFY categoryIdChanged)
Q_PROPERTY(int count READ count NOTIFY countChanged)
protected:
explicit ResultsModelInterface(QObject* parent = 0) : QAbstractListModel(parent) { }
public:
enum Roles {
RoleUri,
RoleCategoryId,
RoleDndUri,
RoleResult,
// card components
RoleTitle,
RoleArt,
RoleSubtitle,
RoleMascot,
RoleEmblem,
RoleSummary,
RoleAttributes,
RoleBackground,
RoleOverlayColor,
RoleQuickPreviewData,
RoleSocialActions
};
Q_ENUM(Roles)
// @cond
virtual QString categoryId() const = 0;
virtual int count() const = 0;
virtual void setCategoryId(QString const& id) = 0;
QHash<int, QByteArray> roleNames() const override
{
QHash<int, QByteArray> roles;
roles[RoleUri] = "uri";
roles[RoleCategoryId] = "categoryId";
roles[RoleDndUri] = "dndUri";
roles[RoleQuickPreviewData] = "quickPreviewData";
roles[RoleResult] = "result";
roles[RoleTitle] = "title";
roles[RoleArt] = "art";
roles[RoleSubtitle] = "subtitle";
roles[RoleMascot] = "mascot";
roles[RoleEmblem] = "emblem";
roles[RoleSummary] = "summary";
roles[RoleAttributes] = "attributes";
roles[RoleBackground] = "background";
roles[RoleOverlayColor] = "overlayColor";
roles[RoleSocialActions] = "socialActions";
return roles;
}
// @endcond
Q_SIGNALS:
// @cond
void categoryIdChanged();
void countChanged();
// @endcond
};
}
}
}
Q_DECLARE_METATYPE(unity::shell::scopes::ResultsModelInterface*)
#endif
unity::shell::scopes::ResultsModelInterface
A model of scope results for a particular category.
Definition ResultsModelInterface.h:35
unity::shell::scopes::ResultsModelInterface::count
int count
Number of items in the model.
Definition ResultsModelInterface.h:46
unity::shell::scopes::ResultsModelInterface::categoryId
QString categoryId
Id of associated category.
Definition ResultsModelInterface.h:41
unity::shell::scopes::ResultsModelInterface::Roles
Roles
The Roles supported by this model.
Definition ResultsModelInterface.h:57
unity::shell::scopes::ResultsModelInterface::RoleQuickPreviewData
@ RoleQuickPreviewData
Data for UI quick previewing. In case of audio should contain uri and duration.
Definition ResultsModelInterface.h:72
unity::shell::scopes::ResultsModelInterface::RoleSocialActions
@ RoleSocialActions
Data for social actions (in-card actions such as "+1").
Definition ResultsModelInterface.h:73
unity
Top-level namespace for all things Unity-related.
Definition Version.h:38