use mobilecomponents for our pages

This is a dumb port of a number of properties to use the new theme and
units API.

- import the plugin
- change accessors from units and theme to MobileComponents.Unit and
  MobileComponents.Theme

Signed-off-by: Sebastian Kügler <sebas@kde.org>
This commit is contained in:
Sebastian Kügler 2015-11-29 17:27:20 +01:00
parent 4d94441b6d
commit 2668da3f60
5 changed files with 38 additions and 36 deletions

View file

@ -17,12 +17,12 @@ Item {
GridLayout { GridLayout {
columns: 2 columns: 2
anchors.fill: parent anchors.fill: parent
anchors.margins: units.gridUnit anchors.margins: MobileComponents.Units.gridUnit
Label { Label {
text: "Cloud credentials" text: "Cloud credentials"
Layout.bottomMargin: units.largeSpacing Layout.bottomMargin: MobileComponents.Units.largeSpacing
font.pointSize: units.titlePointSize font.pointSize: MobileComponents.Units.titlePointSize
Layout.columnSpan: 2 Layout.columnSpan: 2
} }
@ -72,7 +72,7 @@ Item {
id: savePassword id: savePassword
} }
Item { width: units.gridUnit; height: width } Item { width: MobileComponents.Units.gridUnit; height: width }
Item { Item {
height: saveButton.height height: saveButton.height
width: saveButton.width width: saveButton.width

View file

@ -1,10 +1,9 @@
import QtQuick 2.3 import QtQuick 2.3
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2 import QtQuick.Controls.Styles 1.2
import QtQuick.Window 2.2
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Window 2.2 import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
import org.subsurfacedivelog.mobile 1.0 import org.subsurfacedivelog.mobile 1.0
Item { Item {
@ -45,7 +44,7 @@ Item {
Label { Label {
Layout.columnSpan: 2 Layout.columnSpan: 2
font.pointSize: units.titlePointSize font.pointSize: MobileComponents.Units.titlePointSize
text: "Dive " + number + " (" + date + ")" text: "Dive " + number + " (" + date + ")"
} }
@ -55,7 +54,7 @@ Item {
Layout.preferredHeight: qmlProfile.visible ? qmlProfile.height : profileHideButton.height Layout.preferredHeight: qmlProfile.visible ? qmlProfile.height : profileHideButton.height
QMLProfile { QMLProfile {
id: qmlProfile id: qmlProfile
height: units.gridUnit * 25 height: MobileComponents.Units.gridUnit * 25
anchors { anchors {
top: parent.top top: parent.top
left: parent.left left: parent.left

View file

@ -3,6 +3,7 @@ import QtQuick.Controls 1.2
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
import org.subsurfacedivelog.mobile 1.0 import org.subsurfacedivelog.mobile 1.0
Item { Item {
@ -17,12 +18,12 @@ Item {
GridLayout { GridLayout {
columns: 2 columns: 2
anchors.fill: parent anchors.fill: parent
anchors.margins: units.gridUnit anchors.margins: MobileComponents.Units.gridUnit
Label { Label {
text: "Cloud credentials" text: "Cloud credentials"
Layout.bottomMargin: units.largeSpacing Layout.bottomMargin: MobileComponents.Units.largeSpacing
font.pointSize: units.titlePointSize font.pointSize: MobileComponents.Units.titlePointSize
Layout.columnSpan: 2 Layout.columnSpan: 2
} }
@ -74,8 +75,8 @@ Item {
Label { Label {
text: "Subsurface GPS data webservice" text: "Subsurface GPS data webservice"
Layout.bottomMargin: units.largeSpacing Layout.bottomMargin: MobileComponents.Units.largeSpacing
font.pointSize: units.titlePointSize font.pointSize: MobileComponents.Units.titlePointSize
Layout.columnSpan: 2 Layout.columnSpan: 2
} }
@ -101,7 +102,7 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
} }
Item { width: units.gridUnit; height: width } Item { width: MobileComponents.Units.gridUnit; height: width }
Item { Item {
height: saveButton.height height: saveButton.height
width: saveButton.width width: saveButton.width

View file

@ -1,32 +1,33 @@
import QtQuick 2.5 import QtQuick 2.5
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
Item { Item {
ColumnLayout { ColumnLayout {
id: startpage id: startpage
anchors.fill: parent anchors.fill: parent
anchors.margins: units.largeSpacing anchors.margins: MobileComponents.Units.largeSpacing
property int buttonWidth: welcomeText.width * 0.66 property int buttonWidth: welcomeText.width * 0.66
Label { MobileComponents.Label {
Layout.bottomMargin: units.largeSpacing Layout.bottomMargin: MobileComponents.Units.largeSpacing
text: "Subsurface Divelog" text: "Subsurface Divelog"
font.pointSize: welcomeText.font.pointSize * 2 font.pointSize: welcomeText.font.pointSize * 2
} }
Label { MobileComponents.Label {
id: welcomeText id: welcomeText
Layout.fillWidth: true Layout.fillWidth: true
Layout.bottomMargin: units.largeSpacing Layout.bottomMargin: MobileComponents.Units.largeSpacing
text: "No recorded dives found. You can download your dives to this device from the Subsurface cloud storage service, from your dive computer, or add them manually." text: "No recorded dives found. You can download your dives to this device from the Subsurface cloud storage service, from your dive computer, or add them manually."
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
Layout.columnSpan: 2 Layout.columnSpan: 2
} }
Button { Button {
id: cloudstorageButton id: cloudstorageButton
Layout.bottomMargin: units.largeSpacing Layout.bottomMargin: MobileComponents.Units.largeSpacing
Layout.preferredWidth: startpage.buttonWidth Layout.preferredWidth: startpage.buttonWidth
text: "Connect to CloudStorage..." text: "Connect to CloudStorage..."
onClicked: { onClicked: {
@ -36,7 +37,7 @@ Item {
Button { Button {
id: computerButton id: computerButton
Layout.preferredWidth: startpage.buttonWidth Layout.preferredWidth: startpage.buttonWidth
Layout.bottomMargin: units.largeSpacing Layout.bottomMargin: MobileComponents.Units.largeSpacing
text: "Transfer from dive computer..." text: "Transfer from dive computer..."
onClicked: { onClicked: {
stackView.push(downloadDivesWindow) stackView.push(downloadDivesWindow)
@ -45,7 +46,7 @@ Item {
Button { Button {
id: manualButton id: manualButton
Layout.preferredWidth: startpage.buttonWidth Layout.preferredWidth: startpage.buttonWidth
Layout.bottomMargin: units.largeSpacing Layout.bottomMargin: MobileComponents.Units.largeSpacing
text: "Add dive manually..." text: "Add dive manually..."
onClicked: { onClicked: {
manager.addDive(); manager.addDive();

View file

@ -5,6 +5,7 @@ import QtQuick.Window 2.2
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
import org.subsurfacedivelog.mobile 1.0 import org.subsurfacedivelog.mobile 1.0
Rectangle { Rectangle {
@ -12,17 +13,17 @@ Rectangle {
property bool goBack: (stackView.depth > 1) property bool goBack: (stackView.depth > 1)
color: theme.accentColor color: MobileComponents.Theme.accentColor
Layout.minimumHeight: units.gridUnit * 2 + units.largeSpacing Layout.minimumHeight: MobileComponents.Units.gridUnit * 2 + MobileComponents.Units.largeSpacing
Layout.fillWidth: true Layout.fillWidth: true
Layout.margins: 0 Layout.margins: 0
RowLayout { RowLayout {
anchors.bottom: topPart.bottom anchors.bottom: topPart.bottom
anchors.bottomMargin: units.largeSpacing / 2 anchors.bottomMargin: MobileComponents.Units.largeSpacing / 2
anchors.left: topPart.left anchors.left: topPart.left
anchors.leftMargin: units.largeSpacing / 2 anchors.leftMargin: MobileComponents.Units.largeSpacing / 2
anchors.right: topPart.right anchors.right: topPart.right
anchors.rightMargin: units.largeSpacing / 2 anchors.rightMargin: MobileComponents.Units.largeSpacing / 2
Item { Item {
Layout.preferredHeight: subsurfaceLogo.height Layout.preferredHeight: subsurfaceLogo.height
Image { Image {
@ -32,7 +33,7 @@ Rectangle {
top: parent.top top: parent.top
left: parent.left left: parent.left
} }
width: units.gridUnit * 2 width: MobileComponents.Units.gridUnit * 2
height: width height: width
} }
Text { Text {
@ -41,12 +42,12 @@ Rectangle {
anchors { anchors {
left: subsurfaceLogo.right left: subsurfaceLogo.right
bottom: subsurfaceLogo.bottom bottom: subsurfaceLogo.bottom
leftMargin: units.gridUnit / 2 leftMargin: MobileComponents.Units.gridUnit / 2
} }
font.pointSize: units.fontMetrics.font.pointSize * 1.5 font.pointSize: MobileComponents.Units.fontMetrics.font.pointSize * 1.5
verticalAlignment: Text.AlignBottom verticalAlignment: Text.AlignBottom
Layout.fillWidth: false Layout.fillWidth: false
color: theme.accentTextColor color: MobileComponents.Theme.accentTextColor
} }
} }
Item { Item {
@ -57,17 +58,17 @@ Rectangle {
// Display back arrow or menu button // Display back arrow or menu button
text: topPart.goBack ? "\u2190" : "\u22ee" text: topPart.goBack ? "\u2190" : "\u22ee"
anchors.right: parent.right anchors.right: parent.right
Layout.preferredWidth: units.gridUnit * 2 Layout.preferredWidth: MobileComponents.Units.gridUnit * 2
Layout.preferredHeight: parent.height Layout.preferredHeight: parent.height
style: ButtonStyle { style: ButtonStyle {
background: Rectangle { background: Rectangle {
implicitWidth: units.gridUnit * 2 implicitWidth: MobileComponents.Units.gridUnit * 2
color: theme.accentColor color: MobileComponents.Theme.accentColor
} }
label: Text { label: Text {
id: txt id: txt
color: theme.accentTextColor color: MobileComponents.Theme.accentTextColor
font.pointSize: units.fontMetrics.font.pointSize * 2 font.pointSize: MobileComponents.Units.fontMetrics.font.pointSize * 2
font.bold: true font.bold: true
text: control.text text: control.text
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter