Commit f5deff21 authored by Karel Slaný's avatar Karel Slaný

Using QtQuick.Controls 2.0.

parent 45154b94
QT += qml quick network xml sql widgets svg
QT += qml quick quickcontrols2 network xml sql widgets svg
TEMPLATE = app
APP_NAME = Datovka
......
......@@ -23,7 +23,7 @@
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Controls 2.0
import QtQuick.Window 2.1
import QtQuick.Layouts 1.2
import QtQuick.Dialogs 1.2
......
......@@ -23,7 +23,7 @@
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Controls 2.0
Component {
id: aboutDialog
......@@ -108,7 +108,7 @@ Component {
Button {
text: qsTr("Close")
onClicked: {
pageView.pop({immediate: true})
pageView.pop(StackView.Immediate)
}
}
}
......
......@@ -23,7 +23,7 @@
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Controls 2.0
Component {
id: accountdetailpage
......@@ -47,7 +47,7 @@ Component {
anchors.fill: parent
onClicked: {
files.clearFileModel()
pageView.pop({immediate: true})
pageView.pop(StackView.Immediate)
}
}
Column {
......
......@@ -23,7 +23,7 @@
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Controls 2.0
import QtQuick.Dialogs 1.2
Component {
......@@ -230,13 +230,13 @@ Component {
testAccount.checked, rememberPassword.checked,
useLS.checked, certPathLabelId.text.toString())
}
pageView.pop({immediate: true})
pageView.pop(StackView.Immediate)
}
}
Button {
text: qsTr("Cancel")
onClicked: {
pageView.pop({immediate: true})
pageView.pop(StackView.Immediate)
}
}
}
......
......@@ -22,7 +22,7 @@
*/
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Controls 2.0
import QtQuick.Window 2.1
import QtQuick.Layouts 1.2
import QtQuick.Dialogs 1.2
......@@ -56,7 +56,7 @@ Component {
anchors.fill: parent
onClicked: {
gUserName = ""
pageView.push({item: aboutPage, immediate: true})
pageView.push(aboutPage, StackView.Immediate)
}
}
}
......@@ -74,24 +74,24 @@ Component {
id: mainContextMenu
MenuItem {
text: qsTr("Add account")
iconSource: "qrc:/ui/account-plus.svg"
//iconSource: "qrc:/ui/account-plus.svg"
onTriggered: {
gUserName = ""
pageView.push({item: accountSettingsPage, immediate: true})
pageView.push(accountSettingsPage, StackView.Immediate)
}
}
MenuItem {
text: qsTr("Settings")
iconSource: "qrc:/ui/settings.svg"
//iconSource: "qrc:/ui/settings.svg"
onTriggered: {
gUserName = ""
pageView.push({item: settingsPage, immediate: true})
pageView.push(settingsPage, StackView.Immediate)
}
}
MenuItem {
id: syncAllMenu
text: qsTr("Synchronize all")
iconSource: "qrc:/ui/sync-all.svg"
//iconSource: "qrc:/ui/sync-all.svg"
onTriggered: {
statusBarText.text = ""
isds.syncAllAccounts()
......@@ -101,7 +101,10 @@ Component {
MouseArea {
anchors.fill: parent
onClicked: {
mainContextMenu.popup()
// Located in right top corner.
mainContextMenu.x = mouse.x - mainContextMenu.width
mainContextMenu.y = mouse.y
mainContextMenu.open()
}
}
}
......@@ -173,26 +176,26 @@ Component {
id: accountContextMenu
MenuItem {
text: qsTr("Account settings")
iconSource: "qrc:/ui/account-key.svg"
//iconSource: "qrc:/ui/account-key.svg"
onTriggered: {
gAcntName = rAcntName
gUserName = rUserName
pageView.push({item: accountSettingsPage, immediate: true, "userName": rUserName})
pageView.push(accountSettingsPage, {"userName": rUserName}, StackView.Immediate)
}
}
MenuItem {
text: qsTr("View account info")
iconSource: "qrc:/ui/account-search.svg"
//iconSource: "qrc:/ui/account-search.svg"
onTriggered: {
gAcntName = rAcntName
gUserName = rUserName
pageView.push({item: accountDetailPage, immediate: true})
pageView.push(accountDetailPage, StackView.Immediate)
accounts.fillAccountInfo(rUserName)
}
}
MenuItem {
text: qsTr("Download account info")
iconSource: "qrc:/ui/account-box.svg"
//iconSource: "qrc:/ui/account-box.svg"
onTriggered: {
gAcntName = rAcntName
gUserName = rUserName
......@@ -201,7 +204,7 @@ Component {
}
MenuItem {
text: qsTr("Change password")
iconSource: "qrc:/ui/account-key.svg"
//iconSource: "qrc:/ui/account-key.svg"
onTriggered: {
gAcntName = rAcntName
gUserName = rUserName
......@@ -210,7 +213,7 @@ Component {
}
MenuItem {
text: qsTr("Clean up the file database")
iconSource: "qrc:/ui/database.svg"
//iconSource: "qrc:/ui/database.svg"
onTriggered: {
gAcntName = rAcntName
gUserName = rUserName
......@@ -219,7 +222,7 @@ Component {
}
MenuItem {
text: qsTr("Delete account")
iconSource: "qrc:/ui/account-remove.svg"
//iconSource: "qrc:/ui/account-remove.svg"
onTriggered: {
gAcntName = rAcntName
gUserName = rUserName
......@@ -256,7 +259,10 @@ Component {
anchors.fill: parent
onClicked: {
statusBar.visible = false
accountContextMenu.popup()
// Located in left top corner.
accountContextMenu.x = mouse.x
accountContextMenu.y = mouse.y
accountContextMenu.open()
}
}
}
......@@ -342,7 +348,7 @@ Component {
gMsgType = receivedMESSAGE
statusBar.visible = false
messages.fillMessageList(rUserName, receivedMESSAGE)
pageView.push({item: messagesPage, immediate: true})
pageView.push(messagesPage, StackView.Immediate)
}
}
Rectangle {
......@@ -408,8 +414,7 @@ Component {
gMsgType = sentMESSAGE
statusBar.visible = false
messages.fillMessageList(rUserName, sentMESSAGE)
pageView.push({item: messagesPage, immediate: true})
pageView.push(messagesPage, StackView.Immediate)
}
}
Rectangle {
......
......@@ -23,7 +23,7 @@
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Controls 2.0
import QtQuick.Window 2.1
import QtQuick.Layouts 1.2
import QtQuick.Dialogs 1.2
......@@ -64,7 +64,7 @@ Component {
onClicked: {
files.clearFileModel()
statusBar.visible = false
pageView.pop({immediate: true})
pageView.pop(StackView.Immediate)
}
}
}
......
......@@ -23,7 +23,7 @@
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Controls 2.0
import QtQuick.Window 2.1
import QtQuick.Layouts 1.2
import QtQuick.Dialogs 1.2
......@@ -65,7 +65,7 @@ Component {
messages.clearMessagesModel()
accounts.updateNewMessageCounter(gUserName)
statusBar.visible = false
pageView.pop({immediate: true})
pageView.pop(StackView.Immediate)
}
}
}
......@@ -105,7 +105,7 @@ Component {
MenuItem {
id: markAllAsRead
text: qsTr("Mark all as read")
iconSource: "qrc:/ui/email-open-outline.svg"
//iconSource: "qrc:/ui/email-open-outline.svg"
onTriggered: {
messages.markMessagesAsLocallyRead(gUserName, true)
}
......@@ -113,7 +113,7 @@ Component {
MenuItem {
id: markAllAsUnRead
text: qsTr("Mark all as unread")
iconSource: "qrc:/ui/email-outline.svg"
//iconSource: "qrc:/ui/email-outline.svg"
onTriggered: {
messages.markMessagesAsLocallyRead(gUserName, false)
}
......@@ -123,7 +123,10 @@ Component {
anchors.fill: parent
onClicked: {
statusBar.visible = false
mainContextMenu2.popup()
// Located in right top corner.
mainContextMenu2.x = mouse.x - mainContextMenu2.width
mainContextMenu2.y = mouse.y
mainContextMenu2.open()
}
}
}
......@@ -279,7 +282,7 @@ Component {
onClicked: {
gMsgId = rMsgId
statusBar.visible = false
pageView.push({item: messageDetailPage, immediate: true})
pageView.push(messageDetailPage, StackView.Immediate)
messages.markMessageAsLocallyRead(gUserName, rMsgId)
messages.fillMessageDetail(gUserName, rMsgId)
files.fillFileList(gUserName, rMsgId)
......
......@@ -23,7 +23,7 @@
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Controls 2.0
Component {
id: settingsDialog
......@@ -91,11 +91,29 @@ Component {
}
Slider {
id: ifontSizeSlider
property int min: 10
property int max: 20
property int span: max - min
property int step: 1
property int dflt: 16
width: myWidht
minimumValue: 10
stepSize: 1
value: 16
maximumValue: 20
stepSize: 1.0 * step / span
value: (1.0 * dflt - min) / span
snapMode: Slider.SnapAlways
function val() {
return Math.round(value * span + min)
}
function setVal(v) {
if (v - min > 0) {
value = (1.0 * v - min) / span
} else {
value = 0.0
}
}
}
Text {
color: datovkaPalette.mid
......@@ -175,19 +193,37 @@ Component {
}
Slider {
id: ifileLifeDays
property int min: 0
property int max: 90
property int span: max - min
property int step: 5
property int dflt: 10
width: myWidht
minimumValue: 0
stepSize: 5
value: 10
maximumValue: 90
stepSize: 1.0 * step / span
value: (1.0 * dflt - min) / span
snapMode: Slider.SnapAlways
function val() {
return Math.round(value * span + min)
}
function setVal(v) {
if (v - min > 0) {
value = (1.0 * v - min) / span
} else {
value = 0.0
}
}
}
Text {
color: datovkaPalette.mid
width: myWidht
text: if (ifileLifeDays.value == 0) {
text: if (ifileLifeDays.value == 0.0) {
qsTr("Files will be stored in a local database forever.")
} else {
qsTr("Files will be stored in a local database for %1 day(s). Default is 10 days.").arg(ifileLifeDays.value)
qsTr("Files will be stored in a local database for %1 day(s). Default is 10 days.").arg(ifileLifeDays.val())
}
wrapMode: Text.Wrap
}
......@@ -229,11 +265,11 @@ Component {
idownloadOnlyNewMsgs.checked = downloadOnlyNewMsgs
idownloadCompleteMsgs.checked = downloadCompleteMsgs
imessageLifeDays.value = msgLifeDays
ifileLifeDays.value = fileLifeDays
ifileLifeDays.setVal(fileLifeDays)
iusePinCode.checked = usePinCode
ipinCodeString.text = pinCodeString
languageComboBoxId.currentIndex = langIndex
ifontSizeSlider.value = fontSize
ifontSizeSlider.setVal(fontSize)
ipinCodeString.visible = usePinCode
}
}
......@@ -247,20 +283,20 @@ Component {
iusePinCode.checked = false
}
settings.updateSettings(sLang,
ifontSizeSlider.value.toString(),
ifontSizeSlider.val().toString(),
idownloadOnlyNewMsgs.checked,
idownloadCompleteMsgs.checked,
imessageLifeDays.value.toString(),
ifileLifeDays.value.toString(),
ifileLifeDays.val().toString(),
iusePinCode.checked,
ipinCodeString.text.toString())
pageView.pop({immediate: true})
pageView.pop(StackView.Immediate)
}
}
Button {
text: qsTr("Cancel")
onClicked: {
pageView.pop({immediate: true})
pageView.pop(StackView.Immediate)
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment