Commit 0ccf17c4 authored by Martin Straka's avatar Martin Straka Committed by Karel Slaný

QML Material redesign and some pages as Flickable

parent f91b98c0
......@@ -29,14 +29,14 @@ import QtQuick.Controls 2.1
*/
Menu {
id: root
property var inputTextControl: null /* Input text item (e.g. TextField, TextArea). */
property bool isPassword: false /* Don't allow copying of passwords. */
implicitWidth: 800 // Chosen to be large enough
transformOrigin: Menu.BottomLeft
MenuItem {
text: qsTr("Clear")
enabled: inputTextControl.text != ""
font.pointSize: inputTextControl.font.pointSize
implicitHeight: inputTextControl.height
onTriggered: {
inputTextControl.clear()
......@@ -45,6 +45,7 @@ Menu {
MenuItem {
text: qsTr("Copy")
enabled: !isPassword && inputTextControl.text != ""
font.pointSize: inputTextControl.font.pointSize
implicitHeight: inputTextControl.height
onTriggered: {
inputTextControl.selectAll()
......@@ -55,6 +56,7 @@ Menu {
MenuItem {
text: qsTr("Paste")
enabled: inputTextControl.canPaste
font.pointSize: inputTextControl.font.pointSize
implicitHeight: inputTextControl.height
onTriggered: {
inputTextControl.paste()
......
......@@ -28,13 +28,12 @@ import QtQuick 2.7
*/
Rectangle {
id: root
property string title: ""
anchors.top: parent.top
width: parent.width
height: headerHeight
color: datovkaPalette.highlight
z: 1
Image {
id: backElement
anchors.verticalCenter: parent.verticalCenter
......
......@@ -119,8 +119,6 @@ Item {
onPressAndHold: {
if (dialogue.explicitPasteMenu) {
textInputMenu.implicitWidth = content.computeMenuWidth(textInputMenu)
textInputMenu.x = textInput.x
textInputMenu.y = 2 * textInput.y
textInputMenu.open()
}
}
......
......@@ -22,9 +22,9 @@
*/
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Controls 2.1
import QtQuick.Window 2.1
import QtQuick.Layouts 1.2
import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2
import cz.nic.mobileDatovka 1.0
......@@ -39,9 +39,12 @@ ApplicationWindow {
height: 600
color: datovkaPalette.window
// This element set default font (size) and must be hidden. Font is used
// accross application as default font size. Do not remove it.
Text {
id: defaultTextFont
text: ""
visible: false
text: "Note: set default font"
}
// define all pages for stackview
......@@ -103,13 +106,12 @@ ApplicationWindow {
StackView { // Page area.
id: mainStack
anchors.fill: parent
initialItem: appArea
Component { /* Application workspace. */
id: appArea
Rectangle {
Item {
objectName: "appArea"
anchors.fill: parent
......@@ -117,10 +119,9 @@ ApplicationWindow {
mainStack.forceActiveFocus()
}
Rectangle { /* Application page stack. */
Item { /* Application page stack. */
id: mainPage
anchors.fill: parent
color: "transparent"
visible: true
StackView {
id: pageView
......@@ -198,17 +199,16 @@ ApplicationWindow {
Component { /* Pin lock screen. */
id: lockScreen
Rectangle {
objectName: "lockScreen"
anchors.fill: parent
color: "transparent"
Column {
spacing: formItemVerticalSpacing
color: datovkaPalette.base
ColumnLayout {
anchors.centerIn: parent
TextField {
id: pinCodeInput
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
//focus: true // Forcing focus here causes troubles on mobile devices.
echoMode: TextInput.Password
passwordMaskDelay: 500 // milliseconds
......@@ -216,11 +216,9 @@ ApplicationWindow {
placeholderText: qsTr("Enter PIN code")
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: TextInput.AlignHCenter
function verifyPin() {
settings.verifyPin(pinCodeInput.text.toString())
}
onEditingFinished: {
// This function is called repeatedly when switching
// windows. The condition should reduce PIN verification
......@@ -238,22 +236,19 @@ ApplicationWindow {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Wrong PIN code!")
}
Row {
spacing: formButtonHorizontalSpacing
Button {
text: qsTr("Enter")
anchors.horizontalCenter: parent.horizontalCenter
Button {
text: qsTr("Enter")
height: inputItemHeight
onClicked: {
pinCodeInput.verifyPin()
}
font.pointSize: defaultTextFont.font.pointSize
height: inputItemHeight
onClicked: {
pinCodeInput.verifyPin()
}
}
Rectangle {
Item {
id: blankField
width: formItemVerticalSpacing
Layout.fillWidth: true
height: headerHeight
color: "transparent"
anchors.horizontalCenter: parent.horizontalCenter
}
Image{
......@@ -269,7 +264,7 @@ ApplicationWindow {
color: datovkaPalette.text
text: qsTr("Version") + ": " + settings.appVersion()
}
}
} // ColumnLayout
Connections {
target: settings
onSendPinReply: {
......@@ -282,9 +277,9 @@ ApplicationWindow {
wrongPin.visible = !success
pinCodeInput.text = ""
}
}
}
}
} // Connections
} // Rectangle
} // Component
Connections {
target: locker
......
......@@ -22,103 +22,113 @@
*/
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.1
import cz.nic.mobileDatovka 1.0
Component {
id: aboutApp
Item {
id: aboutLayout
/* These properties must be set by caller. */
property var pageView
property var statusBar
PageHeader {
id: headerBar
title: qsTr("About Datovka")
Item {
anchors.left: parent.left
width: parent.width * 0.5
height: parent.height
MouseArea {
anchors.fill: parent
onClicked: {
pageView.pop(StackView.Immediate)
}
Item {
id: pageAboutApp
/* These properties must be set by caller. */
property var pageView
property var statusBar
PageHeader {
id: headerBar
title: qsTr("About Datovka")
Item {
anchors.left: parent.left
width: parent.width * 0.5
height: parent.height
MouseArea {
anchors.fill: parent
onClicked: {
pageView.pop(StackView.Immediate)
}
}
}
ScrollContent {
anchors.top: headerBar.bottom
delegateComponent: Component {
id: aboutComponent
Column {
spacing: formItemVerticalSpacing * 2
width: parent.width
Text {
id: pageLabel
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width
font.bold: true
color: datovkaPalette.text
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
text: qsTr("Datovka - free mobile Data-Box client")
}
Image{
id: datovkaLogo
anchors.horizontalCenter: parent.horizontalCenter
width: imgHeight * 1.4
height: imgHeight * 1.4
source: "qrc:/datovka.png"
}
Text {
id: versionLabel
anchors.horizontalCenter: parent.horizontalCenter
font.bold: true
color: datovkaPalette.text
text: qsTr("Version") + ": " + settings.appVersion()
}
Text {
id: infoLabel
anchors.horizontalCenter: parent.horizontalCenter
color: datovkaPalette.text
width: parent.width
textFormat: TextEdit.RichText
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
text: qsTr("The application provides access to ISDS. This system replaces traditional registered letters in Czech Republic. Communication between the Data boxes and applications Datovka is only one way. The application allows receipt of messages and their attachments. Creating and sending messages is not supported. See project page for more info.")
}
Text {
id: datovkaLink
anchors.horizontalCenter: parent.horizontalCenter
textFormat: TextEdit.RichText
color: datovkaPalette.text
onLinkActivated: Qt.openUrlExternally("http://www.datovka.cz/")
text: "<a href=\"http://www.datovka.cz\">www.datovka.cz</a>"
}
Text {
id: cznicLabel
anchors.horizontalCenter: parent.horizontalCenter
font.bold: true
color: datovkaPalette.text
text: qsTr("Powered by")
}
Image{
id: cznicLogo
anchors.horizontalCenter: parent.horizontalCenter
sourceSize.height: imgHeight
source: "qrc:/cznic.png"
} // PageHeader
Flickable {
id: flickable
z: 0
anchors.top: headerBar.bottom
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: parent.bottom
contentHeight: flickContent.implicitHeight
Pane {
id: flickContent
anchors.fill: parent
ColumnLayout {
anchors.right: parent.right
anchors.left: parent.left
Text {
id: pageLabel
anchors.horizontalCenter: parent.horizontalCenter
Layout.fillWidth: true
font.bold: true
color: datovkaPalette.text
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
text: qsTr("Datovka - free mobile Data-Box client")
}
Image{
id: datovkaLogo
anchors.horizontalCenter: parent.horizontalCenter
width: imgHeight * 1.4
height: imgHeight * 1.4
source: "qrc:/datovka.png"
MouseArea {
anchors.fill: parent
onClicked: {
Qt.openUrlExternally("http://labs.nic.cz/cs/mdatovka.html")
}
}
Text {
id: cznicLink
anchors.horizontalCenter: parent.horizontalCenter
textFormat: TextEdit.RichText
color: datovkaPalette.text
onLinkActivated: Qt.openUrlExternally("http://www.nic.cz/")
text: "<a href=\"http://www.nic.cz\">www.nic.cz</a>"
}
Text {
id: versionLabel
anchors.horizontalCenter: parent.horizontalCenter
font.bold: true
color: datovkaPalette.text
text: qsTr("Version") + ": " + settings.appVersion()
}
Text {
id: infoLabel
anchors.horizontalCenter: parent.horizontalCenter
color: datovkaPalette.text
Layout.fillWidth: true
textFormat: TextEdit.RichText
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
text: qsTr("The application provides access to ISDS. This system replaces traditional registered letters in Czech Republic. Communication between the Data boxes and applications Datovka is only one way. The application allows receipt of messages and their attachments. Creating and sending messages is not supported. See project page for more info.")
}
Text {
id: datovkaLink
anchors.horizontalCenter: parent.horizontalCenter
textFormat: TextEdit.RichText
color: datovkaPalette.text
onLinkActivated: Qt.openUrlExternally("http://www.datovka.cz/")
text: "<a href=\"http://www.datovka.cz\">www.datovka.cz</a>"
}
Text {
id: cznicLabel
anchors.horizontalCenter: parent.horizontalCenter
font.bold: true
color: datovkaPalette.text
text: qsTr("Powered by")
}
Image{
id: cznicLogo
anchors.horizontalCenter: parent.horizontalCenter
sourceSize.height: imgHeight
source: "qrc:/cznic.png"
MouseArea {
anchors.fill: parent
onClicked: {
Qt.openUrlExternally("http://www.nic.cz/")
}
}
}
}
}
}
}
} // Column layout
} // Pane
ScrollIndicator.vertical: ScrollIndicator {}
} // Flickable
} // Item
......@@ -29,13 +29,11 @@ Component {
id: pageAccountDetail
Item {
id: acntDetailPage
/* These properties must be set by caller. */
property var pageView
property var statusBar
property string acntName
property string userName
Component.onCompleted: {
accounts.fillAccountInfo(userName)
}
......
......@@ -41,8 +41,6 @@ Component {
property string userName
property var accountModel: null
property int myWidht: mainLayout.width - 2 * defaultMargin
PageHeader {
id: headerBar
title: acntName + " (" + userName + ")" + "\n" + qsTr("Account properties")
......
......@@ -37,9 +37,7 @@ Component {
/* These properties must be set by caller. */
property var pageView
property var statusBar
property var accountModel: null
property int myWidht: mainLayout.width - 2 * defaultMargin
property var accountModel: null
PageHeader {
id: headerBar
......@@ -56,15 +54,13 @@ Component {
}
}
}
Rectangle {
Item {
anchors.top: headerBar.bottom
anchors.bottom: parent.bottom
width: parent.width
color: "transparent"
ListModel {
id: settingsListModel
ListElement {
// id: addAccountItem
index: 1
name: qsTr("Add account")
image: "qrc:/ui/account-plus.svg"
......@@ -75,25 +71,21 @@ Component {
image: "qrc:/ui/magnify.svg"
}
ListElement {
// id:generalItem
index: 2
name: qsTr("General")
image: "qrc:/ui/settings.svg"
}
ListElement {
// id: syncItem
index: 3
name: qsTr("Synchronization")
image: "qrc:/ui/sync-all.svg"
}
ListElement {
// id: storageItem
index: 4
name: qsTr("Storage")
image: "qrc:/ui/database.svg"
}
ListElement {
// id: securityItem
index: 5
name: qsTr("Security and PIN")
image: "qrc:/ui/key-variant.svg"
......
......@@ -47,11 +47,9 @@ Component {
property var accountModel: null
property var messageModel: null
property int myWidht: mainLayout.width - 2 * defaultMargin
Component.onCompleted: {
messageMenuListModel.setProperty(3, "showIt", canDeleteMsg)
}
PageHeader {
id: headerBar
title: {
......
......@@ -35,7 +35,6 @@ Component {
id: menuMessageDetail
Item {
id: mainLayout
/* These properties must be set by caller. */
property var pageView
property var statusBar
......@@ -45,9 +44,6 @@ Component {
property string msgId
property var messageModel: null
property var attachmentModel: null /* The QVariant holds actually a pointer to the model. */
property int myWidht: mainLayout.width - 2 * defaultMargin
PageHeader {
id: headerBar
title: {
......
......@@ -34,7 +34,6 @@ Component {
id: menuMessageList
Item {
id: mainLayout
/* These properties must be set by caller. */
property var pageView
property var statusBar
......@@ -43,8 +42,6 @@ Component {
property int msgType
property var messageModel: null
property int myWidht: mainLayout.width - 2 * defaultMargin
PageHeader {
id: headerBar
title: {
......
......@@ -22,7 +22,7 @@
*/
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Controls 2.1
import QtQuick.Window 2.1
import QtQuick.Dialogs 1.2
import cz.nic.mobileDatovka 1.0
......@@ -96,46 +96,46 @@ Component {
}
}
}
Row {
OverlaidImage {
id: settingsButton
anchors.verticalCenter: parent.verticalCenter
spacing: defaultMargin
anchors.right: parent.right
anchors.rightMargin: defaultMargin
TextField {
id: filterPhraseText
placeholderText: qsTr("Set filter")
width: headerBar.width * 0.3
height: inputItemHeight
inputMethodHints: Qt.ImhNoPredictiveText
background: Rectangle {
color: (filterPhraseText.text.length == 0) ? datovkaPalette.alternateBase :
(messageList.count > 0) ? "#afffaf" : "#ffafaf"
border.color: filterPhraseText.activeFocus ? "#0066ff" :
"#bdbebf"
}
onTextChanged: {
proxyMessageModel.setFilterRegExpStr(filterPhraseText.text)
image.sourceSize.height: imgHeight
image.source: "qrc:/ui/settings.svg"
MouseArea {
anchors.fill: parent
onClicked: {
statusBar.visible = false
pageView.push(pageMenuMessageList, {
"pageView": pageView,
"statusBar": statusBar,
"acntName": acntName,
"userName": userName,
"msgType": msgType,
"messageModel": messageModel
}, StackView.Immediate)
}
}
OverlaidImage {
id: settingsButton
anchors.verticalCenter: parent.verticalCenter
image.sourceSize.height: imgHeight
image.source: "qrc:/ui/settings.svg"
MouseArea {
anchors.fill: parent
onClicked: {
statusBar.visible = false
pageView.push(pageMenuMessageList, {
"pageView": pageView,
"statusBar": statusBar,
"acntName": acntName,
"userName": userName,
"msgType": msgType,
"messageModel": messageModel
}, StackView.Immediate)
}
}
}
TextField {
id: filterPhraseText
placeholderText: qsTr("Set filter")
width: headerBar.width * 0.3
anchors.right: settingsButton.left
anchors.rightMargin: defaultMargin
anchors.verticalCenter: parent.verticalCenter
font.pointSize: defaultTextFont.font.pointSize
inputMethodHints: Qt.ImhNoPredictiveText
/* TODO - remove background if used materials */
background: Rectangle {
color: (filterPhraseText.text.length == 0) ? datovkaPalette.alternateBase :
(messageList.count > 0) ? "#afffaf" : "#ffafaf"
border.color: filterPhraseText.activeFocus ? "#0066ff" :
"#bdbebf"
}
onTextChanged: {
proxyMessageModel.setFilterRegExpStr(filterPhraseText.text)
}
}
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -22,120 +22,109 @@
*/
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.1
import cz.nic.mobileDatovka 1.0
Component {
id: settingsSync
Item {
id: mainLayout
Item {
id: pageSettingsSync
/* These properties must be set by caller. */
property var pageView
property var statusBar
property var accountModel: null
/* These properties must be set by caller. */
property var pageView
property var statusBar
property var accountModel: null
property string sectionName: "sync"
Component.onCompleted: {
settings.loadSettings(sectionName)
property string sectionName: "sync"
Component.onCompleted: {
settings.loadSettings(sectionName)
}
PageHeader {
id: headerBar
title: qsTr("Synchronization settings")
Item {
anchors.left: parent.left
width: parent.width * 0.5
height: parent.height
MouseArea {
anchors.fill: parent
onClicked: {
pageView.pop(StackView.Immediate)
}
}
}
PageHeader {
id: headerBar
title: qsTr("Synchronization settings")
Item {
anchors.left: parent.left
width: parent.width * 0.5
height: parent.height
Row {
anchors.verticalCenter: parent.verticalCenter
spacing: defaultMargin
anchors.right: parent.right
anchors.rightMargin: defaultMargin
Image {
id: actionButton
anchors.verticalCenter: parent.verticalCenter
sourceSize.height: imgHeight
source: "qrc:/ui/checkbox-marked-circle.svg"
MouseArea {
anchors.fill: parent
onClicked: {
settings.updateSettingsSync(idownloadOnlyNewMsgs.checked,
idownloadCompleteMsgs.checked)
settings.saveAllSettings(accountModel)
pageView.pop(StackView.Immediate)
}
}
}
Row {
anchors.verticalCenter: parent.verticalCenter
spacing: defaultMargin
}
} // PageHeader
Flickable {
id: flickable
z: 0
anchors.top: headerBar.bottom
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: parent.bottom
contentHeight: flickContent.implicitHeight
Pane {
id: flickContent
anchors.fill: parent
ColumnLayout {
anchors.right: parent.right
anchors.rightMargin: defaultMargin
Image {
id: actionButton
anchors.verticalCenter: parent.verticalCenter
sourceSize.height: imgHeight
source: "qrc:/ui/checkbox-marked-circle.svg"
MouseArea {
anchors.fill: parent
onClicked: {
/* TODO - Must be replaced via better solution in the future. */
settings.saveSettingsRequest(sectionName)
}
}