aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-03-31 10:19:05 +0200
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-03-31 10:20:34 +0200
commitefac3cd245e2610924133e304d15bf726f5864f5 (patch)
treec872124a0ea7c40056b69babaf14478f0cb02ce4
parent99c09ff33b7516a568455c6980f0f81c59a4fb3a (diff)
parent30ee95cd19f9a435ce337b4f651175ed2e8ba2e5 (diff)
Merge remote-tracking branch 'origin/1.1' into '1.2'v1.2.0-beta1v1.2.0
Conflicts: .qmake.conf LICENSE.LGPLv21 LICENSE.LGPLv3 src/enginio_client/chunkdevice_p.h src/enginio_client/enginio.h src/enginio_client/enginiobackendconnection.cpp src/enginio_client/enginiobackendconnection_p.h src/enginio_client/enginiobasemodel.h src/enginio_client/enginiobasemodel_p.h src/enginio_client/enginioclient.cpp src/enginio_client/enginioclient.h src/enginio_client/enginioclient_global.h src/enginio_client/enginioclient_p.h src/enginio_client/enginioclientconnection.h src/enginio_client/enginiodummyreply.cpp src/enginio_client/enginiodummyreply_p.h src/enginio_client/enginiofakereply.cpp src/enginio_client/enginiofakereply_p.h src/enginio_client/enginioidentity.cpp src/enginio_client/enginioidentity.h src/enginio_client/enginiomodel.cpp src/enginio_client/enginiomodel.h src/enginio_client/enginiooauth2authentication.h src/enginio_client/enginioobjectadaptor_p.h src/enginio_client/enginioreply.cpp src/enginio_client/enginioreply.h src/enginio_client/enginioreply_p.h src/enginio_client/enginioreplystate.h src/enginio_client/enginiostring.cpp src/enginio_client/enginiostring_p.h src/enginio_plugin/enginioplugin.cpp src/enginio_plugin/enginioplugin_p.h src/enginio_plugin/enginioqmlclient.cpp src/enginio_plugin/enginioqmlclient_p.h src/enginio_plugin/enginioqmlclient_p_p.h src/enginio_plugin/enginioqmlmodel.cpp src/enginio_plugin/enginioqmlmodel_p.h src/enginio_plugin/enginioqmlobjectadaptor_p.h src/enginio_plugin/enginioqmlreply.cpp src/enginio_plugin/enginioqmlreply_p.h tests/auto/common/common.cpp tests/auto/common/common.h tests/auto/enginioclient/tst_enginioclient.cpp tests/auto/enginiomodel/tst_enginiomodel.cpp tests/auto/files/tst_files.cpp tests/auto/identity/common/identitycommon.h tests/auto/identity/oauth2authentication/tst_oauth2authentication.cpp tests/auto/notifications/tst_notifications.cpp tests/auto/qmltests/tst_enginioclient.qml tests/auto/qmltests/tst_enginioreply.qml tests/auto/qmltests/tst_files.qml tests/auto/qmltests/tst_identity.qml tests/auto/qmltests/tst_model.qml tests/auto/qmltests/tst_qmltest.cpp tests/auto/qmltests/tst_query.qml Change-Id: Icb6a167ba58b41e1a8e4d2c8f78213eae9472864
-rw-r--r--dist/changes-1.0.622
-rw-r--r--dist/changes-1.1.031
-rw-r--r--doc/enginio_overview.qdoc230
-rw-r--r--doc/qtenginiooverview.qdocconf4
-rw-r--r--examples/enginio/quick/image-gallery/doc/src/image-gallery.qdoc10
-rw-r--r--examples/enginio/quick/todos/doc/src/todos.qdoc47
-rw-r--r--examples/enginio/widgets/cloudaddressbook/doc/src/cloudaddressbook.qdoc8
-rw-r--r--examples/enginio/widgets/image-gallery-cpp/doc/src/image-gallery-cpp.qdoc2
-rw-r--r--examples/enginio/widgets/todos-cpp/doc/src/todos-cpp.qdoc119
-rw-r--r--qtenginio.pro2
-rw-r--r--src/enginio_client/doc/qtenginio.qdocconf2
-rw-r--r--src/enginio_client/enginioidentity.cpp8
-rw-r--r--src/enginio_client/enginiomodel.cpp2
-rw-r--r--src/enginio_client/enginioreply.cpp8
-rw-r--r--src/enginio_plugin/enginioplugin.cpp57
-rw-r--r--sync.profile6
-rw-r--r--tests/auto/common/testfiles.qrc5
-rw-r--r--tests/auto/enginioclient/enginioclient.pro2
-rw-r--r--tests/auto/enginiomodel/enginiomodel.pro2
-rw-r--r--tests/auto/files/files.pro5
-rw-r--r--tests/auto/files/tst_files.cpp2
21 files changed, 401 insertions, 173 deletions
diff --git a/dist/changes-1.0.6 b/dist/changes-1.0.6
new file mode 100644
index 0000000..97a8f05
--- /dev/null
+++ b/dist/changes-1.0.6
@@ -0,0 +1,22 @@
+Enginio 1.0.6 is a bug-fix release. It maintains both forward and backward
+compatibility(source and binary) with Enginio 1.0 series.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+ http://qt-project.org/doc/qt-5/
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+ http://bugreports.qt-project.org/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+
+****************************************************************************
+* General *
+****************************************************************************
+
+ - Fixed static build on Windows
diff --git a/dist/changes-1.1.0 b/dist/changes-1.1.0
new file mode 100644
index 0000000..ccf161a
--- /dev/null
+++ b/dist/changes-1.1.0
@@ -0,0 +1,31 @@
+Enginio 1.1.0 is a feature release. It maintains backward compatibility
+with Enginio 1.0
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+ http://qt-project.org/doc/qt-5/
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+ http://bugreports.qt-project.org/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+
+***************************************************************************
+
+
+EnginioModel
+------------
+ - Automatically refresh EnginioModel content when identity changes.
+ - Added reload() function to EnginioModel to force a refresh of model data.
+ - Allow to update multiple properties of an item in one setData function
+ call. It can be achieved by using Enginio::JsonObjectRole.
+
+
+EnginioClient
+------------
+ - Allow to directly query objects through object's id
diff --git a/doc/enginio_overview.qdoc b/doc/enginio_overview.qdoc
index cccadef..e03be94 100644
--- a/doc/enginio_overview.qdoc
+++ b/doc/enginio_overview.qdoc
@@ -28,17 +28,26 @@
/*!
\page enginio-index.html
\contentspage {enginio-index.html}{Contents}
-\nextpage Enginio Installation and Prerequisites
+\nextpage Enginio Installation Notes and Prerequisites
\title Enginio Manual
-Enginio is a Backend-as-a-Service solution to ease backend development for any connected and data-driven application.
+This manual shows how to use the Enginio library in a Qt application.
+Both C++ and QML applications are covered. The manual is also used when
+integrating Enginio into an existing Qt project.
-\section1 Tutorials
+Enginio is a \l {http://en.wikipedia.org/wiki/Backend_as_a_service}
+{Backend-as-a-Service} solution for simplifying backend development
+of connected and data-driven applications.
+
+\section1 Getting Started
+
+First read the installation notes and prerequisites, then follow one
+of the short tutorials for using Enginio, either with QT Quick or with
+C++.
-To get started quickly, follow the mini-tutorial using Qt Quick or C++.
\list
-\li \l {Enginio Installation and Prerequisites}
+\li \l {Enginio Installation Notes and Prerequisites}
\li \l {Getting Started with Enginio using Qt Quick}
\li \l {Getting Started with Enginio using C++}
\endlist
@@ -47,26 +56,38 @@ To get started quickly, follow the mini-tutorial using Qt Quick or C++.
\list
\li \l {Enginio C++ Classes and Examples}
\li \l {Enginio QML Types and Examples}
+
+Enginio documentation is also available at the
+\l {https://developer.qtcloudservices.com} {Qt Cloud Services}
+website \l{http://engin.io/documentation/} {here}.
+
\endlist
-\section1 Overview
+\section1 Enginio Overview
-When using Enginio (with Qt Quick or C++), the API is following a general pattern that will be helpful to understand.
-This section gives a short, high-level overview of the concepts used throughout the library.
+The Enginio APIs have a general pattern that is useful to understand.
+This section gives a short overview of the API concepts used
+throughout the library.
-The Qt library is a client-side library to communicate with the server at \l {http://engin.io}.
-Several \e backends can exist for each account on the server.
-For all communication with the server, the \e backend is determined by its \e id.
-When shipping an application built with Enginio, the \c {backend id} will be the same for all users of that application.
+Enginio is a client-side library for communicating with the server
+at \l {http://engin.io}. Multiple \e backends can exist in each
+server account. When communicating with the server, the backend is
+specified by a \b {backend id}. When multiple users load an Enginio
+application, the all use the same \b {backend id}.
\section2 Objects
-Enginio provides several types of objects: \c {custom objects}, \c users, \c {user groups}, \e files, and more.
-All communication with the backend uses JSON. When writing QML, JSON can simply be written inline.
-On the C++ side, \l QJsonObject and \l QJsonValue are used.
+Enginio provides several types of objects. These include users, user
+groups, files, custom objects, and more. All communications with the
+backend use \l {http://json.org} {JSON}. When using the QML API, JSON
+objects are simply written inline. When using the C++ API, the
+\l QJsonObject and \l QJsonValue classes are used.
+
+Each JSON object in Enginio has the reserved properties \c id,
+\c objectType, \c createdAt, and \c updatedAt. For example,
+a custom object with no user-defined properties will look like
+this in JSON:
-Each object in the database has an \c id, \c objectType, \c createdAt and \c updatedAt property that are reserved and always exist.
-For example, a custom object with no additional properties (in JSON) might look like this:
\code
{
"id": "51cdbc08989e975ec300772a",
@@ -75,33 +96,58 @@ For example, a custom object with no additional properties (in JSON) might look
"updatedAt": "2013-06-28T16:38:32.725Z"
}
\endcode
-With this basis, the objects can be augmented with user defined properties that contain the actual application data and can
-even contain other objects.
-For a more detailed description see the \l{http://engin.io/documentation/overview/objects}{Enginio Object documentation}.
-\section2 Operations
+But custom object types are normally augmented with user-defined
+properties that contain the application-specific data. A user-defined
+property can also contain a JSON object. For a more detailed description of
+Enginio objects, see the \l{http://engin.io/documentation/overview/objects}
+{Enginio Object documentation}.
-To operate on objects of any type, the basic operations are:
-\list
-\li create: create a new object
-\li query: list objects
-\li update: change an object
-\li remove: delete an object
-\endlist
-
-For a detailed description of the operations see the functions
-in the \l {EnginioClientCpp}{EnginioClient Class} in C++ or \l {EnginioClientQml}{EnginioClient type} in QML.
+\section2 Operations
-\note User management and access control lists are conveniently done by the same functions.
+The basic operations on objects are shown in the table below.
+For a complete list of operations see the
+\l [CPP] {EnginioClient} {EnginioClient for C++} or the
+\l [QML] {EnginioClient} {EnginioClient for QML}.
+
+\table
+\header
+\li Operation
+\li Description
+\li C++
+\li QML
+\row
+\li create
+\li Insert a new object into the database
+\li \l [CPP] {EnginioClient::create()}
+\li \l [QML] {EnginioClient::create()}
+\row
+\li query
+\li Query the database
+\li \l [CPP] {EnginioClient::query()}
+\li \l [QML] {EnginioClient::query()}
+\row
+\li update
+\li Update an object in the database
+\li \l [CPP] {EnginioClient::update()}
+\li \l [QML] {EnginioClient::update()}
+\row
+\li remove
+\li Remove an object from the database
+\li \l [CPP] {EnginioClient::remove()}
+\li \l [QML] {EnginioClient::remove()}
+\endtable
+
+\note User and access control list management are also performed using
+these same functions.
\section2 File Management
-For file management, the operations are slightly different.
-Files are always attached to objects and can only be referenced through them.
-The Qt library provides convenient functions to upload and download files.
+For file management, these operations are slightly different in that
+files are always attached to objects and can only be accessed through
+their objects. The Qt library provides convenient functions to upload
+and download files.
-The entire Enginio documentation, including backend and client, is available here:
-\l{http://engin.io/documentation/}{Enginio Documentation}
*/
/*!
@@ -109,47 +155,81 @@ The entire Enginio documentation, including backend and client, is available her
\nextpage Getting Started with Enginio using Qt Quick
\previouspage {enginio-index.html}{Enginio Manual}
-\title Enginio Installation and Prerequisites
+\title Enginio Installation Notes and Prerequisites
+
+\section1 Installation Notes
-This guide shows how to use the Enginio Qt library in a Qt application
-(both Qt C++ and QML cases are covered).
-This guide can be also applied when integrating Enginio with existing Qt projects.
+Enginio is packaged with Qt beginning with Qt 5.2. When starting the
+Qt installation, ensure that the Enginio component in the \e {Qt Cloud
+Services} category is selected.
+
+Enginio requires OpenSSL to be installed, except for iOS, where the
+native SSL framework is used instead.
+
+\note For Qt 5.2.0, Enginio comes in the online installer only.
\section1 Prerequisites
-Enginio comes with Qt 5.2 and later (for 5.2.0 only in the online installer).
-Make sure to select the Enginio component in the \e {Qt Cloud Services} category.
+A Qt Account is required to use the
+\l{https://console.qtcloudservices.com} {Qt Cloud Services}. A Qt
+Account can be created at \l{Qt Account Sign-up}.
+
+To run an Enginio Client application to use
+\l{https://console.qtcloudservices.com} {Qt Cloud Services},
+the \c{backend id} of an Engino Data Storage Instance is required.
+
+Sign in to \l{https://console.qtcloudservices.com/login} {Qt Cloud
+Services} using the Qt Account. Under \uicontrol {Enginio Data
+Storage} (EDS), press the \uicontrol {Launch instance} button to create
+a new cloud instance. Enter the name for the new instance and select
+a data center. Then press \uicontrol {Create}.
+
+A dialog of the new instance appears showing the \uicontrol {General}
+tab. Here the instance \uicontrol {Name}, \uicontrol {ID}, and
+\uicontrol {Address} are shown. Select the \uicontrol {Environment}
+tab to show the \uicontrol {EDS_BACKEND_ID} and the
+\uicontrol {EDS_INSTANCE ADDRESS}. These values can be cut and pasted
+into the examples where required.
-\note Make sure to have OpenSSL installed for Enginio to work. On iOS, OpenSSL is not
-required as the native SSL framework is used.
+\note Some of the examples have built-in \uicontrol {EDS_BACKEND_ID}s.
+
+Select the \uicontrol {Configure} tab and press the \uicontrol {Open}
+button. This opens the dashboard for the new instance in a new browser
+tab. The dashboard is used for instance management.
+
+These instructions are also found in
+\l{https://developer.qtcloudservices.com/qtc/getting-started}
+{Getting Started With Qt Cloud Services}. Reading the documentation at
+\l{https://developer.qtcloudservices.com/} {Qt Cloud Services Developers}
+is also recommended.
*/
/*!
\page enginio-qml.html
\nextpage Getting Started with Enginio using C++
-\previouspage Enginio Installation and Prerequisites
+\previouspage Enginio Installation Notes and Prerequisites
\title Getting Started with Enginio using Qt Quick
\brief Introduction to using Enginio using Qt Quick
\section1 Setup a Qt Quick 2 application project
-Create a new Qt Quick 2 Application.
+Create a new \l [QtQuick] {Qt Quick} {Qt Quick 2} Application.
-You can use Qt Creator to get started with a template.
-(File ⇒ New File or Project ⇒ Applications ⇒ Qt Quick 2 Application)
+Qt Creator can be used to create a template.
+\uicontrol {File ⇒ New File or Project ⇒ Applications ⇒ Qt Quick 2 Application}
\section1 Initialize Enginio Client
-To use Enginio's QML API, you have to import the library.
-\code
+To use Enginio's QML API, the Enginio library must be imported.
+\badcode
import Enginio 1.0
\endcode
-Initialize the \l{EnginioClientQml}{EnginioClient} with the \c {backend id} value, which can be copied from the Dashboard.
+Initialize the \l [QML] {EnginioClient} with the \b {backend id} value, which can be copied from the Dashboard.
-Go to Dashboard ⇒ Your Backend home-view ⇒ See ’Keys box’ ⇒ Copy backend id value.
+Go to \uicontrol{Dashboard ⇒ The Backend home-view ⇒ See ’Keys box’ ⇒ Copy backend id value}.
\code
EnginioClient {
@@ -158,9 +238,9 @@ EnginioClient {
}
\endcode
-\section1 Store your first Object
+\section1 Store the First Object
-Now you can store an \e object with Enginio. First, create an \e object in JSON format and fill it with data as needed.
+Now an \e object can be stored with Enginio. First, create an \e object in JSON format and fill it with data as needed.
Then call create on the client with the JSON object as a parameter.
\code
@@ -174,7 +254,7 @@ Component.onCompleted: {
}
\endcode
-Now you can \l{Checking stored objects in the Dashboard}{check the Enginio dashboard} for the newly created object.
+\l{Checking stored objects in the Dashboard}{Check the Enginio dashboard} for the newly created object.
*/
@@ -186,35 +266,36 @@ Now you can \l{Checking stored objects in the Dashboard}{check the Enginio dashb
\title Getting Started with Enginio using C++
\brief Introduction to using Enginio using C++
-\section1 Setup Qt application project
+\section1 Setup Qt Application Project
-You need to link to Enginio. For qmake-based projects simply add
-\code
+To link to Enginio in a qmake-based project, add the line shown below
+to the \c .pro file.
+
+\badcode
QT += enginio
\endcode
-to your \c .pro file.
\section1 Initialize Enginio Client
-To use the Enginio Qt library in your code, you have to include relevant library headers.
+To use the Enginio library, the required library headers must be included.
\code
#include <Enginio/Enginio>
\endcode
-Before making any calls to the Enginio API, the \l EnginioClient needs to be instantiated.
-To do this, you will also need the \c {id} of the backend, which can be copied from the Dashboard.
-Go to the \l{https://dashboard.engin.io/}{Enginio Dashboard} and select a backend.
-Copy the \c {backend id} value.
+Then an \l EnginioClient must be instantiated. The client requires
+a \c{backend id}, which can be copied from the Dashboard. Go to the
+\l{https://dashboard.engin.io/}{Enginio Dashboard} and select a backend.
+Copy the \b {backend id} value.
\code
QByteArray backendId("YOUR_OWN_BACKEND_ID");
EnginioClient *client = new EnginioClient;
client->setBackendId(backendId);
\endcode
-For testing purposes, it is easiest to hardcode the \c {backend id} directly into application code.
+For testing purposes, it is easiest to hardcode the \b {backend id} directly into application code.
However, this might not be always the best choice, and sometimes it might be beneficial
to put the backend configuration in a separate configuration file.
-\section1 Store your first Object
+\section1 Storing the First Object
Create an object in JSON format and fill in the data:
\code
@@ -224,15 +305,15 @@ Create an object in JSON format and fill in the data:
city.insert("population", 624000);
\endcode
-Create the object in the Enginio database by calling \l{EnginioClient}{EnginioClient::create()}:
+Create the object in the Enginio database by calling \l {EnginioClient::create()}:
\code
client->create(city);
connect(client, SIGNAL(finished(EnginioReply*)), this, SLOT(uploadFinished(EnginioReply*)));
\endcode
-Note that the \c create() method performs the actual asynchronous network communication.
-You need to wait for its completion by connecting to the \l{EnginioClient::finished()}{finished} and \l{EnginioClient::error()}{error} signals.
+Note that the \l {EnginioClient::create()} {create()} method performs the actual asynchronous network communication.
+Wait for completion by connecting to the \l{EnginioClient::finished()}{finished} and \l{EnginioClient::error()}{error} signals.
-Now you can \l{Checking stored objects in the Dashboard}{check the Enginio dashboard} for the newly created object.
+\l{Checking stored objects in the Dashboard}{Check the Enginio dashboard} for the newly created object.
*/
@@ -241,8 +322,9 @@ Now you can \l{Checking stored objects in the Dashboard}{check the Enginio dashb
\title Checking Stored Objects in the Dashboard
\previouspage Getting Started with Enginio using C++
-When you have successfully stored objects with Qt C++ or QML code, go to your \l{https://dashboard.engin.io/}{Enginio Dashboard}
-and check the status there.
+When objects have been stored in the database using either the C++ or
+the QML code, go to the \l{https://dashboard.engin.io/}
+{Enginio Dashboard} and check the status there.
\list
\li Select the Objects view from the top navigation bar.
@@ -260,7 +342,7 @@ To get convenient access to objects stored in Enginio, consider using \l Enginio
\title Enginio Tutorials
\list
-\li \l {Enginio Installation and Prerequisites}
+\li \l {Enginio Installation Notes and Prerequisites}
\li \l {Getting Started with Enginio using Qt Quick}
\li \l {Getting Started with Enginio using C++}
\endlist
diff --git a/doc/qtenginiooverview.qdocconf b/doc/qtenginiooverview.qdocconf
index abc7a99..bfc4fc7 100644
--- a/doc/qtenginiooverview.qdocconf
+++ b/doc/qtenginiooverview.qdocconf
@@ -11,13 +11,13 @@ headerdirs += .
imagedirs += images
-depends += qtcore qtgui qtwidgets qtnetwork qtdoc qtenginio qtenginioqml
+depends += qtcore qtgui qtwidgets qtnetwork qtquick qtdoc qtenginio qtenginioqml
qhp.projects = QtEnginioOverview
qhp.QtEnginioOverview.file = qtenginiooverview.qhp
qhp.QtEnginioOverview.namespace = org.qt-project.qtenginiooverview.$QT_VERSION_TAG
-qhp.QtEnginioOverview.virtualFolder = enginiooverview
+qhp.QtEnginioOverview.virtualFolder = qtenginiooverview
qhp.QtEnginioOverview.indexTitle = Enginio Manual
qhp.QtEnginioOverview.filterAttributes = enginio $QT_VERSION
diff --git a/examples/enginio/quick/image-gallery/doc/src/image-gallery.qdoc b/examples/enginio/quick/image-gallery/doc/src/image-gallery.qdoc
index 51e7f1a..8d37fad 100644
--- a/examples/enginio/quick/image-gallery/doc/src/image-gallery.qdoc
+++ b/examples/enginio/quick/image-gallery/doc/src/image-gallery.qdoc
@@ -35,7 +35,7 @@
and a button to upload more images.
\image image-gallery.png
- \section1 Backend configuration
+ \section1 Backend Configuration
The Enginio backend needs to be set up to get this example working.
Go to the Enginio Dashboard and create a new backend with the \c{Image Gallery} template.
@@ -62,19 +62,19 @@
Copy the \e {backend id} from the Enginio dashboard.
They need to be entered into the example when it is executed for the first time.
- \section1 The example code
+ \section1 The Example Code
- The first step is to set up the \l Enginio::EnginioClient client.
+ The first step is to set up the \l {EnginioClient} {Enginio client}.
\snippet image-gallery/image-gallery.qml client
- The model gets initialized with the client declared above.
+ Then the model is initialized with that client.
\snippet image-gallery/image-gallery.qml model
A delegate is needed to present the images nicely.
The model is used to get the list of image objects, but the images
are only attached to the objects as file references.
Thus the image's thumbnail is fetched by each delegate.
- \note in a real application it might be necessary to cache the images.
+ \note In a real application it might be necessary to cache the images.
The \c Component.onCompleted function is used to fetch the image.
When the delegate is created, it has the JSON image object data.
diff --git a/examples/enginio/quick/todos/doc/src/todos.qdoc b/examples/enginio/quick/todos/doc/src/todos.qdoc
index 74052ce..ef33072 100644
--- a/examples/enginio/quick/todos/doc/src/todos.qdoc
+++ b/examples/enginio/quick/todos/doc/src/todos.qdoc
@@ -31,17 +31,21 @@
\ingroup enginio-qml-examples
\inmodule enginio-qml
- In this example a simple list of objects is displayed in a ListView.
- Each item in the list is a "To Do" object which can be \e done or \e{not yet done}.
- Todos can be added and removed (when hovering with the mouse).
+ In this example a simple list of objects is displayed in a
+ ListView. Each item in the list is a "To Do" object which can be
+ \e done or \e{not yet done}. Todos can be added and removed (when
+ hovering with the mouse).
+
\image todolist.png
- In this simple schema the objects will only have two properties that are added
- to the default properties (such as creation date, which always exists):
- a string \c title and a bool \c completed. The object type will be created
- when a call to create, or, in this case, a call to \l{Enginio::EnginioModel::append()}{EnginioModel::append()} is made.
+ In this simple schema, the objects will only have two properties
+ that are added to the default properties (such as creation date,
+ which always exists): a string \c title and a bool \c completed.
+ The object type will be created when a call to create, or, in this
+ case, a call to \l{EnginioModel::append()}{EnginioModel::append()}
+ is made.
- A todo object will look like this (in JSON):
+ A todo object will look like this in \l {http://json.org} {JSON}:
\code
{
"title": "Buy Milk",
@@ -52,11 +56,12 @@
The example uses Qt Quick Controls, Layouts, and Enginio.
\snippet todos/todo.qml imports
- The first step is to create an \l{Enginio::EnginioModel} and
- the Enginio instance with the backend configuration.
- To get nice debug output in case something goes wrong, the onError signal in
- Enginio is handled. Since the error is a JSON object, JSON.stringify is used
- to format it to a string.
+ The first step is to create an \l{Enginio::EnginioModel} {Enginio model} and
+ its \l {EnginioClient} {Enginio client} with the backend configuration.
+ To get nice debug output in case something goes wrong, the client's
+ \l {EnginioClient::error} {onError} signal handler is implented. Since the
+ error is a \l {http://www.ecma-international.org/ecma-262/5.1/#sec-15.12}
+ {JSON object}, JSON.stringify is used to format it to a string.
\snippet todos/todo.qml model
@@ -64,15 +69,19 @@
properties of the Enginio objects are used.
\snippet todos/todo.qml view
- It is easy to add a new object to the model. By using the \l onAccepted
- signal handler of a \l TextField, the data is appended to the model. After appending
- the new Todo, the text gets cleared so that a new Todo can be entered.
+ It is easy to add a new Todo object to the model using a \l {TextInput}.
+ By implementing the \l {TextInput::accepted} {onAccepted} signal handler,
+ the Todo data is appended to the model. After appending the new Todo, the
+ \l {TextInput::text} {text property} is cleared so that the next Todo can
+ be entered.
\snippet todos/todo.qml append
- Inside the delegate, the data for the index is available by using the property names (\e title and \e completed).
- The \e title property is directly assigned to the text displayed on each list item. The \e completed
- boolean is used to display the item with a strikeout font and a light color.
+ Inside the delegate, the data for the index is available by using
+ the property names (\e title and \e completed). The \e title
+ property is directly assigned to the text displayed on each list
+ item. The \e completed boolean is used to display the item with a
+ strikeout font and a light color.
\snippet todos/todo.qml delegate-properties
diff --git a/examples/enginio/widgets/cloudaddressbook/doc/src/cloudaddressbook.qdoc b/examples/enginio/widgets/cloudaddressbook/doc/src/cloudaddressbook.qdoc
index 7864a5e..04caf70 100644
--- a/examples/enginio/widgets/cloudaddressbook/doc/src/cloudaddressbook.qdoc
+++ b/examples/enginio/widgets/cloudaddressbook/doc/src/cloudaddressbook.qdoc
@@ -44,7 +44,7 @@
Enginio backend. The backend can be created using the dashboard, where the Cloud Address Book preconfigured backend
can be chosen.
- \section1 Backend description
+ \section1 Backend Description
We recommend to use preconfigured backend, because it contains already all data and structures that are
needed to run these examples, but it is not difficult to create the backend from scratch too.
The backend should contain one custom object type \c objects.addressbook having properties:
@@ -58,7 +58,7 @@
All properties are of \c string type and have to be indexed, because only indexed properties will be searched
by the full text search.
- \section1 Application design
+ \section1 Application Design
The application's ui mainly consists of a table showing all addresses and a text filed where a query
can be typed. A user should be able to sort addresses or highlight an address containing a specified phrase.
@@ -67,7 +67,7 @@
\list
\li \l EnginioClient which encapsulates all information needed to keep the connection to the backend
\li \l EnginioModel which queries all addresses
- \li \l QSortFilterProxy which sorts the data
+ \li \l QSortFilterProxyModel which sorts the data
\li \l QTableView which shows the data
\endlist
@@ -80,7 +80,7 @@
\snippet cloudaddressbook/mainwindow.cpp model
EnginioModel can sort or filter data only initially, which means that, for example, a newly added
- item will not be placed correctly. To solve the problem QSortFilterProxy has to be used.
+ item will not be placed correctly. To solve the problem QSortFilterProxyModel has to be used.
\snippet cloudaddressbook/mainwindow.cpp assignProxyModel
Now is a time to look deeper into EngnioModel. EnginioModel should define data roles.
diff --git a/examples/enginio/widgets/image-gallery-cpp/doc/src/image-gallery-cpp.qdoc b/examples/enginio/widgets/image-gallery-cpp/doc/src/image-gallery-cpp.qdoc
index 2807863..c01e2d4 100644
--- a/examples/enginio/widgets/image-gallery-cpp/doc/src/image-gallery-cpp.qdoc
+++ b/examples/enginio/widgets/image-gallery-cpp/doc/src/image-gallery-cpp.qdoc
@@ -35,7 +35,7 @@
\image gallery-example.png
- \section1 Backend configuration
+ \section1 Backend Configuration
The \e Enginio \e backend needs to be set up in order to get this example working.
Go to the \e {Enginio Dashboard} and create a new backend with the \gui {Image Gallery} template.
diff --git a/examples/enginio/widgets/todos-cpp/doc/src/todos-cpp.qdoc b/examples/enginio/widgets/todos-cpp/doc/src/todos-cpp.qdoc
index 2b40b65..4852c38 100644
--- a/examples/enginio/widgets/todos-cpp/doc/src/todos-cpp.qdoc
+++ b/examples/enginio/widgets/todos-cpp/doc/src/todos-cpp.qdoc
@@ -27,21 +27,25 @@
/*!
\title Enginio C++ Examples - Todos
\example todos-cpp
- \brief The Todo example shows how to use the \l {EnginioModelCpp}{EnginioModel} with Qt Widgets.
+ \brief The Todo example shows how to use the \l {EnginioModel} with Qt Widgets.
\ingroup enginio-examples
\inmodule enginio-qt
- In this example, a simple list of objects is displayed in a \l QListView.
- Each item in the list is a "To Do" object which can be "done" or "not yet done".
- Todos can be added, removed, or altered.
+ In this example, a list of objects is displayed in a \l QTreeView.
+ Each item in the list is a \c {Todo} object, which can be marked
+ \c {Done} or \c {Not done}. A \c {Todo} can be added, removed,
+ or altered. We will be using the classes and concepts duscussed in
+ \l {Model/View Programming} {Model/View Programming}.
+
\image todo-example.png
- In this simple schema the objects will have two properties that are added
- to the default properties (such as creation date which always exists):
- a string "title" and a bool "completed". The object type will be created
- when a call to create, or in this case EnginoModel::append(), is made.
+ In this simple schema, each \c {ToDo} object will have two properties:
+ a \c {string} named \c {title} and a \c {bool} named \c {completed}.
+ These properties are added to the default properties e.g.: creation date,
+ which always exist.
+
+ A \c {Todo} object will look like this in \l {http://json.org} {JSON}:
- A todo object will look like this (in JSON):
\code
{
"title": "Buy Milk",
@@ -49,54 +53,91 @@
}
\endcode
- The first step is to create a TodosModel which inherits \l {EnginioModelCpp}{EnginioModel},
- and defines the main roles which will be used. As we are interested in the To Do \c title
- and the \c completed information we need to define these two roles.
- \snippet todos-cpp/todosmodel.h definition
-
- By default, views (for example \l QListView) use the \l{Qt::ItemDataRole} role to display or edit the content.
- The newly created \l{EnginioModelCpp}{EnginioModel} is empty and defines basic roles. Most roles are created
- dynamically, based on the JSON datastructure. They have no predefined value in the \l Qt::ItemDataRole enum.
- \l{EnginioModelCpp}{EnginioModel} automatically populates itself as soon as the
- \l{EnginioModel::query}{query} and \l{EnginioModel::client}{client} properties have been set.
- When the data is downloaded, the model resets itself, and sets up the internal data cache and roles names.
- \l{EnginioModelCpp}{EnginioModel} guesses the role names based on heuristics. It may be wrong if not all
- objects received from the backend have exactly the same structure. For example, a property can be missing
- in certain objects. To protect against such cases, we overload \l{EnginioModel::roleNames()}{roleNames()}.
- Overriding \l{EnginioModel::roleNames()}{roleNames()} can also be used to match default Qt roles to the named
- ones.
+ A ToDo object can be created and appended to an EnginioModel using
+ \l {EnginioModel::append()} {append()}, as shown in
+ \l {mainwindow_appenditem} {MainWindow::appendItem()}. Alternatively,
+ if many ToDo objects are to be added to the model all at once, they
+ can be inserted directly into the server database via the model's
+ \l {EnginioClient} {Enginio client}. The client is obtained from
+ the model with \l {EnginioModel::client()} {client()}. Then the
+ ToDo objects are inserted into the server database with the client's
+ \l {EnginioClient::create()} {create()} function. The model can then
+ be reloaded from the server with \l {EnginioModel::reload()} {reload()}.
+
+ But first we must create some infrastructure. Our \c{TodosModel}
+ class is declared in \l{todos-cpp/todosmodel.h}. It inherits
+ \l[CPP]{EnginioModel}, which is a \l{QAbstractListModel}{list
+ model}. We add two roles to the \l {Enginio::Role} {Enginio::Role
+ enum}, chosen for the new properties, one for the ToDo \c title
+ and one for marking a ToDo as \c{completed}. We assign enum values
+ to the new roles, equating \c{TitleRole} to
+ \l{Enginio::CustomPropertyRole}, which is itself equated to
+ \l{Qt::UserRole} + 10. \snippet todos-cpp/todosmodel.h definition
+
+ The new roles can be used for displaying and editing the values of
+ the new properties. Views of the model also use roles from in
+ \l{Qt::ItemDataRole} enum. The example's view is a \l {QTreeView},
+ as shown in the \l{todos-cpp/mainwindow.h} {MainWindow class},
+ which holds a pointer to the view, a pointer to the
+ \l{EnginioClient} {client}, and a pointer to the
+ \l{todos-cpp/todosmodel.h} {model}.
+
+ A new \l [CPP] {EnginioModel} is empty. It automatically populates itself
+ from the server, when its \l{EnginioModel::query}{query} and
+ \l{EnginioModel::client}{client} properties have both been set. In the
+ example, these properties are set in the constructor for the
+ \l {todos-cpp/mainwindow.cpp} {main window}. The \l {EnginioClient} is
+ created first. Then an instance of the \c ToDosModel is created, and its
+ client is set using EnginioModel::setClient(). Then the query is created
+ as a QJsonObject, and the model's query is set using EnginioModel::setQuery().
+
+ Once the ToDo data has been downloaded, the model resets itself, and sets up
+ the internal data cache and roles names. \l [CPP] {EnginioModel} guesses the
+ role names based on heuristics. It may be wrong if not all objects received
+ from the backend have exactly the same structure. For example, a property can
+ be missing in certain objects. To protect against such cases, we overload
+ \l{EnginioModel::roleNames()}{roleNames()}. Overriding
+ \l{EnginioModel::roleNames()}{roleNames()} can also be used to
+ match default Qt roles to the named ones.
\snippet todos-cpp/todosmodel.cpp roleNames
- In this example we map the \l Qt::DisplayRole and \l Qt::EditRole to the \c title property in the JSON.
- This way the right string is shown by default and editing works as expected.
+ In this example, we map the \l Qt::DisplayRole and \l Qt::EditRole
+ to the \c title property in the JSON. This way the right string
+ is shown by default and editing works as expected.
- Remember to always call the base class implementation to avoid situations in which the internal cache is not in sync.
+ Remember to always call the base class implementation to avoid
+ situations in which the internal cache is not in sync.
- By default \l {EnginioModelCpp}{EnginioModel} operates on \l{QJsonValue}, and that is
- what the \l{EnginioModel::data()}{data()} function returns inside the \l QVariant, but standard
- views, such as \l QListView, use predefined roles which do not map directly to our roles.
- That is why we need to write a mapping between them:
+ By default \l [CPP] {EnginioModel} operates on \l{QJsonValue}, and
+ that is what the \l{EnginioModel::data()}{data()} function returns
+ inside the \l QVariant, but standard views, such as \l QListView,
+ use predefined roles which do not map directly to our roles. That
+ is why we need to write a mapping between them:
\snippet todos-cpp/todosmodel.cpp data
- As we have our model defined, we need to create an instance of \l EnginioClient:
+ As we have our model defined, we need to create an instance of \l {EnginioClient}:
\snippet todos-cpp/mainwindow.cpp client
- It is used by the model to connect to the Enginio backend. Next we need to construct
- and configure our model too. The configuration is based on two steps, assigning
- an \l EnginioClient instance and by creating a query.
+ It is used by the model to connect to the Enginio backend. Next we
+ need to construct and configure our model too. The configuration
+ is based on two steps, assigning an \l {EnginioClient} instance
+ and by creating a query.
\snippet todos-cpp/mainwindow.cpp model
- The model has to be assigned to a view. In our case it is a \l QListView.
+ The model has to be assigned to a view. In this example it is a
+ \l QTreeView.
\snippet todos-cpp/mainwindow.cpp assignModel
- To make the application fully functional, a way to add and remove "To Dos" is needed.
- To do so, we need to connect the correct buttons to slots for adding a new item:
+ To make the application fully functional, a way to add and remove
+ a Todo is needed. To do so, we need to connect the correct
+ buttons to slots for adding a new item:
+ \target mainwindow_appenditem
\snippet todos-cpp/mainwindow.cpp appendItem
and for removing it:
diff --git a/qtenginio.pro b/qtenginio.pro
index 300ea20..799f04f 100644
--- a/qtenginio.pro
+++ b/qtenginio.pro
@@ -1,5 +1,5 @@
# iOS does not require OpenSSL and always passes
-!ios:requires(contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked))
+!ios:requires(contains(QT_CONFIG, ssl) | contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked))
lessThan(QT_MAJOR_VERSION, 5): error("The Enginio Qt library only supports Qt 5.")
load(configure)
diff --git a/src/enginio_client/doc/qtenginio.qdocconf b/src/enginio_client/doc/qtenginio.qdocconf
index ca1385c..c9037be 100644
--- a/src/enginio_client/doc/qtenginio.qdocconf
+++ b/src/enginio_client/doc/qtenginio.qdocconf
@@ -23,7 +23,7 @@ exampledirs += \
# Specify example install dir under QT_INSTALL_EXAMPLES
examplesinstallpath = enginio/widgets
-depends += qtcore qtgui qtwidgets qtnetwork qtenginiooverview
+depends += qtcore qtgui qtwidgets qtnetwork qtquick qtenginioqml qtenginiooverview
qhp.projects = QtEnginio
diff --git a/src/enginio_client/enginioidentity.cpp b/src/enginio_client/enginioidentity.cpp
index 4bbf4fe..910b9b3 100644
--- a/src/enginio_client/enginioidentity.cpp
+++ b/src/enginio_client/enginioidentity.cpp
@@ -216,11 +216,11 @@ public:
To authenticate an instance of EnginioClient called \a client such code may be used:
\code
- EnginioOAuth2Authentication identity;
- identity.setUser(_user);
- identity.setPassword(_user);
+ EnginioOAuth2Authentication *identity = new EnginioOAuth2Authentication(client);
+ identity->setUser(_user);
+ identity->setPassword(_password);
- client.setIdentity(&identity);
+ client->setIdentity(identity);
\endcode
Setting the identity will trigger an asynchronous request, resulting in EnginioClient::authenticationState()
diff --git a/src/enginio_client/enginiomodel.cpp b/src/enginio_client/enginiomodel.cpp
index 214725a..1a0fef1 100644
--- a/src/enginio_client/enginiomodel.cpp
+++ b/src/enginio_client/enginiomodel.cpp
@@ -406,7 +406,7 @@ EnginioBaseModel::~EnginioBaseModel()
\note Some objects may not contain value for a static role, it may happen
for example when an item is not in sync with the backend.
- \sa EnginioBaseModel::roleNames()
+ \sa QAbstractItemModel::roleNames()
*/
/*!
diff --git a/src/enginio_client/enginioreply.cpp b/src/enginio_client/enginioreply.cpp
index 4ae204d..60a15fa 100644
--- a/src/enginio_client/enginioreply.cpp
+++ b/src/enginio_client/enginioreply.cpp
@@ -270,8 +270,8 @@ bool EnginioReplyState::delayFinishedSignal()
/*!
\fn bool EnginioReply::isError() const
- \brief EnginioReplyState::isError returns whether this reply was unsuccessful
- \return true if the reply did not succeed
+ Returns whether this reply was unsuccessful.
+ Returns true if the reply did not succeed.
*/
bool EnginioReplyState::isError() const
@@ -282,8 +282,8 @@ bool EnginioReplyState::isError() const
/*!
\fn bool EnginioReply::isFinished() const
- \brief Returns whether this reply was finished or not
- \return true if the reply was finished, false otherwise.
+ Returns whether this reply was finished or not.
+ Returns true if the reply was finished.
*/
bool EnginioReplyState::isFinished() const
diff --git a/src/enginio_plugin/enginioplugin.cpp b/src/enginio_plugin/enginioplugin.cpp
index 4d98e8f..1fd2b7f 100644
--- a/src/enginio_plugin/enginioplugin.cpp
+++ b/src/enginio_plugin/enginioplugin.cpp
@@ -48,11 +48,11 @@
QT_BEGIN_NAMESPACE
/*!
- * \qmlmodule Enginio 1.0
- * \title Enginio QML Plugin
- *
- * The Enginio QML plugin provides access to the Enginio service through a set of
- * QML types.
+ \qmlmodule Enginio 1.0
+ \title Enginio QML Plugin
+
+ The Enginio QML plugin provides access to the Enginio service through a set of
+ QML types.
*/
class EnginioNetworkAccessManagerFactory: public QQmlNetworkAccessManagerFactory
@@ -77,11 +77,54 @@ void EnginioPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
engine->setNetworkAccessManagerFactory(&factory);
} else {
qWarning() << "Enginio client failed to install QQmlNetworkAccessManagerFactory"
- "on QML engine because a differnt factory is already attached, It"
- " is recomanded to use QNetworkAccessManager delivered by Enginio";
+ "on QML engine because a different factory is already attached, it"
+ " is recommended to use QNetworkAccessManager delivered by Enginio";
}
}
+/*!
+ \qmltype EnginioOAuth2Authentication
+ \since 5.3
+ \instantiates EnginioOAuth2Authentication
+ \inqmlmodule Enginio
+ \ingroup engino-qml
+ \target EnginioOAuth2AuthenticationQml
+ \brief Represents a user that is authenticated directly by the backend using OAuth2 standard.
+
+ This component can authenticate a user by verifying the user's login and password.
+ The user has to exist in the backend already.
+
+ To authenticate an instance of EnginioClient called \a client such code may be used:
+ \code
+ EnginioClient {
+ ...
+ identity: oauth2
+ }
+ EnginioOAuth2Authentication {
+ id: oauth2
+ user: "userName"
+ password: "userPassword"
+ }
+ \endcode
+
+ Setting the identity on the EnginioClient will trigger an asynchronous request, resulting in
+ EnginioClient::authenticationState changing.
+
+ \sa EnginioClient::authenticationState EnginioClient::identity EnginioClient::sessionAuthenticated
+ \sa EnginioClient::sessionAuthenticationError() EnginioClient::sessionTerminated()
+*/
+
+/*!
+ \qmlproperty string EnginioOAuth2Authentication::user
+ This property contains the user name used for authentication.
+*/
+
+/*!
+ \qmlproperty string EnginioOAuth2Authentication::password
+ This property contains the password used for authentication.
+*/
+
+
void EnginioPlugin::registerTypes(const char *uri)
{
// @uri Enginio
diff --git a/sync.profile b/sync.profile
index 8e2728b..e64033e 100644
--- a/sync.profile
+++ b/sync.profile
@@ -11,8 +11,8 @@
# - an empty string to use the same branch under test (dependencies will become "refs/heads/master" if we are in the master branch)
#
%dependencies = (
- "qtbase" => "",
- "qtdeclarative" => "",
- "qtxmlpatterns" => "",
+ "qtbase" => "refs/heads/5.5",
+ "qtdeclarative" => "refs/heads/5.5",
+ "qtxmlpatterns" => "refs/heads/5.5",
);
diff --git a/tests/auto/common/testfiles.qrc b/tests/auto/common/testfiles.qrc
new file mode 100644
index 0000000..6a04189
--- /dev/null
+++ b/tests/auto/common/testfiles.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file alias="enginio.png">enginio.png</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/enginioclient/enginioclient.pro b/tests/auto/enginioclient/enginioclient.pro
index 772662b..7c07d2e 100644
--- a/tests/auto/enginioclient/enginioclient.pro
+++ b/tests/auto/enginioclient/enginioclient.pro
@@ -1,8 +1,6 @@
QT += testlib enginio
QT -= gui
-DEFINES += TEST_FILE_PATH=\\\"$$_PRO_FILE_PWD_/../common/enginio.png\\\"
-
TARGET = tst_enginioclient
CONFIG += console testcase
CONFIG -= app_bundle
diff --git a/tests/auto/enginiomodel/enginiomodel.pro b/tests/auto/enginiomodel/enginiomodel.pro
index 64c0742..ea2c8a6 100644
--- a/tests/auto/enginiomodel/enginiomodel.pro
+++ b/tests/auto/enginiomodel/enginiomodel.pro
@@ -1,7 +1,5 @@
QT += testlib enginio widgets
-DEFINES += TEST_FILE_PATH=\\\"$$_PRO_FILE_PWD_/../common/enginio.png\\\"
-
TARGET = tst_enginiomodel
CONFIG += console testcase
CONFIG -= app_bundle
diff --git a/tests/auto/files/files.pro b/tests/auto/files/files.pro
index ae191b7..e739874 100644
--- a/tests/auto/files/files.pro
+++ b/tests/auto/files/files.pro
@@ -1,7 +1,5 @@
QT += testlib enginio enginio-private core-private
-DEFINES += TEST_FILE_PATH=\\\"$$_PRO_FILE_PWD_/../common/enginio.png\\\"
-
TARGET = tst_files
CONFIG += console testcase
CONFIG -= app_bundle
@@ -10,4 +8,5 @@ include(../common/common.pri)
TEMPLATE = app
-SOURCES += tst_files.cpp \ No newline at end of file
+SOURCES += tst_files.cpp
+RESOURCES += ../common/testfiles.qrc
diff --git a/tests/auto/files/tst_files.cpp b/tests/auto/files/tst_files.cpp
index 1360f5d..651de68 100644
--- a/tests/auto/files/tst_files.cpp
+++ b/tests/auto/files/tst_files.cpp
@@ -138,7 +138,7 @@ void tst_Files::fileUploadDownload()
QVERIFY(!_id.isEmpty());
QString fileName = QStringLiteral("test.png");
- QString filePath = QStringLiteral(TEST_FILE_PATH);
+ QString filePath = QFINDTESTDATA(QStringLiteral("enginio.png"));
QFile file(filePath);
QVERIFY(file.exists());
QString fileId;