~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-private-shapes

45.1.4 by Juhapekka Piiroinen
Merged plugins folder into modules
1
/*
1278 by Loïc Molinari
Added private Stroke item and node.
2
 * Copyright 2016 Canonical Ltd.
45.1.4 by Juhapekka Piiroinen
Merged plugins folder into modules
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
 */
17
101.6.63 by Kaleo
Removed ImageMipmap and BorderImageMipmap and replaced them with an extension object to QQuickImageBase.
18
#include <QtQuick/private/qquickimagebase_p.h>
292.1.1 by Albert Astals
Add the BottomEdgeControllerSDK
19
#include <QDBusConnection>
440.3.1 by Kaleo
Preliminary auto rotation support.
20
#include <QtGui/QGuiApplication>
21
#include <QtGui/QScreen>
101.6.4 by Florian Boucault
Transferred Units definition to C++.
22
45.1.4 by Juhapekka Piiroinen
Merged plugins folder into modules
23
#include "plugin.h"
1000.460.16 by Zsombor Egri
rename to ThemeSettings
24
#include "uctheme.h"
1000.448.1 by Zsombor Egri
Theme context property deprecation class prepared; performance test added, UCTheme is instantiable by itself
25
#include "ucdeprecatedtheme.h"
1000.628.20 by Zsombor Egri
remane sources and get use of the extension
26
#include "ucthemingextension.h"
45.1.4 by Juhapekka Piiroinen
Merged plugins folder into modules
27
54.3.38 by Zsombor Egri
Second round of review comments applied.
28
#include <QtQml/QQmlContext>
96.2.74 by tpeeters
rename GettextBinding to UbuntuI18n and rename the header and cpp files
29
#include "i18n.h"
96.2.83 by tpeeters
add context property listener functionality in separate class
30
#include "listener.h"
1204.3.18 by Andrea Bernabei
merge staging
31
#include "livetimer.h"
101.6.81 by Kaleo
Prefixed classes by UC.
32
#include "ucunits.h"
33
#include "ucscalingimageprovider.h"
34
#include "ucqquickimageextension.h"
148.1.1 by Zsombor Egri
QuickUtils class/element to retrieve the current root object.
35
#include "quickutils.h"
1000.415.3 by Loïc Molinari
[Shape] Renamed files to respect project standard.
36
#include "ucubuntushape.h"
1000.428.1 by Loïc Molinari
Added UbuntuShapeOverlay.
37
#include "ucubuntushapeoverlay.h"
1000.585.1 by Loïc Molinari
Renamed ShellIcon to ProportionalShape removing the drop shadow aspect for consistency.
38
#include "ucproportionalshape.h"
278.2.12 by Zsombor Egri
documentation fixes
39
#include "inversemouseareatype.h"
291.2.1 by Zsombor Egri
initial state
40
#include "qquickclipboard.h"
41
#include "qquickmimedata.h"
484.2.1 by Kaleo
New UbuntuAnimation durations and easing constants. New UbuntuNumberAnimation.
42
#include "ucubuntuanimation.h"
497.1.1 by Zsombor Egri
FontUtils moved as native code
43
#include "ucfontutils.h"
445.3.8 by Kaleo
Added Arguments and Argument classes, no implementation.
44
#include "ucarguments.h"
45
#include "ucargument.h"
697.2.5 by Christian Dywan
Bind needed QCoreApp properties as UCApp and move logic into MainView
46
#include "ucapplication.h"
679.1.1 by Zsombor Egri
Alarms API based on memory Organizer engine
47
#include "ucalarm.h"
679.1.9 by Zsombor Egri
API refactored
48
#include "ucalarmmodel.h"
679.2.1 by Lars Uebernickel
Add UnityThemeIconProvider
49
#include "unitythemeiconprovider.h"
748.4.1 by Zsombor Egri
base API
50
#include "ucstatesaver.h"
767.1.1 by Loïc Molinari
Added URI handler.
51
#include "ucurihandler.h"
898.1.27 by Zsombor Egri
small fixes on forwarding; documentation fixed; few more tests added
52
#include "ucmouse.h"
53
#include "ucinversemouse.h"
974.1.1 by Christian Dywan
Introduce QML bindings for SortFilterModel
54
#include "sortfiltermodel.h"
1000.184.2 by Zsombor Egri
component renamed, property and method renamed; Component made internal, all property documentation appears at is derived classes
55
#include "ucstyleditembase.h"
1000.507.3 by Zsombor Egri
styleHint and StyleHint defined
56
#include "ucstylehints.h"
1000.229.1 by Zsombor Egri
Action, ActionContext, ActionManager transferred in API from Unity.Actions. Dependency removed
57
#include "ucaction.h"
58
#include "ucactioncontext.h"
59
#include "ucactionmanager.h"
1000.330.19 by Zsombor Egri
ViewItem changed into ListItem
60
#include "uclistitem.h"
61
#include "uclistitem_p.h"
1000.337.49 by Zsombor Egri
ListItemOptions turned to ListItemActions
62
#include "uclistitemactions.h"
1000.337.80 by Zsombor Egri
introduce styling; move ListItemPanel into Ambiance theme, expose ListItemStyle C++ style component from the main plugin
63
#include "uclistitemstyle.h"
1122.10.9 by Zsombor Egri
ServiceProperties QML component created, replacing DBusPropertyWatcher and SystemSettings intarnal component. Prerequisite for the HapticsFreedback singleton required to fix the OtherVibrate setting
64
#include "ucserviceproperties.h"
1000.418.11 by Zsombor Egri
preset property type changed to enum and renamed to captionStyle
65
#include "ucnamespace.h"
1204.3.5 by Andrea Bernabei
Add C++ SlotsLayout and related benchmarks
66
#include "ucslotslayout.h"
1000.595.1 by Zsombor Egri
ActionItem moved to c++
67
#include "ucactionitem.h"
1000.598.2 by Zsombor Egri
Haptics moved to c++
68
#include "uchaptics.h"
1000.601.4 by Zsombor Egri
logic transfered to cpp
69
#include "ucabstractbutton.h"
1000.630.4 by Tim Peeters
add ucheader
70
#include "ucheader.h"
1000.632.1 by Zsombor Egri
intermediate LabelBase component to speed up text sizing
71
#include "uclabel.h"
1204.3.91 by Andrea Bernabei
SlotsLayout: improve documentation, WIP update UI gallery
72
#include "uclistitemlayout.h"
1000.689.1 by Zsombor Egri
move component under cpp
73
#include "ucbottomedgehint.h"
1000.696.14 by Zsombor Egri
fixup, DirectionalDragArea renamed into SwipeArea
74
#include "gestures/ucswipearea.h"
1000.704.1 by Benjamin Zeller
Move MathUtils to Cpp
75
#include "ucmathutils.h"
1000.711.4 by Zsombor Egri
redoing based on the new concept, completing API
76
#include "ucbottomedge.h"
1000.711.59 by Zsombor Egri
rename BottomEdgeRange into BottomEdgeRegion
77
#include "ucbottomedgeregion.h"
1000.711.25 by Zsombor Egri
move panel into theme, convert BottomEdge into StyledItem
78
#include "ucbottomedgestyle.h"
1000.717.4 by Benjamin Zeller
First version of UCPageTreeNode
79
#include "ucpagetreenode.h"
1285 by Loïc Molinari
Renamed StrokeRectangle to Frame.
80
#include "privates/frame.h"
292.1.1 by Albert Astals
Add the BottomEdgeControllerSDK
81
82
#include <sys/types.h>
83
#include <unistd.h>
766.2.6 by Jussi Pakkanen
Guard against thumbnailer creation error.
84
#include <stdexcept>
292.1.1 by Albert Astals
Add the BottomEdgeControllerSDK
85
1000.332.2 by Zsombor Egri
pluginUrl() to substitute baseUrl() in plugin
86
QUrl UbuntuComponentsPlugin::m_baseUrl = QUrl();
87
291.2.5 by Zsombor Egri
registration function relocated
88
/*
597.1.2 by Loïc Molinari
Fixed compilation warnings.
89
 * Type registration functions.
291.2.5 by Zsombor Egri
registration function relocated
90
 */
597.1.2 by Loïc Molinari
Fixed compilation warnings.
91
291.2.5 by Zsombor Egri
registration function relocated
92
static QObject *registerClipboard(QQmlEngine *engine, QJSEngine *scriptEngine)
93
{
94
    Q_UNUSED(engine)
95
    Q_UNUSED(scriptEngine)
96
97
    QQuickClipboard *clipboard = new QQuickClipboard;
98
    return clipboard;
99
}
100
597.1.2 by Loïc Molinari
Fixed compilation warnings.
101
static QObject *registerUCUbuntuAnimation(QQmlEngine *engine, QJSEngine *scriptEngine)
102
{
103
    Q_UNUSED(engine)
104
    Q_UNUSED(scriptEngine)
105
106
    UCUbuntuAnimation *animation = new UCUbuntuAnimation();
107
    return animation;
108
}
109
767.1.1 by Loïc Molinari
Added URI handler.
110
static QObject *registerUriHandler(QQmlEngine *engine, QJSEngine *scriptEngine)
111
{
112
    Q_UNUSED(engine)
113
    Q_UNUSED(scriptEngine)
114
115
    UCUriHandler *uriHandler = new UCUriHandler();
116
    return uriHandler;
117
}
552.4.1 by Kaleo
Added UbuntuColors singleton.
118
1000.483.4 by Zsombor Egri
adjustments
119
static QObject *registerUbuntuNamespace(QQmlEngine *engine, QJSEngine *scriptEngine)
1000.418.11 by Zsombor Egri
preset property type changed to enum and renamed to captionStyle
120
{
121
    Q_UNUSED(engine)
122
    Q_UNUSED(scriptEngine)
123
124
    return new UCNamespace();
125
}
126
1000.483.3 by Zsombor Egri
versioning API added
127
static QObject *registerUbuntuNamespace13(QQmlEngine *engine, QJSEngine *scriptEngine)
128
{
129
    Q_UNUSED(engine)
130
    Q_UNUSED(scriptEngine)
131
132
    return new UCNamespaceV13();
133
}
134
1000.598.2 by Zsombor Egri
Haptics moved to c++
135
static QObject *registerHaptics(QQmlEngine *engine, QJSEngine *scriptEngine)
136
{
137
    Q_UNUSED(engine)
138
    Q_UNUSED(scriptEngine)
139
140
    return new UCHaptics();
141
}
142
1000.486.5 by Zsombor Egri
fixing Haptics singleton registration
143
void UbuntuComponentsPlugin::initializeBaseUrl()
144
{
145
    if (!m_baseUrl.isValid()) {
146
        m_baseUrl = QUrl(baseUrl().toString() + '/');
147
    }
148
}
149
662.1.1 by Kaleo
OrientationHelper: report the current orientation of the application via QWindow::contentOrientation.
150
void UbuntuComponentsPlugin::registerWindowContextProperty()
151
{
152
    setWindowContextProperty(QGuiApplication::focusWindow());
153
154
    // listen to QGuiApplication::focusWindowChanged
662.1.2 by Kaleo
Ensure that setWindowContextProperty is called in the same thread (the main thread) otherwise it segfaults.
155
    /* Ensure that setWindowContextProperty is called in the same thread (the
156
       main thread) otherwise it segfaults. Reference:
157
       https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1205556
158
    */
662.1.1 by Kaleo
OrientationHelper: report the current orientation of the application via QWindow::contentOrientation.
159
    QGuiApplication* application = static_cast<QGuiApplication*>(QCoreApplication::instance());
160
    QObject::connect(application, SIGNAL(focusWindowChanged(QWindow*)),
662.1.2 by Kaleo
Ensure that setWindowContextProperty is called in the same thread (the main thread) otherwise it segfaults.
161
                     this, SLOT(setWindowContextProperty(QWindow*)),
743.1.1 by Alberto Mardegan
Support re-attaching to a different QQuickView
162
                     Qt::ConnectionType(Qt::DirectConnection | Qt::UniqueConnection));
662.1.1 by Kaleo
OrientationHelper: report the current orientation of the application via QWindow::contentOrientation.
163
164
}
165
166
void UbuntuComponentsPlugin::setWindowContextProperty(QWindow* focusWindow)
167
{
168
    QQuickView* view = qobject_cast<QQuickView*>(focusWindow);
169
170
    if (view != NULL) {
171
        view->rootContext()->setContextProperty("window", view);
172
    }
173
}
174
1000.9.1 by Zsombor Egri
version set to 1.0
175
void UbuntuComponentsPlugin::registerTypesToVersion(const char *uri, int major, int minor)
45.1.4 by Juhapekka Piiroinen
Merged plugins folder into modules
176
{
1000.229.1 by Zsombor Egri
Action, ActionContext, ActionManager transferred in API from Unity.Actions. Dependency removed
177
    qmlRegisterType<UCAction>(uri, major, minor, "Action");
178
    qmlRegisterType<UCActionContext>(uri, major, minor, "ActionContext");
1000.614.1 by Christian Dywan
Register UCApplication and UCFontsUtils so they appear in .api
179
    qmlRegisterUncreatableType<UCApplication>(uri, major, minor, "UCApplication", "Not instantiable");
1000.229.1 by Zsombor Egri
Action, ActionContext, ActionManager transferred in API from Unity.Actions. Dependency removed
180
    qmlRegisterType<UCActionManager>(uri, major, minor, "ActionManager");
1000.614.1 by Christian Dywan
Register UCApplication and UCFontsUtils so they appear in .api
181
    qmlRegisterUncreatableType<UCFontUtils>(uri, major, minor, "UCFontUtils", "Not instantiable");
1000.470.12 by Zsombor Egri
StyledItem.qml removed, UCStyledItem is now the full StyledItem implementation
182
    qmlRegisterType<UCStyledItemBase>(uri, major, minor, "StyledItem");
1000.9.1 by Zsombor Egri
version set to 1.0
183
    qmlRegisterUncreatableType<UbuntuI18n>(uri, major, minor, "i18n", "Singleton object");
184
    qmlRegisterExtendedType<QQuickImageBase, UCQQuickImageExtension>(uri, major, minor, "QQuickImageBase");
185
    qmlRegisterUncreatableType<UCUnits>(uri, major, minor, "UCUnits", "Not instantiable");
1000.415.3 by Loïc Molinari
[Shape] Renamed files to respect project standard.
186
    qmlRegisterType<UCUbuntuShape>(uri, major, minor, "UbuntuShape");
1000.415.62 by Loïc Molinari
Marked new properties as revision 1 of version 1.2.
187
    // FIXME/DEPRECATED: Shape is exported for backwards compatibility only
1000.415.3 by Loïc Molinari
[Shape] Renamed files to respect project standard.
188
    qmlRegisterType<UCUbuntuShape>(uri, major, minor, "Shape");
1000.9.1 by Zsombor Egri
version set to 1.0
189
    qmlRegisterType<InverseMouseAreaType>(uri, major, minor, "InverseMouseArea");
190
    qmlRegisterType<QQuickMimeData>(uri, major, minor, "MimeData");
191
    qmlRegisterSingletonType<QQuickClipboard>(uri, major, minor, "Clipboard", registerClipboard);
192
    qmlRegisterSingletonType<UCUbuntuAnimation>(uri, major, minor, "UbuntuAnimation", registerUCUbuntuAnimation);
193
    qmlRegisterType<UCArguments>(uri, major, minor, "Arguments");
194
    qmlRegisterType<UCArgument>(uri, major, minor, "Argument");
445.3.58 by Kaleo
Added new property Arguments.values
195
    qmlRegisterType<QQmlPropertyMap>();
1000.9.1 by Zsombor Egri
version set to 1.0
196
    qmlRegisterType<UCAlarm>(uri, major, minor, "Alarm");
197
    qmlRegisterType<UCAlarmModel>(uri, major, minor, "AlarmModel");
198
    qmlRegisterType<UCStateSaver>(uri, major, minor, "StateSaver");
748.4.1 by Zsombor Egri
base API
199
    qmlRegisterType<UCStateSaverAttached>();
1000.9.1 by Zsombor Egri
version set to 1.0
200
    qmlRegisterSingletonType<UCUriHandler>(uri, major, minor, "UriHandler", registerUriHandler);
201
    qmlRegisterType<UCMouse>(uri, major, minor, "Mouse");
202
    qmlRegisterType<UCInverseMouse>(uri, major, minor, "InverseMouse");
1000.595.1 by Zsombor Egri
ActionItem moved to c++
203
    qmlRegisterType<UCActionItem>(uri, major, minor, "ActionItem");
1000.598.2 by Zsombor Egri
Haptics moved to c++
204
    qmlRegisterSingletonType<UCHaptics>(uri, major, minor, "Haptics", registerHaptics);
1000.704.8 by Benjamin Zeller
Rename type callback
205
    qmlRegisterSingletonType<UCMathUtils>(uri, major, minor, "MathUtils", UCMathUtils::qmlRegisterTypeCallback);
1000.9.1 by Zsombor Egri
version set to 1.0
206
}
207
208
void UbuntuComponentsPlugin::registerTypes(const char *uri)
209
{
210
    Q_ASSERT(uri == QLatin1String("Ubuntu.Components"));
1000.486.5 by Zsombor Egri
fixing Haptics singleton registration
211
    initializeBaseUrl();
1000.9.1 by Zsombor Egri
version set to 1.0
212
213
    // register 0.1 for backward compatibility
214
    registerTypesToVersion(uri, 0, 1);
215
    registerTypesToVersion(uri, 1, 0);
1000.6.2 by Zsombor Egri
fixing event forwarding
216
217
    // register custom event
218
    ForwardedEvent::registerForwardedEvent();
974.1.14 by Christian Dywan
Merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/staging
219
974.1.20 by Christian Dywan
Make *Behavior uncreatable and document QAbstractItemModel type
220
    // register parent type so that properties can get/ set it
974.1.17 by Christian Dywan
Also register *Behavior and AbstractItemModel with version 1.1
221
    qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 1, "QAbstractItemModel", "Not instantiable");
974.1.20 by Christian Dywan
Make *Behavior uncreatable and document QAbstractItemModel type
222
223
    // register 1.1 only API
1000.470.12 by Zsombor Egri
StyledItem.qml removed, UCStyledItem is now the full StyledItem implementation
224
    qmlRegisterType<UCStyledItemBase, 1>(uri, 1, 1, "StyledItem");
974.1.16 by Christian Dywan
SortFilterModel should be Ubuntu.Components 1.1
225
    qmlRegisterType<QSortFilterProxyModelQML>(uri, 1, 1, "SortFilterModel");
974.1.20 by Christian Dywan
Make *Behavior uncreatable and document QAbstractItemModel type
226
    qmlRegisterUncreatableType<FilterBehavior>(uri, 1, 1, "FilterBehavior", "Not instantiable");
227
    qmlRegisterUncreatableType<SortBehavior>(uri, 1, 1, "SortBehavior", "Not instantiable");
1122.10.9 by Zsombor Egri
ServiceProperties QML component created, replacing DBusPropertyWatcher and SystemSettings intarnal component. Prerequisite for the HapticsFreedback singleton required to fix the OtherVibrate setting
228
    qmlRegisterType<UCServiceProperties, 1>(uri, 1, 1, "ServiceProperties");
1000.329.26 by Zsombor Egri
staging synced
229
1000.415.62 by Loïc Molinari
Marked new properties as revision 1 of version 1.2.
230
    // register 1.2 only API
1000.352.52 by Zsombor Egri
API registration fixed
231
    qmlRegisterType<UCListItem>(uri, 1, 2, "ListItem");
1000.331.12 by Zsombor Egri
ViewItemDivider renamed to ListItemDivider
232
    qmlRegisterType<UCListItemDivider>();
1000.396.3 by Zsombor Egri
cleanup stage, ListItemAnimator, UCActionPanel and ListItem attached object removed
233
    qmlRegisterUncreatableType<UCSwipeEvent>(uri, 1, 2, "SwipeEvent", "This is an event object.");
1000.352.56 by Zsombor Egri
prereq sync
234
    qmlRegisterUncreatableType<UCDragEvent>(uri, 1, 2, "ListItemDrag", "This is an event object");
1000.352.52 by Zsombor Egri
API registration fixed
235
    qmlRegisterType<UCListItemActions>(uri, 1, 2, "ListItemActions");
236
    qmlRegisterUncreatableType<UCViewItemsAttached>(uri, 1, 2, "ViewItems", "Not instantiable");
1000.483.4 by Zsombor Egri
adjustments
237
    qmlRegisterSingletonType<UCNamespace>(uri, 1, 2, "Ubuntu", registerUbuntuNamespace);
1000.415.62 by Loïc Molinari
Marked new properties as revision 1 of version 1.2.
238
    qmlRegisterType<UCUbuntuShape, 1>(uri, 1, 2, "UbuntuShape");
1000.428.5 by Loïc Molinari
Made the overlay component available only for version 1.2.
239
    qmlRegisterType<UCUbuntuShapeOverlay>(uri, 1, 2, "UbuntuShapeOverlay");
1000.460.2 by Zsombor Egri
UCTheme renamed to UCStyleSet, exposed as 1.3 API
240
241
    // register 1.3 API
1000.638.1 by Zsombor Egri
move 1.3 specific code made as workaround into 1.2 base class as it is underperforming
242
    qmlRegisterType<UCListItem, 1>(uri, 1, 3, "ListItem");
1000.610.2 by Zsombor Egri
API and defaults
243
    qmlRegisterType<UCListItemExpansion>();
1000.460.16 by Zsombor Egri
rename to ThemeSettings
244
    qmlRegisterType<UCTheme>(uri, 1, 3, "ThemeSettings");
1000.470.12 by Zsombor Egri
StyledItem.qml removed, UCStyledItem is now the full StyledItem implementation
245
    qmlRegisterType<UCStyledItemBase, 2>(uri, 1, 3, "StyledItem");
1000.483.3 by Zsombor Egri
versioning API added
246
    qmlRegisterSingletonType<UCNamespaceV13>(uri, 1, 3, "Ubuntu", registerUbuntuNamespace13);
1000.503.2 by Zsombor Egri
stage2
247
    qmlRegisterType<UCStyledItemBase, 2>(uri, 1, 3, "StyledItem");
1000.507.3 by Zsombor Egri
styleHint and StyleHint defined
248
    qmlRegisterCustomType<UCStyleHints>(uri, 1, 3, "StyleHints", new UCStyleHintsParser);
1000.534.6 by Christian Dywan
Register UCAction revision 1 to 1.3 and shortcut to 1
249
    qmlRegisterType<UCAction, 1>(uri, 1, 3, "Action");
1204.3.72 by Andrea Bernabei
SlotsLayout: rename properties according to API review agreements
250
    qmlRegisterType<UCSlotsLayout>(uri, 1, 3, "SlotsLayout");
1000.556.5 by Loïc Molinari
Registered new property for 1.3.
251
    qmlRegisterType<UCUbuntuShape, 2>(uri, 1, 3, "UbuntuShape");
1000.585.1 by Loïc Molinari
Renamed ShellIcon to ProportionalShape removing the drop shadow aspect for consistency.
252
    qmlRegisterType<UCProportionalShape>(uri, 1, 3, "ProportionalShape");
1204.3.18 by Andrea Bernabei
merge staging
253
    qmlRegisterType<LiveTimer>(uri, 1, 3, "LiveTimer");
1000.601.22 by Zsombor Egri
roll back AbstractButton for versions earlier than 1.3 to avoid API break
254
    qmlRegisterType<UCAbstractButton>(uri, 1, 3, "AbstractButton");
1204.3.29 by Andrea Bernabei
SlotsLayout: add handling for an optional progression symbol (chevron)
255
    qmlRegisterUncreatableType<UCSlotsAttached>(uri, 1, 3, "SlotsAttached", "Not instantiable");
1204.3.72 by Andrea Bernabei
SlotsLayout: rename properties according to API review agreements
256
    qmlRegisterUncreatableType<UCSlotsLayoutPadding>(uri, 1, 3, "SlotsLayoutPadding", "Not instantiable");
1204.3.91 by Andrea Bernabei
SlotsLayout: improve documentation, WIP update UI gallery
257
    qmlRegisterType<UCListItemLayout>(uri, 1, 3, "ListItemLayout");
1000.630.4 by Tim Peeters
add ucheader
258
    qmlRegisterType<UCHeader>(uri, 1, 3, "Header");
1000.649.1 by Andrea Bernabei
UCLabel: remove REVISION requirement for textSize Q_PROPERTY
259
    qmlRegisterType<UCLabel>(uri, 1, 3, "Label");
1000.689.1 by Zsombor Egri
move component under cpp
260
    qmlRegisterType<UCBottomEdgeHint>(uri, 1, 3, "BottomEdgeHint");
1000.696.14 by Zsombor Egri
fixup, DirectionalDragArea renamed into SwipeArea
261
    qmlRegisterType<UCSwipeArea>(uri, 1, 3, "SwipeArea");
1000.711.4 by Zsombor Egri
redoing based on the new concept, completing API
262
    qmlRegisterType<UCBottomEdge>(uri, 1, 3, "BottomEdge");
1000.711.59 by Zsombor Egri
rename BottomEdgeRange into BottomEdgeRegion
263
    qmlRegisterType<UCBottomEdgeRegion>(uri, 1, 3, "BottomEdgeRegion");
1000.717.4 by Benjamin Zeller
First version of UCPageTreeNode
264
    qmlRegisterType<UCPageTreeNode>(uri, 1, 3, "PageTreeNode");
96.2.4 by tpeeters
something works :)
265
}
266
101.3.1 by Florian Boucault
Migrated code to Qt5 and QtQuick2
267
void UbuntuComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
96.2.4 by tpeeters
something works :)
268
{
1000.216.1 by Zsombor Egri
moving to use baseUrl()
269
    // initialize baseURL
1000.486.5 by Zsombor Egri
fixing Haptics singleton registration
270
    initializeBaseUrl();
1000.216.1 by Zsombor Egri
moving to use baseUrl()
271
1000.337.80 by Zsombor Egri
introduce styling; move ListItemPanel into Ambiance theme, expose ListItemStyle C++ style component from the main plugin
272
    // register internal styles
273
    const char *styleUri = "Ubuntu.Components.Styles";
1000.470.17 by Zsombor Egri
fix listItemIndex style property introduced due to styling
274
    qmlRegisterType<UCListItemStyle>(styleUri, 1, 2, "ListItemStyle");
275
    qmlRegisterType<UCListItemStyle, 1>(styleUri, 1, 3, "ListItemStyle");
1000.711.25 by Zsombor Egri
move panel into theme, convert BottomEdge into StyledItem
276
    qmlRegisterType<UCBottomEdgeStyle>(styleUri, 1, 3, "BottomEdgeStyle");
1000.337.80 by Zsombor Egri
introduce styling; move ListItemPanel into Ambiance theme, expose ListItemStyle C++ style component from the main plugin
277
1278 by Loïc Molinari
Added private Stroke item and node.
278
    // Register private types.
1285 by Loïc Molinari
Renamed StrokeRectangle to Frame.
279
    qmlRegisterType<UCFrame>("Ubuntu.Components.Private", 1, 3, "Frame");
1278 by Loïc Molinari
Added private Stroke item and node.
280
101.3.1 by Florian Boucault
Migrated code to Qt5 and QtQuick2
281
    QQmlExtensionPlugin::initializeEngine(engine, uri);
96.2.82 by tpeeters
move qmlInit and register types to plugin
282
    QQmlContext* context = engine->rootContext();
283
148.1.1 by Zsombor Egri
QuickUtils class/element to retrieve the current root object.
284
    // register root object watcher that sets a global property with the root object
285
    // that can be accessed from any object
286
    context->setContextProperty("QuickUtils", &QuickUtils::instance());
148.1.3 by Zsombor Egri
Dead code removed
287
1000.467.15 by Zsombor Egri
renaming all styleSet occurrences to theme
288
    // register theme context property
1000.460.16 by Zsombor Egri
rename to ThemeSettings
289
    UCTheme::registerToContext(context);
1000.460.7 by Zsombor Egri
fixing unit tests
290
1000.448.1 by Zsombor Egri
Theme context property deprecation class prepared; performance test added, UCTheme is instantiable by itself
291
    UCDeprecatedTheme::instance().registerToContext(context);
552.3.2 by Kaleo
Renamed UITK_THEME_PATH into UBUNTU_UI_TOOLKIT_THEMES_PATH.
292
1000.598.2 by Zsombor Egri
Haptics moved to c++
293
    HapticsProxy::instance().setEngine(context->engine());
294
96.2.82 by tpeeters
move qmlInit and register types to plugin
295
    context->setContextProperty("i18n", &UbuntuI18n::instance());
743.1.1 by Alberto Mardegan
Support re-attaching to a different QQuickView
296
    ContextPropertyChangeListener *i18nChangeListener =
297
        new ContextPropertyChangeListener(context, "i18n");
96.2.82 by tpeeters
move qmlInit and register types to plugin
298
    QObject::connect(&UbuntuI18n::instance(), SIGNAL(domainChanged()),
743.1.1 by Alberto Mardegan
Support re-attaching to a different QQuickView
299
                     i18nChangeListener, SLOT(updateContextProperty()));
179.1.2 by Juhapekka Piiroinen
[i18n] added languageChanged binding to plugin.cpp
300
    QObject::connect(&UbuntuI18n::instance(), SIGNAL(languageChanged()),
743.1.1 by Alberto Mardegan
Support re-attaching to a different QQuickView
301
                     i18nChangeListener, SLOT(updateContextProperty()));
101.6.74 by Kaleo
Merged trunk
302
697.2.11 by Christian Dywan
Expose UCApplication as UbuntuApplication
303
    // We can't use 'Application' because it exists (undocumented)
304
    context->setContextProperty("UbuntuApplication", &UCApplication::instance());
743.1.4 by Alberto Mardegan
Merge changes from trunk
305
    ContextPropertyChangeListener *applicationChangeListener =
306
        new ContextPropertyChangeListener(context, "UbuntuApplication");
697.2.10 by Christian Dywan
Fix test, components.api and set context property
307
    QObject::connect(&UCApplication::instance(), SIGNAL(applicationNameChanged()),
743.1.4 by Alberto Mardegan
Merge changes from trunk
308
                     applicationChangeListener, SLOT(updateContextProperty()));
767.2.1 by Christian Dywan
Set offline storage path and add a unit test
309
    // Give the application object access to the engine
310
    UCApplication::instance().setContext(context);
697.2.10 by Christian Dywan
Fix test, components.api and set context property
311
101.6.81 by Kaleo
Prefixed classes by UC.
312
    context->setContextProperty("units", &UCUnits::instance());
743.1.1 by Alberto Mardegan
Support re-attaching to a different QQuickView
313
    ContextPropertyChangeListener *unitsChangeListener =
314
        new ContextPropertyChangeListener(context, "units");
101.6.81 by Kaleo
Prefixed classes by UC.
315
    QObject::connect(&UCUnits::instance(), SIGNAL(gridUnitChanged()),
743.1.1 by Alberto Mardegan
Support re-attaching to a different QQuickView
316
                     unitsChangeListener, SLOT(updateContextProperty()));
101.6.21 by Kaleo
Improved ImageMipmap.
317
497.1.1 by Zsombor Egri
FontUtils moved as native code
318
    // register FontUtils
319
    context->setContextProperty("FontUtils", &UCFontUtils::instance());
743.1.1 by Alberto Mardegan
Support re-attaching to a different QQuickView
320
    ContextPropertyChangeListener *fontUtilsListener =
321
        new ContextPropertyChangeListener(context, "FontUtils");
497.1.1 by Zsombor Egri
FontUtils moved as native code
322
    QObject::connect(&UCUnits::instance(), SIGNAL(gridUnitChanged()),
743.1.1 by Alberto Mardegan
Support re-attaching to a different QQuickView
323
                     fontUtilsListener, SLOT(updateContextProperty()));
497.1.1 by Zsombor Egri
FontUtils moved as native code
324
101.6.81 by Kaleo
Prefixed classes by UC.
325
    engine->addImageProvider(QLatin1String("scaling"), new UCScalingImageProvider);
196.2.1 by Renato Araujo Oliveira Filho
Implemented new image provider to provide images from GIcon sources.
326
769.3.1 by Lars Uebernickel
Remove GIconProvider
327
    // register icon provider
679.2.1 by Lars Uebernickel
Add UnityThemeIconProvider
328
    engine->addImageProvider(QLatin1String("theme"), new UnityThemeIconProvider);
440.3.1 by Kaleo
Preliminary auto rotation support.
329
440.3.7 by Kaleo
Fix indentation.
330
    // Necessary for Screen.orientation (from import QtQuick.Window 2.0) to work
331
    QGuiApplication::primaryScreen()->setOrientationUpdateMask(
332
            Qt::PortraitOrientation |
333
            Qt::LandscapeOrientation |
334
            Qt::InvertedPortraitOrientation |
335
            Qt::InvertedLandscapeOrientation);
662.1.1 by Kaleo
OrientationHelper: report the current orientation of the application via QWindow::contentOrientation.
336
337
    registerWindowContextProperty();
96.2.4 by tpeeters
something works :)
338
}