From 751626eec574363ef694e1301744704915e6b2ea Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 31 Mar 2017 16:15:14 +0200 Subject: [PATCH] QML UI: Fully port dive edit to Kirigami2 Completely adapt to the api changes of OverlaySheet in Kirigami2 in order to achieve the same look and behavior for the dive edits that had with kirigami1 Port most components to QtQuickContrls2, except comboboxes in the dive edit sheet that will need a new control type Signed-off-by: Marco Martin --- CMakeLists.txt | 1 + mobile-widgets/qml/About.qml | 3 +- mobile-widgets/qml/CloudCredentials.qml | 10 +-- mobile-widgets/qml/DiveDetails.qml | 87 +++++++++---------- mobile-widgets/qml/DiveDetailsEdit.qml | 37 ++++---- mobile-widgets/qml/DiveDetailsView.qml | 4 +- mobile-widgets/qml/DiveList.qml | 15 ++-- .../qml/DownloadFromDiveComputer.qml | 40 ++++----- mobile-widgets/qml/GpsList.qml | 4 +- mobile-widgets/qml/Log.qml | 4 +- mobile-widgets/qml/Preferences.qml | 10 +-- mobile-widgets/qml/StartPage.qml | 4 +- mobile-widgets/qml/StyledTextField.qml | 17 ---- mobile-widgets/qml/SubsurfaceButton.qml | 26 ------ mobile-widgets/qml/ThemeTest.qml | 3 +- mobile-widgets/qml/main.qml | 5 +- mobile-widgets/qml/mobile-resources.qrc | 3 +- mobile-widgets/qml/qtquickcontrols2.conf | 11 +++ scripts/mobilecomponents.sh | 6 +- subsurface-mobile-main.cpp | 1 + 20 files changed, 124 insertions(+), 167 deletions(-) delete mode 100644 mobile-widgets/qml/StyledTextField.qml delete mode 100644 mobile-widgets/qml/SubsurfaceButton.qml create mode 100644 mobile-widgets/qml/qtquickcontrols2.conf diff --git a/CMakeLists.txt b/CMakeLists.txt index 67691be5e..dfa6123a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -250,6 +250,7 @@ if(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "MobileExecutable") mobile-widgets/qmlmanager.cpp mobile-widgets/qmlprofile.cpp mobile-widgets/qml/kirigami/src/kirigamiplugin.cpp + mobile-widgets/qml/kirigami/src/settings.cpp mobile-widgets/qml/kirigami/src/enums.cpp subsurface-mobile-main.cpp subsurface-mobile-helper.cpp diff --git a/mobile-widgets/qml/About.qml b/mobile-widgets/qml/About.qml index cf9ade9b6..0d978bca9 100644 --- a/mobile-widgets/qml/About.qml +++ b/mobile-widgets/qml/About.qml @@ -1,7 +1,6 @@ import QtQuick 2.3 -import QtQuick.Controls 1.2 import QtQuick.Layouts 1.1 -import org.kde.kirigami 1.0 as Kirigami +import org.kde.kirigami 2.0 as Kirigami import org.subsurfacedivelog.mobile 1.0 Kirigami.ScrollablePage { diff --git a/mobile-widgets/qml/CloudCredentials.qml b/mobile-widgets/qml/CloudCredentials.qml index 7f1e0d986..e1d2e047e 100644 --- a/mobile-widgets/qml/CloudCredentials.qml +++ b/mobile-widgets/qml/CloudCredentials.qml @@ -1,9 +1,9 @@ import QtQuick 2.3 -import QtQuick.Controls 1.2 +import QtQuick.Controls 2.0 import QtQuick.Window 2.2 import QtQuick.Dialogs 1.2 import QtQuick.Layouts 1.1 -import org.kde.kirigami 1.0 as Kirigami +import org.kde.kirigami 2.0 as Kirigami import org.subsurfacedivelog.mobile 1.0 Item { @@ -56,7 +56,7 @@ Item { text: qsTr("Email") } - StyledTextField { + TextField { id: login text: manager.cloudUserName Layout.fillWidth: true @@ -68,7 +68,7 @@ Item { text: qsTr("Password") } - StyledTextField { + TextField { id: password text: manager.cloudPassword echoMode: TextInput.Password @@ -97,7 +97,7 @@ Item { text: qsTr("PIN") visible: rootItem.showPin } - StyledTextField { + TextField { id: pin text: "" Layout.fillWidth: true diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml index 076a63576..a5da856ee 100644 --- a/mobile-widgets/qml/DiveDetails.qml +++ b/mobile-widgets/qml/DiveDetails.qml @@ -1,10 +1,9 @@ import QtQuick 2.4 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 +import QtQuick.Controls 2.0 import QtQuick.Dialogs 1.2 import QtQuick.Layouts 1.2 import org.subsurfacedivelog.mobile 1.0 -import org.kde.kirigami 1.0 as Kirigami +import org.kde.kirigami 2.0 as Kirigami Kirigami.Page { id: diveDetailsPage // but this is referenced as detailsWindow @@ -52,23 +51,23 @@ Kirigami.Page { left: diveDetailsListView.currentItem ? (diveDetailsListView.currentItem.modelData.dive.gps !== "" ? mapAction : null) : null } } - PropertyChanges { target: detailsEditScroll; opened: false } + PropertyChanges { target: detailsEditScroll; sheetOpen: false } PropertyChanges { target: pageStack.contentItem; interactive: true } }, State { name: "edit" - PropertyChanges { target: detailsEditScroll; opened: true } + PropertyChanges { target: detailsEditScroll; sheetOpen: true } PropertyChanges { target: pageStack.contentItem; interactive: false } }, State { name: "add" - PropertyChanges { target: detailsEditScroll; opened: true } + PropertyChanges { target: detailsEditScroll; sheetOpen: true } PropertyChanges { target: pageStack.contentItem; interactive: false } } ] - property QtObject deleteAction: Action { + property QtObject deleteAction: Kirigami.Action { text: qsTr("Delete dive") iconName: "trash-empty" onTriggered: { @@ -85,7 +84,7 @@ Kirigami.Page { } } - property QtObject mapAction: Action { + property QtObject mapAction: Kirigami.Action { text: qsTr("Show on map") iconName: "gps" onTriggered: { @@ -93,7 +92,7 @@ Kirigami.Page { } } - actions.main: Action { + actions.main: Kirigami.Action { iconName: state !== "view" ? "document-save" : "document-edit" onTriggered: { manager.appendTextToLog("save/edit button triggered") @@ -175,48 +174,44 @@ Kirigami.Page { Item { anchors.fill: parent - ScrollView { - id: diveDetailList + ListView { + id: diveDetailsListView anchors.fill: parent - ListView { - id: diveDetailsListView - anchors.fill: parent - model: diveModel - currentIndex: -1 - boundsBehavior: Flickable.StopAtBounds - maximumFlickVelocity: parent.width * 5 - orientation: ListView.Horizontal - highlightFollowsCurrentItem: true - focus: true - clip: false - //cacheBuffer: parent.width * 3 // cache one item on either side (this is in pixels) - snapMode: ListView.SnapOneItem - highlightRangeMode: ListView.StrictlyEnforceRange - onMovementEnded: { - currentIndex = indexAt(contentX+1, 1); - } - delegate: ScrollView { - id: internalScrollView - width: diveDetailsListView.width - height: diveDetailsListView.height - property var modelData: model - Flickable { - //contentWidth: parent.width - contentHeight: diveDetails.height - boundsBehavior: Flickable.StopAtBounds - DiveDetailsView { - id: diveDetails - width: internalScrollView.width - } - } - } + model: diveModel + currentIndex: -1 + boundsBehavior: Flickable.StopAtBounds + maximumFlickVelocity: parent.width * 5 + orientation: ListView.Horizontal + highlightFollowsCurrentItem: true + focus: true + clip: false + //cacheBuffer: parent.width * 3 // cache one item on either side (this is in pixels) + snapMode: ListView.SnapOneItem + highlightRangeMode: ListView.StrictlyEnforceRange + onMovementEnded: { + currentIndex = indexAt(contentX+1, 1); } + delegate: Flickable { + id: internalScrollView + width: diveDetailsListView.width + height: diveDetailsListView.height + contentHeight: diveDetails.height + boundsBehavior: Flickable.StopAtBounds + property var modelData: model + DiveDetailsView { + id: diveDetails + width: internalScrollView.width + } + ScrollBar.vertical: ScrollBar { } + } + ScrollIndicator.horizontal: ScrollIndicator { } } Kirigami.OverlaySheet { id: detailsEditScroll - anchors.fill: parent - onOpenedChanged: { - if (!opened) { + parent: diveDetailsPage + rootItem.z: 0 + onSheetOpenChanged: { + if (!sheetOpen) { endEditMode() } } diff --git a/mobile-widgets/qml/DiveDetailsEdit.qml b/mobile-widgets/qml/DiveDetailsEdit.qml index 8a0e62c67..43432fd60 100644 --- a/mobile-widgets/qml/DiveDetailsEdit.qml +++ b/mobile-widgets/qml/DiveDetailsEdit.qml @@ -1,10 +1,11 @@ import QtQuick 2.3 -import QtQuick.Controls 1.2 +import QtQuick.Controls 2.0 +import QtQuick.Controls 1.2 as QQC1 import QtQuick.Controls.Styles 1.2 import QtQuick.Dialogs 1.2 import QtQuick.Layouts 1.1 import org.subsurfacedivelog.mobile 1.0 -import org.kde.kirigami 1.0 as Kirigami +import org.kde.kirigami 2.0 as Kirigami Item { id: detailsEdit @@ -83,7 +84,7 @@ Item { Layout.alignment: Qt.AlignRight text: qsTr("Date:") } - StyledTextField { + TextField { id: txtDate; Layout.fillWidth: true } @@ -91,7 +92,7 @@ Item { Layout.alignment: Qt.AlignRight text: qsTr("Location:") } - StyledTextField { + TextField { id: txtLocation; Layout.fillWidth: true } @@ -100,7 +101,7 @@ Item { Layout.alignment: Qt.AlignRight text: qsTr("Coordinates:") } - StyledTextField { + TextField { id: txtGps Layout.fillWidth: true } @@ -123,7 +124,7 @@ Item { Layout.alignment: Qt.AlignRight text: qsTr("Depth:") } - StyledTextField { + TextField { id: txtDepth Layout.fillWidth: true validator: RegExpValidator { regExp: /[^-]*/ } @@ -132,7 +133,7 @@ Item { Layout.alignment: Qt.AlignRight text: qsTr("Duration:") } - StyledTextField { + TextField { id: txtDuration Layout.fillWidth: true validator: RegExpValidator { regExp: /[^-]*/ } @@ -142,7 +143,7 @@ Item { Layout.alignment: Qt.AlignRight text: qsTr("Air Temp:") } - StyledTextField { + TextField { id: txtAirTemp Layout.fillWidth: true } @@ -151,7 +152,7 @@ Item { Layout.alignment: Qt.AlignRight text: qsTr("Water Temp:") } - StyledTextField { + TextField { id: txtWaterTemp Layout.fillWidth: true } @@ -160,7 +161,7 @@ Item { Layout.alignment: Qt.AlignRight text: qsTr("Suit:") } - ComboBox { + QQC1.ComboBox { id: suitBox editable: true model: diveDetailsListView.currentItem ? diveDetailsListView.currentItem.modelData.dive.suitList : null @@ -175,7 +176,7 @@ Item { Layout.alignment: Qt.AlignRight text: qsTr("Buddy:") } - ComboBox { + QQC1.ComboBox { id: buddyBox editable: true model: diveDetailsListView.currentItem ? diveDetailsListView.currentItem.modelData.dive.buddyList : null @@ -190,7 +191,7 @@ Item { Layout.alignment: Qt.AlignRight text: qsTr("Divemaster:") } - ComboBox { + QQC1.ComboBox { id: divemasterBox editable: true model: diveDetailsListView.currentItem ? diveDetailsListView.currentItem.modelData.dive.divemasterList : null @@ -205,9 +206,9 @@ Item { Layout.alignment: Qt.AlignRight text: qsTr("Weight:") } - StyledTextField { + TextField { id: txtWeight - fixed: text === "cannot edit multiple weight systems" + readOnly: text === "cannot edit multiple weight systems" Layout.fillWidth: true } @@ -215,7 +216,7 @@ Item { Layout.alignment: Qt.AlignRight text: qsTr("Cylinder:") } - ComboBox { + QQC1.ComboBox { id: cylinderBox editable: true model: diveDetailsListView.currentItem ? diveDetailsListView.currentItem.modelData.dive.cylinderList : null @@ -230,7 +231,7 @@ Item { Layout.alignment: Qt.AlignRight text: qsTr("Gas mix:") } - StyledTextField { + TextField { id: txtGasMix Layout.fillWidth: true validator: RegExpValidator { regExp: /(EAN100|EAN\d\d|AIR|100|\d{1,2}|\d{1,2}\/\d{1,2})/i } @@ -240,7 +241,7 @@ Item { Layout.alignment: Qt.AlignRight text: qsTr("Start Pressure:") } - StyledTextField { + TextField { id: txtStartPressure Layout.fillWidth: true } @@ -249,7 +250,7 @@ Item { Layout.alignment: Qt.AlignRight text: qsTr("End Pressure:") } - StyledTextField { + TextField { id: txtEndPressure Layout.fillWidth: true } diff --git a/mobile-widgets/qml/DiveDetailsView.qml b/mobile-widgets/qml/DiveDetailsView.qml index 79602e645..e0069b04a 100644 --- a/mobile-widgets/qml/DiveDetailsView.qml +++ b/mobile-widgets/qml/DiveDetailsView.qml @@ -2,12 +2,10 @@ import QtQuick 2.3 /* import QtWebView 1.0 */ -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.2 import QtQuick.Dialogs 1.2 import QtQuick.Layouts 1.1 import org.subsurfacedivelog.mobile 1.0 -import org.kde.kirigami 1.0 as Kirigami +import org.kde.kirigami 2.0 as Kirigami Item { id: detailsView diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index fc7e114fc..2ae618fa1 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -1,9 +1,9 @@ import QtQuick 2.6 -import QtQuick.Controls 1.2 +import QtQuick.Controls 2.0 import QtQuick.Layouts 1.2 import QtQuick.Window 2.2 import QtQuick.Dialogs 1.2 -import org.kde.kirigami 1.0 as Kirigami +import org.kde.kirigami 2.0 as Kirigami import org.subsurfacedivelog.mobile 1.0 Kirigami.ScrollablePage { @@ -209,11 +209,13 @@ Kirigami.ScrollablePage { } } - ScrollView { + Flickable { id: startPageWrapper anchors.fill: parent opacity: credentialStatus === QMLManager.NOCLOUD || (credentialStatus === QMLManager.VALID || credentialStatus === QMLManager.VALID_EMAIL) ? 0 : 1 visible: opacity > 0 + contentWidth: width + contentHeight: startPage.height Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } } onVisibleChanged: { print("startPageWrapper onVisibleChanged credentialStatus " + credentialStatus + " diveListView.count " + diveListView.count) @@ -233,6 +235,7 @@ Kirigami.ScrollablePage { title = qsTr("Dive list") } } + ScrollBar.vertical: ScrollBar { } StartPage { id: startPage @@ -277,14 +280,14 @@ Kirigami.ScrollablePage { } } - property QtObject addDiveAction: Action { + property QtObject addDiveAction: Kirigami.Action { iconName: "list-add" onTriggered: { startAddDive() } } - property QtObject saveAction: Action { + property QtObject saveAction: Kirigami.Action { iconName: "document-save" onTriggered: { Qt.inputMethod.hide() @@ -292,7 +295,7 @@ Kirigami.ScrollablePage { } } - property QtObject offlineAction: Action { + property QtObject offlineAction: Kirigami.Action { iconName: "qrc:/qml/nocloud.svg" onTriggered: { manager.syncToCloud = false diff --git a/mobile-widgets/qml/DownloadFromDiveComputer.qml b/mobile-widgets/qml/DownloadFromDiveComputer.qml index d75db6737..9021a0668 100644 --- a/mobile-widgets/qml/DownloadFromDiveComputer.qml +++ b/mobile-widgets/qml/DownloadFromDiveComputer.qml @@ -1,11 +1,11 @@ import QtQuick 2.3 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.2 +import QtQuick.Controls 1.4 as QQC1 +import QtQuick.Controls 2.0 import QtQuick.Window 2.2 import QtQuick.Dialogs 1.2 import QtQuick.Layouts 1.1 import org.subsurfacedivelog.mobile 1.0 -import org.kde.kirigami 1.0 as Kirigami +import org.kde.kirigami 2.0 as Kirigami Kirigami.Page { id: diveComputerDownloadWindow @@ -17,7 +17,7 @@ Kirigami.Page { /* this can be done by hitting the back key contextualActions: [ - Action { + Kirigami.Action { text: qsTr("Close Preferences") iconName: "dialog-cancel" onTriggered: { @@ -35,27 +35,27 @@ Kirigami.Page { RowLayout { anchors.top:parent.top Layout.fillWidth: true - Text { text: qsTr(" Vendor name: ") } + Kirigami.Label { text: qsTr(" Vendor name: ") } ComboBox { Layout.fillWidth: true } } RowLayout { - Text { text: qsTr(" Dive Computer:") } + Kirigami.Label { text: qsTr(" Dive Computer:") } ComboBox { Layout.fillWidth: true } } RowLayout { - Text { text: " Progress:" } + Kirigami.Label { text: " Progress:" } Layout.fillWidth: true ProgressBar { Layout.fillWidth: true } } RowLayout { - SubsurfaceButton { + Button { text: qsTr("Download") onClicked: { text: qsTr("Retry") stackView.pop(); } } - SubsurfaceButton { + Button { id:quitbutton text: qsTr("Quit") onClicked: { @@ -64,26 +64,26 @@ Kirigami.Page { } } RowLayout { - Text { + Kirigami.Label { text: qsTr(" Downloaded dives") } } - TableView { + QQC1.TableView { width: parent.width Layout.fillWidth: true // The tableview should fill Layout.fillHeight: true // all remaining vertical space height: parent.height // on this screen - TableViewColumn { + QQC1.TableViewColumn { width: parent.width / 2 role: "datetime" title: qsTr("Date / Time") } - TableViewColumn { + QQC1.TableViewColumn { width: parent.width / 4 role: "duration" title: qsTr("Duration") } - TableViewColumn { + QQC1.TableViewColumn { width: parent.width / 4 role: "depth" title: qsTr("Depth") @@ -91,33 +91,33 @@ Kirigami.Page { } RowLayout { Layout.fillWidth: true - SubsurfaceButton { + Button { text: qsTr("Accept") onClicked: { stackView.pop(); } } - SubsurfaceButton { + Button { text: qsTr("Quit") onClicked: { stackView.pop(); } } - Text { + Kirigami.Label { text: "" // Spacer between 2 button groups Layout.fillWidth: true } - SubsurfaceButton { + Button { text: qsTr("Select All") } - SubsurfaceButton { + Button { id: unselectbutton text: qsTr("Unselect All") } } RowLayout { // spacer to make space for silly button Layout.minimumHeight: 1.2 * unselectbutton.height - Text { + Kirigami.Label { text:"" } } diff --git a/mobile-widgets/qml/GpsList.qml b/mobile-widgets/qml/GpsList.qml index 47b1d4c77..866b5be52 100644 --- a/mobile-widgets/qml/GpsList.qml +++ b/mobile-widgets/qml/GpsList.qml @@ -1,12 +1,10 @@ import QtQuick 2.3 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.2 import QtQuick.Window 2.2 import QtQuick.Dialogs 1.2 import QtQuick.Layouts 1.1 import QtQuick.Window 2.2 import org.subsurfacedivelog.mobile 1.0 -import org.kde.kirigami 1.0 as Kirigami +import org.kde.kirigami 2.0 as Kirigami Kirigami.ScrollablePage { id: gpsListWindow diff --git a/mobile-widgets/qml/Log.qml b/mobile-widgets/qml/Log.qml index 7d630d0bf..a0260e582 100644 --- a/mobile-widgets/qml/Log.qml +++ b/mobile-widgets/qml/Log.qml @@ -1,12 +1,10 @@ import QtQuick 2.3 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.2 import QtQuick.Window 2.2 import QtQuick.Dialogs 1.2 import QtQuick.Layouts 1.1 import QtQuick.Window 2.2 import org.subsurfacedivelog.mobile 1.0 -import org.kde.kirigami 1.0 as Kirigami +import org.kde.kirigami 2.0 as Kirigami Kirigami.ScrollablePage { id: logWindow diff --git a/mobile-widgets/qml/Preferences.qml b/mobile-widgets/qml/Preferences.qml index c43734114..ad21f810a 100644 --- a/mobile-widgets/qml/Preferences.qml +++ b/mobile-widgets/qml/Preferences.qml @@ -1,16 +1,16 @@ import QtQuick 2.3 -import QtQuick.Controls 1.2 +import QtQuick.Controls 2.0 import QtQuick.Window 2.2 import QtQuick.Dialogs 1.2 import QtQuick.Layouts 1.1 -import org.kde.kirigami 1.0 as Kirigami +import org.kde.kirigami 2.0 as Kirigami import org.subsurfacedivelog.mobile 1.0 Kirigami.Page { title: qsTr("Preferences") actions { - main: Action { + main: Kirigami.Action { text: qsTr("Save") iconName: "document-save" onTriggered: { @@ -52,7 +52,7 @@ Kirigami.Page { Layout.alignment: Qt.AlignRight } - StyledTextField { + TextField { id: distanceThreshold text: manager.distanceThreshold Layout.fillWidth: true @@ -63,7 +63,7 @@ Kirigami.Page { Layout.alignment: Qt.AlignRight } - StyledTextField { + TextField { id: timeThreshold text: manager.timeThreshold Layout.fillWidth: true diff --git a/mobile-widgets/qml/StartPage.qml b/mobile-widgets/qml/StartPage.qml index 12a5d0103..26ebb0897 100644 --- a/mobile-widgets/qml/StartPage.qml +++ b/mobile-widgets/qml/StartPage.qml @@ -1,8 +1,6 @@ import QtQuick 2.5 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.2 import QtQuick.Layouts 1.1 -import org.kde.kirigami 1.0 as Kirigami +import org.kde.kirigami 2.0 as Kirigami import org.subsurfacedivelog.mobile 1.0 ColumnLayout { diff --git a/mobile-widgets/qml/StyledTextField.qml b/mobile-widgets/qml/StyledTextField.qml deleted file mode 100644 index fdb61b7b8..000000000 --- a/mobile-widgets/qml/StyledTextField.qml +++ /dev/null @@ -1,17 +0,0 @@ -import QtQuick 2.3 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.2 - -TextField { - property bool fixed: false - readOnly: fixed - style: TextFieldStyle { - background: Rectangle { - color: fixed ? "transparent" : "white" - radius: 4 - border.width: 0.5 - border.color: fixed ? "transparent" : "#c0c0c0" - } - } - -} diff --git a/mobile-widgets/qml/SubsurfaceButton.qml b/mobile-widgets/qml/SubsurfaceButton.qml deleted file mode 100644 index 174d44659..000000000 --- a/mobile-widgets/qml/SubsurfaceButton.qml +++ /dev/null @@ -1,26 +0,0 @@ -import QtQuick 2.5 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.2 -import org.kde.kirigami 1.0 as Kirigami - -Button { - style: ButtonStyle { - padding { - top: Kirigami.Units.smallSpacing * 2 - left: Kirigami.Units.smallSpacing * 4 - right: Kirigami.Units.smallSpacing * 4 - bottom: Kirigami.Units.smallSpacing * 2 - } - background: Rectangle { - border.width: 1 - radius: height / 3 - color: control.pressed ? subsurfaceTheme.shadedColor : subsurfaceTheme.accentColor - } - label: Text{ - text: control.text - color: subsurfaceTheme.accentTextColor - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - } - } -} diff --git a/mobile-widgets/qml/ThemeTest.qml b/mobile-widgets/qml/ThemeTest.qml index 8aae32a30..3005032e0 100644 --- a/mobile-widgets/qml/ThemeTest.qml +++ b/mobile-widgets/qml/ThemeTest.qml @@ -1,8 +1,7 @@ import QtQuick 2.5 -import QtQuick.Controls 1.4 import QtQuick.Layouts 1.1 import QtQuick.Window 2.2 -import org.kde.kirigami 1.0 as Kirigami +import org.kde.kirigami 2.0 as Kirigami Kirigami.Page { diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index 62325b691..59c584df2 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -1,12 +1,11 @@ import QtQuick 2.4 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.2 +import QtQuick.Controls 2.0 import QtQuick.Window 2.2 import QtQuick.Dialogs 1.2 import QtQuick.Layouts 1.1 import QtQuick.Window 2.2 import org.subsurfacedivelog.mobile 1.0 -import org.kde.kirigami 1.0 as Kirigami +import org.kde.kirigami 2.0 as Kirigami Kirigami.ApplicationWindow { id: rootItem diff --git a/mobile-widgets/qml/mobile-resources.qrc b/mobile-widgets/qml/mobile-resources.qrc index b95ce4134..a0247acb0 100644 --- a/mobile-widgets/qml/mobile-resources.qrc +++ b/mobile-widgets/qml/mobile-resources.qrc @@ -13,9 +13,7 @@ Log.qml ThemeTest.qml StartPage.qml - StyledTextField.qml dive.jpg - SubsurfaceButton.qml ../../icons/subsurface-mobile-icon.png icons/main-menu.png icons/context-menu.png @@ -24,6 +22,7 @@ icons/nocloud.svg + qtquickcontrols2.conf kirigami/icons/go-next.svg kirigami/icons/go-previous.svg kirigami/icons/handle-left.svg diff --git a/mobile-widgets/qml/qtquickcontrols2.conf b/mobile-widgets/qml/qtquickcontrols2.conf new file mode 100644 index 000000000..777a4a5b9 --- /dev/null +++ b/mobile-widgets/qml/qtquickcontrols2.conf @@ -0,0 +1,11 @@ +[Controls] +Style=Material + +[Material] +Primary=#2d5b9a +Accent=#2d5b9a +Theme=System + +[Universal] +Accent=#2d5b9a +Theme=System diff --git a/scripts/mobilecomponents.sh b/scripts/mobilecomponents.sh index 8b42d2223..71c053177 100755 --- a/scripts/mobilecomponents.sh +++ b/scripts/mobilecomponents.sh @@ -26,12 +26,12 @@ fi # or SHAs from upstream cd $SRC if [ ! -d kirigami ] ; then - git clone -b Kirigami/1.1 git://github.com/KDE/kirigami + git clone -b master git://github.com/KDE/kirigami fi if [ "$NOPULL" = "" ] ; then pushd kirigami - git checkout Kirigami/1.1 - git pull origin Kirigami/1.1 + git checkout master + git pull origin master popd fi if [ ! -d breeze-icons ] ; then diff --git a/subsurface-mobile-main.cpp b/subsurface-mobile-main.cpp index c64368ceb..69b628ab9 100644 --- a/subsurface-mobile-main.cpp +++ b/subsurface-mobile-main.cpp @@ -20,6 +20,7 @@ int main(int argc, char **argv) { int i; + QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true")); QApplication *application = new QApplication(argc, argv); (void)application;