on xenial help sign in
removed chewie test plugin
commit1a125976fadd5e7d35cf5f6c2a71ddc2f0ade026 authorNick Dedekind <nicholas.dedekind@gmail.com> dateWed 12 Jun 2013, 09:44 (13 years ago) parentbd55217
9 files changed+1−354
debian/indicators-client.install+1−1 tests/qmltests/plugins/CMakeLists.txt−1 tests/qmltests/plugins/Ubuntu/CMakeLists.txt−1 tests/qmltests/plugins/Ubuntu/ChewieUI/CMakeLists.txt−33 tests/qmltests/plugins/Ubuntu/ChewieUI/fake_chewie_plugin.cpp−29 tests/qmltests/plugins/Ubuntu/ChewieUI/fake_chewie_plugin.h−31 tests/qmltests/plugins/Ubuntu/ChewieUI/fake_pluginmodel.cpp−193 tests/qmltests/plugins/Ubuntu/ChewieUI/fake_pluginmodel.h−64 tests/qmltests/plugins/Ubuntu/ChewieUI/qmldir−1
debian/indicators-client.install+1−1
@@ -1 +1 @@
1−/usr/bin/indicators-client
1+/usr/bin/indicators-client
tests/qmltests/plugins/CMakeLists.txt−1
@@ -1,4 +1,3 @@
11add_subdirectory(HudClient)
22add_subdirectory(IndicatorsClient)
3−add_subdirectory(Ubuntu)
43add_subdirectory(Unity)
tests/qmltests/plugins/Ubuntu/CMakeLists.txtdeleted−1
@@ -1 +0,0 @@
1−add_subdirectory(ChewieUI)
tests/qmltests/plugins/Ubuntu/ChewieUI/CMakeLists.txtdeleted−33
@@ -1,33 +0,0 @@
1−set(CMAKE_AUTOMOC ON)
2−
3−include(FindPkgConfig)
4−find_package(Qt5Core REQUIRED)
5−find_package(Qt5Quick REQUIRED)
6−
7−set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wextra -std=c++11")
8−
9−include_directories(
10− ${CMAKE_CURRENT_BINARY_DIR}
11− ${Qt5Core_INCLUDE_DIRS}
12− ${Qt5Quick_INCLUDE_DIRS}
13−)
14−
15−add_definitions(-DQT_NO_KEYWORDS)
16−
17−set(ChewieUIQML_SOURCES
18− fake_chewie_plugin.cpp
19− fake_pluginmodel.cpp
20−)
21−
22−add_library(FakeChewieUIQml MODULE ${ChewieUIQML_SOURCES})
23−target_link_libraries(FakeChewieUIQml
24− ${Qt5Core_LIBRARIES}
25− ${Qt5Quick_LIBRARIES}
26−)
27−
28−qt5_use_modules(FakeChewieUIQml Qml)
29−
30−# copy qmldir file into build directory for shadow builds
31−file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
32− DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
33− )
tests/qmltests/plugins/Ubuntu/ChewieUI/fake_chewie_plugin.cppdeleted−29
@@ -1,29 +0,0 @@
1−/*
2− * Copyright (C) 2012, 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 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 General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#include "fake_chewie_plugin.h"
18−#include "fake_pluginmodel.h"
19−
20−#include <qqml.h>
21−
22−void FakeChewieQmlPlugin::registerTypes(const char *uri)
23−{
24−// #ifndef GLIB_VERSION_2_36
25−// g_type_init();
26−// #endif
27−
28− qmlRegisterType<PluginModel>(uri, 0, 1, "PluginModel");
29−}
tests/qmltests/plugins/Ubuntu/ChewieUI/fake_chewie_plugin.hdeleted−31
@@ -1,31 +0,0 @@
1−/*
2− * Copyright (C) 2012, 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 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 General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#ifndef PLUGIN_H
18−#define PLUGIN_H
19−
20−#include <QQmlExtensionPlugin>
21−
22−class FakeChewieQmlPlugin : public QQmlExtensionPlugin
23−{
24− Q_OBJECT
25− Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
26−public:
27− void registerTypes(const char *uri);
28−};
29−
30−
31−#endif
tests/qmltests/plugins/Ubuntu/ChewieUI/fake_pluginmodel.cppdeleted−193
@@ -1,193 +0,0 @@
1−/*
2− * Copyright 2012 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− */
19−
20−#include "fake_pluginmodel.h"
21−#include "paths.h"
22−
23−#include <QQmlContext>
24−#include <QQmlEngine>
25−#include <QDebug>
26−#include <QQmlComponent>
27−
28−struct Indicator {
29− Indicator(QString const& title, QString iconSource, QString label, QString description, QString componentSource)
30− : title(title)
31− , iconSource(iconSource)
32− , label(label)
33− , description(description)
34− , componentSource(componentSource)
35− , isValid(true)
36− {}
37−
38− QString title;
39− QString iconSource;
40− QString label;
41− QString description;
42− QString componentSource;
43− QMap<QString, QVariant> initialProperties;
44− bool isValid;
45−};
46−
47−const QList<Indicator> indicator_list = QList<Indicator>()
48− << Indicator("Menu1", sourceDirectory()+"Panel/graphics/Battery@18.png", "", "", sourceDirectory()+"tests/qmltests/Panel/qml/fake_menu_plugin1.qml")
49− << Indicator("Menu2", sourceDirectory()+"Panel/graphics/Bluetooth@18.png", "", "", sourceDirectory()+"tests/qmltests/Panel/qml/fake_menu_plugin2.qml")
50− << Indicator("Menu3", sourceDirectory()+"Panel/graphics/Clock@18.png", "", "", sourceDirectory()+"tests/qmltests/Panel/qml/fake_menu_plugin3.qml")
51− << Indicator("Menu4", sourceDirectory()+"Panel/graphics/Location@18.png", "", "", sourceDirectory()+"tests/qmltests/Panel/qml/fake_menu_plugin4.qml")
52− << Indicator("Menu5", sourceDirectory()+"Panel/graphics/Network@18.png", "", "", sourceDirectory()+"tests/qmltests/Panel/qml/fake_menu_plugin5.qml");
53−
54−
55−PluginModel::PluginModel(QObject *parent)
56− : QAbstractListModel(parent)
57−{
58− QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
59− QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
60− QObject::connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged()));
61−}
62−
63−/*! \internal */
64−PluginModel::~PluginModel()
65−{
66−}
67−
68−/*!
69− \qmlmethod PluginModel::get(int)
70−
71− Returns the item at index in the model. This allows the item data to be accessed from JavaScript:
72− \b Note: methods should only be called after the Component has completed.
73−*/
74−QVariantMap PluginModel::get(int row) const
75−{
76− QVariantMap result;
77−
78− QModelIndex index = this->index(row);
79− if (index.isValid()) {
80− QMap<int, QVariant> data = itemData(index);
81− const QHash<int, QByteArray> roleNames = this->roleNames();
82− Q_FOREACH(int i, roleNames.keys()) {
83− result.insert(roleNames[i], data[i]);
84− }
85− }
86− return result;
87−}
88−
89−/*!
90− \qmlproperty PluginModel::count
91− The number of data entries in the model.
92−
93− \b Note: methods should only be called after the Component has completed.
94−*/
95−int PluginModel::count() const
96−{
97− return rowCount();
98−}
99−
100−/*!
101− \qmlmethod PluginModel::load()
102−
103− Load all plugin information available on baseDir.
104−*/
105−void PluginModel::load()
106−{
107−
108−}
109−
110−/*!
111− \qmlmethod PluginModel::unload()
112−
113− Unload all plugins.
114−*/
115−void PluginModel::unload()
116−{
117−}
118−
119−/*! \internal */
120−QHash<int, QByteArray> PluginModel::roleNames() const
121−{
122− static QHash<int, QByteArray> roles;
123− if (roles.isEmpty()) {
124− roles[Title] = "title";
125− roles[IconSource] = "iconSource";
126− roles[Label] = "label";
127− roles[Description] = "description";
128− roles[QMLComponent] = "component";
129− roles[InitialProperties] = "initialProperties";
130− roles[IsValid] = "isValid";
131− }
132− return roles;
133−}
134−
135−/*! \internal */
136−int PluginModel::columnCount(const QModelIndex &) const
137−{
138− return 1;
139−}
140−
141−/*! \internal */
142−QVariant PluginModel::data(const QModelIndex &index, int role) const
143−{
144− QVariant attribute;
145−
146− if ((index.row() >= 0) && (index.row() < indicator_list.size())) {
147− Indicator indicator = (indicator_list[index.row()]);
148−
149− switch (role) {
150− case Title:
151− attribute = indicator.title;
152− break;
153− case IconSource:
154− attribute = indicator.iconSource;
155− break;
156− case Label:
157− attribute = indicator.label;
158− break;
159− case Description:
160− attribute = indicator.description;
161− break;
162− case QMLComponent:
163− {
164− QQmlContext *context = QQmlEngine::contextForObject(this);
165− if (context) {
166− QQmlComponent* component = new QQmlComponent(context->parentContext()->engine(), QUrl(indicator.componentSource), NULL);
167− attribute = QVariant::fromValue<QQmlComponent*>(component);
168− }
169− } break;
170− case InitialProperties:
171− attribute = indicator.initialProperties;
172− break;
173− case IsValid:
174− attribute = indicator.isValid;
175− break;
176− default:
177− break;
178− }
179− }
180− return attribute;
181−}
182−
183−/*! \internal */
184−QModelIndex PluginModel::parent(const QModelIndex&) const
185−{
186− return QModelIndex();
187−}
188−
189−/*! \internal */
190−int PluginModel::rowCount(const QModelIndex &) const
191−{
192− return indicator_list.size();
193−}
tests/qmltests/plugins/Ubuntu/ChewieUI/fake_pluginmodel.hdeleted−64
@@ -1,64 +0,0 @@
1−/*
2− * Copyright 2012 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− */
19−
20−#ifndef PLUGINMODEL_H
21−#define PLUGINMODEL_H
22−
23−#include <QAbstractListModel>
24−#include <QQmlEngine>
25−
26−class PluginModel : public QAbstractListModel
27−{
28− Q_OBJECT
29− Q_PROPERTY(int count READ count NOTIFY countChanged)
30−
31−public:
32− enum ModelRoles {
33− Title = 0,
34− IconSource,
35− Label,
36− Description,
37− QMLComponent,
38− InitialProperties,
39− IsValid
40− };
41−
42− PluginModel(QObject *parent=0);
43− ~PluginModel();
44−
45− Q_INVOKABLE void load();
46− Q_INVOKABLE void unload();
47−
48− Q_INVOKABLE QVariantMap get(int row) const;
49−
50− /* QAbstractItemModel */
51− QHash<int, QByteArray> roleNames() const;
52− int columnCount(const QModelIndex &parent = QModelIndex()) const;
53− QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
54− QModelIndex parent (const QModelIndex &index) const;
55− int rowCount(const QModelIndex &parent = QModelIndex()) const;
56−
57−Q_SIGNALS:
58− void countChanged();
59−
60−private:
61− int count() const;
62−};
63−
64−#endif
tests/qmltests/plugins/Ubuntu/ChewieUI/qmldirdeleted−1
@@ -1 +0,0 @@
1−plugin FakeChewieUIQml