├── doc ├── shared │ ├── client-downloadUrl.qdocinc │ ├── client-uploadFile.qdocinc │ ├── client-fullTextSearch.qdocinc │ ├── model-remove.qdocinc │ ├── client-remove.qdocinc │ ├── model-append.qdocinc │ ├── model-query.qdocinc │ ├── client-update.qdocinc │ ├── client-create.qdocinc │ └── client-query.qdocinc ├── enginio_global.qdocconf ├── images │ └── object_browser_first_city_object.png └── qtenginiooverview.qdocconf ├── .tag ├── examples ├── examples.pro └── enginio │ ├── common │ ├── backendhelper │ │ ├── qmlbackendhelper.pri │ │ ├── backendhelper.pri │ │ ├── qmlbackendhelper.qrc │ │ ├── backendhelper.h │ │ ├── backendhelper.cpp │ │ └── helperdialog.ui │ ├── icons │ │ ├── add_icon.png │ │ ├── back_icon.png │ │ ├── delete_icon.png │ │ ├── reload_icon.png │ │ ├── share_icon.png │ │ ├── add_icon_pressed.png │ │ ├── delete_icon_pressed.png │ │ ├── reload_icon_pressed.png │ │ └── share_icon_pressed.png │ └── images │ │ ├── checkbox.png │ │ ├── delegate.png │ │ ├── enginio.png │ │ ├── shadow.png │ │ ├── textfield.png │ │ ├── checkbox_checked.png │ │ └── delegate_pressed.png │ ├── quick │ ├── todos │ │ ├── doc │ │ │ └── images │ │ │ │ └── todolist.png │ │ ├── todos.pro │ │ └── todo.qrc │ ├── socialtodos │ │ ├── backendconfig │ │ │ └── sharedtodo.zip │ │ ├── socialtodos.pro │ │ ├── socialtodos.qrc │ │ ├── socialtodos.qml │ │ ├── Header.qml │ │ ├── TouchButton.qml │ │ └── TextField.qml │ ├── image-gallery │ │ ├── doc │ │ │ └── images │ │ │ │ └── image-gallery.png │ │ ├── image-gallery.pro │ │ └── gallery.qrc │ ├── quick.pro │ └── users │ │ ├── users.qrc │ │ ├── users.pro │ │ ├── Browse.qml │ │ └── users.qml │ ├── widgets │ ├── widgets.pro │ ├── todos-cpp │ │ ├── todos-cpp.pro │ │ ├── main.cpp │ │ ├── todosmodel.h │ │ ├── mainwindow.h │ │ └── todosmodel.cpp │ ├── image-gallery-cpp │ │ ├── image-gallery-cpp.pro │ │ ├── main.cpp │ │ ├── imagemodel.h │ │ ├── imageobject.h │ │ ├── mainwindow.h │ │ ├── doc │ │ │ └── src │ │ │ │ └── image-gallery-cpp.qdoc │ │ └── imageobject.cpp │ └── cloudaddressbook │ │ ├── cloudaddressbook.pro │ │ ├── mainwindow.ui │ │ ├── main.cpp │ │ ├── mainwindow.h │ │ └── addressbookmodel.h │ └── enginio.pro ├── tests ├── tests.pro ├── auto │ ├── common │ │ ├── enginio.png │ │ ├── testfiles.qrc │ │ └── common.pri │ ├── identity │ │ ├── identity.pro │ │ ├── common │ │ │ └── common.pri │ │ └── oauth2authentication │ │ │ ├── oauth2authentication.pro │ │ │ └── tst_oauth2authentication.cpp │ ├── cmake │ │ ├── cmake.pro │ │ └── CMakeLists.txt │ ├── enginiomodel │ │ └── enginiomodel.pro │ ├── enginioclient │ │ └── enginioclient.pro │ ├── files │ │ └── files.pro │ ├── notifications │ │ └── notifications.pro │ ├── auto.pro │ └── qmltests │ │ └── qmltests.pro └── README ├── .qmake.conf ├── dist ├── changes-0.1.0 ├── changes-0.2.1 ├── changes-1.0.2 ├── changes-1.0.1 ├── changes-0.2.0 ├── changes-0.4.0 ├── changes-0.3.0 ├── packages │ ├── com.digia.enginioExamples │ │ └── meta │ │ │ └── package.xml │ ├── com.digia.enginioSources │ │ └── meta │ │ │ └── package.xml │ ├── com.digia.enginioDocumentation │ │ └── meta │ │ │ ├── package.xml │ │ │ └── installscript.qs │ └── com.digia.enginio │ │ └── meta │ │ ├── package.xml │ │ ├── LGPL_EXCEPTION.txt │ │ └── qtselection.ui ├── config │ └── config.xml ├── changes-0.6.0 ├── changes-0.5.0 ├── README ├── changes-1.0.6 ├── changes-1.0.5 ├── changes-1.0.4 ├── changes-1.1.0 ├── changes-1.0.0 └── patcher.py ├── src ├── enginio_plugin │ ├── qmldir │ ├── doc │ │ ├── images │ │ │ ├── users-example.png │ │ │ └── socialtodo-example.png │ │ ├── enginio_plugin.qdoc │ │ ├── qtenginioqml.qdocconf │ │ └── snippets │ │ │ ├── simple.qml │ │ │ └── models.qml │ ├── enginio_plugin.pro │ ├── enginioplugin_p.h │ ├── enginioqmlreply_p.h │ ├── enginioqmlclient_p_p.h │ ├── enginioqmlclient_p.h │ └── enginioqmlmodel_p.h ├── enginio_client │ ├── doc │ │ ├── images │ │ │ ├── todo-example.png │ │ │ ├── gallery-example.png │ │ │ └── cloudaddressbook-example.png │ │ ├── enginio_client.qdoc │ │ └── qtenginio.qdocconf │ ├── enginio_client.pro │ ├── enginiostring.cpp │ ├── enginioclient_global.h │ ├── enginiodummyreply_p.h │ ├── enginioidentity.h │ ├── enginiofakereply_p.h │ ├── enginiooauth2authentication.h │ ├── enginiodummyreply.cpp │ ├── enginiobasemodel.h │ ├── chunkdevice_p.h │ ├── enginioclient.h │ ├── enginiomodel.h │ ├── enginio.h │ ├── enginiofakereply.cpp │ ├── enginioreply.h │ ├── enginioclientconnection.h │ └── enginioreplystate.h ├── src.pro └── src.pri ├── sync.profile ├── qtenginio.pro ├── LGPL_EXCEPTION.txt └── README.md /doc/shared/client-downloadUrl.qdocinc: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/shared/client-uploadFile.qdocinc: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/shared/client-fullTextSearch.qdocinc: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.tag: -------------------------------------------------------------------------------- 1 | 23603a3b088178d8ec92fddb240e5a5c55d77d5a 2 | -------------------------------------------------------------------------------- /doc/enginio_global.qdocconf: -------------------------------------------------------------------------------- 1 | navigation.landingpage = "Enginio Manual" 2 | -------------------------------------------------------------------------------- /examples/examples.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | SUBDIRS += enginio 4 | -------------------------------------------------------------------------------- /tests/tests.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | CONFIG += no_docs_target 3 | SUBDIRS = auto 4 | -------------------------------------------------------------------------------- /.qmake.conf: -------------------------------------------------------------------------------- 1 | load(qt_build_config) 2 | CONFIG += warning_clean 3 | 4 | MODULE_VERSION = 1.8.0 5 | -------------------------------------------------------------------------------- /examples/enginio/common/backendhelper/qmlbackendhelper.pri: -------------------------------------------------------------------------------- 1 | RESOURCES += $$PWD/qmlbackendhelper.qrc 2 | -------------------------------------------------------------------------------- /tests/auto/common/enginio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/tests/auto/common/enginio.png -------------------------------------------------------------------------------- /tests/auto/identity/identity.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | SUBDIRS += \ 4 | oauth2authentication \ 5 | -------------------------------------------------------------------------------- /dist/changes-0.1.0: -------------------------------------------------------------------------------- 1 | ## 0.1.0 (March 15th 2013) 2 | New: 3 | * Initial release version of the client library 4 | -------------------------------------------------------------------------------- /tests/auto/identity/common/common.pri: -------------------------------------------------------------------------------- 1 | include(../../common/common.pri) 2 | HEADERS += $$PWD/identitycommon.h 3 | -------------------------------------------------------------------------------- /dist/changes-0.2.1: -------------------------------------------------------------------------------- 1 | ## 0.2.1 (April 19th 2013) 2 | Fixes: 3 | * QML plugin is installed under /qml 4 | 5 | -------------------------------------------------------------------------------- /examples/enginio/common/icons/add_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/examples/enginio/common/icons/add_icon.png -------------------------------------------------------------------------------- /examples/enginio/common/icons/back_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/examples/enginio/common/icons/back_icon.png -------------------------------------------------------------------------------- /examples/enginio/common/images/checkbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/examples/enginio/common/images/checkbox.png -------------------------------------------------------------------------------- /examples/enginio/common/images/delegate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/examples/enginio/common/images/delegate.png -------------------------------------------------------------------------------- /examples/enginio/common/images/enginio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/examples/enginio/common/images/enginio.png -------------------------------------------------------------------------------- /examples/enginio/common/images/shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/examples/enginio/common/images/shadow.png -------------------------------------------------------------------------------- /src/enginio_plugin/qmldir: -------------------------------------------------------------------------------- 1 | module Enginio 2 | plugin enginioplugin 3 | typeinfo plugins.qmltypes 4 | classname EnginioPlugin 5 | 6 | -------------------------------------------------------------------------------- /dist/changes-1.0.2: -------------------------------------------------------------------------------- 1 | Main changes 2 | ------------ 3 | - Static build was fixed 4 | - Different documentation and examples improvements 5 | -------------------------------------------------------------------------------- /examples/enginio/common/icons/delete_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/examples/enginio/common/icons/delete_icon.png -------------------------------------------------------------------------------- /examples/enginio/common/icons/reload_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/examples/enginio/common/icons/reload_icon.png -------------------------------------------------------------------------------- /examples/enginio/common/icons/share_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/examples/enginio/common/icons/share_icon.png -------------------------------------------------------------------------------- /examples/enginio/common/images/textfield.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/examples/enginio/common/images/textfield.png -------------------------------------------------------------------------------- /doc/images/object_browser_first_city_object.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/doc/images/object_browser_first_city_object.png -------------------------------------------------------------------------------- /src/enginio_client/doc/images/todo-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/src/enginio_client/doc/images/todo-example.png -------------------------------------------------------------------------------- /src/enginio_plugin/doc/images/users-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/src/enginio_plugin/doc/images/users-example.png -------------------------------------------------------------------------------- /examples/enginio/common/icons/add_icon_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/examples/enginio/common/icons/add_icon_pressed.png -------------------------------------------------------------------------------- /src/enginio_client/doc/images/gallery-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/src/enginio_client/doc/images/gallery-example.png -------------------------------------------------------------------------------- /examples/enginio/common/icons/delete_icon_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/examples/enginio/common/icons/delete_icon_pressed.png -------------------------------------------------------------------------------- /examples/enginio/common/icons/reload_icon_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/examples/enginio/common/icons/reload_icon_pressed.png -------------------------------------------------------------------------------- /examples/enginio/common/icons/share_icon_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/examples/enginio/common/icons/share_icon_pressed.png -------------------------------------------------------------------------------- /examples/enginio/common/images/checkbox_checked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/examples/enginio/common/images/checkbox_checked.png -------------------------------------------------------------------------------- /examples/enginio/common/images/delegate_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/examples/enginio/common/images/delegate_pressed.png -------------------------------------------------------------------------------- /examples/enginio/quick/todos/doc/images/todolist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/examples/enginio/quick/todos/doc/images/todolist.png -------------------------------------------------------------------------------- /src/enginio_plugin/doc/images/socialtodo-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/src/enginio_plugin/doc/images/socialtodo-example.png -------------------------------------------------------------------------------- /examples/enginio/widgets/widgets.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | SUBDIRS += \ 4 | image-gallery-cpp \ 5 | todos-cpp \ 6 | cloudaddressbook \ 7 | -------------------------------------------------------------------------------- /src/enginio_client/doc/images/cloudaddressbook-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/src/enginio_client/doc/images/cloudaddressbook-example.png -------------------------------------------------------------------------------- /tests/auto/common/testfiles.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | enginio.png 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/auto/cmake/cmake.pro: -------------------------------------------------------------------------------- 1 | 2 | # Cause make to do nothing. 3 | TEMPLATE = subdirs 4 | 5 | CMAKE_QT_MODULES_UNDER_TEST = enginio 6 | 7 | CONFIG += ctest_testcase 8 | -------------------------------------------------------------------------------- /examples/enginio/quick/socialtodos/backendconfig/sharedtodo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/examples/enginio/quick/socialtodos/backendconfig/sharedtodo.zip -------------------------------------------------------------------------------- /tests/auto/common/common.pri: -------------------------------------------------------------------------------- 1 | QT += enginio-private core-private 2 | SOURCES += $$PWD/common.cpp 3 | HEADERS += $$PWD/common.h 4 | 5 | QMAKE_MOC_OPTIONS += -b QtTest/QtTest -------------------------------------------------------------------------------- /examples/enginio/quick/image-gallery/doc/images/image-gallery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtenginio/dev/examples/enginio/quick/image-gallery/doc/images/image-gallery.png -------------------------------------------------------------------------------- /dist/changes-1.0.1: -------------------------------------------------------------------------------- 1 | Fixed Issues 2 | ------------ 3 | - Fix QML Enginio plugin on iOS 4 | - Show up examples in QtCreator 5 | - Social Todo example code and documentation improvements 6 | -------------------------------------------------------------------------------- /src/src.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | SUBDIRS += enginio_client 4 | 5 | qtHaveModule(qml) { 6 | SUBDIRS += enginio_plugin 7 | enginio_plugin.depends = enginio_client 8 | } 9 | -------------------------------------------------------------------------------- /tests/auto/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | cmake_minimum_required(VERSION 2.8) 3 | 4 | project(qmake_cmake_files) 5 | 6 | enable_testing() 7 | 8 | add_test(dummy ${CMAKE_COMMAND} -E echo) 9 | -------------------------------------------------------------------------------- /sync.profile: -------------------------------------------------------------------------------- 1 | %modules = ( # path to module name map 2 | "Enginio" => "$basedir/src/enginio_client" 3 | ); 4 | %moduleheaders = ( # restrict the module headers to those found in relative path 5 | ); 6 | -------------------------------------------------------------------------------- /examples/enginio/quick/quick.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | SUBDIRS += \ 4 | image-gallery \ 5 | socialtodos \ 6 | todos \ 7 | users \ 8 | 9 | EXAMPLE_FILES += \ 10 | main.cpp 11 | -------------------------------------------------------------------------------- /examples/enginio/common/backendhelper/backendhelper.pri: -------------------------------------------------------------------------------- 1 | QT += widgets 2 | 3 | INCLUDEPATH += $$PWD 4 | HEADERS += $$PWD/backendhelper.h 5 | SOURCES += $$PWD/backendhelper.cpp 6 | FORMS += $$PWD/helperdialog.ui 7 | -------------------------------------------------------------------------------- /examples/enginio/enginio.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | qtHaveModule(widgets) { 4 | SUBDIRS += widgets 5 | qtHaveModule(quick) { 6 | SUBDIRS += quick 7 | } 8 | } 9 | 10 | EXAMPLE_FILES += \ 11 | common 12 | -------------------------------------------------------------------------------- /examples/enginio/quick/users/users.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | users.qml 4 | Browse.qml 5 | Login.qml 6 | Register.qml 7 | 8 | 9 | -------------------------------------------------------------------------------- /doc/shared/model-remove.qdocinc: -------------------------------------------------------------------------------- 1 | 2 | \brief Removes the \a row from the model and database. 3 | 4 | This function immediately removes the \a row from the local cache 5 | and sends a remove request to the Enginio backend. 6 | 7 | \return the EnginioReply from the backend. 8 | -------------------------------------------------------------------------------- /tests/auto/enginiomodel/enginiomodel.pro: -------------------------------------------------------------------------------- 1 | QT += testlib enginio widgets 2 | 3 | TARGET = tst_enginiomodel 4 | CONFIG += console testcase 5 | CONFIG -= app_bundle 6 | 7 | TEMPLATE = app 8 | 9 | include(../common/common.pri) 10 | 11 | SOURCES += tst_enginiomodel.cpp 12 | -------------------------------------------------------------------------------- /tests/auto/enginioclient/enginioclient.pro: -------------------------------------------------------------------------------- 1 | QT += testlib enginio 2 | QT -= gui 3 | 4 | TARGET = tst_enginioclient 5 | CONFIG += console testcase 6 | CONFIG -= app_bundle 7 | 8 | TEMPLATE = app 9 | 10 | include(../common/common.pri) 11 | 12 | SOURCES += tst_enginioclient.cpp -------------------------------------------------------------------------------- /tests/auto/files/files.pro: -------------------------------------------------------------------------------- 1 | QT += testlib enginio enginio-private core-private 2 | 3 | TARGET = tst_files 4 | CONFIG += console testcase 5 | CONFIG -= app_bundle 6 | 7 | include(../common/common.pri) 8 | 9 | TEMPLATE = app 10 | 11 | SOURCES += tst_files.cpp 12 | RESOURCES += ../common/testfiles.qrc 13 | -------------------------------------------------------------------------------- /tests/auto/notifications/notifications.pro: -------------------------------------------------------------------------------- 1 | QT += testlib enginio enginio-private 2 | QT -= gui 3 | 4 | TARGET = tst_notifications 5 | CONFIG += console testcase 6 | CONFIG -= app_bundle 7 | 8 | TEMPLATE = app 9 | 10 | include(../common/common.pri) 11 | 12 | SOURCES += tst_notifications.cpp 13 | -------------------------------------------------------------------------------- /tests/auto/identity/oauth2authentication/oauth2authentication.pro: -------------------------------------------------------------------------------- 1 | QT += testlib enginio 2 | QT -= gui 3 | 4 | TARGET = tst_oauth2authentication 5 | CONFIG += console testcase 6 | CONFIG -= app_bundle 7 | 8 | TEMPLATE = app 9 | 10 | include(../common/common.pri) 11 | 12 | SOURCES += tst_oauth2authentication.cpp -------------------------------------------------------------------------------- /examples/enginio/common/backendhelper/qmlbackendhelper.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | ../../common/backendhelper/BackendHelper.qml 4 | 5 | 6 | ../../common/images/enginio.png 7 | 8 | 9 | -------------------------------------------------------------------------------- /dist/changes-0.2.0: -------------------------------------------------------------------------------- 1 | ## 0.2.0 (April 16th 2013) 2 | New: 3 | * QueryOperation now supports fulltext search 4 | * AclOperation added for handling object permissions 5 | * FileOperation added for uploading files to backend 6 | * header added 7 | 8 | Fixes: 9 | * Build and API documentation fixes 10 | * Various smaller bug fixes 11 | 12 | -------------------------------------------------------------------------------- /tests/auto/auto.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | SUBDIRS += \ 4 | # cmake \ 5 | enginioclient \ 6 | notifications \ 7 | identity \ 8 | 9 | qtHaveModule(gui) { 10 | SUBDIRS += files 11 | } 12 | 13 | qtHaveModule(quick) { 14 | SUBDIRS += qmltests 15 | } 16 | 17 | qtHaveModule(widgets) { 18 | SUBDIRS += enginiomodel 19 | } 20 | -------------------------------------------------------------------------------- /dist/changes-0.4.0: -------------------------------------------------------------------------------- 1 | ## 0.4.0 (May 31st 2013) 2 | New: 3 | * UsergroupOperation added 4 | * Usergroup members can now be fetched with query operation 5 | * Get usergroups of logged in user from QML 6 | 7 | Fixes: 8 | * Handle removed and null properties correctly in EnginioJsonObject 9 | * Use default flags with ObjectModel 10 | * Internal ACL fixes 11 | 12 | -------------------------------------------------------------------------------- /dist/changes-0.3.0: -------------------------------------------------------------------------------- 1 | ## 0.3.0 (May 7th 2013) 2 | New: 3 | * Usage simplified by building Enginio library as a proper Qt5 module. Now only configuration required is `QT += enginio`. 4 | * QML FileOperation added 5 | * Chunked file upload implemented 6 | 7 | Fixes: 8 | * Build issues on Mac 9 | * Object given to ObjectOperation::create/read/update methods updated properly when operation is finished 10 | 11 | -------------------------------------------------------------------------------- /examples/enginio/quick/todos/todos.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | 3 | DEFINES += ENGINIO_SAMPLE_NAME=\\\"todo\\\" 4 | 5 | include(../../common/backendhelper/qmlbackendhelper.pri) 6 | 7 | QT += quick qml enginio 8 | SOURCES += ../main.cpp 9 | 10 | mac: CONFIG -= app_bundle 11 | 12 | OTHER_FILES += todo.qml 13 | RESOURCES += todo.qrc 14 | 15 | target.path = $$[QT_INSTALL_EXAMPLES]/enginio/quick/todos 16 | INSTALLS += target 17 | -------------------------------------------------------------------------------- /dist/packages/com.digia.enginioExamples/meta/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Enginio Qt Examples 4 | Examples showing the use of Enginio. 5 | 0.6.0 6 | 2013-09-03 7 | com.digia.enginioExamples 8 | true 9 | 50 10 | 11 | -------------------------------------------------------------------------------- /examples/enginio/widgets/todos-cpp/todos-cpp.pro: -------------------------------------------------------------------------------- 1 | QT += network gui widgets enginio 2 | 3 | TARGET = todos 4 | TEMPLATE = app 5 | 6 | include(../../common/backendhelper/backendhelper.pri) 7 | 8 | SOURCES += \ 9 | main.cpp\ 10 | mainwindow.cpp \ 11 | todosmodel.cpp \ 12 | 13 | HEADERS += \ 14 | mainwindow.h \ 15 | todosmodel.h \ 16 | 17 | target.path = $$[QT_INSTALL_EXAMPLES]/enginio/widgets/todos-cpp 18 | INSTALLS += target 19 | -------------------------------------------------------------------------------- /dist/packages/com.digia.enginioSources/meta/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Enginio Qt Source Code 4 | The source code for the Engino Qt library. 5 | 0.6.0 6 | 2013-09-03 7 | com.digia.enginioSources 8 | false 9 | 10 10 | 11 | -------------------------------------------------------------------------------- /dist/config/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Enginio 4 | 0.5.0 5 | Enginio Installer 6 | Digia Plc. 7 | enginio.png 8 | Enginio 9 | http://engin.io 10 | @homeDir@/enginio 11 | true 12 | 13 | -------------------------------------------------------------------------------- /examples/enginio/quick/users/users.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | 3 | DEFINES += ENGINIO_SAMPLE_NAME=\\\"users\\\" 4 | 5 | include(../../common/backendhelper/qmlbackendhelper.pri) 6 | 7 | QT += quick qml enginio qml 8 | SOURCES += ../main.cpp 9 | 10 | mac: CONFIG -= app_bundle 11 | 12 | OTHER_FILES += users.qml Browse.qml Login.qml Register.qml 13 | RESOURCES += users.qrc 14 | 15 | target.path = $$[QT_INSTALL_EXAMPLES]/enginio/quick/users 16 | INSTALLS += target 17 | -------------------------------------------------------------------------------- /src/src.pri: -------------------------------------------------------------------------------- 1 | contains(CONFIG, coverage) { 2 | gcc*: { 3 | message("Enabling test coverage instrumentization") 4 | QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage --coverage 5 | QMAKE_LDFLAGS += -fprofile-arcs -ftest-coverage --coverage 6 | CXXFLAGS += -fprofile-arcs -ftest-coverage --coverage 7 | LIBS += -lgcov 8 | DEFINES += QT_NO_DEBUG 9 | } else { 10 | warning("Test coverage is supported only through gcc") 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/enginio/quick/image-gallery/image-gallery.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | 3 | DEFINES += ENGINIO_SAMPLE_NAME=\\\"image-gallery\\\" 4 | 5 | include(../../common/backendhelper/qmlbackendhelper.pri) 6 | 7 | QT += quick qml enginio 8 | SOURCES += ../main.cpp 9 | 10 | mac: CONFIG -= app_bundle 11 | 12 | OTHER_FILES += *.qml 13 | 14 | RESOURCES += \ 15 | gallery.qrc 16 | 17 | target.path = $$[QT_INSTALL_EXAMPLES]/enginio/quick/image-gallery 18 | INSTALLS += target 19 | -------------------------------------------------------------------------------- /dist/packages/com.digia.enginioDocumentation/meta/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Enginio Qt HTML Documentation 4 | Offline Documentation for Enginio. 5 | 0.6.0 6 | 2013-09-03 7 | com.digia.enginioDocumentation 8 | true 9 | 40 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/auto/qmltests/qmltests.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | 3 | include(../common/common.pri) 4 | SOURCES += tst_qmltest.cpp 5 | 6 | TARGET = tst_qmltests 7 | 8 | QT += enginio 9 | CONFIG += testcase 10 | CONFIG -= app_bundle 11 | 12 | QT += qmltest testlib 13 | 14 | DEFINES += QUICK_TEST_SOURCE_DIR=\\\"$$_PRO_FILE_PWD_\\\" 15 | 16 | OTHER_FILES += \ 17 | tst_enginioclient.qml \ 18 | tst_enginioreply.qml \ 19 | tst_files.qml \ 20 | tst_identity.qml \ 21 | tst_query.qml \ 22 | tst_model.qml 23 | 24 | -------------------------------------------------------------------------------- /examples/enginio/widgets/image-gallery-cpp/image-gallery-cpp.pro: -------------------------------------------------------------------------------- 1 | QT += network gui widgets enginio 2 | 3 | TARGET = image-gallery 4 | TEMPLATE = app 5 | 6 | include(../../common/backendhelper/backendhelper.pri) 7 | 8 | SOURCES += \ 9 | main.cpp\ 10 | mainwindow.cpp \ 11 | imageobject.cpp \ 12 | imagemodel.cpp 13 | 14 | HEADERS += \ 15 | mainwindow.h \ 16 | imageobject.h \ 17 | imagemodel.h 18 | 19 | target.path = $$[QT_INSTALL_EXAMPLES]/enginio/widgets/image-gallery-cpp 20 | INSTALLS += target 21 | -------------------------------------------------------------------------------- /examples/enginio/widgets/cloudaddressbook/cloudaddressbook.pro: -------------------------------------------------------------------------------- 1 | QT += network gui widgets enginio 2 | 3 | TARGET = cloudaddressbook 4 | TEMPLATE = app 5 | 6 | include(../../common/backendhelper/backendhelper.pri) 7 | 8 | SOURCES += \ 9 | main.cpp\ 10 | mainwindow.cpp \ 11 | addressbookmodel.cpp \ 12 | 13 | HEADERS += \ 14 | mainwindow.h \ 15 | addressbookmodel.h \ 16 | 17 | FORMS += \ 18 | mainwindow.ui 19 | 20 | target.path = $$[QT_INSTALL_EXAMPLES]/enginio/widgets/cloudaddressbook 21 | INSTALLS += target 22 | -------------------------------------------------------------------------------- /dist/changes-0.6.0: -------------------------------------------------------------------------------- 1 | # Enginio Qt Library Changelog 2 | ## 0.6.0 3 | * Improved documentation 4 | * Improved stability in many "edge cases" 5 | * Examples within Enginio are not dependent on hard-coded backend anymore 6 | * Clearer and more precise error messages 7 | * Client library has been moved under the Qt-Project umbrella 8 | * Groundwork laid for coming websocket support 9 | * New binary installers for Windows, Mac and Linux 10 | * Renamed EnginioAuthentication to EnginioBasicAuthentication (Qt API change) 11 | * EnginioModel defined an enums with default roles (Qt API change) -------------------------------------------------------------------------------- /doc/shared/client-remove.qdocinc: -------------------------------------------------------------------------------- 1 | \brief Remove an object from the database. 2 | 3 | The \a object that is to be removed is identified by its object ID and if it is a regular object also \tt objectType. 4 | 5 | The JSON that identfies an object looks like this: 6 | \code 7 | { 8 | "objectType": "objects.images", 9 | "id": "52b1a94b5a3d8b15b1037ff5" 10 | } 11 | \endcode 12 | 13 | The \a operation is the area from which the object gets removed. 14 | It defaults to \l Enginio::ObjectOperation to remove regular objects by default. 15 | 16 | \sa EnginioReply, create(), query(), update() 17 | -------------------------------------------------------------------------------- /examples/enginio/quick/socialtodos/socialtodos.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | 3 | DEFINES += ENGINIO_SAMPLE_NAME=\\\"socialtodos\\\" 4 | 5 | include(../../common/backendhelper/qmlbackendhelper.pri) 6 | 7 | QT += quick qml enginio 8 | SOURCES += ../main.cpp 9 | 10 | mac: CONFIG -= app_bundle 11 | 12 | OTHER_FILES += \ 13 | Header.qml \ 14 | List.qml \ 15 | Login.qml \ 16 | ShareDialog.qml \ 17 | TextField.qml \ 18 | TodoLists.qml \ 19 | socialtodos.qml 20 | 21 | RESOURCES += socialtodos.qrc 22 | 23 | target.path = $$[QT_INSTALL_EXAMPLES]/enginio/quick/socialtodos 24 | INSTALLS += target 25 | 26 | EXAMPLE_FILES += \ 27 | backendconfig 28 | -------------------------------------------------------------------------------- /dist/changes-0.5.0: -------------------------------------------------------------------------------- 1 | ## 0.5.0 (July 5th 2013) 2 | * New more Qt-like API, based on QNetworkAccessManager design 3 | * QJS and QJson based API 4 | * New classes: 5 | - EnginioClient: main class for all direct queries 6 | - EnginioModel: model for simple data access and fast View & Delegate integration 7 | - EnginioReply: class that contains query data and network status 8 | - EnginioAuthentication: basic authentication 9 | * New building process 10 | - Enginio client library is now a Qt add-on module 11 | - Separate code for qml plugin that doesn't have to be built if not needed 12 | * New repository layout: tests and examples were moved to the same repository 13 | * All operation classes were removed -------------------------------------------------------------------------------- /dist/README: -------------------------------------------------------------------------------- 1 | Building installers the long way... 2 | 3 | Note that building the installer does NOT work when Qt is configured with -developer-build. 4 | It is recommended to use the official Qt sdk packages (http://qt-project.org/downloads). 5 | 6 | Linux: 7 | qtbase, qttools, qtscript 8 | 9 | ./configure -nomake examples -nomake tests -static -release -opensource -confirm-license -prefix `pwd`/../qt-install -qt-libpng -qt-libjpeg -qt-zlib -no-cups -no-icu -qt-sql-sqlite -no-c++11 10 | 11 | actually install all of them! 12 | 13 | installer-framework (master branch) 14 | qtbase-static/bin/qmake 15 | make 16 | 17 | Run the python script with the desired target qt version and the installer-framework/bin in path. 18 | -------------------------------------------------------------------------------- /doc/shared/model-append.qdocinc: -------------------------------------------------------------------------------- 1 | \brief Add a new \a object to the model and database. 2 | 3 | This function appends the new object to the local model cache 4 | and makes an asynchronous request to the backend. 5 | 6 | Since adding an object to the database may fail for various reasons, 7 | the returned reply must be kept and used for error handling (see \l EnginioReply). 8 | If the operation fails, the object that was supposed to be appended will be removed 9 | from the local model again. If the model is used in a view and the backend does 10 | not accept the object because it violates a validator, it will be visible to the 11 | user that a new row in the view appears and disappears again. 12 | 13 | \return the EnginioReply from the backend 14 | -------------------------------------------------------------------------------- /tests/README: -------------------------------------------------------------------------------- 1 | This directory contains autotests based on Qt Test. In order to run the autotests 2 | reliably, you need to configure a desktop to match the test environment that these 3 | tests are written for. 4 | 5 | The tests need network connection and access to an Enginio backend. 6 | To be able to run the tests the following environment variables have to be set: 7 | 8 | ENGINIO_API_URL (for example https://api.engin.io/) 9 | ENGINIO_EMAIL_ADDRESS (for example jan.kowalski@email.com) 10 | ENGINIO_LOGIN_PASSWORD (mySecretPassword) 11 | 12 | Alternatively ENGINIO_EMAIL_ADDRESS and ENGINIO_LOGIN_PASSWORD can be replaced by: 13 | 14 | ENGINIO_CREDENTIALS_FILE_PATH (for example ~/.enginio/user) 15 | 16 | where "user" is a text file with 2 lines containing email and password for example: 17 | jan.kowalski@email.com 18 | mySecretPassword 19 | -------------------------------------------------------------------------------- /examples/enginio/quick/image-gallery/gallery.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | image-gallery.qml 4 | 5 | 6 | ../../common/icons/delete_icon.png 7 | ../../common/icons/add_icon.png 8 | ../../common/icons/add_icon_pressed.png 9 | ../../common/icons/delete_icon_pressed.png 10 | 11 | 12 | ../../common/images/delegate.png 13 | ../../common/images/delegate_pressed.png 14 | ../../common/images/shadow.png 15 | 16 | 17 | -------------------------------------------------------------------------------- /doc/shared/model-query.qdocinc: -------------------------------------------------------------------------------- 1 | /*! 2 | //![0] 3 | \brief The query used to populate the model with data from the backend. 4 | 5 | See 6 | //![0] 7 | \l {EnginioClient::query()} 8 | //![1] 9 | documentation for information on how to construct a query. 10 | 11 | While the EnginioClient implementation of \c query() returns 12 | the data of a query as a JSON object, for the model the query will be 13 | interpreted as the model data. 14 | 15 | Usually, the query is for a single object type and will return all objects 16 | in the database of that type. The model will then represent each returned object 17 | as one row. It can be limited and sorted just like its counterpart 18 | in EnginioClient. 19 | 20 | One important thing to note is that the model cannot keep the same sorting as 21 | the backend, and thus sorting and limits are only preserved until 22 | an insertion or deletion happens. 23 | //![1] 24 | */ 25 | -------------------------------------------------------------------------------- /dist/packages/com.digia.enginio/meta/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Enginio Qt Library 4 | Needed to use Enginio (C++ and QML). 5 | 0.6.0 6 | 2013-09-03 7 | com.digia.enginio 8 | 100 9 | 10 | 11 | 12 | 13 | 14 | 15 | script 16 | 17 | true 18 | 19 | qtselection.ui 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/enginio_plugin/enginio_plugin.pro: -------------------------------------------------------------------------------- 1 | requires(qtHaveModule(qml)) 2 | 3 | TARGETPATH = Enginio 4 | 5 | IMPORT_VERSION = 1.0 6 | 7 | QT = qml enginio enginio-private core-private 8 | 9 | QMAKE_DOCS = $$PWD/doc/qtenginioqml.qdocconf 10 | OTHER_FILES += \ 11 | doc/qtenginioqml.qdocconf \ 12 | doc/enginio_plugin.qdoc \ 13 | qmldir 14 | 15 | include(../src.pri) 16 | 17 | 18 | TARGET = enginioplugin 19 | TARGET.module_name = Enginio 20 | 21 | SOURCES += \ 22 | enginioqmlclient.cpp \ 23 | enginioqmlmodel.cpp \ 24 | enginioplugin.cpp \ 25 | enginioqmlreply.cpp \ 26 | 27 | HEADERS += \ 28 | enginioqmlobjectadaptor_p.h \ 29 | enginioqmlclient_p_p.h \ 30 | enginioplugin_p.h \ 31 | enginioqmlclient_p.h \ 32 | enginioqmlmodel_p.h \ 33 | enginioqmlreply_p.h 34 | 35 | CONFIG += no_cxx_module 36 | load(qml_plugin) 37 | 38 | DEFINES += "ENGINIO_VERSION=\\\"$$MODULE_VERSION\\\"" 39 | -------------------------------------------------------------------------------- /dist/changes-1.0.6: -------------------------------------------------------------------------------- 1 | Enginio 1.0.6 is a bug-fix release. It maintains both forward and backward 2 | compatibility(source and binary) with Enginio 1.0 series. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://qt-project.org/doc/qt-5/ 8 | 9 | Some of the changes listed in this file include issue tracking numbers 10 | corresponding to tasks in the Qt Bug Tracker: 11 | 12 | http://bugreports.qt-project.org/ 13 | 14 | Each of these identifiers can be entered in the bug tracker to obtain more 15 | information about a particular change. 16 | 17 | 18 | **************************************************************************** 19 | * General * 20 | **************************************************************************** 21 | 22 | - Fixed static build on Windows 23 | -------------------------------------------------------------------------------- /dist/changes-1.0.5: -------------------------------------------------------------------------------- 1 | Enginio 1.0.5 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Enginio 1.0.0, 1.0.1, 1.0.2 and 1.0.4. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://qt-project.org/doc/qt-5/ 8 | 9 | Some of the changes listed in this file include issue tracking numbers 10 | corresponding to tasks in the Qt Bug Tracker: 11 | 12 | http://bugreports.qt-project.org/ 13 | 14 | Each of these identifiers can be entered in the bug tracker to obtain more 15 | information about a particular change. 16 | 17 | 18 | **************************************************************************** 19 | * General * 20 | **************************************************************************** 21 | 22 | - This release contains only minor code improvements. 23 | -------------------------------------------------------------------------------- /doc/shared/client-update.qdocinc: -------------------------------------------------------------------------------- 1 | \brief Update an object in the database. 2 | 3 | The \a operation is the area in which the \a object gets updated. It defaults to \l Enginio::ObjectOperation 4 | to update regular objects by default. 5 | 6 | To change the name property of an object to "New Name", use the following JSON: 7 | \code 8 | { 9 | "id": "objectId", 10 | "objectType": "objects.objectType", 11 | "name": "New Name" 12 | } 13 | \endcode 14 | 15 | All other existing properties of the object are not affected by the update. 16 | 17 | To update the access control list of an object, use the following JSON: 18 | \code 19 | { 20 | "id": "objectId", 21 | "objectType": "objects.objectType", 22 | "access": { "read": ["id": "userId", "objectTypes": "users"], 23 | "update": ["id": "userId", "objectTypes": "users"], 24 | "admin": ["id": "userId", "objectTypes": "users"] } 25 | } 26 | \endcode 27 | 28 | \sa EnginioReply, create(), query(), remove() 29 | -------------------------------------------------------------------------------- /examples/enginio/quick/todos/todo.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | ../../common/icons/delete_icon.png 4 | ../../common/icons/add_icon.png 5 | ../../common/icons/add_icon_pressed.png 6 | ../../common/icons/delete_icon_pressed.png 7 | 8 | 9 | ../../common/images/delegate.png 10 | ../../common/images/delegate_pressed.png 11 | ../../common/images/shadow.png 12 | ../../common/images/textfield.png 13 | ../../common/images/checkbox_checked.png 14 | 15 | 16 | todo.qml 17 | 18 | 19 | -------------------------------------------------------------------------------- /dist/changes-1.0.4: -------------------------------------------------------------------------------- 1 | Enginio 1.0.4 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Enginio 1.0.0, 1.0.1 and 1.0.2. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://qt-project.org/doc/qt-5/ 8 | 9 | Some of the changes listed in this file include issue tracking numbers 10 | corresponding to tasks in the Qt Bug Tracker: 11 | 12 | http://bugreports.qt-project.org/ 13 | 14 | Each of these identifiers can be entered in the bug tracker to obtain more 15 | information about a particular change. 16 | 17 | 18 | **************************************************************************** 19 | * General * 20 | **************************************************************************** 21 | 22 | - Mark EnginioClientConnection::serviceUrl as public property 23 | - Several documentation and example improvements 24 | -------------------------------------------------------------------------------- /doc/shared/client-create.qdocinc: -------------------------------------------------------------------------------- 1 | \brief Insert a new \a object into the database. 2 | 3 | The returned \l EnginioReply indicates the success of the object creation. 4 | The object becomes available from the backend if it finishes without errors. 5 | 6 | \a operation determines the kind of object created. For example a regular object 7 | or a user or usergroup. 8 | By default, \l Enginio::ObjectOperation is used and regular objects created. 9 | \note that the \tt objectType is required for regular objects and has to begin with 10 | \tt {"objects."}. 11 | 12 | The JSON for the object that will be created must follow this structure: 13 | \code 14 | { 15 | "objectType": "object.myType", 16 | "name" : "A thing", 17 | "price" : "5", 18 | } 19 | \endcode 20 | Where only the \tt objectType property is required and \tt name and \tt price 21 | are examples of custom properties. 22 | 23 | Users and all kinds of other objects are created the same way but do not require any 24 | \tt objectType. 25 | 26 | \sa EnginioReply, query(), update(), remove(), Enginio::Operation 27 | -------------------------------------------------------------------------------- /dist/changes-1.1.0: -------------------------------------------------------------------------------- 1 | Enginio 1.1.0 is a feature release. It maintains backward compatibility 2 | with Enginio 1.0 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://qt-project.org/doc/qt-5/ 8 | 9 | Some of the changes listed in this file include issue tracking numbers 10 | corresponding to tasks in the Qt Bug Tracker: 11 | 12 | http://bugreports.qt-project.org/ 13 | 14 | Each of these identifiers can be entered in the bug tracker to obtain more 15 | information about a particular change. 16 | 17 | 18 | *************************************************************************** 19 | 20 | 21 | EnginioModel 22 | ------------ 23 | - Automatically refresh EnginioModel content when identity changes. 24 | - Added reload() function to EnginioModel to force a refresh of model data. 25 | - Allow to update multiple properties of an item in one setData function 26 | call. It can be achieved by using Enginio::JsonObjectRole. 27 | 28 | 29 | EnginioClient 30 | ------------ 31 | - Allow to directly query objects through object's id 32 | -------------------------------------------------------------------------------- /qtenginio.pro: -------------------------------------------------------------------------------- 1 | # iOS does not require OpenSSL and always passes 2 | !ios:requires(contains(QT_CONFIG, ssl) | contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked)) 3 | 4 | lessThan(QT_MAJOR_VERSION, 5): error("The Enginio Qt library only supports Qt 5.") 5 | load(configure) 6 | load(qt_parts) 7 | 8 | QMAKE_DOCS = $$PWD/doc/qtenginiooverview.qdocconf 9 | load(qt_docs) 10 | OTHER_FILES += \ 11 | doc/enginio_overview.qdoc \ 12 | doc/qtenginiooverview.qdocconf 13 | 14 | contains(CONFIG, coverage) { 15 | gcc*: { 16 | message("Enabling test coverage instrumentization") 17 | coverage.commands = lcov -t "Enginio" -o result1.info -c -d . \ 18 | && lcov -e result1.info *enginio* -o result2.info \ 19 | && lcov -r result2.info moc* -o result.info \ 20 | && genhtml -o results result.info 21 | coverage.target = check_coverage 22 | coverage.depends = check 23 | QMAKE_EXTRA_TARGETS += coverage 24 | } else { 25 | warning("Test coverage is supported only through gcc") 26 | } 27 | } 28 | 29 | contains(DEFINES, ENGINIO_VALGRIND_DEBUG) { 30 | warning("ENGINIO_VALGRIND_DEBUG is enabled, ssl cipher will be hardcoded, DO NOT USE IT IN PRODUCTION") 31 | } 32 | -------------------------------------------------------------------------------- /doc/qtenginiooverview.qdocconf: -------------------------------------------------------------------------------- 1 | include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) 2 | 3 | include(enginio_global.qdocconf) 4 | 5 | project = QtEnginioOverview 6 | description = Enginio Client Library 7 | version = $QT_VERSION 8 | 9 | sourcedirs += . 10 | headerdirs += . 11 | 12 | imagedirs += images 13 | 14 | depends += qtcore qtgui qtwidgets qtnetwork qtquick qtdoc qtenginio qtenginioqml 15 | 16 | qhp.projects = QtEnginioOverview 17 | 18 | qhp.QtEnginioOverview.file = qtenginiooverview.qhp 19 | qhp.QtEnginioOverview.namespace = org.qt-project.qtenginiooverview.$QT_VERSION_TAG 20 | qhp.QtEnginioOverview.virtualFolder = qtenginiooverview 21 | qhp.QtEnginioOverview.indexTitle = Enginio Manual 22 | 23 | qhp.QtEnginioOverview.filterAttributes = enginio $QT_VERSION 24 | qhp.QtEnginioOverview.customFilters.Qt.name = Enginio $QT_VERSION 25 | qhp.QtEnginioOverview.customFilters.Qt.filterAttributes = enginio $QT_VERSION 26 | 27 | qhp.QtEnginioOverview.subprojects = manual 28 | qhp.QtEnginioOverview.subprojects.manual.title = Enginio Manual 29 | qhp.QtEnginioOverview.subprojects.manual.indexTitle = Enginio Manual 30 | qhp.QtEnginioOverview.subprojects.manual.type = manual 31 | -------------------------------------------------------------------------------- /src/enginio_client/enginio_client.pro: -------------------------------------------------------------------------------- 1 | TARGET = Enginio 2 | MODULE = enginio 3 | 4 | QT = core-private network 5 | DEFINES += ENGINIOCLIENT_LIBRARY 6 | 7 | QMAKE_DOCS = $$PWD/doc/qtenginio.qdocconf 8 | OTHER_FILES += \ 9 | doc/qtenginio.qdocconf \ 10 | doc/enginio_client.qdoc 11 | 12 | include(../src.pri) 13 | 14 | SOURCES += \ 15 | enginiobackendconnection.cpp \ 16 | enginioclient.cpp \ 17 | enginioreply.cpp \ 18 | enginiomodel.cpp \ 19 | enginioidentity.cpp \ 20 | enginiofakereply.cpp \ 21 | enginiodummyreply.cpp \ 22 | enginiostring.cpp 23 | 24 | HEADERS += \ 25 | chunkdevice_p.h \ 26 | enginio.h \ 27 | enginiobackendconnection_p.h \ 28 | enginiobasemodel.h \ 29 | enginiobasemodel_p.h \ 30 | enginioclient.h\ 31 | enginioclient_global.h \ 32 | enginioclient_p.h \ 33 | enginioreply.h \ 34 | enginiomodel.h \ 35 | enginioidentity.h \ 36 | enginioobjectadaptor_p.h \ 37 | enginioreply_p.h \ 38 | enginiofakereply_p.h \ 39 | enginiodummyreply_p.h \ 40 | enginiostring_p.h \ 41 | enginioclientconnection.h \ 42 | enginiooauth2authentication.h \ 43 | enginioreplystate.h 44 | 45 | DEFINES += "ENGINIO_VERSION=\\\"$$MODULE_VERSION\\\"" 46 | 47 | load(qt_module) 48 | -------------------------------------------------------------------------------- /LGPL_EXCEPTION.txt: -------------------------------------------------------------------------------- 1 | The Qt Company Qt LGPL Exception version 1.1 2 | 3 | As an additional permission to the GNU Lesser General Public License version 4 | 2.1, the object code form of a "work that uses the Library" may incorporate 5 | material from a header file that is part of the Library. You may distribute 6 | such object code under terms of your choice, provided that: 7 | (i) the header files of the Library have not been modified; and 8 | (ii) the incorporated material is limited to numerical parameters, data 9 | structure layouts, accessors, macros, inline functions and 10 | templates; and 11 | (iii) you comply with the terms of Section 6 of the GNU Lesser General 12 | Public License version 2.1. 13 | 14 | Moreover, you may apply this exception to a modified version of the Library, 15 | provided that such modification does not involve copying material from the 16 | Library into the modified Library's header files unless such material is 17 | limited to (i) numerical parameters; (ii) data structure layouts; 18 | (iii) accessors; and (iv) small macros, templates and inline functions of 19 | five lines or less in length. 20 | 21 | Furthermore, you are not required to apply this additional permission to a 22 | modified version of the Library. 23 | -------------------------------------------------------------------------------- /dist/packages/com.digia.enginio/meta/LGPL_EXCEPTION.txt: -------------------------------------------------------------------------------- 1 | The Qt Company Qt LGPL Exception version 1.1 2 | 3 | As an additional permission to the GNU Lesser General Public License version 4 | 2.1, the object code form of a "work that uses the Library" may incorporate 5 | material from a header file that is part of the Library. You may distribute 6 | such object code under terms of your choice, provided that: 7 | (i) the header files of the Library have not been modified; and 8 | (ii) the incorporated material is limited to numerical parameters, data 9 | structure layouts, accessors, macros, inline functions and 10 | templates; and 11 | (iii) you comply with the terms of Section 6 of the GNU Lesser General 12 | Public License version 2.1. 13 | 14 | Moreover, you may apply this exception to a modified version of the Library, 15 | provided that such modification does not involve copying material from the 16 | Library into the modified Library's header files unless such material is 17 | limited to (i) numerical parameters; (ii) data structure layouts; 18 | (iii) accessors; and (iv) small macros, templates and inline functions of 19 | five lines or less in length. 20 | 21 | Furthermore, you are not required to apply this additional permission to a 22 | modified version of the Library. 23 | -------------------------------------------------------------------------------- /dist/packages/com.digia.enginio/meta/qtselection.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | QtSelectionPage 4 | 5 | 6 | 7 | 0 8 | 0 9 | 392 10 | 206 11 | 12 | 13 | 14 | Select Qt Version 15 | 16 | 17 | 18 | 19 | 20 | Enginio needs to install some files next to your Qt installation. 21 | Please select qmake (in the bin directory of your Qt installation) of the Qt 5 version you would like to use with Enginio. 22 | 23 | 24 | true 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | &Browse ... 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/enginio_plugin/doc/enginio_plugin.qdoc: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the documentation of Enginio. 7 | ** 8 | ** $QT_BEGIN_LICENSE:FDL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Free Documentation License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Free 19 | ** Documentation License version 1.3 as published by the Free Software 20 | ** Foundation and appearing in the file included in the packaging of 21 | ** this file. Please review the following information to ensure 22 | ** the GNU Free Documentation License version 1.3 requirements 23 | ** will be met: http://www.gnu.org/copyleft/fdl.html. 24 | ** $QT_END_LICENSE$ 25 | ** 26 | ****************************************************************************/ 27 | 28 | /*! 29 | \page enginio-qml-types-and-examples.html 30 | \title Enginio QML Types and Examples 31 | \inmodule enginio-qml 32 | 33 | Enginio provides these \b{QML types}: 34 | \annotatedlist engino-qml 35 | 36 | List of examples: 37 | \annotatedlist enginio-qml-examples 38 | */ 39 | -------------------------------------------------------------------------------- /examples/enginio/quick/socialtodos/socialtodos.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | ../../common/icons/delete_icon.png 4 | ../../common/icons/add_icon.png 5 | ../../common/icons/add_icon_pressed.png 6 | ../../common/icons/delete_icon_pressed.png 7 | ../../common/icons/back_icon.png 8 | ../../common/icons/share_icon.png 9 | ../../common/icons/share_icon_pressed.png 10 | ../../common/icons/reload_icon.png 11 | ../../common/icons/reload_icon_pressed.png 12 | 13 | 14 | ../../common/images/delegate.png 15 | ../../common/images/delegate_pressed.png 16 | ../../common/images/shadow.png 17 | ../../common/images/textfield.png 18 | ../../common/images/checkbox_checked.png 19 | 20 | 21 | socialtodos.qml 22 | Login.qml 23 | TextField.qml 24 | TodoLists.qml 25 | List.qml 26 | ShareDialog.qml 27 | Header.qml 28 | TouchButton.qml 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/enginio_client/doc/enginio_client.qdoc: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the documentation of Enginio. 7 | ** 8 | ** $QT_BEGIN_LICENSE:FDL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Free Documentation License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Free 19 | ** Documentation License version 1.3 as published by the Free Software 20 | ** Foundation and appearing in the file included in the packaging of 21 | ** this file. Please review the following information to ensure 22 | ** the GNU Free Documentation License version 1.3 requirements 23 | ** will be met: http://www.gnu.org/copyleft/fdl.html. 24 | ** $QT_END_LICENSE$ 25 | ** 26 | ****************************************************************************/ 27 | 28 | /*! 29 | \page enginio-cpp-classes-and-examples.html 30 | \title Enginio C++ Classes and Examples 31 | \inmodule enginio-qt 32 | \ingroup modules 33 | 34 | \section1 Namespaces 35 | 36 | \annotatedlist enginio-namespace 37 | 38 | \section1 Classes 39 | \generatelist {classesbymodule enginio-qt} 40 | 41 | List of examples: 42 | \annotatedlist enginio-examples 43 | */ 44 | -------------------------------------------------------------------------------- /doc/shared/client-query.qdocinc: -------------------------------------------------------------------------------- 1 | \brief Query the database 2 | 3 | The \a query is an object containing the actual query to the backend. 4 | The query will be run on the \a operation part of the backend. 5 | 6 | The \a query has to contain an "objectType" which has to point to a type defined 7 | in the backend. Optionally, it can also contain: 8 | \list 9 | \li query - describes how objects are queried, allows filtering of results. See {https://engin.io/documentation/rest/parameters/queries} 10 | {JSON query structure} 11 | \li limit - limits how many objects the server should return (default value is \c 100). 12 | \li offset - how many objects the server should skip from the beginning of the returned results. Note that the server keeps the data 13 | in random order so that usage of offset implies using \c sort as well. 14 | \li sort - describes how results are sorted. See \l{https://engin.io/documentation/rest/parameters/sort}{JSON sort request structure} 15 | \li count - if the \c count is set, the server will return only count of matching objects 16 | \li include - describes which other objects are included in the response. See \l{https://engin.io/documentation/rest/parameters/include} 17 | {JSON include structure} 18 | \endlist 19 | 20 | The JSON to list all objects of type "objects.image": 21 | \code 22 | { 23 | "objectType": "objects.image" 24 | } 25 | \endcode 26 | 27 | An example using \tt include to get \tt file references and with a query parameter that 28 | limits the results to only those objects where the reference is valid: 29 | \code 30 | { 31 | "objectType": "objects.image", 32 | "include": {"file": {}}, 33 | "query" : { "file": { "$ne": null } } 34 | } 35 | \endcode 36 | 37 | \sa EnginioReply, create(), update(), remove() 38 | -------------------------------------------------------------------------------- /src/enginio_client/doc/qtenginio.qdocconf: -------------------------------------------------------------------------------- 1 | include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) 2 | 3 | include(../../../doc/enginio_global.qdocconf) 4 | 5 | project = QtEnginio 6 | description = Client library for Enginio 7 | version = $QT_VERSION 8 | 9 | sourcedirs += .. \ 10 | ../../../doc/shared 11 | 12 | headerdirs += .. 13 | 14 | imagedirs += images 15 | 16 | outputdir = ./html 17 | outputformats = HTML 18 | 19 | exampledirs += \ 20 | ../../../examples/enginio/widgets \ 21 | ../../../tests/auto \ 22 | 23 | # Specify example install dir under QT_INSTALL_EXAMPLES 24 | examplesinstallpath = enginio/widgets 25 | 26 | depends += qtcore qtgui qtwidgets qtnetwork qtquick qtenginioqml qtenginiooverview 27 | 28 | qhp.projects = QtEnginio 29 | 30 | qhp.QtEnginio.file = qtenginio.qhp 31 | qhp.QtEnginio.namespace = org.qt-project.qtenginio.$QT_VERSION_TAG 32 | qhp.QtEnginio.virtualFolder = qtenginio 33 | qhp.QtEnginio.indexTitle = Enginio C++ Classes and Examples 34 | qhp.QtEnginio.indexRoot = 35 | 36 | qhp.QtEnginio.filterAttributes = qtenginio $QT_VERSION 37 | qhp.QtEnginio.customFilters.Qt.name = Enginio $QT_VERSION 38 | qhp.QtEnginio.customFilters.Qt.filterAttributes = qtenginio $QT_VERSION 39 | 40 | qhp.QtEnginio.subprojects = classes examples 41 | 42 | qhp.QtEnginio.subprojects.classes.title = C++ Classes 43 | qhp.QtEnginio.subprojects.classes.indexTitle = Enginio C++ Classes and Examples 44 | qhp.QtEnginio.subprojects.classes.selectors = class 45 | qhp.QtEnginio.subprojects.classes.sortPages = true 46 | 47 | qhp.QtEnginio.subprojects.examples.title = Examples 48 | qhp.QtEnginio.subprojects.examples.indexTitle = Enginio C++ Classes and Examples 49 | qhp.QtEnginio.subprojects.examples.selectors = fake:example 50 | qhp.QtEnginio.subprojects.examples.sortPages = true 51 | 52 | navigation.cppclassespage = "Enginio C++ Classes and Examples" 53 | -------------------------------------------------------------------------------- /src/enginio_plugin/doc/qtenginioqml.qdocconf: -------------------------------------------------------------------------------- 1 | include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) 2 | 3 | include(../../../doc/enginio_global.qdocconf) 4 | 5 | project = QtEnginioQml 6 | description = Client library for Enginio from QML 7 | version = $QT_VERSION 8 | 9 | sourcedirs += .. \ 10 | ../../../doc/shared 11 | 12 | headerdirs += .. 13 | 14 | imagedirs += images 15 | 16 | outputdir = ./html 17 | outputformats = HTML 18 | 19 | exampledirs += \ 20 | ../../../examples/enginio/quick \ 21 | snippets \ 22 | ../../../tests/auto \ 23 | 24 | # Specify example install dir under QT_INSTALL_EXAMPLES 25 | examplesinstallpath = enginio/quick 26 | 27 | depends += qtcore qtgui qtnetwork qtqml qtquick qtquickcontrols qtenginio qtenginiooverview 28 | 29 | qhp.projects = QtEnginioQml 30 | 31 | qhp.QtEnginioQml.file = qtenginioqml.qhp 32 | qhp.QtEnginioQml.namespace = org.qt-project.qtenginioqml.$QT_VERSION_TAG 33 | qhp.QtEnginioQml.virtualFolder = qtenginioqml 34 | qhp.QtEnginioQml.indexTitle = Enginio QML Types and Examples 35 | qhp.QtEnginioQml.indexRoot = 36 | 37 | qhp.QtEnginioQml.filterAttributes = qtenginio $QT_VERSION 38 | qhp.QtEnginioQml.customFilters.Qt.name = Enginio $QT_VERSION 39 | qhp.QtEnginioQml.customFilters.Qt.filterAttributes = qtenginio $QT_VERSION 40 | 41 | qhp.QtEnginioQml.subprojects = qmltypes examples 42 | 43 | qhp.QtEnginioQml.subprojects.qmltypes.title = QML Types 44 | qhp.QtEnginioQml.subprojects.qmltypes.indexTitle = Enginio QML Types and Examples 45 | qhp.QtEnginioQml.subprojects.qmltypes.selectors = qmlclass 46 | qhp.QtEnginioQml.subprojects.qmltypes.sortPages = true 47 | 48 | qhp.QtEnginioQml.subprojects.examples.title = Examples 49 | qhp.QtEnginioQml.subprojects.examples.indexTitle = Enginio QML Types and Examples 50 | qhp.QtEnginioQml.subprojects.examples.selectors = fake:example 51 | qhp.QtEnginioQml.subprojects.examples.sortPages = true 52 | 53 | navigation.qmltypespage = "Enginio QML Types and Examples" 54 | -------------------------------------------------------------------------------- /examples/enginio/widgets/cloudaddressbook/mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 640 10 | 480 11 | 12 | 13 | 14 | Enginio address book example 15 | 16 | 17 | 18 | 19 | 20 | 21 | Type here a phrase to search 22 | 23 | 24 | Search phrase 25 | 26 | 27 | 28 | 29 | 30 | 31 | Qt::Horizontal 32 | 33 | 34 | 35 | 40 36 | 20 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | address book 45 | 46 | 47 | 48 | 49 | 50 | 51 | Add 52 | 53 | 54 | 55 | 56 | 57 | 58 | false 59 | 60 | 61 | Remove 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /src/enginio_client/enginiostring.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #include 35 | 36 | #define DEFINE_ENGINIO_STRING(Name, String)\ 37 | const QString EnginioString::Name = QStringLiteral(String); 38 | 39 | FOR_EACH_ENGINIO_STRING(DEFINE_ENGINIO_STRING) 40 | 41 | #undef DEFINE_ENGINIO_STRING 42 | 43 | 44 | #define DEFINE_ENGINIO_BYTEARRAY(Name, String)\ 45 | const QByteArray EnginioString::Name = QByteArrayLiteral(String); 46 | 47 | FOR_EACH_ENGINIO_BYTEARRAY(DEFINE_ENGINIO_BYTEARRAY) 48 | 49 | #undef DEFINE_ENGINIO_BYTEARRAY 50 | -------------------------------------------------------------------------------- /dist/packages/com.digia.enginioDocumentation/meta/installscript.qs: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/contact-us 5 | ** 6 | ** This file is part of the Enginio Qt Client Library. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | function Component() 35 | { 36 | // default constructor 37 | } 38 | 39 | Component.prototype.createOperations = function() 40 | { 41 | component.createOperations(); 42 | 43 | if (installer.value("os") === "win") { 44 | component.addOperation("CreateShortcut", "@TargetDir@/doc/qtenginio/index.html", "@StartMenuDir@/Enginio Documentation.lnk", 45 | "workingDirectory=@TargetDir@", "iconPath=%SystemRoot%/system32/SHELL32.dll", 46 | "iconId=2"); 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /dist/changes-1.0.0: -------------------------------------------------------------------------------- 1 | Enginio 1.0 introduces many improvements to stability and API compared to previous beta versions. 2 | 3 | API Changes 4 | ----------- 5 | - backendSecret was removed from EnginioClient (both QML and C++) 6 | - Switched to OAuth2 as authentication mechanism everywhere 7 | - EnginioBasicAuthentication removed 8 | - EnginioOAuth2Authentication added 9 | - Many properties and signal&slots argument types changed to better fit QML API 10 | - Simplify working with dynamic roles in C++ 11 | - New property in Enginio model qml: rowCount 12 | - ObjectAclOperation and UsergroupMembersOperation JSON api was fixed 13 | - EnginioClient is not exposed to QML directly anymore 14 | - Renamed ObjectAclOperation to AccessControlOperation 15 | - Renamed the EnginioClient::search method to fullTextSearch 16 | - Renamed the EnginioClient::downloadFile function to downloadUrl to make it clear that this function does only provide a URL and does not download the file 17 | - Renamed EnginioModel::engino property to client 18 | - Renamed EnginioModel::setProperty to setData for better consistency with other C++ models. The order of the role and value arguments was changed as well 19 | - Renamed Roles to Role in EnginioModelBase. Enums should be singular according to Qt naming policy 20 | - Renamed EnginioClientBase to EnginioClientConnection 21 | - ErrorTypes enum was renamed to ErrorType 22 | - All enums were moved from a class scope to Enginio namespace 23 | 24 | Fixed Issues 25 | ------------ 26 | - It was not possible to add a user to a group with Qt api 27 | - Enums would sometimes not work 28 | - EnginioIdentity would emit userChanged instead of passwordChanged 29 | - Several memory leaks and crashes 30 | - Fixed namespace builds 31 | - Improved documentation 32 | - QNetworkAccessManager is deleted when not needed anymore 33 | - Improved build system 34 | - Improved error messages 35 | - Fixed autocompletion of QML types in QtCreator 36 | - Fixed non-local enums usage in QML 37 | - Fixed no-widget build 38 | 39 | Examples 40 | -------- 41 | - Added users example (showing user accounts and management) 42 | - Added Social Todos example (showing user management and ACLs) 43 | 44 | 45 | Platform Specific Issues 46 | ------------------------ 47 | - Fixed MSVC 2012 compilation 48 | -------------------------------------------------------------------------------- /src/enginio_client/enginioclient_global.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #ifndef ENGINIOCLIENT_GLOBAL_H 35 | #define ENGINIOCLIENT_GLOBAL_H 36 | 37 | #include 38 | 39 | #if defined(QT_SHARED) || !defined(QT_STATIC) 40 | # if defined(ENGINIOCLIENT_LIBRARY) 41 | # define ENGINIOCLIENT_EXPORT Q_DECL_EXPORT 42 | # else 43 | # define ENGINIOCLIENT_EXPORT Q_DECL_IMPORT 44 | # endif 45 | #else 46 | # define ENGINIOCLIENT_EXPORT 47 | #endif 48 | 49 | QT_BEGIN_NAMESPACE 50 | ENGINIOCLIENT_EXPORT extern bool gEnableEnginioDebugInfo; 51 | QT_END_NAMESPACE 52 | 53 | #endif // ENGINIOCLIENT_GLOBAL_H 54 | -------------------------------------------------------------------------------- /examples/enginio/common/backendhelper/backendhelper.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #ifndef ENGINIO_EXAMPLE_BACKEND_HELPER 42 | #define ENGINIO_EXAMPLE_BACKEND_HELPER 43 | 44 | #include 45 | 46 | QByteArray backendId(const QString &exampleName); 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /examples/enginio/widgets/todos-cpp/main.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #include "mainwindow.h" 42 | #include 43 | 44 | int main(int argc, char *argv[]) 45 | { 46 | QApplication a(argc, argv); 47 | MainWindow w; 48 | w.show(); 49 | 50 | return a.exec(); 51 | } 52 | -------------------------------------------------------------------------------- /examples/enginio/widgets/cloudaddressbook/main.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #include "mainwindow.h" 42 | #include 43 | 44 | int main(int argc, char *argv[]) 45 | { 46 | QApplication a(argc, argv); 47 | MainWindow w; 48 | w.show(); 49 | 50 | return a.exec(); 51 | } 52 | -------------------------------------------------------------------------------- /examples/enginio/widgets/image-gallery-cpp/main.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #include "mainwindow.h" 42 | #include 43 | 44 | int main(int argc, char *argv[]) 45 | { 46 | QApplication a(argc, argv); 47 | MainWindow w; 48 | w.show(); 49 | 50 | return a.exec(); 51 | } 52 | -------------------------------------------------------------------------------- /src/enginio_plugin/enginioplugin_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #ifndef ENGINIOPLUGIN_H 35 | #define ENGINIOPLUGIN_H 36 | 37 | #include 38 | #include 39 | 40 | QT_BEGIN_NAMESPACE 41 | 42 | class EnginioPlugin : public QQmlExtensionPlugin 43 | { 44 | Q_OBJECT 45 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") 46 | 47 | public: 48 | void initializeEngine(QQmlEngine *engine, const char *uri); 49 | void registerTypes(const char *uri); 50 | }; 51 | 52 | class QNetworkAccessManager; 53 | class QNetworkAccessManagerHolder : public QObject 54 | { 55 | Q_OBJECT 56 | public: 57 | QNetworkAccessManagerHolder(QObject *parent) : QObject(parent) 58 | {} 59 | QSharedPointer _guard; 60 | }; 61 | 62 | QT_END_NAMESPACE 63 | 64 | #endif // ENGINIOPLUGIN_H 65 | -------------------------------------------------------------------------------- /src/enginio_client/enginiodummyreply_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #ifndef ENGINIOWAITREPLY_H 35 | #define ENGINIOWAITREPLY_H 36 | 37 | #include 38 | #include 39 | 40 | QT_BEGIN_NAMESPACE 41 | 42 | class EnginioClientConnectionPrivate; 43 | class EnginioReply; 44 | class ENGINIOCLIENT_EXPORT EnginioDummyReply : public QNetworkReply 45 | { 46 | Q_OBJECT 47 | public: 48 | explicit EnginioDummyReply(QObject *parent = 0); 49 | 50 | virtual void abort() Q_DECL_OVERRIDE; 51 | virtual bool isSequential() const Q_DECL_OVERRIDE; 52 | virtual qint64 size() const Q_DECL_OVERRIDE; 53 | virtual qint64 readData(char *dest, qint64 n) Q_DECL_OVERRIDE; 54 | virtual qint64 writeData(const char *data, qint64 maxSize) Q_DECL_OVERRIDE; 55 | }; 56 | 57 | QT_END_NAMESPACE 58 | 59 | #endif // ENGINIOWAITREPLY_H 60 | -------------------------------------------------------------------------------- /src/enginio_client/enginioidentity.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #ifndef ENGINIOIDENTITY_H 35 | #define ENGINIOIDENTITY_H 36 | 37 | #include 38 | 39 | #include 40 | 41 | QT_BEGIN_NAMESPACE 42 | 43 | class EnginioClientConnectionPrivate; 44 | class EnginioIdentityPrivate; 45 | class ENGINIOCLIENT_EXPORT EnginioIdentity : public QObject 46 | { 47 | Q_OBJECT 48 | Q_DECLARE_PRIVATE(EnginioIdentity) 49 | 50 | protected: 51 | explicit EnginioIdentity(EnginioIdentityPrivate &, QObject *parent); 52 | 53 | Q_SIGNALS: 54 | void dataChanged(); 55 | void aboutToDestroy(); 56 | 57 | protected: 58 | virtual void prepareSessionToken(EnginioClientConnectionPrivate *enginio) = 0; 59 | virtual void removeSessionToken(EnginioClientConnectionPrivate *enginio) = 0; 60 | friend class EnginioClientConnectionPrivate; 61 | }; 62 | 63 | QT_END_NAMESPACE 64 | 65 | #endif // ENGINIOIDENTITY_H 66 | -------------------------------------------------------------------------------- /src/enginio_client/enginiofakereply_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #ifndef ENGINIOFAKEREPLY_P_H 35 | #define ENGINIOFAKEREPLY_P_H 36 | 37 | #include 38 | #include 39 | 40 | #include 41 | #include 42 | 43 | QT_BEGIN_NAMESPACE 44 | 45 | class ENGINIOCLIENT_EXPORT EnginioFakeReply : public QNetworkReply 46 | { 47 | Q_OBJECT 48 | QByteArray _msg; 49 | public: 50 | explicit EnginioFakeReply(EnginioClientConnectionPrivate *parent, const QByteArray &msg); 51 | explicit EnginioFakeReply(QObject *parent, const QByteArray &msg); 52 | 53 | virtual void abort() Q_DECL_OVERRIDE; 54 | virtual bool isSequential() const Q_DECL_OVERRIDE; 55 | virtual qint64 size() const Q_DECL_OVERRIDE; 56 | virtual qint64 readData(char *dest, qint64 n) Q_DECL_OVERRIDE; 57 | virtual qint64 writeData(const char *data, qint64 maxSize) Q_DECL_OVERRIDE; 58 | 59 | private: 60 | void init(QNetworkAccessManager*); 61 | }; 62 | 63 | QT_END_NAMESPACE 64 | 65 | #endif // ENGINIOFAKEREPLY_P_H 66 | -------------------------------------------------------------------------------- /examples/enginio/widgets/todos-cpp/todosmodel.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #ifndef TODOSMODEL_H 42 | #define TODOSMODEL_H 43 | 44 | #include 45 | 46 | //![definition] 47 | class TodosModel : public EnginioModel 48 | { 49 | Q_OBJECT 50 | 51 | public: 52 | enum Role 53 | { 54 | TitleRole = Enginio::CustomPropertyRole, 55 | CompletedRole 56 | }; 57 | //![definition] 58 | 59 | explicit TodosModel(QObject *parent = 0); 60 | virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; 61 | virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE; 62 | 63 | virtual QHash roleNames() const Q_DECL_OVERRIDE; 64 | }; 65 | 66 | #endif // TODOSMODEL_H 67 | -------------------------------------------------------------------------------- /examples/enginio/widgets/image-gallery-cpp/imagemodel.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #include 42 | #include "imageobject.h" 43 | 44 | #ifndef IMAGEMODEL_H 45 | #define IMAGEMODEL_H 46 | class ImageModel : public EnginioModel 47 | { 48 | Q_OBJECT 49 | public: 50 | ImageModel(QObject *parent = 0); 51 | 52 | QVariant data(const QModelIndex &index, int role) const; 53 | 54 | virtual Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE; 55 | 56 | public slots: 57 | void updateRows(const QModelIndex &, int start, int end); 58 | void onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); 59 | void reset(); 60 | void imageChanged(const QString &id); 61 | 62 | private: 63 | QMap m_images; 64 | 65 | }; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/enginio_plugin/doc/snippets/simple.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the documentation of the QtEnginio library. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | import QtQuick 2.0 42 | //! [import] 43 | import Enginio 1.0 44 | //! [import] 45 | 46 | Rectangle { 47 | //! [client] 48 | EnginioClient { 49 | id: client 50 | backendId: "YOUR_BACKEND_ID" // from Enginio Dashboard 51 | } 52 | //! [client] 53 | 54 | //! [client-signals] 55 | EnginioClient { 56 | // ... 57 | onFinished: console.log("Engino request finished." + reply.data) 58 | onError: console.log("Enginio error " + reply.errorCode + ": " + reply.errorString) 59 | } 60 | //! [client-signals] 61 | 62 | //! [client-query] 63 | EnginioClient { 64 | // ... 65 | Component.onCompleted: query({"objectType": "objects.image"}) 66 | } 67 | //! [client-query] 68 | } 69 | -------------------------------------------------------------------------------- /src/enginio_plugin/enginioqmlreply_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #ifndef ENGINIOQMLREPLY_H 35 | #define ENGINIOQMLREPLY_H 36 | 37 | #include 38 | #include 39 | #include 40 | 41 | QT_BEGIN_NAMESPACE 42 | 43 | class EnginioQmlClientPrivate; 44 | class EnginioQmlReplyPrivate; 45 | 46 | class EnginioQmlReply : public EnginioReplyState 47 | { 48 | Q_OBJECT 49 | Q_ENUMS(QNetworkReply::NetworkError); // TODO remove me QTBUG-33577 50 | Q_ENUMS(Enginio::Operation) // TODO remove me QTBUG-33577 51 | Q_ENUMS(Enginio::ErrorType); // TODO remove me QTBUG-33577 52 | Q_ENUMS(Enginio::Role); // TODO remove me QTBUG-33577 53 | 54 | 55 | public: 56 | Q_PROPERTY(QJSValue data READ data NOTIFY dataChanged FINAL) 57 | Q_PROPERTY(bool isError READ isError NOTIFY dataChanged FINAL) 58 | Q_PROPERTY(bool isFinished READ isFinished NOTIFY finished FINAL) 59 | 60 | explicit EnginioQmlReply(EnginioQmlClientPrivate *parent, QNetworkReply *reply); 61 | ~EnginioQmlReply(); 62 | 63 | QJSValue data() const Q_REQUIRED_RESULT; 64 | 65 | Q_SIGNALS: 66 | void finished(const QJSValue &reply); 67 | void dataChanged(); 68 | 69 | private: 70 | Q_DECLARE_PRIVATE(EnginioQmlReply) 71 | }; 72 | 73 | QT_END_NAMESPACE 74 | 75 | #endif // ENGINIOQMLREPLY_H 76 | -------------------------------------------------------------------------------- /examples/enginio/widgets/image-gallery-cpp/imageobject.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #ifndef IMAGEOBJECT_H 42 | #define IMAGEOBJECT_H 43 | 44 | #include 45 | #include 46 | 47 | QT_BEGIN_NAMESPACE 48 | class QNetworkReply; 49 | class EnginioClient; 50 | class EnginioReply; 51 | QT_END_NAMESPACE 52 | QT_USE_NAMESPACE 53 | 54 | class ImageObject : public QObject 55 | { 56 | Q_OBJECT 57 | public: 58 | explicit ImageObject(EnginioClient *enginio); 59 | 60 | void setObject(const QJsonObject &object); 61 | 62 | QImage image() { return m_image; } 63 | QPixmap thumbnail(); 64 | 65 | signals: 66 | void imageChanged(const QString &id); 67 | 68 | private slots: 69 | void replyFinished(EnginioReply *enginioReply); 70 | void downloadFinished(); 71 | 72 | private: 73 | QImage m_image; 74 | QPixmap m_thumbnail; 75 | QNetworkReply *m_reply; 76 | EnginioClient *m_enginio; 77 | QJsonObject m_object; 78 | }; 79 | 80 | #endif // IMAGEOBJECT_H 81 | -------------------------------------------------------------------------------- /src/enginio_client/enginiooauth2authentication.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #ifndef ENGINIOOAUTH2AUTHENTICATION_H 35 | #define ENGINIOOAUTH2AUTHENTICATION_H 36 | 37 | #include 38 | #include 39 | 40 | QT_BEGIN_NAMESPACE 41 | 42 | class EnginioOAuth2AuthenticationPrivate; 43 | class ENGINIOCLIENT_EXPORT EnginioOAuth2Authentication : public EnginioIdentity 44 | { 45 | Q_OBJECT 46 | Q_PROPERTY(QString user READ user WRITE setUser NOTIFY userChanged) 47 | Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged) 48 | Q_DECLARE_PRIVATE(EnginioOAuth2Authentication) 49 | 50 | public: 51 | explicit EnginioOAuth2Authentication(QObject *parent = nullptr); 52 | ~EnginioOAuth2Authentication(); 53 | 54 | QString user() const Q_REQUIRED_RESULT; 55 | QString password() const Q_REQUIRED_RESULT; 56 | 57 | public Q_SLOTS: 58 | void setUser(const QString &user); 59 | void setPassword(const QString &password); 60 | 61 | Q_SIGNALS: 62 | void userChanged(const QString &user); 63 | void passwordChanged(const QString &password); 64 | 65 | protected: 66 | virtual void prepareSessionToken(EnginioClientConnectionPrivate *enginio) Q_DECL_OVERRIDE; 67 | virtual void removeSessionToken(EnginioClientConnectionPrivate *enginio) Q_DECL_OVERRIDE; 68 | }; 69 | 70 | QT_END_NAMESPACE 71 | 72 | #endif // ENGINIOOAUTH2AUTHENTICATION_H 73 | -------------------------------------------------------------------------------- /tests/auto/identity/oauth2authentication/tst_oauth2authentication.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the test suite of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #include 35 | #include 36 | 37 | #include "../common/identitycommon.h" 38 | #include 39 | 40 | class tst_OAuth2Authentication: public QObject, public IdentityCommonTest 41 | { 42 | Q_OBJECT 43 | 44 | typedef IdentityCommonTest Base; 45 | 46 | public: 47 | static QJsonObject enginioData(const QJsonObject &obj) { return obj["enginio_data"].toObject(); } 48 | 49 | public slots: 50 | void error(EnginioReply *reply) { Base::error(reply); } 51 | 52 | private slots: 53 | void initTestCase() 54 | { 55 | Base::initTestCase(QStringLiteral("tst_OAuth2Auth")); 56 | } 57 | void cleanupTestCase() 58 | { 59 | Base::cleanupTestCase(); 60 | } 61 | 62 | void identity() { Base::identity(); } 63 | void identity_changing() { Base::identity_changing(); } 64 | void identity_invalid() { Base::identity_invalid(); } 65 | void identity_afterLogout() { Base::identity_afterLogout(QByteArrayLiteral("Authorization")); } 66 | void queryRestrictedObject() { Base::queryRestrictedObject(); } 67 | void userAndPass() { Base::userAndPass(); } 68 | }; 69 | 70 | QTEST_MAIN(tst_OAuth2Authentication) 71 | #include "tst_oauth2authentication.moc" 72 | -------------------------------------------------------------------------------- /src/enginio_client/enginiodummyreply.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #include 35 | #include 36 | 37 | QT_BEGIN_NAMESPACE 38 | 39 | EnginioDummyReply::EnginioDummyReply(QObject *parent) 40 | : QNetworkReply(parent) 41 | { 42 | } 43 | 44 | struct EnginioDummyReplyAbort 45 | { 46 | QNetworkAccessManager *_qnam; 47 | EnginioDummyReply *_reply; 48 | void operator ()() 49 | { 50 | _qnam->finished(_reply); 51 | } 52 | }; 53 | 54 | void EnginioDummyReply::abort() 55 | { 56 | QNetworkReply::close(); 57 | setError(OperationCanceledError, tr("Operation canceled")); 58 | setFinished(true); 59 | EnginioDummyReplyAbort fin = {EnginioClientConnectionPrivate::prepareNetworkManagerInThread().data(), this}; 60 | QObject::connect(this, &EnginioDummyReply::finished, fin); 61 | QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); 62 | } 63 | 64 | bool EnginioDummyReply::isSequential() const 65 | { 66 | return false; 67 | } 68 | 69 | qint64 EnginioDummyReply::size() const 70 | { 71 | return 0; 72 | } 73 | 74 | qint64 EnginioDummyReply::readData(char *dest, qint64 n) 75 | { 76 | Q_UNUSED(dest); 77 | Q_UNUSED(n); 78 | return 0; 79 | } 80 | 81 | qint64 EnginioDummyReply::writeData(const char *data, qint64 maxSize) 82 | { 83 | Q_UNUSED(data); 84 | Q_UNUSED(maxSize); 85 | return -1; 86 | } 87 | 88 | QT_END_NAMESPACE 89 | -------------------------------------------------------------------------------- /examples/enginio/widgets/cloudaddressbook/mainwindow.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #ifndef MAINWINDOW_H 42 | #define MAINWINDOW_H 43 | 44 | #include 45 | #include "ui_mainwindow.h" 46 | 47 | QT_BEGIN_NAMESPACE 48 | class EnginioClient; 49 | class EnginioReply; 50 | class QSortFilterProxyModel; 51 | QT_END_NAMESPACE 52 | 53 | 54 | QT_USE_NAMESPACE 55 | 56 | class AddressBookModel; 57 | 58 | class MainWindow : public QMainWindow, Ui_MainWindow 59 | { 60 | Q_OBJECT 61 | 62 | public: 63 | MainWindow(QWidget *parent = 0); 64 | 65 | private slots: 66 | void onSearchEdit(); 67 | void onSearchFinished(); 68 | void onAddRow(); 69 | void onSelectionChanged(); 70 | void onRemoveRow(); 71 | void error(EnginioReply *error); 72 | 73 | private: 74 | // The Enginio client object used in all enginio operations 75 | EnginioClient *client; 76 | 77 | // Enginio object model containing addresses 78 | AddressBookModel *model; 79 | QSortFilterProxyModel *sortFilterProxyModel; 80 | }; 81 | 82 | #endif // MAINWINDOW_H 83 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Enginio Qt Library development branch 2 | Client library for accessing Enginio service from Qt and QML code. 3 | 4 | # System Requirements 5 | * Qt 5.1 or newer 6 | * OpenSSL library 7 | * Mac OS X: the OpenSSL library should be preinstalled. 8 | * Linux: Most distributions have a preinstalled OpenSSL library. If yours doesn't, seach for `libssl` in the package repository. 9 | * Windows: Get the installer from http://slproweb.com/products/Win32OpenSSL.html (light version is enough, copy DLLs to windows system directory when asked). 10 | * Perl 5.10 or newer 11 | * Mac and Linux: Perl should be preinstalled. 12 | * Windows: http://www.perl.org/get.html 13 | 14 | # Build & Install 15 | * `qmake && make install` 16 | * Produces shared library and installs it as a globally available Qt5 module 17 | 18 | # Usage 19 | * In C++ applications 20 | * Use Enginio module by adding `QT += enginio` to application `.pro` file 21 | * Include Enginio headers with `` (for example: `#include `) 22 | * In QML applications 23 | * Import Enginio components with `import Enginio 1.0` 24 | 25 | # Contributing 26 | * Contributing to the Enginio Qt Library works the same way as contributing to any other Qt module 27 | * See [Qt Contribution Guidelines](http://wiki.qt.io/Qt_Contribution_Guidelines) 28 | * Clone the repository from ssh://codereview.qt-project.org/qt/qtenginio.git 29 | * Implement the new feature and automated tests for it 30 | * Make sure all tests pass 31 | * Push your change for review to [Gerrit](http://wiki.qt.io/Gerrit_Introduction) 32 | * Add reviewers (You can find e-mail addresses in git log and git blame) 33 | 34 | # Copyright 35 | Copyright (C) 2015 The Qt Company Ltd. 36 | Contact http://www.qt.io/contact-us 37 | 38 | 39 | # License 40 | Enginio Qt library is tri-licensed under the Commercial Qt License, the GNU General Public License 3.0, and the GNU Lesser General Public License 2.1. 41 | 42 | **Commercial License Usage** 43 | Licensees holding valid Commercial Qt Licenses may use this library 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 http://www.qt.io/terms-conditions. For further information use the contact form at http://www.qt.io/contact-us. 44 | 45 | **GNU Lesser General Public License Usage** 46 | Alternatively, this file may be used under the terms of the GNU Lesser General Public License version 2.1 or version 3 as published by the Free Software Foundation and appearing in the file LICENSE.LGPLv21 and LICENSE.LGPLv3 included in the packaging of this file. Please review the following information to ensure the GNU Lesser General Public License requirements will be met: https://www.gnu.org/licenses/lgpl.html and http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 47 | 48 | As a special exception, The Qt Company gives you certain additional rights. These rights are described in The Qt Company LGPL Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 49 | -------------------------------------------------------------------------------- /src/enginio_client/enginiobasemodel.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #ifndef ENGINIOMODELBASE_H 35 | #define ENGINIOMODELBASE_H 36 | 37 | #include 38 | #include 39 | 40 | #include 41 | 42 | QT_BEGIN_NAMESPACE 43 | 44 | class EnginioBaseModelPrivate; 45 | class ENGINIOCLIENT_EXPORT EnginioBaseModel : public QAbstractListModel 46 | { 47 | Q_OBJECT 48 | 49 | protected: 50 | explicit EnginioBaseModel(EnginioBaseModelPrivate &dd, QObject *parent); 51 | public: 52 | ~EnginioBaseModel(); 53 | 54 | virtual Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE; 55 | virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; 56 | virtual int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; 57 | virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE; 58 | 59 | virtual void fetchMore(const QModelIndex &parent) Q_DECL_OVERRIDE; 60 | virtual bool canFetchMore(const QModelIndex &parent) const Q_DECL_OVERRIDE; 61 | 62 | virtual QHash roleNames() const Q_DECL_OVERRIDE; 63 | 64 | void disableNotifications(); 65 | 66 | private: 67 | Q_DISABLE_COPY(EnginioBaseModel) 68 | Q_DECLARE_PRIVATE(EnginioBaseModel) 69 | friend class EnginioModelPrivate; 70 | }; 71 | 72 | 73 | QT_END_NAMESPACE 74 | 75 | 76 | #endif // ENGINIOMODELBASE_H 77 | -------------------------------------------------------------------------------- /examples/enginio/quick/socialtodos/socialtodos.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | import QtQuick 2.1 42 | import QtQuick.Controls 1.0 43 | import QtQuick.Window 2.1 44 | import Enginio 1.0 45 | 46 | Item { 47 | id: main 48 | property real scaleFactor: Screen.pixelDensity / 5.0 49 | property int intScaleFactor: Math.max(1, scaleFactor) 50 | 51 | width: 400 * scaleFactor 52 | height: 640 * scaleFactor 53 | 54 | BackendHelper{ 55 | id: backendHelper 56 | } 57 | 58 | Rectangle { 59 | id: root 60 | anchors.fill: parent 61 | opacity: 1 - backendHelper.opacity 62 | 63 | color: "#f4f4f4" 64 | 65 | Component { 66 | id: lists 67 | TodoLists{} 68 | } 69 | 70 | EnginioClient { 71 | id: enginioClient 72 | backendId: backendHelper.backendId 73 | } 74 | 75 | EnginioOAuth2Authentication { 76 | id: auth 77 | } 78 | 79 | StackView { 80 | id: mainView 81 | anchors.fill: parent 82 | initialItem: Login{} 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /examples/enginio/widgets/todos-cpp/mainwindow.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #ifndef MAINWINDOW_H 42 | #define MAINWINDOW_H 43 | 44 | #include 45 | #include 46 | 47 | QT_BEGIN_NAMESPACE 48 | class QPushButton; 49 | class EnginioClient; 50 | class EnginioReply; 51 | QT_END_NAMESPACE 52 | QT_USE_NAMESPACE 53 | 54 | class TodosModel; 55 | class MainWindow : public QMainWindow 56 | { 57 | Q_OBJECT 58 | 59 | public: 60 | MainWindow(QWidget *parent = 0); 61 | virtual QSize sizeHint() const; 62 | 63 | private slots: 64 | void error(EnginioReply *error); 65 | 66 | void removeItem(); 67 | void appendItem(); 68 | void toggleCompleted(); 69 | void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); 70 | 71 | private: 72 | void queryTodos(); 73 | 74 | // The Enginio client object used in all enginio operations 75 | EnginioClient *m_client; 76 | 77 | // Enginio object model containing todos objects 78 | TodosModel *m_model; 79 | 80 | // The list view showing contents of m_model 81 | QTreeView *m_view; 82 | 83 | QPushButton *m_addNewButton; 84 | QPushButton *m_removeButton; 85 | QPushButton *m_toggleButton; 86 | }; 87 | 88 | #endif // MAINWINDOW_H 89 | -------------------------------------------------------------------------------- /examples/enginio/quick/users/Browse.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | import QtQuick 2.1 42 | //![imports] 43 | import Enginio 1.0 44 | import QtQuick.Controls 1.0 45 | import QtQuick.Layouts 1.0 46 | //![imports] 47 | 48 | ColumnLayout { 49 | anchors.margins: 3 50 | spacing: 3 51 | TableView { 52 | Layout.fillWidth: true 53 | Layout.fillHeight: true 54 | 55 | //![columns] 56 | TableViewColumn { title: "First name"; role: "firstName" } 57 | TableViewColumn { title: "Last name"; role: "lastName" } 58 | TableViewColumn { title: "Login"; role: "username" } 59 | TableViewColumn { title: "Email"; role: "email" } 60 | //![columns] 61 | 62 | //![browse] 63 | model: EnginioModel { 64 | id: enginioModel 65 | client: enginioClient 66 | operation: Enginio.UserOperation 67 | query: {"objectType": "users" } 68 | } 69 | //![browse] 70 | } 71 | 72 | Button { 73 | text: "Refresh" 74 | Layout.fillWidth: true 75 | 76 | onClicked: { 77 | var tmp = enginioModel.query 78 | enginioModel.query = null 79 | enginioModel.query = tmp 80 | } 81 | } 82 | } 83 | 84 | -------------------------------------------------------------------------------- /examples/enginio/widgets/image-gallery-cpp/mainwindow.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #ifndef MAINWINDOW_H 42 | #define MAINWINDOW_H 43 | 44 | #include 45 | #include 46 | #include 47 | 48 | QT_BEGIN_NAMESPACE 49 | class EnginioClient; 50 | class EnginioReply; 51 | class QFileDialog; 52 | class QListView; 53 | class QNetworkReply; 54 | class QPushButton; 55 | QT_END_NAMESPACE 56 | QT_USE_NAMESPACE 57 | 58 | class ImageModel; 59 | class ImageObject; 60 | class ImageDownloader; 61 | 62 | class MainWindow : public QMainWindow 63 | { 64 | Q_OBJECT 65 | 66 | public: 67 | MainWindow(QWidget *parent = 0); 68 | virtual QSize sizeHint() const; 69 | 70 | private slots: 71 | void queryImages(); 72 | void error(EnginioReply *error); 73 | void beginUpload(EnginioReply *reply); 74 | void fileSelected(const QString &file); 75 | 76 | private: 77 | // The Enginio client object used in all enginio operations 78 | EnginioClient *m_client; 79 | 80 | // Enginio object model containing image objects 81 | ImageModel *m_model; 82 | 83 | // The list view showing contents of m_model 84 | QListView *m_view; 85 | QPushButton *m_uploadButton; 86 | QFileDialog *m_fileDialog; 87 | }; 88 | 89 | #endif // MAINWINDOW_H 90 | -------------------------------------------------------------------------------- /examples/enginio/quick/users/users.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | import QtQuick 2.1 42 | import Enginio 1.0 43 | import QtQuick.Controls 1.0 44 | import QtQuick.Layouts 1.0 45 | 46 | Item { 47 | id: main 48 | height: 800 49 | width: 600 50 | 51 | BackendHelper{ 52 | id: backendHelper 53 | } 54 | 55 | Rectangle { 56 | id: root 57 | anchors.fill: parent 58 | opacity: 1 - backendHelper.opacity 59 | 60 | color: "#f4f4f4" 61 | 62 | //![client] 63 | EnginioClient { 64 | id: enginioClient 65 | backendId: backendHelper.backendId 66 | 67 | onError: console.debug(JSON.stringify(reply.data)) 68 | } 69 | //![client] 70 | 71 | TabView { 72 | id: tabView 73 | anchors.fill: parent 74 | anchors.margins: 3 75 | 76 | Tab { 77 | title: "Users" 78 | Browse { anchors.fill: parent } 79 | } 80 | 81 | Tab { 82 | title: "Login" 83 | Login { anchors.fill: parent } 84 | } 85 | 86 | Tab { 87 | title: "Register" 88 | Register { anchors.fill: parent } 89 | } 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /dist/patcher.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Copyright (C) 2015 The Qt Company Ltd. 5 | # Contact: http://engin.io 6 | # 7 | # You may use this file under the terms of the 3-clause BSD license. 8 | # See the file LICENSE from this package for details. 9 | # 10 | 11 | from __future__ import print_function 12 | import os 13 | import shutil 14 | import subprocess 15 | import sys 16 | 17 | script_path = os.path.abspath(os.path.dirname(sys.argv[0])) 18 | os.chdir(script_path) 19 | qmake = "bin/qmake" 20 | otool = "otool" 21 | install_name_tool = "install_name_tool" 22 | 23 | cwd = os.getcwd() 24 | print(cwd) 25 | 26 | qt_install_placeholder = "<__QT__INSTALL__PREFIX__>" 27 | qt_install_prefix = subprocess.check_output([qmake, "-query", "QT_INSTALL_PREFIX"]).strip().decode('utf-8') 28 | 29 | if sys.platform == "darwin" or sys.platform.startswith("linux"): 30 | filenames = ['mkspecs/modules/qt_lib_enginio.pri', 31 | 'lib/Enginio.framework/Enginio_debug.prl', 32 | 'lib/Enginio.framework/Enginio.prl', 33 | 'lib/libEnginio.prl', 34 | 'lib/pkgconfig/Enginio.pc', 35 | 'lib/libEnginio.la', 36 | 'lib/Enginio.la', 37 | 'lib/Enginio_debug.la'] 38 | 39 | for f in filenames: 40 | if os.path.exists(f): 41 | with open(f, "r+") as f_handle: 42 | lines = f_handle.readlines() 43 | f_handle.seek(0) 44 | f_handle.truncate() 45 | for line in lines: 46 | modline = line 47 | if qt_install_placeholder in line: 48 | modline = line.replace(qt_install_placeholder, qt_install_prefix) 49 | f_handle.write(modline) 50 | 51 | if not sys.platform == "darwin": 52 | exit(0) 53 | 54 | plugin_lib = "qml/Enginio/libenginioplugin.dylib" 55 | plugin_debug_lib = "qml/Enginio/libenginioplugin_debug.dylib" 56 | 57 | install_path = subprocess.check_output([otool, "-D", "lib/Enginio.framework/Enginio"]).split().pop() 58 | rpath = install_path.replace(qt_install_placeholder, qt_install_prefix) 59 | enginio_lib = install_path.replace(qt_install_placeholder, '.') 60 | 61 | subprocess.check_call([install_name_tool, "-id", rpath, enginio_lib]) 62 | subprocess.check_call([install_name_tool, "-id", rpath + "_debug", enginio_lib + "_debug"]) 63 | 64 | rpath_libs = subprocess.check_output([otool, "-L", enginio_lib]).strip().split('\n') 65 | rpath_libs.extend(subprocess.check_output([otool, "-L", plugin_lib]).strip().split('\n')) 66 | rpath_libs.extend(subprocess.check_output([otool, "-L", plugin_debug_lib]).strip().split('\n')) 67 | 68 | seen = set() 69 | for line in rpath_libs: 70 | lib = line.split()[0].strip() 71 | if lib not in seen and lib.startswith(qt_install_placeholder): 72 | print("# " + lib) 73 | subprocess.check_call([install_name_tool, "-change", lib, lib.replace(qt_install_placeholder, qt_install_prefix), enginio_lib]) 74 | subprocess.check_call([install_name_tool, "-change", lib, lib.replace(qt_install_placeholder, qt_install_prefix), enginio_lib + "_debug"]) 75 | subprocess.check_call([install_name_tool, "-change", lib, lib.replace(qt_install_placeholder, qt_install_prefix), plugin_lib]) 76 | subprocess.check_call([install_name_tool, "-change", lib, lib.replace(qt_install_placeholder, qt_install_prefix), plugin_debug_lib]) 77 | seen.add(lib) 78 | 79 | os.chdir(cwd) 80 | 81 | -------------------------------------------------------------------------------- /examples/enginio/widgets/cloudaddressbook/addressbookmodel.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #ifndef ADDRESSBOOKMODEL_H 42 | #define ADDRESSBOOKMODEL_H 43 | 44 | #include 45 | #include 46 | 47 | class AddressBookModel : public EnginioModel 48 | { 49 | Q_OBJECT 50 | 51 | EnginioReply *_searchReply; 52 | QSet _markedItems; 53 | 54 | public: 55 | //![Roles] 56 | enum Roles { 57 | FirstNameRole = Enginio::CustomPropertyRole, 58 | LastNameRole, 59 | EmailRole, 60 | PhoneRole, 61 | AddressRole 62 | }; 63 | //![Roles] 64 | 65 | explicit AddressBookModel(QObject *parent); 66 | virtual ~AddressBookModel(); 67 | 68 | virtual QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; 69 | bool setData(const QModelIndex &index, const QVariant &value, int role) Q_DECL_OVERRIDE; 70 | virtual int columnCount(const QModelIndex & parent = QModelIndex()) const Q_DECL_OVERRIDE; 71 | virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE; 72 | virtual QHash roleNames() const Q_DECL_OVERRIDE; 73 | 74 | public slots: 75 | void newSearch(const QString &search); 76 | 77 | private slots: 78 | void searchResultsArrived(); 79 | 80 | signals: 81 | void searchFinished(); 82 | }; 83 | 84 | #endif // ADDRESSBOOKMODEL_H 85 | 86 | -------------------------------------------------------------------------------- /examples/enginio/quick/socialtodos/Header.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | import QtQuick 2.1 42 | 43 | Rectangle { 44 | property alias text: t.text 45 | property int rightMargin: 0 46 | 47 | anchors.top: parent.top 48 | width: parent.width 49 | height: 70 * scaleFactor 50 | color: "white" 51 | 52 | Item { 53 | height: parent.height 54 | width: parent.height 55 | id: backButton 56 | Image { 57 | anchors.centerIn: parent 58 | width: implicitWidth * scaleFactor 59 | height: implicitHeight * scaleFactor 60 | source: "qrc:icons/back_icon.png" 61 | MouseArea { 62 | anchors.fill: parent 63 | anchors.margins: - 10 64 | onClicked: mainView.pop() 65 | } 66 | } 67 | } 68 | Text { 69 | id: t 70 | anchors.left: backButton.right 71 | anchors.leftMargin: 10 * scaleFactor 72 | anchors.right: parent.right 73 | anchors.rightMargin: rightMargin 74 | anchors.verticalCenter: parent.verticalCenter 75 | anchors.verticalCenterOffset: -3 76 | elide: Text.ElideMiddle 77 | font.bold: true 78 | font.pixelSize: 36 * scaleFactor 79 | color: "#555" 80 | } 81 | Rectangle { 82 | width: parent.width; height: 1 83 | anchors.bottom: parent.bottom 84 | color: "#bbb" 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /examples/enginio/widgets/image-gallery-cpp/doc/src/image-gallery-cpp.qdoc: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the documentation of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:FDL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Free Documentation License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Free 19 | ** Documentation License version 1.3 as published by the Free Software 20 | ** Foundation and appearing in the file included in the packaging of 21 | ** this file. Please review the following information to ensure 22 | ** the GNU Free Documentation License version 1.3 requirements 23 | ** will be met: http://www.gnu.org/copyleft/fdl.html. 24 | ** $QT_END_LICENSE$ 25 | ** 26 | ****************************************************************************/ 27 | /*! 28 | \title Enginio C++ Examples - Image Gallery 29 | \example image-gallery-cpp 30 | \brief This is an example that demonstrates uploading and downloading of files in Enginio. 31 | \ingroup enginio-examples 32 | \inmodule enginio-qt 33 | 34 | The user interface consists of a list of images and a button to upload more images. 35 | 36 | \image gallery-example.png 37 | 38 | \section1 Backend Configuration 39 | The \e Enginio \e backend needs to be set up in order to get this example working. 40 | 41 | Go to the \e {Enginio Dashboard} and create a new backend with the \gui {Image Gallery} template. 42 | The template will construct a new custom backend by executing these steps: 43 | \list 44 | \li Create a new object type \c objects.image (on the \gui {Object Types} page). 45 | 46 | Add two properties to the image object: 47 | name:"name", type: "String" and name: "file", type: "Ref" with target "files". 48 | 49 | \li Add a file processor by clicking the \c file property. 50 | Choose \gui {Image processor} and in \gui {Variants} enter: 51 | \code 52 | { 53 | "thumbnail": { "crop":"100x100" } 54 | } 55 | \endcode 56 | This JSON snippet triggers the server to generate thumbnails for all uploaded images. 57 | In the image gallery, the thumbnails will be used in the list view, and the full image will be shown 58 | when the thumbnail is clicked. 59 | \endlist 60 | 61 | Copy the backend id from the Enginio dashboard, and use them when requested. 62 | 63 | \section1 The Example Code 64 | 65 | The example consists of three classes. 66 | ImageModel is a subclass of \l {EnginioModelCpp}{EnginioModel} 67 | that exposes the images in the \l Qt::DecorationRole for the list view. 68 | In the \c {MainWindow}, a normal QListView is used to display the model contents. 69 | The ImageObject is a class that takes care of the download, and emits a signal 70 | when an image has been downloaded. 71 | 72 | 73 | */ 74 | -------------------------------------------------------------------------------- /src/enginio_plugin/enginioqmlclient_p_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #ifndef ENGINIOQMLCLIENT_P_H 35 | #define ENGINIOQMLCLIENT_P_H 36 | 37 | #include 38 | #include "enginioqmlclient_p.h" 39 | 40 | #include 41 | #include 42 | 43 | QT_BEGIN_NAMESPACE 44 | 45 | class EnginioQmlClientPrivate : public EnginioClientConnectionPrivate 46 | { 47 | QJSEngine *_engine; 48 | QJSValue _stringify; 49 | QJSValue _parse; 50 | 51 | Q_DECLARE_PUBLIC(EnginioQmlClient) 52 | public: 53 | EnginioQmlClientPrivate() 54 | : _engine(0) 55 | {} 56 | 57 | static EnginioQmlClientPrivate* get(EnginioClientConnection *client) { return static_cast(EnginioClientConnectionPrivate::get(client)); } 58 | static EnginioQmlClient* get(EnginioClientConnectionPrivate *client) { return static_cast(client->q_ptr); } 59 | 60 | virtual void init() Q_DECL_OVERRIDE; 61 | virtual void emitSessionTerminated() const Q_DECL_OVERRIDE; 62 | virtual void emitSessionAuthenticated(EnginioReplyState *reply) Q_DECL_OVERRIDE; 63 | virtual void emitSessionAuthenticationError(EnginioReplyState *reply) Q_DECL_OVERRIDE; 64 | virtual void emitFinished(EnginioReplyState *reply) Q_DECL_OVERRIDE; 65 | virtual void emitError(EnginioReplyState *reply) Q_DECL_OVERRIDE; 66 | virtual EnginioReplyState *createReply(QNetworkReply *nreply) Q_DECL_OVERRIDE; 67 | 68 | 69 | inline QJSEngine *jsengine() 70 | { 71 | if (Q_UNLIKELY(!_engine)) 72 | _setEngine(); 73 | return _engine; 74 | } 75 | 76 | QByteArray toJson(const QJSValue &value); 77 | QJSValue fromJson(const QByteArray &value); 78 | private: 79 | void _setEngine(); 80 | }; 81 | 82 | QT_END_NAMESPACE 83 | 84 | #endif // ENGINIOQMLCLIENT_P_H 85 | -------------------------------------------------------------------------------- /src/enginio_plugin/enginioqmlclient_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #ifndef ENGINIOQMLCLIENT_H 35 | #define ENGINIOQMLCLIENT_H 36 | 37 | #include 38 | #include "enginioqmlreply_p.h" 39 | #include 40 | 41 | QT_BEGIN_NAMESPACE 42 | 43 | class EnginioQmlClientPrivate; 44 | class EnginioQmlClient : public EnginioClientConnection 45 | { 46 | Q_OBJECT 47 | Q_DISABLE_COPY(EnginioQmlClient) 48 | 49 | Q_ENUMS(Enginio::Operation); // TODO remove me QTBUG-33577 50 | Q_ENUMS(Enginio::AuthenticationState); // TODO remove me QTBUG-33577 51 | public: 52 | EnginioQmlClient(QObject *parent = 0); 53 | ~EnginioQmlClient(); 54 | 55 | Q_INVOKABLE EnginioQmlReply *fullTextSearch(const QJSValue &query); 56 | Q_INVOKABLE EnginioQmlReply *query(const QJSValue &query, const Enginio::Operation operation = Enginio::ObjectOperation); 57 | Q_INVOKABLE EnginioQmlReply *create(const QJSValue &object, const Enginio::Operation operation = Enginio::ObjectOperation); 58 | Q_INVOKABLE EnginioQmlReply *update(const QJSValue &object, const Enginio::Operation operation = Enginio::ObjectOperation); 59 | Q_INVOKABLE EnginioQmlReply *remove(const QJSValue &object, const Enginio::Operation operation = Enginio::ObjectOperation); 60 | Q_INVOKABLE EnginioQmlReply *downloadUrl(const QJSValue &object); 61 | Q_INVOKABLE EnginioQmlReply *uploadFile(const QJSValue &object, const QUrl &url); 62 | 63 | Q_SIGNALS: 64 | void sessionAuthenticated(const QJSValue &reply) const; 65 | void sessionAuthenticationError(const QJSValue &reply) const; 66 | void sessionTerminated() const; 67 | void finished(const QJSValue &reply); 68 | void error(const QJSValue &reply); 69 | 70 | private: 71 | Q_DECLARE_PRIVATE(EnginioQmlClient) 72 | }; 73 | 74 | QT_END_NAMESPACE 75 | 76 | #endif // ENGINIOQMLCLIENT_H 77 | 78 | -------------------------------------------------------------------------------- /src/enginio_client/chunkdevice_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #include 35 | 36 | QT_BEGIN_NAMESPACE 37 | 38 | /*! 39 | \brief The ChunkDevice class is a simple QIODevice representing a part of another QIODevice 40 | 41 | Used for chunked upload so that we can pass a QIODevice to QNetworkAccessManager. 42 | 43 | \internal 44 | */ 45 | 46 | class ChunkDevice : public QIODevice 47 | { 48 | Q_OBJECT 49 | 50 | public: 51 | ChunkDevice(QIODevice *source, qint64 startPos, qint64 chunkSize) 52 | : _source(source), _startPos(startPos), _chunkSize(chunkSize) 53 | { 54 | Q_ASSERT(source->isOpen()); 55 | Q_ASSERT(source->isReadable()); 56 | Q_ASSERT(!source->isSequential()); 57 | source->seek(startPos); 58 | } 59 | 60 | bool isSequential() const Q_DECL_OVERRIDE 61 | { 62 | return _source->isSequential(); 63 | } 64 | 65 | qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE 66 | { 67 | return _source->read(data, maxlen); 68 | } 69 | 70 | qint64 writeData(const char*, qint64) Q_DECL_OVERRIDE 71 | { 72 | return -1; 73 | } 74 | 75 | qint64 size() const Q_DECL_OVERRIDE 76 | { 77 | return qMin(_source->size() - _startPos, _chunkSize); 78 | } 79 | 80 | qint64 pos() const Q_DECL_OVERRIDE 81 | { 82 | return _source->pos() - _startPos; 83 | } 84 | 85 | bool seek(qint64 pos) Q_DECL_OVERRIDE 86 | { 87 | QIODevice::seek(pos); 88 | return _source->seek(pos + _startPos); 89 | } 90 | 91 | qint64 bytesAvailable() const Q_DECL_OVERRIDE 92 | { 93 | return qMin(_source->bytesAvailable(), _chunkSize + (_startPos - _source->pos())); 94 | } 95 | 96 | private: 97 | QIODevice *_source; 98 | qint64 _startPos; 99 | qint64 _chunkSize; 100 | }; 101 | 102 | QT_END_NAMESPACE 103 | -------------------------------------------------------------------------------- /src/enginio_client/enginioclient.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #ifndef ENGINIOCLIENT_H 35 | #define ENGINIOCLIENT_H 36 | 37 | #include 38 | #include 39 | #include 40 | 41 | QT_BEGIN_NAMESPACE 42 | 43 | class QNetworkAccessManager; 44 | class QNetworkReply; 45 | class EnginioReply; 46 | class EnginioClientPrivate; 47 | class ENGINIOCLIENT_EXPORT EnginioClient : public EnginioClientConnection 48 | { 49 | Q_OBJECT 50 | 51 | Q_ENUMS(Enginio::Operation) // TODO remove me QTBUG-33577 52 | Q_ENUMS(Enginio::AuthenticationState) // TODO remove me QTBUG-33577 53 | 54 | Q_DECLARE_PRIVATE(EnginioClient) 55 | public: 56 | explicit EnginioClient(QObject *parent = nullptr); 57 | ~EnginioClient(); 58 | 59 | Q_INVOKABLE EnginioReply *customRequest(const QUrl &url, const QByteArray &httpOperation, const QJsonObject &data = QJsonObject()); 60 | Q_INVOKABLE EnginioReply *fullTextSearch(const QJsonObject &query); 61 | Q_INVOKABLE EnginioReply *query(const QJsonObject &query, const Enginio::Operation operation = Enginio::ObjectOperation); 62 | Q_INVOKABLE EnginioReply *create(const QJsonObject &object, const Enginio::Operation operation = Enginio::ObjectOperation); 63 | Q_INVOKABLE EnginioReply *update(const QJsonObject &object, const Enginio::Operation operation = Enginio::ObjectOperation); 64 | Q_INVOKABLE EnginioReply *remove(const QJsonObject &object, const Enginio::Operation operation = Enginio::ObjectOperation); 65 | 66 | Q_INVOKABLE EnginioReply *uploadFile(const QJsonObject &associatedObject, const QUrl &file); 67 | Q_INVOKABLE EnginioReply *downloadUrl(const QJsonObject &object); 68 | 69 | Q_SIGNALS: 70 | void sessionAuthenticated(EnginioReply *reply) const; 71 | void sessionAuthenticationError(EnginioReply *reply) const; 72 | void sessionTerminated() const; 73 | void finished(EnginioReply *reply); 74 | void error(EnginioReply *reply); 75 | }; 76 | 77 | QT_END_NAMESPACE 78 | 79 | #endif // ENGINIOCLIENT_H 80 | -------------------------------------------------------------------------------- /examples/enginio/quick/socialtodos/TouchButton.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | import QtQuick 2.1 41 | 42 | Item { 43 | id: button 44 | signal clicked 45 | property alias text: label.text 46 | property color baseColor: "#555" 47 | property color textColor: "#fff" 48 | height: Math.round(40 * scaleFactor) 49 | width: Math.round(160 * scaleFactor) 50 | activeFocusOnTab: true 51 | 52 | 53 | Rectangle { 54 | anchors.fill: button 55 | color: "#ffffff" 56 | anchors.bottomMargin: intScaleFactor 57 | radius: background.radius 58 | } 59 | 60 | Keys.onReturnPressed: clicked() 61 | 62 | Rectangle { 63 | id: background 64 | opacity: enabled ? 1 : 0.7 65 | Behavior on opacity {NumberAnimation{}} 66 | radius: height/2 67 | border.width: intScaleFactor * button.activeFocus ? 2 : 1 68 | border.color: Qt.darker(baseColor, 1.4) 69 | anchors.fill: parent 70 | gradient: Gradient { 71 | GradientStop { color: mousearea.pressed ? baseColor : Qt.lighter(baseColor, 1.4) ; position: 0 } 72 | GradientStop { color: baseColor ; position: 1 } 73 | } 74 | 75 | Text { 76 | id: label 77 | anchors.centerIn: parent 78 | font.pixelSize: 22 * scaleFactor 79 | font.bold: true 80 | color: textColor 81 | style: Text.Raised 82 | styleColor: "#44000000" 83 | } 84 | 85 | MouseArea { 86 | id: mousearea 87 | onClicked: button.clicked() 88 | anchors.fill: parent 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/enginio_plugin/enginioqmlmodel_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #ifndef ENGINIOQMLMODEL_H 35 | #define ENGINIOQMLMODEL_H 36 | 37 | #include 38 | #include 39 | 40 | QT_BEGIN_NAMESPACE 41 | 42 | class EnginioQmlReply; 43 | class EnginioQmlClient; 44 | class EnginioQmlModelPrivate; 45 | class EnginioQmlModel : public EnginioBaseModel 46 | { 47 | Q_OBJECT 48 | Q_DISABLE_COPY(EnginioQmlModel) 49 | public: 50 | EnginioQmlModel(QObject *parent = 0); 51 | ~EnginioQmlModel(); 52 | 53 | Q_ENUMS(Enginio::Operation) // TODO remove me QTBUG-33577 54 | Q_ENUMS(Enginio::ErrorType); // TODO remove me QTBUG-33577 55 | Q_ENUMS(Enginio::Role); // TODO remove me QTBUG-33577 56 | 57 | Q_PROPERTY(EnginioQmlClient *client READ client WRITE setClient NOTIFY clientChanged) 58 | Q_PROPERTY(QJSValue query READ query WRITE setQuery NOTIFY queryChanged) 59 | Q_PROPERTY(Enginio::Operation operation READ operation WRITE setOperation NOTIFY operationChanged) 60 | Q_PROPERTY(int rowCount READ rowCount NOTIFY rowCountChanged) 61 | 62 | EnginioQmlClient *client() const Q_REQUIRED_RESULT; 63 | void setClient(const EnginioQmlClient *client); 64 | 65 | QJSValue query() Q_REQUIRED_RESULT; 66 | void setQuery(const QJSValue &query); 67 | 68 | Enginio::Operation operation() const Q_REQUIRED_RESULT; 69 | void setOperation(Enginio::Operation operation); 70 | 71 | Q_INVOKABLE EnginioQmlReply *append(const QJSValue &value); 72 | Q_INVOKABLE EnginioQmlReply *remove(int row); 73 | Q_INVOKABLE EnginioQmlReply *setProperty(int row, const QString &role, const QVariant &value); 74 | Q_INVOKABLE EnginioQmlReply *reload(); 75 | 76 | Q_SIGNALS: 77 | void queryChanged(const QJSValue &query); 78 | void clientChanged(EnginioQmlClient *client); 79 | void operationChanged(Enginio::Operation operation); 80 | void rowCountChanged(); 81 | 82 | private: 83 | Q_DECLARE_PRIVATE(EnginioQmlModel) 84 | }; 85 | 86 | QT_END_NAMESPACE 87 | 88 | #endif // ENGINIOQMLOBJECTMODEL_H 89 | -------------------------------------------------------------------------------- /src/enginio_client/enginiomodel.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #ifndef ENGINIOMODEL_H 35 | #define ENGINIOMODEL_H 36 | 37 | #include 38 | #include 39 | 40 | #include 41 | #include 42 | 43 | QT_BEGIN_NAMESPACE 44 | 45 | class EnginioModelPrivate; 46 | class ENGINIOCLIENT_EXPORT EnginioModel 47 | #ifdef Q_QDOC 48 | : public QAbstractListModel 49 | #else 50 | : public EnginioBaseModel 51 | #endif 52 | { 53 | Q_OBJECT 54 | Q_ENUMS(Enginio::Operation) // TODO remove me QTBUG-33577 55 | Q_PROPERTY(Enginio::Operation operation READ operation WRITE setOperation NOTIFY operationChanged) 56 | Q_PROPERTY(EnginioClient *client READ client WRITE setClient NOTIFY clientChanged) 57 | Q_PROPERTY(QJsonObject query READ query WRITE setQuery NOTIFY queryChanged) 58 | 59 | public: 60 | explicit EnginioModel(QObject *parent = nullptr); 61 | ~EnginioModel(); 62 | 63 | EnginioClient *client() const Q_REQUIRED_RESULT; 64 | void setClient(const EnginioClient *client); 65 | 66 | QJsonObject query() Q_REQUIRED_RESULT; 67 | void setQuery(const QJsonObject &query); 68 | 69 | Enginio::Operation operation() const Q_REQUIRED_RESULT; 70 | void setOperation(Enginio::Operation operation); 71 | 72 | Q_INVOKABLE EnginioReply *append(const QJsonObject &value); 73 | Q_INVOKABLE EnginioReply *remove(int row); 74 | Q_INVOKABLE EnginioReply *setData(int row, const QVariant &value, const QString &role); 75 | Q_INVOKABLE EnginioReply *setData(int row, const QJsonObject &value); 76 | using EnginioBaseModel::setData; 77 | 78 | Q_INVOKABLE EnginioReply *reload(); 79 | 80 | Q_SIGNALS: 81 | void queryChanged(const QJsonObject &query); 82 | void clientChanged(EnginioClient *client); 83 | void operationChanged(Enginio::Operation operation); 84 | 85 | private: 86 | Q_DISABLE_COPY(EnginioModel) 87 | Q_DECLARE_PRIVATE(EnginioModel) 88 | friend class EnginioBaseModelPrivate; 89 | }; 90 | 91 | QT_END_NAMESPACE 92 | 93 | #endif // ENGINIOMODEL_H 94 | -------------------------------------------------------------------------------- /src/enginio_plugin/doc/snippets/models.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the documentation of the QtEnginio library. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | import QtQuick 2.0 42 | import Enginio 1.0 43 | import "../../examples/qml/config.js" as Config 44 | 45 | Rectangle { 46 | width: 400 47 | height: 400 48 | 49 | EnginioClient { 50 | id: client 51 | backendId: Config.id 52 | onFinished: console.log("Engino request finished." + reply.data) 53 | onError: console.log("Enginio error " + reply.errorCode + ": " + reply.errorString) 54 | } 55 | 56 | //! [model] 57 | EnginioModel { 58 | id: enginioModel 59 | client: client 60 | query: { "objectType": "objects.city" } 61 | } 62 | //! [model] 63 | 64 | //! [view] 65 | ListView { 66 | anchors.fill: parent 67 | model: enginioModel 68 | delegate: Text { 69 | text: name + ": " + population 70 | } 71 | } 72 | //! [view] 73 | 74 | Rectangle { 75 | color: "lightsteelblue" 76 | width: parent.width 77 | height: 30 78 | anchors.bottom: parent.bottom 79 | Text { 80 | anchors.centerIn: parent 81 | text: "Add Berlin" 82 | } 83 | MouseArea { 84 | anchors.fill: parent 85 | onClicked: addCity() 86 | } 87 | } 88 | 89 | //! [append] 90 | function addCity() { 91 | var berlin = { 92 | "objectType": "objects.city", 93 | "name": "Berlin", 94 | "population": 3300000 95 | } 96 | enginioModel.append(berlin) 97 | } 98 | //! [append] 99 | 100 | } 101 | -------------------------------------------------------------------------------- /src/enginio_client/enginio.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #ifndef ENGINIO_H 35 | #define ENGINIO_H 36 | 37 | #include 38 | #include 39 | 40 | QT_BEGIN_NAMESPACE 41 | 42 | #ifndef Q_QDOC 43 | class ENGINIOCLIENT_EXPORT Enginio 44 | { 45 | Q_GADGET 46 | #else 47 | namespace Enginio { 48 | #endif 49 | Q_ENUMS(AuthenticationState) 50 | Q_ENUMS(Operation) 51 | Q_ENUMS(ErrorType) 52 | Q_ENUMS(Role) 53 | 54 | #ifndef Q_QDOC 55 | public: 56 | #endif 57 | enum AuthenticationState { 58 | NotAuthenticated, 59 | Authenticating, 60 | Authenticated, 61 | AuthenticationFailure 62 | }; 63 | 64 | enum Operation { 65 | ObjectOperation, 66 | AccessControlOperation, 67 | UserOperation, 68 | UsergroupOperation, 69 | UsergroupMembersOperation, 70 | FileOperation, 71 | 72 | // private 73 | SessionOperation, 74 | SearchOperation, 75 | FileChunkUploadOperation, 76 | FileGetDownloadUrlOperation 77 | }; 78 | 79 | enum Role { 80 | InvalidRole = -1, 81 | SyncedRole = Qt::UserRole + 1, 82 | CreatedAtRole, 83 | UpdatedAtRole, 84 | IdRole, 85 | ObjectTypeRole, 86 | JsonObjectRole, 87 | CustomPropertyRole = Qt::UserRole + 10 // the first fully dynamic role 88 | }; 89 | 90 | enum ErrorType { 91 | NoError, 92 | NetworkError, 93 | BackendError 94 | }; 95 | }; 96 | 97 | Q_DECLARE_TYPEINFO(Enginio::Operation, Q_PRIMITIVE_TYPE); 98 | Q_DECLARE_TYPEINFO(Enginio::AuthenticationState, Q_PRIMITIVE_TYPE); 99 | Q_DECLARE_TYPEINFO(Enginio::Role, Q_PRIMITIVE_TYPE); 100 | Q_DECLARE_TYPEINFO(Enginio::ErrorType, Q_PRIMITIVE_TYPE); 101 | 102 | QT_END_NAMESPACE 103 | 104 | Q_DECLARE_METATYPE(Enginio::Operation) 105 | Q_DECLARE_METATYPE(Enginio::AuthenticationState) 106 | Q_DECLARE_METATYPE(Enginio::Role) 107 | Q_DECLARE_METATYPE(Enginio::ErrorType) 108 | 109 | #endif // ENGINIO_H 110 | -------------------------------------------------------------------------------- /examples/enginio/common/backendhelper/backendhelper.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #include 42 | #include 43 | #include "backendhelper.h" 44 | #include "ui_helperdialog.h" 45 | 46 | const QString backendIdKey = QStringLiteral("backendId"); 47 | const QString showAgainKey = QStringLiteral("showAgain"); 48 | 49 | QByteArray backendId(const QString &exampleName) 50 | { 51 | 52 | QString fileName = QStringLiteral("EnginioExamples.conf"); 53 | for (int i = 0; i < 4; ++i) { 54 | if (QFile::exists(fileName)) 55 | break; 56 | fileName = fileName.prepend("../"); 57 | } 58 | 59 | QFileInfo settingsFile = QFileInfo(fileName); 60 | 61 | QScopedPointer settings(settingsFile.exists() 62 | ? new QSettings(settingsFile.absoluteFilePath(), QSettings::IniFormat) 63 | : new QSettings("QtProject", "EnginioExamples")); 64 | 65 | settings->beginGroup(exampleName); 66 | QByteArray id = settings->value(backendIdKey).toByteArray(); 67 | bool askAgain = settings->value(showAgainKey, true).toBool(); 68 | 69 | if (askAgain || id.isEmpty()) { 70 | Ui::Dialog dialog; 71 | QDialog d; 72 | dialog.setupUi(&d); 73 | dialog.exampleName->setText(exampleName); 74 | dialog.backendId->setText(id); 75 | 76 | if (d.exec() == QDialog::Accepted) { 77 | id = dialog.backendId->text().toLocal8Bit(); 78 | askAgain = !dialog.askAgain->isChecked(); 79 | settings->setValue(backendIdKey, id); 80 | settings->setValue(showAgainKey, askAgain); 81 | } 82 | } 83 | 84 | settings->endGroup(); 85 | settings->sync(); 86 | 87 | return id; 88 | } 89 | 90 | -------------------------------------------------------------------------------- /examples/enginio/common/backendhelper/helperdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Dialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 412 10 | 257 11 | 12 | 13 | 14 | Enginio Backend Configuration 15 | 16 | 17 | 18 | 19 | 20 | <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> 21 | 22 | 23 | true 24 | 25 | 26 | true 27 | 28 | 29 | 30 | 31 | 32 | 33 | QFormLayout::AllNonFixedFieldsGrow 34 | 35 | 36 | 37 | 38 | Example name: 39 | 40 | 41 | 42 | 43 | 44 | 45 | ... 46 | 47 | 48 | 49 | 50 | 51 | 52 | Backend ID: 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | Do not show this dialog again 65 | 66 | 67 | 68 | 69 | 70 | 71 | Qt::Horizontal 72 | 73 | 74 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | buttonBox 84 | accepted() 85 | Dialog 86 | accept() 87 | 88 | 89 | 248 90 | 254 91 | 92 | 93 | 157 94 | 274 95 | 96 | 97 | 98 | 99 | buttonBox 100 | rejected() 101 | Dialog 102 | reject() 103 | 104 | 105 | 316 106 | 260 107 | 108 | 109 | 286 110 | 274 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /src/enginio_client/enginiofakereply.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | QT_BEGIN_NAMESPACE 40 | 41 | struct FinishedFunctor 42 | { 43 | QNetworkAccessManager *_qnam; 44 | EnginioFakeReply *_reply; 45 | void operator ()() 46 | { 47 | _qnam->finished(_reply); 48 | } 49 | }; 50 | 51 | EnginioFakeReply::EnginioFakeReply(EnginioClientConnectionPrivate *parent, const QByteArray &msg) 52 | : QNetworkReply(parent->q_ptr) 53 | , _msg(msg) 54 | { 55 | init(parent->networkManager()); 56 | } 57 | 58 | EnginioFakeReply::EnginioFakeReply(QObject *parent, const QByteArray &msg) 59 | : QNetworkReply(parent) 60 | , _msg(msg) 61 | { 62 | init(EnginioClientConnectionPrivate::prepareNetworkManagerInThread().data()); 63 | } 64 | 65 | void EnginioFakeReply::init(QNetworkAccessManager *qnam) 66 | { 67 | QIODevice::open(QIODevice::ReadOnly | QIODevice::Unbuffered); 68 | setError(ContentNotFoundError, QString::fromUtf8(_msg)); 69 | setAttribute(QNetworkRequest::HttpStatusCodeAttribute, 400); 70 | setFinished(true); 71 | FinishedFunctor fin = {qnam, this}; 72 | QObject::connect(this, &EnginioFakeReply::finished, fin); 73 | QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); 74 | } 75 | 76 | void EnginioFakeReply::abort() {} 77 | 78 | bool EnginioFakeReply::isSequential() const 79 | { 80 | return false; 81 | } 82 | 83 | qint64 EnginioFakeReply::size() const 84 | { 85 | return _msg.size(); 86 | } 87 | 88 | qint64 EnginioFakeReply::readData(char *dest, qint64 n) 89 | { 90 | if (pos() > _msg.size()) 91 | return -1; 92 | qint64 size = qMin(qint64(_msg.size() - pos()), n); 93 | memcpy(dest, _msg.constData(), size); 94 | return size; 95 | } 96 | 97 | qint64 EnginioFakeReply::writeData(const char *data, qint64 maxSize) 98 | { 99 | Q_UNUSED(data); 100 | Q_UNUSED(maxSize); 101 | return -1; 102 | } 103 | 104 | QT_END_NAMESPACE 105 | -------------------------------------------------------------------------------- /examples/enginio/widgets/todos-cpp/todosmodel.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #include "todosmodel.h" 42 | 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | #include 49 | 50 | TodosModel::TodosModel(QObject *parent) 51 | : EnginioModel(parent) 52 | {} 53 | 54 | QVariant TodosModel::headerData(int section, Qt::Orientation orientation, int role) const 55 | { 56 | if (orientation == Qt::Horizontal && section == 0 && role == Qt::DisplayRole) 57 | return QStringLiteral("Todo List"); 58 | return EnginioModel::headerData(section, orientation, role); 59 | } 60 | 61 | //![data] 62 | QVariant TodosModel::data(const QModelIndex &index, int role) const 63 | { 64 | if (role == Qt::FontRole) { 65 | bool completed = EnginioModel::data(index, CompletedRole).value().toBool(); 66 | QFont font; 67 | font.setPointSize(20); 68 | font.setStrikeOut(completed); 69 | return font; 70 | } 71 | 72 | if (role == Qt::TextColorRole) { 73 | bool completed = EnginioModel::data(index, CompletedRole).value().toBool(); 74 | return completed ? QColor("#999") : QColor("#333"); 75 | } 76 | 77 | if (role == CompletedRole) 78 | return EnginioModel::data(index, CompletedRole).value().toBool(); 79 | 80 | // fallback to base class 81 | return EnginioModel::data(index, role); 82 | } 83 | //![data] 84 | //![roleNames] 85 | QHash TodosModel::roleNames() const 86 | { 87 | QHash roles = EnginioModel::roleNames(); 88 | roles.insert(TitleRole, "title"); 89 | roles.insert(Qt::DisplayRole, "title"); 90 | roles.insert(Qt::EditRole, "title"); 91 | roles.insert(CompletedRole, "completed"); 92 | return roles; 93 | } 94 | //![roleNames] 95 | -------------------------------------------------------------------------------- /src/enginio_client/enginioreply.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #ifndef ENGINIOREPLY_H 35 | #define ENGINIOREPLY_H 36 | 37 | #include 38 | 39 | #include 40 | #include 41 | 42 | QT_BEGIN_NAMESPACE 43 | 44 | class EnginioClient; 45 | class EnginioReplyPrivate; 46 | class EnginioClientConnectionPrivate; 47 | 48 | class ENGINIOCLIENT_EXPORT EnginioReply 49 | #ifdef Q_QDOC 50 | : public QObject 51 | #else 52 | : public EnginioReplyState 53 | #endif 54 | { 55 | Q_OBJECT 56 | Q_PROPERTY(QJsonObject data READ data NOTIFY dataChanged) 57 | Q_ENUMS(Enginio::ErrorType) 58 | public: 59 | 60 | explicit EnginioReply(EnginioClientConnectionPrivate *parent, QNetworkReply *reply); 61 | virtual ~EnginioReply(); 62 | 63 | QJsonObject data() const Q_REQUIRED_RESULT; 64 | 65 | Q_SIGNALS: 66 | void finished(EnginioReply *reply); 67 | void dataChanged(); 68 | 69 | #ifdef Q_QDOC 70 | public: 71 | Q_PROPERTY(ErrorType errorType READ errorType NOTIFY dataChanged) 72 | Q_PROPERTY(QNetworkReply::NetworkError networkError READ networkError NOTIFY dataChanged) 73 | Q_PROPERTY(QString errorString READ errorString NOTIFY dataChanged) 74 | Q_PROPERTY(int backendStatus READ backendStatus NOTIFY dataChanged) 75 | Q_PROPERTY(QString requestId READ requestId CONSTANT) 76 | 77 | ErrorType errorType() const Q_REQUIRED_RESULT; 78 | QNetworkReply::NetworkError networkError() const Q_REQUIRED_RESULT; 79 | QString errorString() const Q_REQUIRED_RESULT; 80 | int backendStatus() const Q_REQUIRED_RESULT; 81 | 82 | bool isError() const Q_REQUIRED_RESULT; 83 | bool isFinished() const Q_REQUIRED_RESULT; 84 | 85 | Q_SIGNALS: 86 | void progress(qint64 bytesSent, qint64 bytesTotal); 87 | 88 | #endif 89 | 90 | private: 91 | Q_DISABLE_COPY(EnginioReply) 92 | Q_DECLARE_PRIVATE(EnginioReply) 93 | }; 94 | 95 | Q_DECLARE_TYPEINFO(const EnginioReply*, Q_PRIMITIVE_TYPE); 96 | 97 | #ifndef QT_NO_DEBUG_STREAM 98 | class QDebug; 99 | ENGINIOCLIENT_EXPORT QDebug operator<<(QDebug d, const EnginioReply *reply); 100 | #endif 101 | 102 | QT_END_NAMESPACE 103 | Q_DECLARE_METATYPE(const EnginioReply*) 104 | 105 | #endif // ENGINIOREPLY_H 106 | -------------------------------------------------------------------------------- /src/enginio_client/enginioclientconnection.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #ifndef ENGINIOCLIENTCONNECTION_H 35 | #define ENGINIOCLIENTCONNECTION_H 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | QT_BEGIN_NAMESPACE 46 | 47 | class QNetworkAccessManager; 48 | class EnginioIdentity; 49 | class EnginioClientConnectionPrivate; 50 | 51 | class ENGINIOCLIENT_EXPORT EnginioClientConnection : public QObject 52 | { 53 | Q_OBJECT 54 | 55 | Q_PROPERTY(QByteArray backendId READ backendId WRITE setBackendId NOTIFY backendIdChanged FINAL) 56 | Q_PROPERTY(QUrl serviceUrl READ serviceUrl WRITE setServiceUrl NOTIFY serviceUrlChanged FINAL) 57 | Q_PROPERTY(EnginioIdentity *identity READ identity WRITE setIdentity NOTIFY identityChanged FINAL) 58 | Q_PROPERTY(Enginio::AuthenticationState authenticationState READ authenticationState NOTIFY authenticationStateChanged FINAL) 59 | 60 | Q_ENUMS(Enginio::Operation) // TODO remove me QTBUG-33577 61 | Q_ENUMS(Enginio::AuthenticationState) // TODO remove me QTBUG-33577 62 | 63 | public: 64 | ~EnginioClientConnection(); 65 | 66 | 67 | QByteArray backendId() const Q_REQUIRED_RESULT; 68 | void setBackendId(const QByteArray &backendId); 69 | EnginioIdentity *identity() const Q_REQUIRED_RESULT; 70 | void setIdentity(EnginioIdentity *identity); 71 | Enginio::AuthenticationState authenticationState() const Q_REQUIRED_RESULT; 72 | 73 | QUrl serviceUrl() const Q_REQUIRED_RESULT; 74 | void setServiceUrl(const QUrl &serviceUrl); 75 | QNetworkAccessManager *networkManager() const Q_REQUIRED_RESULT; 76 | 77 | bool finishDelayedReplies(); 78 | 79 | Q_SIGNALS: 80 | void backendIdChanged(const QByteArray &backendId); 81 | void serviceUrlChanged(const QUrl& url); 82 | void authenticationStateChanged(Enginio::AuthenticationState state); 83 | void identityChanged(EnginioIdentity *identity); 84 | 85 | protected: 86 | explicit EnginioClientConnection(EnginioClientConnectionPrivate &dd, QObject *parent); 87 | 88 | private: 89 | Q_DECLARE_PRIVATE(EnginioClientConnection) 90 | Q_DISABLE_COPY(EnginioClientConnection) 91 | }; 92 | 93 | QT_END_NAMESPACE 94 | 95 | #endif // ENGINIOCLIENTCONNECTION_H 96 | -------------------------------------------------------------------------------- /examples/enginio/quick/socialtodos/TextField.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | import QtQuick 2.1 41 | 42 | FocusScope { 43 | id: textfield 44 | 45 | property alias text: textInput.text 46 | property alias placeholderText: placeholder.text 47 | property alias echoMode: textInput.echoMode 48 | signal accepted 49 | 50 | activeFocusOnTab: true 51 | 52 | implicitHeight: Math.round(40 * scaleFactor) 53 | implicitWidth: Math.round(parent.width) 54 | 55 | Rectangle { 56 | anchors.fill: editbg 57 | radius: editbg.radius 58 | color: "#aaffffff" 59 | anchors.bottomMargin: -1 60 | } 61 | 62 | Rectangle { 63 | id: editbg 64 | anchors.fill: parent 65 | radius: height/2 66 | border.width: intScaleFactor 67 | border.color: "#999" 68 | 69 | gradient: Gradient { 70 | GradientStop {color: "#eee" ; position: 0} 71 | GradientStop {color: "white" ; position: 0.1} 72 | GradientStop {color: "white" ; position: 1} 73 | } 74 | 75 | TextInput{ 76 | id: textInput 77 | anchors.fill: parent 78 | clip: true 79 | anchors.leftMargin: 16 * scaleFactor 80 | anchors.rightMargin: 16 * scaleFactor 81 | verticalAlignment: Text.AlignVCenter 82 | font.pixelSize: 22 * scaleFactor 83 | focus: true 84 | onAccepted: textfield.accepted() 85 | Text { 86 | id: placeholder 87 | anchors.fill: parent 88 | verticalAlignment: Text.AlignVCenter 89 | visible: !(parent.text.length || textInput.inputMethodComposing) 90 | font: parent.font 91 | color: "#aaa" 92 | } 93 | } 94 | } 95 | 96 | onAccepted: { 97 | Qt.inputMethod.commit(); 98 | Qt.inputMethod.hide(); 99 | } 100 | } 101 | 102 | -------------------------------------------------------------------------------- /examples/enginio/widgets/image-gallery-cpp/imageobject.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of The Qt Company Ltd nor the names of its 21 | ** contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #include "imageobject.h" 42 | 43 | #include 44 | #include 45 | #include 46 | 47 | ImageObject::ImageObject(EnginioClient *enginio) 48 | : m_enginio(enginio) 49 | {} 50 | 51 | void ImageObject::setObject(const QJsonObject &object) 52 | { 53 | m_object = object; 54 | QString fileId; 55 | fileId = object.value("file").toObject().value("id").toString(); 56 | 57 | if (!fileId.isEmpty()) { 58 | QJsonObject fileObject; 59 | fileObject.insert("id", fileId); 60 | fileObject.insert("variant", QString("thumbnail")); 61 | EnginioReply *reply = m_enginio->downloadUrl(fileObject); 62 | connect(reply, SIGNAL(finished(EnginioReply*)), this, SLOT(replyFinished(EnginioReply*))); 63 | } else { 64 | // Try to fall back to the local file 65 | QString localPath = object.value("localPath").toString(); 66 | if (QFile::exists(localPath)) { 67 | m_image = QImage(localPath); 68 | emit imageChanged(object.value("id").toString()); 69 | } 70 | } 71 | } 72 | 73 | void ImageObject::replyFinished(EnginioReply *enginioReply) 74 | { 75 | QString url = enginioReply->data().value("expiringUrl").toString(); 76 | QNetworkRequest request(url); 77 | m_reply = m_enginio->networkManager()->get(request); 78 | m_reply->setParent(this); 79 | connect(m_reply, SIGNAL(finished()), this, SLOT(downloadFinished())); 80 | } 81 | 82 | void ImageObject::downloadFinished() 83 | { 84 | QByteArray imageData = m_reply->readAll(); 85 | m_image.loadFromData(imageData); 86 | emit imageChanged(m_object.value("id").toString()); 87 | 88 | m_reply->deleteLater(); 89 | m_reply = 0; 90 | } 91 | 92 | QPixmap ImageObject::thumbnail() 93 | { 94 | if (m_image.isNull() || !m_thumbnail.size().isNull()) 95 | return m_thumbnail; 96 | m_thumbnail = QPixmap::fromImage(m_image.scaled(100, 100, Qt::KeepAspectRatio, Qt::SmoothTransformation)); 97 | return m_thumbnail; 98 | } 99 | -------------------------------------------------------------------------------- /src/enginio_client/enginioreplystate.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2015 The Qt Company Ltd. 4 | ** Contact: http://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtEnginio module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL21$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see http://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at http://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 2.1 or version 3 as published by the Free 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 | ** following information to ensure the GNU Lesser General Public License 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 | ** 26 | ** As a special exception, The Qt Company gives you certain additional 27 | ** rights. These rights are described in The Qt Company LGPL Exception 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 | ** 30 | ** $QT_END_LICENSE$ 31 | ** 32 | ****************************************************************************/ 33 | 34 | #ifndef ENGINIOREPLYBASE_H 35 | #define ENGINIOREPLYBASE_H 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | #include 45 | #include 46 | 47 | QT_BEGIN_NAMESPACE 48 | 49 | class EnginioClientConnectionPrivate; 50 | class EnginioReplyStatePrivate; 51 | class ENGINIOCLIENT_EXPORT EnginioReplyState: public QObject 52 | { 53 | Q_OBJECT 54 | Q_ENUMS(QNetworkReply::NetworkError) // TODO remove me QTBUG-33577 55 | Q_ENUMS(Enginio::ErrorType) // TODO remove me QTBUG-33577 56 | 57 | Q_PROPERTY(Enginio::ErrorType errorType READ errorType NOTIFY dataChanged) 58 | Q_PROPERTY(QNetworkReply::NetworkError networkError READ networkError NOTIFY dataChanged) 59 | Q_PROPERTY(QString errorString READ errorString NOTIFY dataChanged) 60 | Q_PROPERTY(int backendStatus READ backendStatus NOTIFY dataChanged) 61 | Q_PROPERTY(QString requestId READ requestId CONSTANT) 62 | 63 | Q_DECLARE_PRIVATE(EnginioReplyState) 64 | 65 | public: 66 | ~EnginioReplyState(); 67 | 68 | 69 | Enginio::ErrorType errorType() const Q_REQUIRED_RESULT; 70 | QNetworkReply::NetworkError networkError() const Q_REQUIRED_RESULT; 71 | QString errorString() const Q_REQUIRED_RESULT; 72 | QString requestId() const Q_REQUIRED_RESULT; 73 | int backendStatus() const Q_REQUIRED_RESULT; 74 | 75 | bool isError() const Q_REQUIRED_RESULT; 76 | bool isFinished() const Q_REQUIRED_RESULT; 77 | 78 | void setDelayFinishedSignal(bool delay); 79 | bool delayFinishedSignal() Q_REQUIRED_RESULT; 80 | 81 | void swapNetworkReply(EnginioReplyState *other); 82 | void setNetworkReply(QNetworkReply *reply); 83 | 84 | QJsonObject data() const Q_REQUIRED_RESULT; 85 | 86 | public Q_SLOTS: 87 | void dumpDebugInfo() const; 88 | 89 | Q_SIGNALS: 90 | void dataChanged(); 91 | void progress(qint64 bytesSent, qint64 bytesTotal); 92 | 93 | protected: 94 | EnginioReplyState(EnginioClientConnectionPrivate *parent, QNetworkReply *reply, EnginioReplyStatePrivate *priv); 95 | friend class EnginioClient; 96 | friend class EnginioClientConnectionPrivate; 97 | }; 98 | 99 | QT_END_NAMESPACE 100 | 101 | #endif // ENGINIOREPLYBASE_H 102 | --------------------------------------------------------------------------------