on a4713ff help sign in
unity8/plugins/IndicatorsClient/indicatorclientinterface.h
144 lines 4.5 kB history raw
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
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 Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Renato Araujo Oliveira Filho <renato@canonical.com>
18 */
20#ifndef INDICATORCLIENTININTERFACE_H
21#define INDICATORCLIENTININTERFACE_H
23#include <QMap>
24#include <QString>
25#include <QUrl>
26#include <QObject>
27#include <QQmlComponent>
28#include <QQmlEngine>
29#include <QSettings>
31#include <memory>
33class IndicatorClientInterface
35public:
36 typedef QMap<QString, QVariant> PropertiesMap;
37 typedef QMap<QString, QUrl> WidgetsMap;
39 typedef std::shared_ptr<IndicatorClientInterface> Ptr;
41 enum IndicatorPriority {
42 MESSAGING = 0,
43 SOUND = 10,
44 NETWORK = 20,
45 POWER = 30,
46 DATETIME = 100
47 };
48 /**
49 * @brief This fuction will be called by PluginManager after create the plugin object
50 * @param config The dbus configuration used by this plugin
51 */
52 virtual void init(const QSettings& settings) = 0;
54 /**
55 * @brief This function will be called by PluginManager before destroy the plugin
56 */
57 virtual void shutdown() = 0;
59 /**
60 * @brief Used to retrieve the current plugin identifier
61 * @return The identifier
62 *
63 * This function can be used to retrieve the indicator identifier
64 */
65 virtual QString identifier() const = 0;
67 /**
68 * @brief Used to retrieve the current plugin icon
69 * @return The icon url
70 *
71 * This function can be used to retrieve the indicator icon which will appear on the panel
72 */
73 virtual QUrl icon() const = 0;
75 /**
76 * @brief Used to retrieve the current plugin title
77 * @return The title
78 *
79 * This function can be used to retrieve the indicator title which can be used as plugin name on the menu
80 */
81 virtual QString title() const = 0;
83 /**
84 * @brief Used to retrieve the current plugin label
85 * @return The label
86 *
87 * This function can be used to retrieve the indicator label which can appear in the panel
88 */
89 virtual QString label() const = 0;
91 /**
92 * @brief Used to retrieve the current plugin label
93 * @return The label
94 *
95 * This function can be used to retrieve the indicator description which can appear in the panel
96 */
97 virtual QString description() const = 0;
99 /**
100 * @brief Used to retrieve the current plugin visibility
101 * @return The visibility
102 *
103 * This function can be used to retrieve the indicator is visible on the panel or not
104 */
105 virtual bool visible() const = 0;
107 /**
108 * @brief Used to retrieve the current plugin accessible name
109 * @return The accessible name is plugin name as seen by assistive technologies
110 */
111 virtual QString accessibleName() const = 0;
114 /**
115 * @brief Used to retrieve the current plugin priority
116 * @return The priorty value for the plugin, this will be used to arrange the plugin on the indicator panel
117 */
118 virtual int priority() const = 0;
121 /**
122 * @brief Used to retrieve the plugin initial component
123 * @param engine The current \l QDeclarativeEngine used to parse the componente code
124 * @param parent The parent of the returned object
125 * @return A new \l QDeclarativeComponent with the initial plugin view
126 */
127 virtual QQmlComponent *component(QQmlEngine *engine, QObject *parent=0) = 0;
129 /**
130 * @brief Used during the plugin Component instanciation to set the initial properties
131 * @return The map with the initial property and value: {'property-name' : property-value}
132 */
134 virtual PropertiesMap initialProperties() = 0;
136 /**
137 * @brief The plugin should implement this function to return the custom widgets
138 * implemente by the plugin
139 * @return The map with the widget name and url: {'WifiAccessPointItem' : 'wifi-widget.qml'}
140 */
141 virtual WidgetsMap widgets() = 0;
142};
144#endif