From 7b70a143c4b89e7c44d0f66f8d7a56ef65296261 Mon Sep 17 00:00:00 2001 From: Sergey Chupligin Date: Fri, 29 Dec 2017 12:00:04 +0300 Subject: [PATCH 1/4] Move to libglacierapp --- .../touch/{main.qml => glacier-components.qml} | 0 examples/touch/src/main.cpp | 14 ++++++-------- examples/touch/touch.pro | 13 ++++++------- rpm/qtquickcontrols-nemo.spec | 5 ++++- 4 files changed, 16 insertions(+), 16 deletions(-) rename examples/touch/{main.qml => glacier-components.qml} (100%) diff --git a/examples/touch/main.qml b/examples/touch/glacier-components.qml similarity index 100% rename from examples/touch/main.qml rename to examples/touch/glacier-components.qml diff --git a/examples/touch/src/main.cpp b/examples/touch/src/main.cpp index 5650e06..5a985c4 100644 --- a/examples/touch/src/main.cpp +++ b/examples/touch/src/main.cpp @@ -42,18 +42,16 @@ #include #include +#include + int main(int argc, char *argv[]) { setenv("QT_QUICK_CONTROLS_STYLE", "Nemo", 1); - QGuiApplication app(argc, argv); - - QQmlApplicationEngine* engine = new QQmlApplicationEngine(QUrl("/usr/share/glacier-components/main.qml")); - - QObject *topLevel = engine->rootObjects().value(0); + QGuiApplication *app = GlacierApp::app(argc, argv); + app->setOrganizationName("NemoMobile"); - QQuickWindow *window = qobject_cast(topLevel); + QQuickWindow *window = GlacierApp::showWindow(); window->setTitle(QObject::tr("Glacier components")); - window->showFullScreen(); - return app.exec(); + return app->exec(); } diff --git a/examples/touch/touch.pro b/examples/touch/touch.pro index dd58914..8ff8b06 100644 --- a/examples/touch/touch.pro +++ b/examples/touch/touch.pro @@ -3,12 +3,12 @@ QT += qml quick TARGET = glacier-components target.path = /usr/bin -qtHaveModule(widgets) { - QT += widgets -} +CONFIG += link_pkgconfig +LIBS += -lglacierapp +PKGCONFIG += glacierapp -mainqml.files = main.qml -mainqml.path = /usr/share/glacier-components +mainqml.files = glacier-components.qml +mainqml.path = /usr/share/glacier-components/qml qml.files += \ content/AndroidDelegate.qml \ @@ -28,7 +28,7 @@ qml.files += \ content/IconPage.qml \ content/DatePickerPage.qml -qml.path = /usr/share/glacier-components/content +qml.path = /usr/share/glacier-components/qml/content images.files = images/*.png images.files += images/*.jpg @@ -36,7 +36,6 @@ images.path = /usr/share/glacier-components/images OTHER_FILES += $$qml.files - desktop.path = /usr/share/applications desktop.files = glacier-gallery.desktop diff --git a/rpm/qtquickcontrols-nemo.spec b/rpm/qtquickcontrols-nemo.spec index 552eedb..8937bbb 100644 --- a/rpm/qtquickcontrols-nemo.spec +++ b/rpm/qtquickcontrols-nemo.spec @@ -1,6 +1,6 @@ Name: qt5-qtquickcontrols-nemo Summary: Nemomobile Qt Quick Controls -Version: 5.3.1 +Version: 5.3.2 Release: nemo1 Group: System/Library License: LGPLv2.1 with exception or GPLv3 @@ -10,9 +10,12 @@ BuildRequires: pkgconfig(Qt5Core) BuildRequires: pkgconfig(Qt5Qml) BuildRequires: pkgconfig(Qt5Quick) BuildRequires: fdupes +BuildRequires: pkgconfig(glacierapp) + Requires: qt5-qtquickcontrols Requires: qt5-qtgraphicaleffects Requires: nemo-theme-glacier +Requires: libglacierapp %description Qt is a cross-platform application and UI framework. Using Qt, you can From 91dd38d8155887c598c25c2a04bd29ea2e99a3cc Mon Sep 17 00:00:00 2001 From: Sergey Chupligin Date: Fri, 29 Dec 2017 12:05:50 +0300 Subject: [PATCH 2/4] [Examples] remove dots from main listview --- examples/touch/glacier-components.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/touch/glacier-components.qml b/examples/touch/glacier-components.qml index b6ab1ac..ddaf04f 100644 --- a/examples/touch/glacier-components.qml +++ b/examples/touch/glacier-components.qml @@ -228,6 +228,7 @@ ApplicationWindow { anchors.fill: parent clip: true delegate: ListViewItemWithActions { + iconVisible: false label: title onClicked: pageItem.Stack.view.push(Qt.resolvedUrl(page)) } From 8c5339a4021350303da5d14cebecf2d0bd17c7e3 Mon Sep 17 00:00:00 2001 From: Sergey Chupligin Date: Fri, 29 Dec 2017 12:46:32 +0300 Subject: [PATCH 3/4] [examples] add Notifications example --- examples/touch/content/NotificationsPage.qml | 76 ++++++++++++++++++++ examples/touch/glacier-components.qml | 4 ++ examples/touch/touch.pro | 3 +- rpm/qtquickcontrols-nemo.spec | 5 +- 4 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 examples/touch/content/NotificationsPage.qml diff --git a/examples/touch/content/NotificationsPage.qml b/examples/touch/content/NotificationsPage.qml new file mode 100644 index 0000000..841bc89 --- /dev/null +++ b/examples/touch/content/NotificationsPage.qml @@ -0,0 +1,76 @@ +/**************************************************************************************** +** +** Copyright (C) 2017 Chupligin Sergey +** All rights reserved. +** +** You may use this file under the terms of BSD license as follows: +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** * Neither the name of the author nor the +** names of its contributors may be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR +** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +****************************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Controls 1.0 //needed for the Stack attached property +import QtQuick.Controls.Nemo 1.0 +import QtQuick.Controls.Styles.Nemo 1.0 + +import Nemo.Notifications 1.0 + +Page { + id: root + + headerTools: HeaderToolsLayout { + showBackButton: true; + title: "Notifications" + } + allowedOrientations: Qt.PortraitOrientation | Qt.LandscapeOrientation | Qt.InvertedLandscapeOrientation | Qt.InvertedPortraitOrientation + + + Notification{ + id: simpleNotify + category: "x-nemo.example" + summary: "" + body: "" + itemCount: 1 + remoteActions: [ { + "name": "default", + "service": "org.nemomobile.notify", + "path": "/org/nemomobile/notify", + "iface": "org.nemomobile.notify", + "method": "activateApp", + "arguments": [ "Hello Nemo! You have a notification" ] + }] + } + + Column { + spacing: 40 + anchors.centerIn: parent + Button { + text: "Test label" + onClicked:{ + simpleNotify.summary = "Hello Nemo! You have a notification" + simpleNotify.publish() + } + } + } +} diff --git a/examples/touch/glacier-components.qml b/examples/touch/glacier-components.qml index ddaf04f..2cfdd04 100644 --- a/examples/touch/glacier-components.qml +++ b/examples/touch/glacier-components.qml @@ -124,6 +124,10 @@ ApplicationWindow { title: "Icons" page: "content/IconPage.qml" } + ListElement { + title: "Notifications" + page: "content/NotificationsPage.qml" + } } diff --git a/examples/touch/touch.pro b/examples/touch/touch.pro index 8ff8b06..2b03345 100644 --- a/examples/touch/touch.pro +++ b/examples/touch/touch.pro @@ -26,7 +26,8 @@ qml.files += \ content/ListViewPage.qml \ content/SelectRollerPage.qml \ content/IconPage.qml \ - content/DatePickerPage.qml + content/DatePickerPage.qml \ + content/NotificationsPage.qml qml.path = /usr/share/glacier-components/qml/content diff --git a/rpm/qtquickcontrols-nemo.spec b/rpm/qtquickcontrols-nemo.spec index 8937bbb..c36d1d4 100644 --- a/rpm/qtquickcontrols-nemo.spec +++ b/rpm/qtquickcontrols-nemo.spec @@ -10,12 +10,10 @@ BuildRequires: pkgconfig(Qt5Core) BuildRequires: pkgconfig(Qt5Qml) BuildRequires: pkgconfig(Qt5Quick) BuildRequires: fdupes -BuildRequires: pkgconfig(glacierapp) Requires: qt5-qtquickcontrols Requires: qt5-qtgraphicaleffects Requires: nemo-theme-glacier -Requires: libglacierapp %description Qt is a cross-platform application and UI framework. Using Qt, you can @@ -27,7 +25,10 @@ This package contains the Qt Quick Controls library %package examples Summary: Examples to showcase Nemo UI components Requires: %{name} +Requires: nemo-qml-plugin-notifications-qt5 +Requires: libglacierapp BuildRequires: desktop-file-utils +BuildRequires: pkgconfig(glacierapp) %description examples %{summary}. From 664ca7fa92a41683d6f95573166d0cc17dece65c Mon Sep 17 00:00:00 2001 From: Sergey Chupligin Date: Fri, 29 Dec 2017 12:59:27 +0300 Subject: [PATCH 4/4] [ScrollDecorator] add ScrollDecorator --- examples/touch/glacier-components.qml | 5 +++ src/controls/controls.pro | 1 + src/controls/qml/ListView.qml | 17 --------- src/controls/qml/ScrollDecorator.qml | 54 +++++++++++++++++++++++++++ src/controls/qml/qmldir | 1 + 5 files changed, 61 insertions(+), 17 deletions(-) create mode 100644 src/controls/qml/ScrollDecorator.qml diff --git a/examples/touch/glacier-components.qml b/examples/touch/glacier-components.qml index 2cfdd04..cd8a009 100644 --- a/examples/touch/glacier-components.qml +++ b/examples/touch/glacier-components.qml @@ -228,6 +228,7 @@ ApplicationWindow { } ListView { + id: mainList model: pageModel anchors.fill: parent clip: true @@ -236,6 +237,10 @@ ApplicationWindow { label: title onClicked: pageItem.Stack.view.push(Qt.resolvedUrl(page)) } + + ScrollDecorator{ + flickable: mainList + } } } } diff --git a/src/controls/controls.pro b/src/controls/controls.pro index b68b0a0..0822bbc 100644 --- a/src/controls/controls.pro +++ b/src/controls/controls.pro @@ -25,6 +25,7 @@ QML_FILES += \ qml/InverseMouseArea.qml \ qml/IconButton.qml \ qml/DatePicker.qml \ + qml/ScrollDecorator.qml \ qml/dialogs/QueryDialog.qml OTHER_FILES += qmldir \ diff --git a/src/controls/qml/ListView.qml b/src/controls/qml/ListView.qml index cfbd01e..9b9b637 100644 --- a/src/controls/qml/ListView.qml +++ b/src/controls/qml/ListView.qml @@ -8,10 +8,8 @@ ListView { signal hideAllActions(int hideIndex) - property bool showDecorator: false property color delegateColor: Theme.backgroundColor property color bottomGradientColor: Theme.backgroundColor - property color scrollerDecoratorColor: Theme.accentColor section.criteria: ViewSection.FullString section.delegate: Component{ @@ -67,20 +65,5 @@ ListView { } } - - Rectangle{ - id: scrollerDecorator - visible: (listView.showDecorator && listView.contentHeight > listView.height) - color: scrollerDecoratorColor - - width: Theme.itemSpacingExtraSmall - height: listView.height*listView.height/listView.contentHeight - y: (listView.height)/listView.contentHeight*listView.contentY - - anchors{ - right: listView.right - rightMargin: Theme.itemSpacingExtraSmall / 2 - } - } } diff --git a/src/controls/qml/ScrollDecorator.qml b/src/controls/qml/ScrollDecorator.qml new file mode 100644 index 0000000..79d5225 --- /dev/null +++ b/src/controls/qml/ScrollDecorator.qml @@ -0,0 +1,54 @@ +/**************************************************************************************** +** +** Copyright (C) 2017 Chupligin Sergey +** All rights reserved. +** +** You may use this file under the terms of BSD license as follows: +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** * Neither the name of the author nor the +** names of its contributors may be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR +** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +****************************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Controls 1.0 //needed for the Stack attached property +import QtQuick.Controls.Nemo 1.0 + + +Rectangle{ + id: scroolDecorator + + property var flickable + + visible: (flickable.contentHeight > flickable.height) + color: Theme.accentColor + + width: Theme.itemSpacingExtraSmall + height: flickable.height*flickable.height/flickable.contentHeight + y: (flickable.height)/flickable.contentHeight*flickable.contentY + + anchors{ + right: flickable.right + rightMargin: Theme.itemSpacingExtraSmall / 2 + } +} + diff --git a/src/controls/qml/qmldir b/src/controls/qml/qmldir index cdb0369..90fdeaf 100644 --- a/src/controls/qml/qmldir +++ b/src/controls/qml/qmldir @@ -26,6 +26,7 @@ GlacierRollerItem 1.0 GlacierRollerItem.qml InverseMouseArea 1.0 InverseMouseArea.qml IconButton 1.0 IconButton.qml DatePicker 1.0 DatePicker.qml +ScrollDecorator 1.0 ScrollDecorator.qml # MIRRORED CONTROLS: # These are the controls that we take directly from official QQC.