diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-01-21 13:21:53 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-01-21 13:21:57 +0100 |
commit | b72fcd31c02a3f1b197ef2ca67c9692b6081ba94 (patch) | |
tree | 92d7d86e3f7b558727d1d9a63b0955858d7cab01 | |
parent | 022b06541fed57825e1ec379ad60d558fb93c6fb (diff) | |
parent | de5e3c6631c0bfd8562feb050339187a55116b4f (diff) |
Merge remote-tracking branch 'origin/stable' into release
Change-Id: I4127820ff319208899d0a2f4e80404365c6946b3
29 files changed, 237 insertions, 170 deletions
diff --git a/.qmake.conf b/.qmake.conf index fe0d887..ca0b710 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,3 +1,5 @@ load(qt_build_config) +CONFIG += warning_clean +CONFIG += qt_example_installs MODULE_VERSION = 1.0.1 diff --git a/doc/enginio_global.qdocconf b/doc/enginio_global.qdocconf new file mode 100644 index 0000000..e4b0c01 --- /dev/null +++ b/doc/enginio_global.qdocconf @@ -0,0 +1,2 @@ +navigation.homepage = "Enginio $QT_VER" +buildversion = "Enginio $QT_VERSION Reference Documentation"
\ No newline at end of file diff --git a/doc/enginio_overview.qdoc b/doc/enginio_overview.qdoc index aa20a27..6ae91ff 100644 --- a/doc/enginio_overview.qdoc +++ b/doc/enginio_overview.qdoc @@ -119,34 +119,13 @@ This guide can be also applied when integrating Enginio with existing Qt project \section1 Prerequisites -You can use Enginio with an existing installation of Qt 5.2 or later, or get Qt packages containing Engino (starting with Qt 5.2). +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 \tt{Qt Cloud Services} category. -\list - \li Development environment (Linux, Windows or Mac OS X) and compiler toolchain. - \li Qt framework, 5.2 or newer - \li OpenSSL to enable SSL support in Qt. - Install the OpenSSL binaries into your system and Qt will automatically pick them up. - - \list - \li Mac OS X: the OpenSSL library should be preinstalled in the system - \li Linux: Most distributions have a preinstalled OpenSSL library. If yours doesn't, install libssl via your distribution's package manager - \li Windows: Install Win32 OpenSSL (light version is enough, copy DLLs to windows system directory when asked) - \endlist - - \li Perl 5.10 or newer to enable Qt5 module compilation - \list - \li Mac OS X: Perl should exist as preinstalled in the system - \li Linux: Perl should exist as preinstalled in the system - \li Windows: Install some Perl distribution - \endlist -\endlist +\note Make sure to have OpenSSL installed for Enginio to work. -\section1 Install Enginio Qt library +On iOS openSSL is not required since the native SSL framework is used. -\list - \li Download the latest library release for your platform - \li Execute downloaded binary installer and follow instructions -\endlist */ /*! diff --git a/doc/qtenginiooverview.qdocconf b/doc/qtenginiooverview.qdocconf index c6faf29..3c8c701 100644 --- a/doc/qtenginiooverview.qdocconf +++ b/doc/qtenginiooverview.qdocconf @@ -1,8 +1,11 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) +include(enginio_global.qdocconf) + project = QtEnginioOverview description = Enginio Client Library url = http://engin.io +version = $QT_VERSION sourcedirs += . headerdirs += . @@ -14,13 +17,13 @@ depends += qtcore qtgui qtwidgets qtnetwork qtdoc qtenginio qtenginioqml qhp.projects = QtEnginioOverview qhp.QtEnginioOverview.file = qtenginiooverview.qhp -qhp.QtEnginioOverview.namespace = io.engin.overview.101 +qhp.QtEnginioOverview.namespace = io.engin.overview.$QT_VERSION_TAG qhp.QtEnginioOverview.virtualFolder = enginiooverview qhp.QtEnginioOverview.indexTitle = Enginio Manual -qhp.QtEnginioOverview.filterAttributes = enginio 1.0.1 -qhp.QtEnginioOverview.customFilters.Qt.name = Enginio 1.0.1 -qhp.QtEnginioOverview.customFilters.Qt.filterAttributes = enginio 1.0.1 +qhp.QtEnginioOverview.filterAttributes = enginio $QT_VERSION +qhp.QtEnginioOverview.customFilters.Qt.name = Enginio $QT_VERSION +qhp.QtEnginioOverview.customFilters.Qt.filterAttributes = enginio $QT_VERSION qhp.QtEnginioOverview.subprojects = manual qhp.QtEnginioOverview.subprojects.manual.title = Manual diff --git a/doc/shared/client-create.qdocinc b/doc/shared/client-create.qdocinc new file mode 100644 index 0000000..abf060d --- /dev/null +++ b/doc/shared/client-create.qdocinc @@ -0,0 +1,26 @@ +\brief Insert a new \a object into the database. + +The returned \l EnginioReply indicates the success of the object creation. +The object becomes available from the backend if it finishes without errors. + +\a operation determines the kind of object created. For example a regular object +or a user or usergroup. +By default, \l Enginio::ObjectOperation is used and regular objects created. +\note that the \tt objectType is required for regular objects and has to begin with +\tt {"objects."}. + +The JSON for the object that will be created must follow this structure: +\code +{ + "objectType": "object.myType", + "name" : "A thing", + "price" : "5", +} +\endcode +Where only the \tt objectType property is required and \tt name and \tt price +are examples of custom properties. + +Users and all kinds of other objects are created the same way but do not require any +\tt objectType. + +\sa EnginioReply, query(), update(), remove(), Enginio::Operation diff --git a/doc/shared/client-downloadUrl.qdocinc b/doc/shared/client-downloadUrl.qdocinc new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/doc/shared/client-downloadUrl.qdocinc diff --git a/doc/shared/client-fullTextSearch.qdocinc b/doc/shared/client-fullTextSearch.qdocinc new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/doc/shared/client-fullTextSearch.qdocinc diff --git a/doc/shared/client-query.qdocinc b/doc/shared/client-query.qdocinc new file mode 100644 index 0000000..1c4499a --- /dev/null +++ b/doc/shared/client-query.qdocinc @@ -0,0 +1,37 @@ +\brief Query the database + +The \a query is an object containing the actual query to the backend. +The query will be run on the \a operation part of the backend. + +The \a query has to contain an "objectType" which has to point to a type defined +in the backend. Optionally, it can also contain: +\list +\li query - describes how objects are queried, allows filtering of results. See {https://engin.io/documentation/rest/parameters/queries} +{JSON query structure} +\li limit - limits how many objects the server should return (default value is \c 100). +\li offset - how many objects the server should skip from the beginning of the returned results. Note that the server keeps the data +in random order so that usage of offset implies using \c sort as well. +\li sort - describes how results are sorted. See \l{https://engin.io/documentation/rest/parameters/sort}{JSON sort request structure} +\li count - if the \c count is set, the server will return only count of matching objects +\li include - describes which other objects are included in the response. See \l{https://engin.io/documentation/rest/parameters/include} +{JSON include structure} +\endlist + +The JSON to list all objects of type "objects.image": +\code +{ + "objectType": "objects.image" +} +\endcode + +An example using \tt include to get \tt file references and with a query parameter that +limits the results to only those objects where the reference is valid: +\code +{ + "objectType": "objects.image", + "include": {"file": {}}, + "query" : { "file": { "$ne": null } } +} +\endcode + +\sa EnginioReply, create(), update(), remove() diff --git a/doc/shared/client-remove.qdocinc b/doc/shared/client-remove.qdocinc new file mode 100644 index 0000000..995554c --- /dev/null +++ b/doc/shared/client-remove.qdocinc @@ -0,0 +1,16 @@ +\brief Remove an object from the database. + +The \a object that is to be removed is identified by its object ID and if it is a regular object also \tt objectType. + +The JSON that identfies an object looks like this: +\code +{ + "objectType": "objects.images", + "id": "52b1a94b5a3d8b15b1037ff5" +} +\endcode + +The \a operation is the area from which the object gets removed. +It defaults to \l Enginio::ObjectOperation to remove regular objects by default. + +\sa EnginioReply, create(), query(), update() diff --git a/doc/shared/client-update.qdocinc b/doc/shared/client-update.qdocinc new file mode 100644 index 0000000..f1d0874 --- /dev/null +++ b/doc/shared/client-update.qdocinc @@ -0,0 +1,28 @@ +\brief Update an object in the database. + +The \a operation is the area in which the \a object gets updated. It defaults to \l Enginio::ObjectOperation +to update regular objects by default. + +To change the name property of an object to "New Name", use the following JSON: +\code +{ + "id": "objectId", + "objectType": "objects.objectType", + "name": "New Name" +} +\endcode + +All other existing properties of the object are not affected by the update. + +To update the access control list of an object, use the following JSON: +\code +{ + "id": "objectId", + "objectType": "objects.objectType", + "access": { "read": ["id": "userId", "objectTypes": "users"], + "update": ["id": "userId", "objectTypes": "users"], + "admin": ["id": "userId", "objectTypes": "users"] } +} +\endcode + +\sa EnginioReply, create(), query(), remove() diff --git a/doc/shared/client-uploadFile.qdocinc b/doc/shared/client-uploadFile.qdocinc new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/doc/shared/client-uploadFile.qdocinc diff --git a/doc/shared/model-append.qdocinc b/doc/shared/model-append.qdocinc new file mode 100644 index 0000000..cf1bb5d --- /dev/null +++ b/doc/shared/model-append.qdocinc @@ -0,0 +1,13 @@ +\brief Add a new \a object to the model and database. + +This function appends the new object to the local model cache +and makes an asynchronous request to the backend. + +Since adding an object to the database may fail for various reasons, +the returned reply must be kept and used for error handling (see \l EnginioReply). +If the operation fails, the object that was supposed to be appended will be removed +from the local model again. If the model is used in a view and the backend does +not accept the object because it violates a validator, it will be visible to the +user that a new row in the view appears and disappears again. + +\return the EnginioReply from the backend diff --git a/doc/shared/model-query.qdocinc b/doc/shared/model-query.qdocinc new file mode 100644 index 0000000..bdba13a --- /dev/null +++ b/doc/shared/model-query.qdocinc @@ -0,0 +1,19 @@ +\brief The query used to populate the model with data from the backend. + +It takes the same argument as \l EnginioClient::query(), so that the documentation +for \l EnginioClient::query() can be consulted regarding how to construct the query. + +While \l EnginioClient::query() returns the data of a query as a JSON +object, for the model the query will be interpreted as the model data. + +Usually the query is for one object type and will return all objects +in the database of that type. The model will then represent each returned object +as one row. It can be limited and sorted just like its counterpart +in EnginioClient. + +One important thing to note is that the model cannot keep the same sorting as +the backend and thus sorting and limits are only preserved until +an insertion or deletion happens. + +\return the EnginioReply from the backend +\sa EnginioClient::query() diff --git a/doc/shared/model-remove.qdocinc b/doc/shared/model-remove.qdocinc new file mode 100644 index 0000000..94de12d --- /dev/null +++ b/doc/shared/model-remove.qdocinc @@ -0,0 +1,8 @@ + +\brief Removes the \a row from the model and database. + +This function immediately removes the \a row from the local cache +and sends a remove request to the Enginio backend. + +\return the EnginioReply from the backend +\sa EnginioClient::remove()
\ No newline at end of file diff --git a/examples/enginio/common/backendhelper/BackendHelper.qml b/examples/enginio/common/backendhelper/BackendHelper.qml index d490f4f..f06f56b 100644 --- a/examples/enginio/common/backendhelper/BackendHelper.qml +++ b/examples/enginio/common/backendhelper/BackendHelper.qml @@ -82,10 +82,11 @@ Rectangle { verticalAlignment: Text.AlignVCenter font.pixelSize: 20 - text: "<html><head/><body><p>For the Enginio Examples to work the backend ID is needed. Please copy them from your <a href=\"http://engin.io\"><span style=\" text-decoration: underline; color:#0000ff;\">Enginio Dashboard.</span></a></p><p>Make sure to have the right type of backend or configure it manually according to the example's documentation. </p></body></html>" + text: "<html><head/><body><p>For the Enginio Examples to work the backend ID is needed. Please copy it from your <a href=\"http://engin.io\"><span style=\" text-decoration: underline; color:#0000ff;\">Enginio Dashboard</span></a>.</p><p>Make sure to have the right type of backend or configure it manually according to the example's documentation. </p></body></html>" color: "black" wrapMode: Text.Wrap + onLinkActivated: Qt.openUrlExternally(link) } Text { @@ -118,7 +119,7 @@ Rectangle { verticalAlignment: Text.AlignVCenter visible: !(parent.text.length || parent.inputMethodComposing) font: parent.font - text: "Place " + capitalise(enginioBackendContext.exampleName) + " example backend id here" + text: "backend id" color: "#aaa" } } diff --git a/examples/enginio/common/backendhelper/helperdialog.ui b/examples/enginio/common/backendhelper/helperdialog.ui index 4b97f64..299f8fd 100644 --- a/examples/enginio/common/backendhelper/helperdialog.ui +++ b/examples/enginio/common/backendhelper/helperdialog.ui @@ -17,7 +17,7 @@ <item> <widget class="QLabel" name="label_3"> <property name="text"> - <string><html><head/><body><p>For the Enginio Examples to work the backend ID is needed. Please copy them from your <a href="http://engin.io"><span style=" text-decoration: underline; color:#0000ff;">Enginio Dashboard.</span></a></p><p>Make sure to have the right type of backend or configure it manually according to the example's documentation. </p></body></html></string> + <string><html><head/><body><p>For the Enginio Examples to work the backend ID is needed. Please copy it from your <a href="http://engin.io"><span style=" text-decoration: underline; color:#0000ff;">Enginio Dashboard.</span></a></p><p>Make sure to have the right type of backend or configure it manually according to the example's documentation.</p></body></html></string> </property> <property name="wordWrap"> <bool>true</bool> 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 56816b0..7832203 100644 --- a/examples/enginio/quick/image-gallery/doc/src/image-gallery.qdoc +++ b/examples/enginio/quick/image-gallery/doc/src/image-gallery.qdoc @@ -28,7 +28,7 @@ \title Enginio QML Examples - Image Gallery \example image-gallery \brief This is an example that demonstrates uploading and downloading of files in Enginio. - \ingroup enginio-examples + \ingroup enginio-qml-examples \inmodule enginio-qml The user interface is a list of images with their meta-information diff --git a/examples/enginio/quick/socialtodos/doc/src/socialtodos.qdoc b/examples/enginio/quick/socialtodos/doc/src/socialtodos.qdoc index 05c6588..f756c90 100644 --- a/examples/enginio/quick/socialtodos/doc/src/socialtodos.qdoc +++ b/examples/enginio/quick/socialtodos/doc/src/socialtodos.qdoc @@ -29,7 +29,7 @@ \example socialtodos \brief Social Todos is a todo list application with a social twist, demonstrating the user management and access control features of Enginio. -\ingroup enginio-examples +\ingroup enginio-qml-examples \inmodule enginio-qml diff --git a/examples/enginio/quick/todos/doc/src/todos.qdoc b/examples/enginio/quick/todos/doc/src/todos.qdoc index 7d5d954..2bdc91b 100644 --- a/examples/enginio/quick/todos/doc/src/todos.qdoc +++ b/examples/enginio/quick/todos/doc/src/todos.qdoc @@ -28,7 +28,7 @@ \title Enginio QML Examples - Todos \example todos \brief The Todo example shows the EnginioModel usage in Qt Quick. - \ingroup enginio-examples + \ingroup enginio-qml-examples \inmodule enginio-qml In this example a simple list of objects is displayed in a ListView. diff --git a/examples/enginio/quick/users/doc/src/users.qdoc b/examples/enginio/quick/users/doc/src/users.qdoc index af321eb..c735ad7 100644 --- a/examples/enginio/quick/users/doc/src/users.qdoc +++ b/examples/enginio/quick/users/doc/src/users.qdoc @@ -29,7 +29,7 @@ \title Enginio QML Examples - Users \example users \brief The Users example introduces user registration, authentication and browsing. - \ingroup enginio-examples + \ingroup enginio-qml-examples \inmodule enginio-qml \section1 Introduction diff --git a/examples/enginio/widgets/cloudaddressbook/mainwindow.cpp b/examples/enginio/widgets/cloudaddressbook/mainwindow.cpp index 32352e7..f54ff2e 100644 --- a/examples/enginio/widgets/cloudaddressbook/mainwindow.cpp +++ b/examples/enginio/widgets/cloudaddressbook/mainwindow.cpp @@ -85,10 +85,10 @@ MainWindow::MainWindow(QWidget *parent) tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); //![assignProxyModel] - QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(this); - proxyModel->setSourceModel(model); + sortFilterProxyModel = new QSortFilterProxyModel(this); + sortFilterProxyModel->setSourceModel(model); tableView->setSortingEnabled(true); - tableView->setModel(proxyModel); + tableView->setModel(sortFilterProxyModel); //![assignProxyModel] // create the full text search based on searchEdit text value @@ -135,7 +135,8 @@ void MainWindow::onSelectionChanged() void MainWindow::onRemoveRow() { foreach (const QModelIndex &index, tableView->selectionModel()->selectedRows()) { - EnginioReply *reply = model->remove(index.row()); + QModelIndex sourceIndex = sortFilterProxyModel->mapToSource(index); + EnginioReply *reply = model->remove(sourceIndex.row()); QObject::connect(reply, &EnginioReply::finished, reply, &EnginioReply::deleteLater); } } diff --git a/examples/enginio/widgets/cloudaddressbook/mainwindow.h b/examples/enginio/widgets/cloudaddressbook/mainwindow.h index 7161792..979b08c 100644 --- a/examples/enginio/widgets/cloudaddressbook/mainwindow.h +++ b/examples/enginio/widgets/cloudaddressbook/mainwindow.h @@ -47,12 +47,14 @@ QT_BEGIN_NAMESPACE class EnginioClient; class EnginioReply; +class QSortFilterProxyModel; QT_END_NAMESPACE QT_USE_NAMESPACE class AddressBookModel; + class MainWindow : public QMainWindow, Ui_MainWindow { Q_OBJECT @@ -74,6 +76,7 @@ private: // Enginio object model containing addresses AddressBookModel *model; + QSortFilterProxyModel *sortFilterProxyModel; }; #endif // MAINWINDOW_H diff --git a/src/enginio_client/doc/qtenginio.qdocconf b/src/enginio_client/doc/qtenginio.qdocconf index e3e12e8..50bc32b 100644 --- a/src/enginio_client/doc/qtenginio.qdocconf +++ b/src/enginio_client/doc/qtenginio.qdocconf @@ -1,10 +1,15 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) +include(../../../doc/enginio_global.qdocconf) + project = QtEnginio description = Client library for Enginio url = http://engin.io +version = $QT_VERSION + +sourcedirs += .. \ + ../../../doc/shared -sourcedirs += .. headerdirs += .. imagedirs += images @@ -24,14 +29,14 @@ depends += qtcore qtgui qtwidgets qtnetwork qhp.projects = QtEnginio qhp.QtEnginio.file = qtenginio.qhp -qhp.QtEnginio.namespace = io.engin.101 +qhp.QtEnginio.namespace = io.engin.$QT_VERSION_TAG qhp.QtEnginio.virtualFolder = qtenginio qhp.QtEnginio.indexTitle = Enginio C++ Classes and Examples qhp.QtEnginio.indexRoot = -qhp.QtEnginio.filterAttributes = qtenginio 1.0.1 -qhp.QtEnginio.customFilters.Qt.name = Enginio 1.0.1 -qhp.QtEnginio.customFilters.Qt.filterAttributes = qtenginio 1.0.1 +qhp.QtEnginio.filterAttributes = qtenginio $QT_VERSION +qhp.QtEnginio.customFilters.Qt.name = Enginio $QT_VERSION +qhp.QtEnginio.customFilters.Qt.filterAttributes = qtenginio $QT_VERSION qhp.QtEnginio.subprojects = classes examples diff --git a/src/enginio_client/enginioclient.cpp b/src/enginio_client/enginioclient.cpp index 5fdd3f6..8c53ea5 100644 --- a/src/enginio_client/enginioclient.cpp +++ b/src/enginio_client/enginioclient.cpp @@ -504,30 +504,12 @@ EnginioReply *EnginioClient::fullTextSearch(const QJsonObject &query) } /*! - \brief Query the database. - - The \a query is a JSON object containing the actual query to the backend. - The query will be run on the \a operation part of the backend. - - The \a query has to contain an "objectType" which has to point to a type defined - in the backend. Optionaly it can also contain: - \list - \li query - describes how objects are queried, allows to filter results. See \l{https://engin.io/documentation/rest/parameters/queries} - {JSON query structure} - \li limit - limits how many objects the server should return (default value is 100). - \li offset - how many objects the server should skip from the beginning of the returned results. Note that the server keeps the data - in random order so that usage of offset implies using \c sort as well. - \li sort - describes how results are sorted. See \l{https://engin.io/documentation/rest/parameters/sort}{JSON sort request structure} - \li count - if the \c count is set the server will return only count of matching objects - \li include - describes which other objects are included in the response. See \l{https://engin.io/documentation/rest/parameters/include} - {JSON include structure} - \endlist - - To query the database of all objects of type "objects.todo": + \include client-query.qdocinc + + To query the database for all objects of the type "objects.todo": \snippet enginioclient/tst_enginioclient.cpp query-todo - \return EnginioReply containing the status and the result once it is finished. - \sa EnginioReply, create(), update(), remove() + \return an EnginioReply containing the status and the result once it is finished. */ EnginioReply* EnginioClient::query(const QJsonObject &query, const Enginio::Operation operation) { @@ -540,10 +522,7 @@ EnginioReply* EnginioClient::query(const QJsonObject &query, const Enginio::Oper } /*! - \brief Insert a new \a object into the database. - - The \a operation is the area in which the object gets created. It defaults to \l Enginio::ObjectOperation - to create new objects by default. + \include client-create.qdocinc \snippet enginioclient/tst_enginioclient.cpp create-todo @@ -557,8 +536,7 @@ EnginioReply* EnginioClient::query(const QJsonObject &query, const Enginio::Oper It can be constructed like this: \snippet enginioclient/tst_enginioclient.cpp create-newmember - \return EnginioReply containing the status of the query and the data once it is finished. - \sa EnginioReply, query(), update(), remove() + \return an EnginioReply containing the status and data once it is finished. */ EnginioReply* EnginioClient::create(const QJsonObject &object, const Enginio::Operation operation) { @@ -571,26 +549,12 @@ EnginioReply* EnginioClient::create(const QJsonObject &object, const Enginio::Op } /*! - \brief Update an existing \a object in the database. + \include client-update.qdocinc - The \a operation is the area in which the object gets created. It defaults to \l Enginio::ObjectOperation - to create new objects by default. - - To update access control list of an object the JSON loook like this: - \code - { - "id": "objectId", - "objectType": "objects.objectType", - "access": { "read": ["id": "userId", "objectTypes": "users"], - "update": ["id": "userId", "objectTypes": "users"], - "admin": ["id": "userId", "objectTypes": "users"] } - } - \endcode - which could be implemented for example this way: + In C++, the updating of the ACL could be done like this: \snippet enginioclient/tst_enginioclient.cpp update-access - \return EnginioReply containing the status of the query and the data once it is finished. - \sa EnginioReply, create(), query(), remove() + \return an EnginioReply containing the status of the query and the data once it is finished. */ EnginioReply* EnginioClient::update(const QJsonObject &object, const Enginio::Operation operation) { @@ -603,15 +567,12 @@ EnginioReply* EnginioClient::update(const QJsonObject &object, const Enginio::Op } /*! - \brief Remove an existing \a object from the database. - - The \a operation is the area in which the object gets created. It defaults to \l Enginio::ObjectOperation - to create new objects by default. + \include client-remove.qdocinc + To remove a todo object: \snippet enginioclient/tst_enginioclient.cpp remove-todo - \return EnginioReply containing the status of the query and the data once it is finished. - \sa EnginioReply, create(), query(), update() + \return an EnginioReply containing the status and the data once it is finished. */ EnginioReply* EnginioClient::remove(const QJsonObject &object, const Enginio::Operation operation) { diff --git a/src/enginio_client/enginiomodel.cpp b/src/enginio_client/enginiomodel.cpp index f493513..0163de0 100644 --- a/src/enginio_client/enginiomodel.cpp +++ b/src/enginio_client/enginiomodel.cpp @@ -437,11 +437,8 @@ void EnginioModel::setClient(const EnginioClient *client) /*! \property EnginioModel::query - \brief The query which returns the data for the model. - Sorting preserved until insertion/deletion - - \sa EnginioClient::query() + \include model-query.qdocinc */ QJsonObject EnginioModel::query() { @@ -479,12 +476,10 @@ void EnginioModel::setOperation(Enginio::Operation operation) } /*! - Append \a value to this model local cache and send a create request - to enginio backend. - \return reply from backend + \include model-append.qdocinc \sa EnginioClient::create() */ -EnginioReply *EnginioModel::append(const QJsonObject &value) +EnginioReply *EnginioModel::append(const QJsonObject &object) { Q_D(EnginioModel); if (Q_UNLIKELY(!d->enginio())) { @@ -492,14 +487,11 @@ EnginioReply *EnginioModel::append(const QJsonObject &value) return 0; } - return d->append(value); + return d->append(object); } /*! - Remove a value from \a row in this model local cache and send - a remove request to enginio backend. - \return reply from backend - \sa EnginioClient::remove() + \include model-remove.qdocinc */ EnginioReply *EnginioModel::remove(int row) { @@ -546,10 +538,7 @@ EnginioReply *EnginioModel::setData(int row, const QVariant &value, const QStrin return d->setValue(row, role, value); } -/*! - \overload - \internal -*/ + Qt::ItemFlags EnginioBaseModel::flags(const QModelIndex &index) const { return QAbstractListModel::flags(index) | Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable; diff --git a/src/enginio_plugin/doc/enginio_plugin.qdoc b/src/enginio_plugin/doc/enginio_plugin.qdoc index 817598e..dbe52da 100644 --- a/src/enginio_plugin/doc/enginio_plugin.qdoc +++ b/src/enginio_plugin/doc/enginio_plugin.qdoc @@ -34,5 +34,5 @@ \annotatedlist engino-qml List of examples: - \annotatedlist enginio-examples + \annotatedlist enginio-qml-examples */ diff --git a/src/enginio_plugin/doc/qtenginioqml.qdocconf b/src/enginio_plugin/doc/qtenginioqml.qdocconf index 379a8bf..5d3b091 100644 --- a/src/enginio_plugin/doc/qtenginioqml.qdocconf +++ b/src/enginio_plugin/doc/qtenginioqml.qdocconf @@ -1,10 +1,15 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) +include(../../../doc/enginio_global.qdocconf) + project = QtEnginioQml description = Client library for Enginio from QML url = http://engin.io +version = $QT_VERSION + +sourcedirs += .. \ + ../../../doc/shared -sourcedirs += .. headerdirs += .. imagedirs += images @@ -25,14 +30,14 @@ depends += qtcore qtgui qtnetwork qtqml qtquick qtquickcontrols qtenginio qhp.projects = QtEnginioQml qhp.QtEnginioQml.file = qtenginioqml.qhp -qhp.QtEnginioQml.namespace = io.engin.qml.101 +qhp.QtEnginioQml.namespace = io.engin.qml.$QT_VERSION_TAG qhp.QtEnginioQml.virtualFolder = qtenginioqml qhp.QtEnginioQml.indexTitle = Enginio QML Types and Examples qhp.QtEnginioQml.indexRoot = -qhp.QtEnginioQml.filterAttributes = qtenginio 1.0.1 -qhp.QtEnginioQml.customFilters.Qt.name = Enginio 1.0.1 -qhp.QtEnginioQml.customFilters.Qt.filterAttributes = qtenginio 1.0.1 +qhp.QtEnginioQml.filterAttributes = qtenginio $QT_VERSION +qhp.QtEnginioQml.customFilters.Qt.name = Enginio $QT_VERSION +qhp.QtEnginioQml.customFilters.Qt.filterAttributes = qtenginio $QT_VERSION qhp.QtEnginioQml.subprojects = qmltypes examples diff --git a/src/enginio_plugin/enginioqmlclient.cpp b/src/enginio_plugin/enginioqmlclient.cpp index c5b4bac..b538be1 100644 --- a/src/enginio_plugin/enginioqmlclient.cpp +++ b/src/enginio_plugin/enginioqmlclient.cpp @@ -124,38 +124,20 @@ QT_BEGIN_NAMESPACE */ /*! - \qmlmethod EnginioReply EnginioClient::query(QJSValue query, Enginio::Operation operation) - \brief Query the database. - - The \a query is an object containing the actual query to the backend. - The query will be run on the \a operation part of the backend. - - The \a query has to contain an "objectType" which has to point to a type defined - in the backend. Optionaly it can also contain: - \list - \li query - describes how objects are queried, allows to filter results. See \l{https://engin.io/documentation/rest/parameters/queries} - {JSON query structure} - \li limit - limits how many objects the server should return (default value is 100). - \li offset - how many objects the server should skip from the beginning of the returned results. Note that the server keeps the data - in random order so that usage of offset implies using \c sort as well. - \li sort - describes how results are sorted. See \l{https://engin.io/documentation/rest/parameters/sort}{JSON sort request structure} - \li count - if the \c count is set the server will return only count of matching objects - \li include - describes which other objects are included in the response. See \l{https://engin.io/documentation/rest/parameters/include} - {JSON include structure} - \endlist - - For example to find a usergroup named "allUsers" it is enough to call: + \qmlmethod EnginioReply EnginioClient::query(QJSValue query, Operation operation) + \include client-query.qdocinc + + To find a usergroup named "allUsers": \snippet socialtodos/Login.qml queryUsergroup - \return EnginioReply containing the status and the result once it is finished. - \sa EnginioReply, create(), update(), remove(), Enginio::Operation + \return an EnginioReply containing the status and the result once it is finished. */ + /*! - \qmlmethod EnginioReply EnginioClient::create(QJSValue query, Enginio::Operation operation) - \brief Create an object in the database. + \qmlmethod EnginioReply EnginioClient::create(QJSValue object, Operation operation) + \include client-create.qdocinc - This command can create an object in the database, for example to create a new user - such code could be used: + To create a new user: \snippet users/Register.qml create To add a new member to a usergroup, the JSON needs to look like the example below. @@ -166,30 +148,21 @@ QT_BEGIN_NAMESPACE } \endcode - \return EnginioReply containing the status and the result once it is finished. + \return an EnginioReply containing the status and data once it is finished. */ + /*! \qmlmethod EnginioReply EnginioClient::update(QJSValue query, Operation operation) - \brief Update an object in the database. + \include client-remove.qdocinc - To update access control list of an object the JSON loook like this: - \code - { - "id": "objectId", - "objectType": "objects.objectType", - "access": { "read": ["id": "userId", "objectTypes": "users"], - "update": ["id": "userId", "objectTypes": "users"], - "admin": ["id": "userId", "objectTypes": "users"] } - } - \endcode - - \return EnginioReply containing the status of the query and the data once it is finished. + \return an EnginioReply containing the status once it is finished. */ + /*! \qmlmethod EnginioReply EnginioClient::remove(QJSValue query, Operation operation) - \brief Remove an object from the database. + \include client-remove.qdocinc - \return EnginioReply containing the status once it is finished. + \return an EnginioReply containing the status once it is finished. */ /*! diff --git a/src/enginio_plugin/enginioqmlmodel.cpp b/src/enginio_plugin/enginioqmlmodel.cpp index fbb405e..8e60252 100644 --- a/src/enginio_plugin/enginioqmlmodel.cpp +++ b/src/enginio_plugin/enginioqmlmodel.cpp @@ -79,7 +79,7 @@ QT_BEGIN_NAMESPACE /*! \qmlproperty QJSValue EnginioModel::query - The query used to populate the model with data. + \include model-query.qdocinc */ /*! @@ -93,15 +93,11 @@ QT_BEGIN_NAMESPACE */ /*! - \qmlmethod EnginioReply EnginioModel::append(QJSValue value) - \brief Add a new object to the model and database. + \qmlmethod EnginioReply EnginioModel::append(QJSValue object) + \include model-append.qdocinc To add a "city" object to the model by appending it: \snippet models.qml append - The append will be reflected by the model immediately and will be propagated - to the server asynchronously. - - The returned \l EnginioReply can be used to react to a finished object creation. */ /*! @@ -115,7 +111,7 @@ QT_BEGIN_NAMESPACE /*! \qmlmethod EnginioReply EnginioModel::remove(int row) - \brief removes the object at \a row + \include model-remove.qdocinc */ namespace { |