summaryrefslogtreecommitdiffstats
path: root/basicsuite/ebike-ui/datamodelplugin/plugin.cpp
diff options
context:
space:
mode:
authorMikko Gronoff <mikko.gronoff@qt.io>2018-08-24 11:10:54 +0300
committerMikko Gronoff <mikko.gronoff@qt.io>2018-08-24 11:11:38 +0300
commit75addc77b361384b018ec28bde26e5880887c80f (patch)
tree38d58d5737dda597a6a69f2c931672575e5ed217 /basicsuite/ebike-ui/datamodelplugin/plugin.cpp
parent22cdfdd27aaa885ac5b7b450c8fb82b87853250d (diff)
parent1ff81b46a37550bb4430cc032b6d5504525af53f (diff)
Merge remote-tracking branch 'origin/5.11' into dev
* origin/5.11: 1ff81b4 Merge remote-tracking branch 'origin/5.9' into 5.11 3594ea2 Fix scaling, video path & focusing issues on mediaplayer demo e81384c Remove confusing highlighting on media player file browser 4aa85d7 Use QSettings for color definitions a60eb67 Disable graphical effect from imx7 boards 83bffe9 Move color definitions to QSettings 57bc95f Fix qtquickcontrols2 demo image paths & controls theme a5ba671 Doc: Bump version to 5.11.2 1510d96 Doc: bump version to 5.9.7 cc9de37 Fix mediaplayer slider color definitions c20966f Move info button to mediaplayer-demo footer 0b0d77e Fix mediaplayer color definitions a607978 Update Boot2Qt Launcher demo icons & doc images 773a661 Disable webbrowser demo from all imx7 boards 9f18bb7 Doc: Bump version to 5.11.1 4fa8854 Doc: remove outdate doc folder under qtquickcontrols2 example 054a2ea doc: add missing doc images for e-bike & quickcontrols2 demo 173d934 Update Boot2Qt demos appearing in QtCreator a70868f Enable ebike demo 6ed3d30 Temporarily disable e-bike from the basicsuite demo set 28e9fdf Fix Media Player demo color definitions 6b5a6d0 Fix paths for demos.xml 783ca94 Doc: bump version to 5.9.6 d083365 Add new Ebike demo to basicsuite da60352 Move common definitions to shared settings e513aed Update QtWebBrowser demo to new UI theme f5c4c3a Remove qtwebbrowser submodule 3fa5796 Replace existing controls demos with controls 2 gallery example 04e4798 Update Mediaplayer demo to new UI theme 2e8942f Update GraphicalEffects demo to new UI theme e365074 Add new fonts 7c41444 Update Charts demo to new UI theme 2a50d49 Comment out 7 demos from demos.xml file 9e941af Doc: Bump version to 5.9.5 0909f9b Doc: Bump version to 5.11.0 55fee3b Doc: Bump version to 5.9.4 89033ce Doc: Bump version to 5.9.3 Change-Id: I17ac5f2e2ef94535458b07cf8db38688e25ca21c
Diffstat (limited to 'basicsuite/ebike-ui/datamodelplugin/plugin.cpp')
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/plugin.cpp112
1 files changed, 112 insertions, 0 deletions
diff --git a/basicsuite/ebike-ui/datamodelplugin/plugin.cpp b/basicsuite/ebike-ui/datamodelplugin/plugin.cpp
new file mode 100644
index 0000000..098a6a8
--- /dev/null
+++ b/basicsuite/ebike-ui/datamodelplugin/plugin.cpp
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qt for Device Creation.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQml/QQmlExtensionPlugin>
+#include <QtQml/qqml.h>
+#include <QtQml/QQmlEngine>
+#include <QtQml/QQmlContext>
+#include <qdebug.h>
+
+#include "datastore.h"
+#include "tripdatamodel.h"
+#include "navigation.h"
+#include "mapbox.h"
+#include "mapboxsuggestions.h"
+#include "suggestionsmodel.h"
+#include "brightnesscontroller.h"
+#include "fpscounter.h"
+
+class QExampleQmlPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+
+ void registerTypes(const char *uri)
+ {
+ Q_UNUSED(uri);
+ qmlRegisterType<DataStore>("DataStore", 1, 0, "DataStore");
+ }
+
+ void initializeEngine(QQmlEngine *engine, const char *uri)
+ {
+ Q_UNUSED(uri);
+
+ // Setup data store for connection to backend server
+ DataStore *datastore = new DataStore(engine);
+ datastore->connectToServer("datasocket");
+
+ // Setup mapbox and suggestions
+ MapBox *mapbox = new MapBox(engine);
+ MapBoxSuggestions *suggest = new MapBoxSuggestions(mapbox, engine);
+
+ // Setup navigation container
+ Navigation *navi = new Navigation(mapbox, engine);
+
+ // Brightness controller
+ BrightnessController *brightness = new BrightnessController(engine);
+
+ // FPS counter
+ FpsCounter *fps = new FpsCounter(engine);
+
+ QQmlContext *context = engine->rootContext();
+ context->setContextProperty("datastore", datastore);
+ context->setContextProperty("tripdata", datastore->tripDataModel());
+ context->setContextProperty("navigation", navi);
+ context->setContextProperty("suggest", suggest);
+ context->setContextProperty("suggestions", suggest->suggestions());
+ context->setContextProperty("brightness", brightness);
+ context->setContextProperty("fps", fps);
+ }
+};
+
+
+#include "plugin.moc"