Loading...
Searching...
No Matches
LauncherModelInterface.h
/*
* Copyright 2013 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authors:
* Michael Zanetti <michael.zanetti@canonical.com>
*/
#ifndef LOMIRI_SHELL_LAUNCHER_LAUNCHERMODELINTERFACE_H
#define LOMIRI_SHELL_LAUNCHER_LAUNCHERMODELINTERFACE_H
#include <lomiri/SymbolExport.h>
#include <lomiri/shell/application/ApplicationManagerInterface.h>
#include <QtCore/QAbstractListModel>
namespace lomiri
{
namespace shell
{
namespace launcher
{
class LauncherItemInterface;
class LOMIRI_API LauncherModelInterface: public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(lomiri::shell::application::ApplicationManagerInterface* applicationManager
READ applicationManager WRITE setApplicationManager NOTIFY applicationManagerChanged)
Q_PROPERTY(bool onlyPinned READ onlyPinned WRITE setOnlyPinned NOTIFY onlyPinnedChanged)
protected:
LauncherModelInterface(QObject *parent = 0): QAbstractListModel(parent) {
m_roleNames.insert(RoleAppId, "appId");
m_roleNames.insert(RoleName, "name");
m_roleNames.insert(RoleIcon, "icon");
m_roleNames.insert(RolePinned, "pinned");
m_roleNames.insert(RoleRunning, "running");
m_roleNames.insert(RoleRecent, "recent");
m_roleNames.insert(RoleProgress, "progress");
m_roleNames.insert(RoleCount, "count");
m_roleNames.insert(RoleCountVisible, "countVisible");
m_roleNames.insert(RoleFocused, "focused");
m_roleNames.insert(RoleAlerting, "alerting");
m_roleNames.insert(RoleSurfaceCount, "surfaceCount");
}
public:
*/
enum Roles {
RoleAppId = Qt::UserRole,
RoleName,
RoleIcon,
RolePinned,
RoleRunning,
RoleRecent,
RoleProgress,
RoleCount,
RoleCountVisible,
RoleFocused,
RoleAlerting,
RoleSurfaceCount
};
virtual ~LauncherModelInterface() {}
Q_INVOKABLE virtual void move(int oldIndex, int newIndex) = 0;
Q_INVOKABLE virtual lomiri::shell::launcher::LauncherItemInterface *get(int index) const = 0;
Q_INVOKABLE virtual void pin(const QString &appId, int index = -1) = 0;
Q_INVOKABLE virtual void requestRemove(const QString &appId) = 0;
Q_INVOKABLE virtual void quickListActionInvoked(const QString &appId, int actionIndex) = 0;
Q_INVOKABLE virtual void setUser(const QString &username) = 0;
virtual lomiri::shell::application::ApplicationManagerInterface *applicationManager() const = 0;
virtual void setApplicationManager(lomiri::shell::application::ApplicationManagerInterface *applicationManager) = 0;
virtual bool onlyPinned() const = 0;
virtual void setOnlyPinned(bool onlyPinned) = 0;
QHash<int, QByteArray> roleNames() const override
{
return m_roleNames;
}
Q_SIGNALS:
void applicationManagerChanged();
void onlyPinnedChanged();
void hint();
protected:
QHash<int, QByteArray> m_roleNames;
};
} // namespace launcher
} // namespace shell
} // namespace lomiri
#endif // LOMIRI_SHELL_LAUNCHER_LAUNCHERMODELINTERFACE_H
lomiri::shell::application::ApplicationManagerInterface
The Application manager.
Definition ApplicationManagerInterface.h:45
lomiri::shell::launcher::LauncherItemInterface
An item presented in the launcher.
Definition LauncherItemInterface.h:45
lomiri::shell::launcher::LauncherModelInterface
A list of launcher items to be displayed.
Definition LauncherModelInterface.h:44
lomiri::shell::launcher::LauncherModelInterface::onlyPinned
bool onlyPinned
Only show pinned apps, hiding the unpinned running/recent ones.
Definition LauncherModelInterface.h:59
lomiri::shell::launcher::LauncherModelInterface::get
virtual Q_INVOKABLE lomiri::shell::launcher::LauncherItemInterface * get(int index) const =0
Get a launcher item.
lomiri::shell::launcher::LauncherModelInterface::Roles
Roles
The Roles supported by the model.
Definition LauncherModelInterface.h:85
lomiri::shell::launcher::LauncherModelInterface::requestRemove
virtual Q_INVOKABLE void requestRemove(const QString &appId)=0
Request removal of an item from the model.
lomiri::shell::launcher::LauncherModelInterface::quickListActionInvoked
virtual Q_INVOKABLE void quickListActionInvoked(const QString &appId, int actionIndex)=0
Trigger an action from the QuickList.
lomiri::shell::launcher::LauncherModelInterface::hint
void hint()
Emitted when the launcher should hint itself to the user, e.g. to indicate a change the user should b...
lomiri::shell::launcher::LauncherModelInterface::pin
virtual Q_INVOKABLE void pin(const QString &appId, int index=-1)=0
Pin an item to the launcher.
lomiri::shell::launcher::LauncherModelInterface::move
virtual Q_INVOKABLE void move(int oldIndex, int newIndex)=0
Move an item in the model.
lomiri::shell::launcher::LauncherModelInterface::applicationManager
lomiri::shell::application::ApplicationManagerInterface * applicationManager
The ApplicationManager instance the launcher should be connected to.
Definition LauncherModelInterface.h:54
lomiri::shell::launcher::LauncherModelInterface::setUser
virtual Q_INVOKABLE void setUser(const QString &username)=0
Set the user for which the launcher should display items.
lomiri
Top-level namespace for all things Lomiri-related.
Definition Version.h:38