diff options
Diffstat (limited to 'qt-mobile/qml')
-rw-r--r-- | qt-mobile/qml/DiveDetails.qml | 97 | ||||
-rw-r--r-- | qt-mobile/qml/DiveList.qml | 170 | ||||
-rw-r--r-- | qt-mobile/qml/DownloadFromDiveComputer.qml | 97 | ||||
-rw-r--r-- | qt-mobile/qml/Log.qml | 37 | ||||
-rw-r--r-- | qt-mobile/qml/Preferences.qml | 87 | ||||
-rw-r--r-- | qt-mobile/qml/TextButton.qml | 37 | ||||
-rw-r--r-- | qt-mobile/qml/ThemeTest.qml | 72 | ||||
-rw-r--r-- | qt-mobile/qml/TopBar.qml | 67 | ||||
-rw-r--r-- | qt-mobile/qml/components/Label.qml | 11 | ||||
-rw-r--r-- | qt-mobile/qml/main.qml | 219 | ||||
-rw-r--r-- | qt-mobile/qml/mobile-resources.qrc | 20 | ||||
-rw-r--r-- | qt-mobile/qml/theme/Theme.qml | 57 | ||||
-rw-r--r-- | qt-mobile/qml/theme/Units.qml | 102 | ||||
-rw-r--r-- | qt-mobile/qml/theme/qmldir | 2 |
14 files changed, 1075 insertions, 0 deletions
diff --git a/qt-mobile/qml/DiveDetails.qml b/qt-mobile/qml/DiveDetails.qml new file mode 100644 index 000000000..afb62104a --- /dev/null +++ b/qt-mobile/qml/DiveDetails.qml @@ -0,0 +1,97 @@ +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 + +Item { + id: diveDetailsWindow + width: parent.width + objectName: "DiveDetails" + + property string location + property string dive_id + property string airtemp + property string watertemp + property string suit + property string buddy + property string divemaster; + property string notes; + property string date + property string number + + onDive_idChanged: { + qmlProfile.diveId = dive_id + qmlProfile.update() + } + + Flickable { + id: flick + width: parent.width + anchors { top: parent.top; bottom: parent.bottom } + contentHeight: parent.height + clip: true + ColumnLayout { + width: parent.width + spacing: 8 + + TopBar { + + } + + Button { + text: "Hide Dive Profile" + onClicked: { + qmlProfile.visible = !qmlProfile.visible + if (qmlProfile.visible) { + text = "Hide Dive Profile" + } else { + text = "Show Dive Profile" + } + } + } + + GridLayout { + id: editorDetails + width: parent.width + columns: 2 + Text { + Layout.columnSpan: 2 + Layout.alignment: Qt.AlignHCenter + text: "Dive " + number + " (" + date + ")"; font.bold: true + } + QMLProfile { + Layout.columnSpan: 2 + Layout.fillWidth: true + id: qmlProfile + height: 500 + } + Text { text: "Location:"; font.bold: true } + TextField { id: txtLocation; text: location; Layout.fillWidth: true } + Text { text: "Air Temp:"; font.bold: true } + TextField { id: txtAirTemp; text: airtemp; Layout.fillWidth: true } + Text { text: "Water Temp:"; font.bold: true } + TextField { id: txtWaterTemp; text: watertemp; Layout.fillWidth: true } + Text { text: "Suit:"; font.bold: true } + TextField { id: txtSuit; text: suit; Layout.fillWidth: true } + Text { text: "Buddy:"; font.bold: true } + TextField { id: txtBuddy; text: buddy; Layout.fillWidth: true } + Text { text: "Dive Master:"; font.bold: true } + TextField { id: txtDiveMaster; text: divemaster; Layout.fillWidth: true} + Text { text: "Notes:"; font.bold: true } + TextEdit{ + id: txtNotes + text: notes + focus: true + Layout.fillWidth: true + Layout.fillHeight: true + selectByMouse: true + wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere + } + } + } + } +} diff --git a/qt-mobile/qml/DiveList.qml b/qt-mobile/qml/DiveList.qml new file mode 100644 index 000000000..c95b4dcaa --- /dev/null +++ b/qt-mobile/qml/DiveList.qml @@ -0,0 +1,170 @@ +import QtQuick 2.3 +import QtQuick.Controls 1.2 +import QtQuick.Window 2.2 +import QtQuick.Dialogs 1.2 +import org.subsurfacedivelog.mobile 1.0 +import QtQuick.Layouts 1.0 + +Rectangle { + id: page + objectName: "DiveList" + + Component { + id: diveDelegate + Item { + id: dive + + property real detailsOpacity : 0 + + width: diveListView.width - units.smallSpacing + height: childrenRect.height + + //Mouse region: When clicked, the mode changes to details view + MouseArea { + anchors.fill: parent + onClicked: { + detailsWindow.width = parent.width + detailsWindow.location = location + detailsWindow.dive_id = id + detailsWindow.buddy = buddy + detailsWindow.suit = suit + detailsWindow.airtemp = airtemp + detailsWindow.watertemp = watertemp + detailsWindow.divemaster = divemaster + detailsWindow.notes = notes + detailsWindow.number = diveNumber + detailsWindow.date = date + stackView.push(detailsWindow) + } + } + + //Layout of the page: (mini profile, dive no, date at the top + //And other details at the bottom. + Item { + x: units.smallSpacing + width: parent.width - units.smallSpacing * 2 + height: childrenRect.height + units.smallSpacing * 2 + //spacing: units.smallSpacing / 2 + anchors.margins: units.smallSpacing + + Text { + id: locationText + text: location + color: theme.textColor + scale: 1.1 // Let's see how this works, otherwise, we'll need the default point size somewhere + transformOrigin: Item.TopLeft + anchors { + left: parent.left + top: parent.top + } + } + Text { + text: date + opacity: 0.6 + color: theme.textColor + anchors { + right: parent.right + top: parent.top + bottomMargin: units.smallSpacing / 2 + } + } + Row { + id: descriptionText + anchors { + left: parent.left + right: parent.right + bottom: numberText.bottom + } + Text { + text: 'Depth: ' + opacity: 0.6 + color: theme.textColor + } + Text { + text: depth + width: Math.max(units.gridUnit * 3, paintedWidth) // helps vertical alignment throughout listview + color: theme.textColor + } + Text { + text: 'Duration: ' + opacity: 0.6 + color: theme.textColor + } + Text { + text: duration + color: theme.textColor + } + } + Text { + id: numberText + text: "#" + diveNumber + color: theme.textColor + scale: 1.2 + transformOrigin: Item.BottomRight + opacity: 0.4 + anchors { + right: parent.right + topMargin: units.smallSpacing + top: locationText.bottom + } + } + //Text { text: location; width: parent.width } + Rectangle { + color: theme.textColor + opacity: .2 + height: Math.max(1, units.gridUnit / 24) // we really want a thin line + anchors { + left: parent.left + right: parent.right + top: numberText.bottom + } + } + } + } + } + + Component { + id: tripHeading + Item { + width: page.width - units.smallSpacing * 2 + height: childrenRect.height + units.smallSpacing * 2 + + Text { + id: sectionText + text: section + anchors { + top: parent.top + left: parent.left + leftMargin: units.smallSpacing + right: parent.right + } + color: theme.textColor + font.pointSize: 16 + } + Rectangle { + height: Math.max(2, units.gridUnit / 12) // we want a thicker line + anchors { + top: sectionText.bottom + left: parent.left + leftMargin: units.smallSpacing + right: parent.right + } + color: theme.accentColor + } + } + } + + ListView { + id: diveListView + anchors.fill: parent + model: diveModel + delegate: diveDelegate + boundsBehavior: Flickable.StopAtBounds + //highlight: Rectangle { color: theme.highlightColor; width: units.smallSpacing } + focus: true + clip: true + section.property: "trip" + section.criteria: ViewSection.FullString + section.delegate: tripHeading + } +} diff --git a/qt-mobile/qml/DownloadFromDiveComputer.qml b/qt-mobile/qml/DownloadFromDiveComputer.qml new file mode 100644 index 000000000..d23754407 --- /dev/null +++ b/qt-mobile/qml/DownloadFromDiveComputer.qml @@ -0,0 +1,97 @@ +import QtQuick 2.3 +import QtQuick.Controls 1.2 +import QtQuick.Window 2.2 +import QtQuick.Dialogs 1.2 +import QtQuick.Layouts 1.1 +import org.subsurfacedivelog.mobile 1.0 + +Item { + id: diveComputerDownloadWindow + anchors.top: parent.top + width: parent.width + height: parent.height + + GridLayout { + columns: 2 + anchors.top: parent.top + width: parent.width + height: parent.height + ColumnLayout { + height: parent.height + width: parent.width + ColumnLayout { + width: parent.width + Layout.fillHeight: true + ColumnLayout { + Layout.fillHeight: true + Layout.fillWidth: true + ColumnLayout { + height: parent.height + Layout.fillWidth: true + Text { text: "Vendor" } + ComboBox { Layout.fillWidth: true } + Text { text: "Dive Computer" } + ComboBox { Layout.fillWidth: true } + Text { text: "Device or mount point" } + RowLayout { + Layout.fillWidth: true + TextField { Layout.fillWidth: true } + Button { text: "..." } + } + GridLayout { + columns: 2 + CheckBox { text: "Force download of all dives" } + CheckBox { text: "Always prefer downloaded dives" } + CheckBox { text: "Download into new trip" } + CheckBox { text: "Save libdivecomputer logfile" } + CheckBox { text: "Save libdivecomputer dumpfile" } + CheckBox { text: "Choose Bluetooth download mode" } + } + + RowLayout { + Layout.fillWidth: true + ProgressBar { Layout.fillWidth: true } + Button { text: "Download" } + } + } + } + ColumnLayout { + height: parent.height + Layout.fillWidth: true + RowLayout { + Text { + text: "Downloaded dives" + } + Button { + text: "Select All" + } + Button { + text: "Unselect All" + } + } + TableView { + Layout.fillWidth: true + Layout.fillHeight: true + } + } + } + RowLayout { + width: parent.width + Button { + text: "OK" + + onClicked: { + stackView.pop(); + } + } + Button { + text: "Cancel" + + onClicked: { + stackView.pop(); + } + } + } + } + } +} diff --git a/qt-mobile/qml/Log.qml b/qt-mobile/qml/Log.qml new file mode 100644 index 000000000..8e660f2c7 --- /dev/null +++ b/qt-mobile/qml/Log.qml @@ -0,0 +1,37 @@ +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 + +Item { + id: logWindow + width: parent.width + height: parent.height + objectName: "Log" + + ColumnLayout { + width: parent.width + height: parent.height + spacing: 8 + + TopBar { + id: topBar + anchors.top: parent.top + } + + Rectangle { + anchors.top: topBar.bottom + Layout.fillHeight: true + Layout.fillWidth: true + Text { + anchors.fill: parent + wrapMode: Text.WrapAnywhere + text: manager.logText + } + } + } +} diff --git a/qt-mobile/qml/Preferences.qml b/qt-mobile/qml/Preferences.qml new file mode 100644 index 000000000..8f4a15328 --- /dev/null +++ b/qt-mobile/qml/Preferences.qml @@ -0,0 +1,87 @@ +import QtQuick 2.3 +import QtQuick.Controls 1.2 +import QtQuick.Window 2.2 +import QtQuick.Dialogs 1.2 +import QtQuick.Layouts 1.1 +import org.subsurfacedivelog.mobile 1.0 + +Item { + id: loginWindow + + signal accept + + property string username: login.text; + property string password: password.text; + property bool issave: savePassword.checked; + + GridLayout { + columns: 2 + anchors.centerIn: parent + width: parent.width + + Label { + text: "Enter your Subsurface cloud credentials" + Layout.columnSpan: 2 + } + + Label { + text: "Email Address:" + } + + TextField { + id: login + text: manager.cloudUserName + Layout.fillWidth: true + } + + Label { + text: "Password" + } + + TextField { + id: password + text: manager.cloudPassword + echoMode: TextInput.Password + Layout.fillWidth: true + } + + Label { + text: "Save Password locally" + } + + CheckBox { + checked: manager.saveCloudPassword + id: savePassword + } + + Item { + height: saveButton.height + width: saveButton.width + Button { + id: saveButton + text: "Save" + anchors.centerIn: parent + onClicked: { + manager.cloudUserName = login.text + manager.cloudPassword = password.text + manager.saveCloudPassword = savePassword.checked + manager.savePreferences() + stackView.pop() + } + } + } + + Item { + height: cancelButton.height + width: cancelButton.width + Button { + id: cancelButton + text: "Cancel" + + onClicked: { + stackView.pop(); + } + } + } + } +} diff --git a/qt-mobile/qml/TextButton.qml b/qt-mobile/qml/TextButton.qml new file mode 100644 index 000000000..3e5a36735 --- /dev/null +++ b/qt-mobile/qml/TextButton.qml @@ -0,0 +1,37 @@ +import QtQuick 2.3 + +Rectangle { + id: container + + property alias text: label.text + + signal clicked + + width: label.width + 20; height: label.height + 6 + smooth: true + radius: 10 + + gradient: Gradient { + GradientStop { id: gradientStop; position: 0.0; color: palette.light } + GradientStop { position: 1.0; color: palette.button } + } + + SystemPalette { id: palette } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: { container.clicked() } + } + + Text { + id: label + anchors.centerIn: parent + } + + states: State { + name: "pressed" + when: mouseArea.pressed + PropertyChanges { target: gradientStop; color: palette.dark } + } +} diff --git a/qt-mobile/qml/ThemeTest.qml b/qt-mobile/qml/ThemeTest.qml new file mode 100644 index 000000000..7452acc1b --- /dev/null +++ b/qt-mobile/qml/ThemeTest.qml @@ -0,0 +1,72 @@ +import QtQuick 2.5 +import QtQuick.Layouts 1.1 + +GridLayout { + id: themetest + columns: 2 + + Label { + Layout.columnSpan: 2 + Layout.fillHeight: true + text: "Theme Information" + } + + FontMetrics { + id: fm + } + + Label { + text: "units.gridUnit:" + } + Label { + text: units.gridUnit + } + + Label { + text: "units.devicePixelRatio:" + } + Label { + text: units.devicePixelRatio + } + + Label { + text: "FontMetrics pointSize:" + } + Label { + text: fm.font.pointSize + } + + Label { + text: "FontMetrics pixelSize:" + } + Label { + text: fm.height + + } + + Label { + text: "hand-computed devicePixelRatio:" + } + Label { + text: fm.height / fm.font.pointSize + } + + Text { + text: "Text item pixelSize:" + } + Text { + text: font.pixelSize + } + + Text { + text: "Text item pointSize:" + } + Text { + text: font.pointSize + } + + Label { + Layout.columnSpan: 2 + Layout.fillHeight: true + } +} diff --git a/qt-mobile/qml/TopBar.qml b/qt-mobile/qml/TopBar.qml new file mode 100644 index 000000000..552159d53 --- /dev/null +++ b/qt-mobile/qml/TopBar.qml @@ -0,0 +1,67 @@ +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 + +Rectangle { + id: topBar + color: theme.accentColor + Layout.fillWidth: true + Layout.margins: 0 + Layout.minimumHeight: prefsButton.height + units.smallSpacing * 2 + RowLayout { + anchors.bottom: topBar.bottom + anchors.bottomMargin: units.smallSpacing + anchors.left: topBar.left + anchors.leftMargin: units.smallSpacing + anchors.right: topBar.right + anchors.rightMargin: units.smallSpacing + Button { + id: backButton + Layout.maximumHeight: prefsButton.height + Layout.minimumHeight: prefsButton.height + Layout.preferredWidth: units.gridUnit * 2 + text: "\u2190" + style: ButtonStyle { + background: Rectangle { + color: theme.accentColor + implicitWidth: units.gridUnit * 2 + } + label: Text { + id: txt + color: theme.accentTextColor + font.pointSize: 18 + font.bold: true + text: control.text + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + } + onClicked: { + if (stackView.currentItem.objectName == "DiveDetails") + { + manager.commitChanges( + dive_id, + suit, + buddy, + divemaster, + notes + ) + } + stackView.pop(); + } + } + Text { + text: qsTr("Subsurface mobile") + font.pointSize: 18 + color: theme.accentTextColor + anchors.left: backButton.right + anchors.leftMargin: units.smallSpacing + //horizontalAlignment: Text.AlignHCenter + } + } +} diff --git a/qt-mobile/qml/components/Label.qml b/qt-mobile/qml/components/Label.qml new file mode 100644 index 000000000..617e05245 --- /dev/null +++ b/qt-mobile/qml/components/Label.qml @@ -0,0 +1,11 @@ +import QtQuick 2.5 +//import QtQuick.Controls 1.2 as QuickControls +import QtQuick.Window 2.2 +import QtQuick.Dialogs 1.2 +import QtQuick.Layouts 1.1 + +Text { + + font.pointSize: 18 + color: theme.textColor +} diff --git a/qt-mobile/qml/main.qml b/qt-mobile/qml/main.qml new file mode 100644 index 000000000..f75476537 --- /dev/null +++ b/qt-mobile/qml/main.qml @@ -0,0 +1,219 @@ +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 "qrc:/qml/theme" as Theme + + +ApplicationWindow { + title: qsTr("Subsurface mobile") + property bool fullscreen: true + property alias messageText: message.text + visible: true + + Theme.Units { + id: units + } + + Theme.Theme { + id: theme + /* Added for subsurface */ + property color accentColor: "#2d5b9a" + property color accentTextColor: "#ececec" + } + + Menu { + id: prefsMenu + title: "Menu" + + MenuItem { + text: "Preferences" + onTriggered: { + stackView.push(prefsWindow) + } + } + + MenuItem { + text: "Load Dives" + onTriggered: { + manager.loadDives(); + } + } + + MenuItem { + text: "Download Dives" + onTriggered: { + stackView.push(downloadDivesWindow) + } + } + + MenuItem { + text: "Add Dive" + onTriggered: { + manager.addDive(); + stackView.push(detailsWindow) + } + } + + MenuItem { + text: "Save Changes" + onTriggered: { + manager.saveChanges(); + } + } + + MenuItem { + text: "View Log" + onTriggered: { + stackView.push(logWindow) + } + } + + MenuItem { + text: "Theme Information" + onTriggered: { + stackView.push(themetest) + } + } + } + + StackView { + id: stackView + anchors.fill: parent + focus: true + Keys.onReleased: if (event.key == Qt.Key_Back && stackView.depth > 1) { + stackView.pop() + event.accepted = true; + } + initialItem: Item { + width: parent.width + height: parent.height + + ColumnLayout { + id: awLayout + anchors.fill: parent + spacing: units.gridUnit / 2 + Rectangle { + id: topPart + color: theme.accentColor + Layout.minimumHeight: units.gridUnit * 2 + units.smallSpacing * 2 + Layout.fillWidth: true + Layout.margins: 0 + RowLayout { + anchors.bottom: topPart.bottom + anchors.bottomMargin: units.smallSpacing + anchors.left: topPart.left + anchors.leftMargin: units.smallSpacing + anchors.right: topPart.right + anchors.rightMargin: units.smallSpacing + Image { + source: "qrc:/qml/subsurface-mobile-icon.png" + Layout.maximumWidth: units.gridUnit * 2 + Layout.preferredWidth: units.gridUnit * 2 + Layout.preferredHeight: units.gridUnit * 2 + } + Text { + text: qsTr("Subsurface mobile") + font.pointSize: 18 + Layout.fillWidth: false + color: theme.accentTextColor + } + Item { + Layout.fillWidth: true + } + Button { + id: prefsButton + text: "\u22ee" + anchors.right: parent.right + Layout.preferredWidth: units.gridUnit * 2 + Layout.preferredHeight: units.gridUnit * 2 + style: ButtonStyle { + background: Rectangle { + implicitWidth: units.gridUnit * 2 + color: theme.accentColor + } + label: Text { + id: txt + color: theme.accentTextColor + font.pointSize: 18 + font.bold: true + text: control.text + horizontalAlignment: Text.AlignHCenter + } + } + onClicked: { + prefsMenu.popup() + } + } + + } + + } + + Rectangle { + id: detailsPage + Layout.fillHeight: true + Layout.fillWidth: true + + DiveList { + anchors.fill: detailsPage + id: diveDetails + color: theme.backgroundColor + } + } + + Rectangle { + id: messageArea + height: childrenRect.height + Layout.fillWidth: true + + Text { + id: message + color: theme.textColor + text: "" + styleColor: theme.textColor + font.pointSize: 10 + } + } + + } + } + } + + QMLManager { + id: manager + } + + Preferences { + id: prefsWindow + visible: false + } + + DiveDetails { + id: detailsWindow + visible: false + } + + DownloadFromDiveComputer { + id: downloadDivesWindow + visible: false + } + + Log { + id: logWindow + visible: false + } + + ThemeTest { + id: themetest + visible: false + } + + Component.onCompleted: { + print("units.gridUnit is: " + units.gridUnit); + } +} diff --git a/qt-mobile/qml/mobile-resources.qrc b/qt-mobile/qml/mobile-resources.qrc new file mode 100644 index 000000000..42a89bd21 --- /dev/null +++ b/qt-mobile/qml/mobile-resources.qrc @@ -0,0 +1,20 @@ +<RCC> + <qresource prefix="/qml"> + <file>main.qml</file> + <file>TextButton.qml</file> + <file>Preferences.qml</file> + <file>DiveList.qml</file> + <file>DiveDetails.qml</file> + <file>DownloadFromDiveComputer.qml</file> + <file>Log.qml</file> + <file>TopBar.qml</file> + <file>ThemeTest.qml</file> + <file alias="Label.qml">components/Label.qml</file> + <file alias="subsurface-mobile-icon.png">../../icons/subsurface-mobile-icon.png</file> + </qresource> + <qresource prefix="/qml/theme"> + <file alias="Theme.qml">theme/Theme.qml</file> + <file alias="qmldir">theme/qmldir</file> + <file alias="Units.qml" >theme/Units.qml</file> + </qresource> +</RCC> diff --git a/qt-mobile/qml/theme/Theme.qml b/qt-mobile/qml/theme/Theme.qml new file mode 100644 index 000000000..2c51ae00f --- /dev/null +++ b/qt-mobile/qml/theme/Theme.qml @@ -0,0 +1,57 @@ +/* + * Copyright 2015 Marco Martin <mart@kde.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import QtQuick 2.0 + +//pragma Singleton + +/*! + \qmltype Theme + \inqmlmodule Material 0.1 + + \brief Provides access to standard colors that follow the Material Design specification. + + See \l {http://www.google.com/design/spec/style/color.html#color-ui-color-application} for + details about choosing a color scheme for your application. + */ +QtObject { + id: theme + + property color textColor: Qt.rgba(0,0,0, 0.54) + + property color highlightColor: "#2196F3" + property color backgroundColor: "#f3f3f3" + property color linkColor: "#2196F3" + property color visitedLinkColor: "#2196F3" + + property color buttonTextColor: Qt.rgba(0,0,0, 0.54) + property color buttonBackgroundColor: "#f3f3f3" + property color buttonHoverColor: "#2196F3" + property color buttonFocusColor: "#2196F3" + + property color viewTextColor: Qt.rgba(0,0,0, 0.54) + property color viewBackgroundColor: "#f3f3f3" + property color viewHoverColor: "#2196F3" + property color viewFocusColor: "#2196F3" + + property color complementaryTextColor: "#f3f3f3" + property color complementaryBackgroundColor: Qt.rgba(0,0,0, 0.54) + property color complementaryHoverColor: "#2196F3" + property color complementaryFocusColor: "#2196F3" +} diff --git a/qt-mobile/qml/theme/Units.qml b/qt-mobile/qml/theme/Units.qml new file mode 100644 index 000000000..1d0899fbc --- /dev/null +++ b/qt-mobile/qml/theme/Units.qml @@ -0,0 +1,102 @@ +/* + * Copyright 2015 Marco Martin <mart@kde.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import QtQuick 2.5 +import QtQuick.Window 2.2 + +//pragma Singleton + + +QtObject { + id: units + + /** + * The fundamental unit of space that should be used for sizes, expressed in pixels. + * Given the screen has an accurate DPI settings, it corresponds to a width of + * the capital letter M + */ + property int gridUnit: fontMetrics.height + + /** + * units.iconSizes provides access to platform-dependent icon sizing + * + * The icon sizes provided are normalized for different DPI, so icons + * will scale depending on the DPI. + * + * Icon sizes from KIconLoader, adjusted to devicePixelRatio: + * * small + * * smallMedium + * * medium + * * large + * * huge + * * enormous + * + * Not devicePixelRation-adjusted:: + * * desktop + */ + property QtObject iconSizes: QtObject { + property int small: 16 * devicePixelRatio + property int smallMedium: 22 * devicePixelRatio + property int medium: 32 * devicePixelRatio + property int large: 48 * devicePixelRatio + property int huge: 64 * devicePixelRatio + property int enormous: 128 * devicePixelRatio + } + + /** + * units.smallSpacing is the amount of spacing that should be used around smaller UI elements, + * for example as spacing in Columns. Internally, this size depends on the size of + * the default font as rendered on the screen, so it takes user-configured font size and DPI + * into account. + */ + property int smallSpacing: gridUnit/4 + + /** + * units.largeSpacing is the amount of spacing that should be used inside bigger UI elements, + * for example between an icon and the corresponding text. Internally, this size depends on + * the size of the default font as rendered on the screen, so it takes user-configured font + * size and DPI into account. + */ + property int largeSpacing: gridUnit + + /** + * The ratio between physical and device-independent pixels. This value does not depend on the \ + * size of the configured font. If you want to take font sizes into account when scaling elements, + * use theme.mSize(theme.defaultFont), units.smallSpacing and units.largeSpacing. + * The devicePixelRatio follows the definition of "device independent pixel" by Microsoft. + */ + property real devicePixelRatio: Screen.devicePixelRatio + + /** + * units.longDuration should be used for longer, screen-covering animations, for opening and + * closing of dialogs and other "not too small" animations + */ + property int longDuration: 250 + + /** + * units.shortDuration should be used for short animations, such as accentuating a UI event, + * hover events, etc.. + */ + property int shortDuration: 150 + + property QtObject fontMetrics: FontMetrics { + //id: textSpacer + //text: "M" + } +} diff --git a/qt-mobile/qml/theme/qmldir b/qt-mobile/qml/theme/qmldir new file mode 100644 index 000000000..c654dbad6 --- /dev/null +++ b/qt-mobile/qml/theme/qmldir @@ -0,0 +1,2 @@ +#singleton Units Units.qml +#//singleton Theme Theme.qml |