Browse Source

qml cleanup (remove unneccesary 1.1 versions)

pull/2/head
Skycoder42 6 years ago
parent
commit
55dda691f5
No known key found for this signature in database GPG Key ID: 8E01AD9EF0578D2B
  1. 1
      examples/mvvmdatasyncquick/DataSyncSampleQuick/main.qml
  2. 33
      src/imports/mvvmdatasyncquick/ChangeRemoteView.qml
  3. 211
      src/imports/mvvmdatasyncquick/ChangeRemoteView11.qml
  4. 81
      src/imports/mvvmdatasyncquick/DataSyncView.qml
  5. 292
      src/imports/mvvmdatasyncquick/DataSyncView11.qml
  6. 11
      src/imports/mvvmdatasyncquick/ExportSetupView.qml
  7. 74
      src/imports/mvvmdatasyncquick/ExportSetupView11.qml
  8. 16
      src/imports/mvvmdatasyncquick/IdentityEditView.qml
  9. 62
      src/imports/mvvmdatasyncquick/IdentityEditView11.qml
  10. 33
      src/imports/mvvmdatasyncquick/NetworkExchangeView.qml
  11. 152
      src/imports/mvvmdatasyncquick/NetworkExchangeView11.qml
  12. 74
      src/imports/mvvmdatasyncquick/SubButton.qml
  13. 8
      src/imports/mvvmdatasyncquick/mvvmdatasyncquick.pro
  14. 7
      src/imports/mvvmdatasyncquick/qmldir
  15. 9
      src/imports/mvvmquick/ActionButton.qml
  16. 4
      src/imports/mvvmquick/AndroidFileDialog.qml
  17. 4
      src/imports/mvvmquick/AndroidFolderDialog.qml
  18. 27
      src/imports/mvvmquick/ContrastToolBar.qml
  19. 26
      src/imports/mvvmquick/ContrastToolBar11.qml
  20. 12
      src/imports/mvvmquick/DateEdit.qml
  21. 4
      src/imports/mvvmquick/FileDialog.qml
  22. 4
      src/imports/mvvmquick/FolderDialog.qml
  23. 2
      src/imports/mvvmquick/InputDialog.qml
  24. 2
      src/imports/mvvmquick/MenuButton.qml
  25. 2
      src/imports/mvvmquick/PresenterProgress.qml
  26. 2
      src/imports/mvvmquick/RoundActionButton.qml
  27. 2
      src/imports/mvvmquick/SectionListView.qml
  28. 139
      src/imports/mvvmquick/SettingsView.qml
  29. 159
      src/imports/mvvmquick/SettingsView11.qml
  30. 6
      src/imports/mvvmquick/TintIcon.qml
  31. 2
      src/imports/mvvmquick/mvvmquick.pro
  32. 2
      src/imports/mvvmquick/qmldir
  33. 40
      tests/auto/mvvmcore/settingsgenerator/test_de.ts
  34. 2
      tests/auto/testrun.pri

1
examples/mvvmdatasyncquick/DataSyncSampleQuick/main.qml

@ -5,6 +5,7 @@ import de.skycoder42.QtMvvm.Quick 1.1
QtMvvmApp { QtMvvmApp {
Material.accent: Material.DeepPurple Material.accent: Material.DeepPurple
Material.primary: Material.Lime Material.primary: Material.Lime
Material.theme: Material.Dark
title: qsTr("QtMvvm Quick Sample") title: qsTr("QtMvvm Quick Sample")
} }

33
src/imports/mvvmdatasyncquick/ChangeRemoteView.qml

@ -2,9 +2,9 @@ import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import de.skycoder42.QtDataSync 4.0 import de.skycoder42.QtDataSync 4.0
import de.skycoder42.QtMvvm.Core 1.0 import de.skycoder42.QtMvvm.Core 1.1
import de.skycoder42.QtMvvm.Quick 1.0 import de.skycoder42.QtMvvm.Quick 1.1
import de.skycoder42.QtMvvm.DataSync.Core 1.0 import de.skycoder42.QtMvvm.DataSync.Core 1.1
import de.skycoder42.QtMvvm.Quick.Private 1.0 import de.skycoder42.QtMvvm.Quick.Private 1.0
Page { Page {
@ -33,13 +33,10 @@ Page {
text: qsTr("Change Remote") text: qsTr("Change Remote")
} }
ToolButton { ActionButton {
id: _syncButton id: _syncButton
implicitHeight: 48
text: qsTr("Change") text: qsTr("Change")
enabled: viewModel.valid enabled: viewModel.valid
icon.width: 24
icon.height: 24
icon.name: "gtk-apply" icon.name: "gtk-apply"
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_check.svg" icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_check.svg"
display: AbstractButton.TextBesideIcon display: AbstractButton.TextBesideIcon
@ -59,17 +56,17 @@ Page {
id: _layout id: _layout
anchors.fill: parent anchors.fill: parent
Label { DecorLabel {
text: qsTr("Remote url:") text: qsTr("Remote url:")
Layout.fillWidth: true Layout.fillWidth: true
color: _urlEdit.focus ? _urlEdit.selectionColor : palette.text edit: _urlEdit
opacity: _urlEdit.focus ? 1 : 0.5
} }
TextField { TextField {
id: _urlEdit id: _urlEdit
Layout.fillWidth: true Layout.fillWidth: true
placeholderText: "wss://example.org/qdsapp/"
validator: UrlValidator { validator: UrlValidator {
allowedSchemes: ["ws", "wss"] allowedSchemes: ["ws", "wss"]
} }
@ -83,17 +80,17 @@ Page {
} }
} }
Label { DecorLabel {
text: qsTr("Access key:") text: qsTr("Access key:")
Layout.fillWidth: true Layout.fillWidth: true
color: _accessKeyEdit.focus ? _accessKeyEdit.selectionColor : palette.text edit: _accessKeyEdit
opacity: _accessKeyEdit.focus ? 1 : 0.5
} }
TextField { TextField {
id: _accessKeyEdit id: _accessKeyEdit
Layout.fillWidth: true Layout.fillWidth: true
echoMode: TextInput.Password echoMode: TextInput.Password
placeholderText: "Optional access secret"
MvvmBinding { MvvmBinding {
viewModel: _changeRemoteView.viewModel viewModel: _changeRemoteView.viewModel
@ -104,11 +101,10 @@ Page {
} }
} }
Label { DecorLabel {
text: qsTr("Keep-Alive timout:") text: qsTr("Keep-Alive timout:")
Layout.fillWidth: true Layout.fillWidth: true
color: _keepAliveEdit.focus ? _accessKeyEdit.selectionColor : palette.text edit: _keepAliveEdit
opacity: _keepAliveEdit.focus ? 1 : 0.5
} }
SpinBox { SpinBox {
@ -138,11 +134,10 @@ Page {
} }
} }
Label { DecorLabel {
text: qsTr("Extra Headers:") text: qsTr("Extra Headers:")
Layout.fillWidth: true Layout.fillWidth: true
color: _headerScrollView.focus ? _accessKeyEdit.selectionColor : palette.text edit: _headerScrollView
opacity: _headerScrollView.focus ? 1 : 0.5
} }
ScrollView { ScrollView {

211
src/imports/mvvmdatasyncquick/ChangeRemoteView11.qml

@ -1,211 +0,0 @@
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import de.skycoder42.QtDataSync 4.0
import de.skycoder42.QtMvvm.Core 1.1
import de.skycoder42.QtMvvm.Quick 1.1
import de.skycoder42.QtMvvm.DataSync.Core 1.1
import de.skycoder42.QtMvvm.Quick.Private 1.0
Page {
id: _changeRemoteView
property PChangeRemoteViewModel viewModel: null
header: ContrastToolBar {
id: _toolBar
RowLayout {
id: _toolLayout
anchors.fill: parent
spacing: 0
ActionButton {
id: _cancelButton
icon.name: "gtk-cancel"
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_close.svg"
text: qsTr("Cancel")
onClicked: QuickPresenter.popView()
}
ToolBarLabel {
id: _titleLabel
Layout.fillWidth: true
text: qsTr("Change Remote")
}
ToolButton {
id: _syncButton
implicitHeight: 48
text: qsTr("Change")
enabled: viewModel.valid
icon.width: 24
icon.height: 24
icon.name: "gtk-apply"
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_check.svg"
display: AbstractButton.TextBesideIcon
rightPadding: 16
onClicked: {
if(viewModel.completeSetup())
QuickPresenter.popView()
}
}
}
}
Pane {
anchors.fill: parent
ColumnLayout {
id: _layout
anchors.fill: parent
DecorLabel {
text: qsTr("Remote url:")
Layout.fillWidth: true
edit: _urlEdit
}
TextField {
id: _urlEdit
Layout.fillWidth: true
placeholderText: "wss://example.org/qdsapp/"
validator: UrlValidator {
allowedSchemes: ["ws", "wss"]
}
MvvmBinding {
viewModel: _changeRemoteView.viewModel
viewModelProperty: "url"
view: _urlEdit
viewProperty: "text"
type: MvvmBinding.OneWayToViewModel
}
}
DecorLabel {
text: qsTr("Access key:")
Layout.fillWidth: true
edit: _accessKeyEdit
}
TextField {
id: _accessKeyEdit
Layout.fillWidth: true
echoMode: TextInput.Password
placeholderText: "Optional access secret"
MvvmBinding {
viewModel: _changeRemoteView.viewModel
viewModelProperty: "accessKey"
view: _accessKeyEdit
viewProperty: "text"
type: MvvmBinding.OneWayToViewModel
}
}
DecorLabel {
text: qsTr("Keep-Alive timout:")
Layout.fillWidth: true
edit: _keepAliveEdit
}
SpinBox {
id: _keepAliveEdit
Layout.fillWidth: true
editable: true
from: 1
to: 1440
MvvmBinding {
viewModel: _changeRemoteView.viewModel
viewModelProperty: "accessKey"
view: _keepAliveEdit
viewProperty: "value"
}
}
CheckBox {
id: _keepDataBox
text: qsTr("Keep data")
MvvmBinding {
viewModel: _changeRemoteView.viewModel
viewModelProperty: "keepData"
view: _keepDataBox
viewProperty: "checked"
}
}
DecorLabel {
text: qsTr("Extra Headers:")
Layout.fillWidth: true
edit: _headerScrollView
}
ScrollView {
id: _headerScrollView
Layout.fillWidth: true
Layout.fillHeight: true
clip: true
ListView {
id: _headerList
model: viewModel.headerModel
delegate: ItemDelegate {
width: _headerScrollView.width
text: qsTr("%1: %2").arg(key).arg(value)
Button {
id: _rmButton
flat: true
icon.width: 24
icon.height: 24
icon.name: "user-trash"
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_delete_forever.svg"
anchors.right: parent.right
implicitHeight: parent.height
implicitWidth: implicitHeight
onClicked: viewModel.removeHeaderConfig(index)
}
}
footer: RowLayout {
width: _headerScrollView.width
TextField {
id: _keyEdit
placeholderText: qsTr("Key")
Layout.fillWidth: true
}
TextField {
id: _valueEdit
placeholderText: qsTr("Value")
Layout.fillWidth: true
}
Button {
id: _addButton
flat: true
enabled: _keyEdit.text !== ""
icon.width: 24
icon.height: 24
icon.name: "list-add"
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_add.svg"
onClicked: {
viewModel.addHeaderConfig(_keyEdit.text, _valueEdit.text);
_keyEdit.clear();
_valueEdit.clear();
}
}
}
}
}
}
}
}

81
src/imports/mvvmdatasyncquick/DataSyncView.qml

@ -4,9 +4,9 @@ import QtQuick.Controls.Material 2.3
import QtQuick.Controls.Universal 2.3 import QtQuick.Controls.Universal 2.3
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import de.skycoder42.QtDataSync 4.0 import de.skycoder42.QtDataSync 4.0
import de.skycoder42.QtMvvm.Core 1.0 import de.skycoder42.QtMvvm.Core 1.1
import de.skycoder42.QtMvvm.Quick 1.0 import de.skycoder42.QtMvvm.Quick 1.1
import de.skycoder42.QtMvvm.DataSync.Core 1.0 import de.skycoder42.QtMvvm.DataSync.Core 1.1
/*! @brief The view implementation for the QtMvvm::DataSyncViewModel /*! @brief The view implementation for the QtMvvm::DataSyncViewModel
* *
@ -95,6 +95,11 @@ Page {
Pane { Pane {
anchors.fill: parent anchors.fill: parent
ColorHelper {
id: helper
}
ColumnLayout { ColumnLayout {
id: _layout id: _layout
anchors.fill: parent anchors.fill: parent
@ -146,14 +151,7 @@ Page {
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumHeight: 1 Layout.minimumHeight: 1
Layout.maximumHeight: 1 Layout.maximumHeight: 1
color: { color: helper.text
if(QuickPresenter.currentStyle === "Material")
return Material.foreground;
else if(QuickPresenter.currentStyle === "Universal")
return Universal.foreground;
else
return "black";
}
} }
Label { Label {
@ -253,65 +251,42 @@ Page {
} }
} }
RoundActionButton { RoundMenuButton {
id: _addButton id: _addButton
z: 7
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.margins: 16 anchors.margins: 16
checkable: true
text: qsTr("Add new devices") text: qsTr("Add new devices")
icon.name: checked ? "tab-close" : "list-add" icon.name: checked ? "tab-close" : "list-add"
icon.source: checked ? icon.source: checked ?
"qrc:/de/skycoder42/qtmvvm/quick/icons/ic_close.svg" : "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_close.svg" :
"qrc:/de/skycoder42/qtmvvm/quick/icons/ic_add.svg" "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_add.svg"
} stickyToolTips: true
SubButton {
id: _exchangeButton
z: 3
reference: _addButton
expanded: _addButton.checked
text: qsTr("Network Exchange") Action {
icon.name: "network-connect" text: qsTr("Network Exchange")
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_exchange.svg" icon.name: "network-connect"
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_exchange.svg"
onClicked: { onTriggered: viewModel.startNetworkExchange()
viewModel.startNetworkExchange();
_addButton.checked = false;
} }
}
SubButton { Action {
id: _exportButton text: qsTr("Export to file")
z: 3 icon.name: "document-export"
reference: _exchangeButton icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_export.svg"
expanded: _addButton.checked
text: qsTr("Export to file") onTriggered: viewModel.startExport()
icon.name: "document-export"
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_export.svg"
onClicked: {
viewModel.startExport();
_addButton.checked = false;
} }
}
SubButton {
id: _importButton
z: 3
reference: _exportButton
expanded: _addButton.checked
text: qsTr("Import from file") Action {
icon.name: "document-import" text: qsTr("Import from file")
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_import.svg" icon.name: "document-import"
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_import.svg"
onClicked: { onTriggered: viewModel.startImport()
viewModel.startImport();
_addButton.checked = false;
} }
} }
} }

292
src/imports/mvvmdatasyncquick/DataSyncView11.qml

@ -1,292 +0,0 @@
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.3
import QtQuick.Controls.Universal 2.3
import QtQuick.Layouts 1.3
import de.skycoder42.QtDataSync 4.0
import de.skycoder42.QtMvvm.Core 1.1
import de.skycoder42.QtMvvm.Quick 1.1
import de.skycoder42.QtMvvm.DataSync.Core 1.1
/*! @brief The view implementation for the QtMvvm::DataSyncViewModel
*
* @extends QtQuick.Controls.Page
*
* @details This is the view used to present a datasync view model. You can extend the class
* if you need to extend that view.
*
* @sa QtMvvm::DataSyncViewModel
*/
Page {
id: _dataSyncView
/*! @brief The viewmodel to use
*
* @default{<i>Injected</i>}
*
* @accessors{
* @memberAc{viewModel}
* @notifyAc{viewModelChanged()}
* }
*
* @sa QtMvvm::DataSyncViewModel
*/
property DataSyncViewModel viewModel: null
header: ContrastToolBar {
id: _toolBar
RowLayout {
id: _toolLayout
anchors.fill: parent
spacing: 0
ToolBarLabel {
id: _titleLabel
Layout.fillWidth: true
text: qsTr("Synchronization")
}
ActionButton {
id: _syncButton
icon.name: "view-refresh"
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_sync.svg"
text: qsTr("Synchronize")
onClicked: viewModel.syncOrConnect()
}
ActionButton {
id: _idButton
icon.name: "fingerprint-gui"
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_fingerprint.svg"
text: qsTr("Edit Identity")
onClicked: viewModel.showDeviceInfo()
}
MenuButton {
id: _moreButton
MenuItem {
text: qsTr("Update exchange key")
onClicked: viewModel.accountManager.updateExchangeKey()
}
MenuSeparator {}
MenuItem {
text: qsTr("Reload devices list")
onClicked: viewModel.accountManager.listDevices()
}
MenuSeparator {}
MenuItem {
text: qsTr("Change remote server")
onClicked: viewModel.changeRemote()
}
MenuItem {
text: qsTr("Reset Identity")
onClicked: viewModel.performReset()
}
}
}
}
Pane {
anchors.fill: parent
ColorHelper {
id: helper
}
ColumnLayout {
id: _layout
anchors.fill: parent
spacing: 16
Switch {
id: _syncSwitch
text: qsTr("Synchronization enabled")
Layout.fillWidth: true
MvvmBinding {
viewModel: _dataSyncView.viewModel.syncManager
viewModelProperty: "syncEnabled"
view: _syncSwitch
viewProperty: "checked"
}
}
Label {
id: _statusLabel
Layout.fillWidth: true
text: viewModel.statusString
font.bold: true
font.pointSize: 16
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
ProgressBar {
id: _syncProgress
Layout.fillWidth: true
from: 0
to: 1
value: viewModel.syncManager.syncProgress
visible: !_errorLabel.visible
}
Label {
id: _errorLabel
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: viewModel.syncManager.lastError
visible: text != ""
color: "#aa0000"
font.bold: true
}
Rectangle {
Layout.fillWidth: true
Layout.minimumHeight: 1
Layout.maximumHeight: 1
color: helper.text
}
Label {
Layout.fillWidth: true
text: qsTr("Other Devices:")
}
ScrollView {
id: _devicesScrollView
Layout.fillWidth: true
Layout.fillHeight: true
clip: true
ListView {
id: _devicesList
model: viewModel.sortedModel
delegate: SwipeDelegate {
id: _swipeDelegate
width: _devicesScrollView.width
contentItem: ColumnLayout {
id: _delegateLayout
spacing: 8
Label {
id: _nameLabel
Layout.fillWidth: true
text: name
}
Label {
id: _fpLabel
font.pointSize: _nameLabel.font.pointSize * 0.8
Layout.fillWidth: true
Layout.leftMargin: 8
text: fingerPrint
elide: Text.ElideMiddle
opacity: 0.75
}
}
ListView.onRemove: SequentialAnimation {
PropertyAction {
target: _swipeDelegate
property: "ListView.delayRemove"
value: true
}
NumberAnimation {
target: _swipeDelegate
property: "height"
to: 0
easing.type: Easing.InOutQuad
}
PropertyAction {
target: _swipeDelegate
property: "ListView.delayRemove"
value: false
}
}
swipe.right: Rectangle {
height: _devicesScrollView.height
width: height
anchors.right: parent.right
color: {
if(QuickPresenter.currentStyle === "Material")
return Material.color(Material.Red);
else if(QuickPresenter.currentStyle === "Universal")
return Universal.color(Universal.Red);
else
return "#FF0000";
}
ActionButton {
anchors.centerIn: parent
implicitHeight: parent.height
implicitWidth: parent.width
icon.name: "user-trash"
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_delete_forever.svg"
text: qsTr("Remove Device")
Material.foreground: "white"
Universal.foreground: "white"
onClicked: {
_swipeDelegate.swipe.close();
viewModel.removeDevice(index)
}
}
}
}
}
}
}
}
RoundMenuButton {
id: _addButton
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: 16
text: qsTr("Add new devices")
icon.name: checked ? "tab-close" : "list-add"
icon.source: checked ?
"qrc:/de/skycoder42/qtmvvm/quick/icons/ic_close.svg" :
"qrc:/de/skycoder42/qtmvvm/quick/icons/ic_add.svg"
stickyToolTips: true
Action {
text: qsTr("Network Exchange")
icon.name: "network-connect"
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_exchange.svg"
onTriggered: viewModel.startNetworkExchange()
}
Action {
text: qsTr("Export to file")
icon.name: "document-export"
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_export.svg"
onTriggered: viewModel.startExport()
}
Action {
text: qsTr("Import from file")
icon.name: "document-import"
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_import.svg"
onTriggered: viewModel.startImport()
}
}
}

11
src/imports/mvvmdatasyncquick/ExportSetupView.qml

@ -2,9 +2,9 @@ import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import de.skycoder42.QtMvvm.Core 1.0 import de.skycoder42.QtMvvm.Core 1.1
import de.skycoder42.QtMvvm.Quick 1.0 import de.skycoder42.QtMvvm.Quick 1.1
import de.skycoder42.QtMvvm.DataSync.Core 1.0 import de.skycoder42.QtMvvm.DataSync.Core 1.1
AlertDialog { AlertDialog {
id: _exportSetupView id: _exportSetupView
@ -43,11 +43,10 @@ AlertDialog {
} }
} }
Label { DecorLabel {
text: qsTr("Password:") text: qsTr("Password:")
Layout.fillWidth: true Layout.fillWidth: true
color: _passwordEdit.focus ? _passwordEdit.selectionColor : palette.text edit: _passwordEdit
opacity: _passwordEdit.focus ? 1 : 0.5
enabled: viewModel.trusted enabled: viewModel.trusted
} }

74
src/imports/mvvmdatasyncquick/ExportSetupView11.qml

@ -1,74 +0,0 @@
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import QtQuick.Window 2.2
import de.skycoder42.QtMvvm.Core 1.1
import de.skycoder42.QtMvvm.Quick 1.1
import de.skycoder42.QtMvvm.DataSync.Core 1.1
AlertDialog {
id: _exportSetupView
property PExportSetupViewModel viewModel: null
title: viewModel.label
ColumnLayout {
id: _layout
anchors.fill: parent
CheckBox {
id: _trustBox
text: qsTr("Trusted")
Layout.fillWidth: true
MvvmBinding {
viewModel: _exportSetupView.viewModel
viewModelProperty: "trusted"
view: _trustBox
viewProperty: "checked"
}
}
CheckBox {
id: _includeBox
text: qsTr("Include Server")
Layout.fillWidth: true
MvvmBinding {
viewModel: _exportSetupView.viewModel
viewModelProperty: "includeServer"
view: _includeBox
viewProperty: "checked"
}
}
DecorLabel {
text: qsTr("Password:")
Layout.fillWidth: true
edit: _passwordEdit
enabled: viewModel.trusted
}
TextField {
id: _passwordEdit
echoMode: TextInput.Password
Layout.fillWidth: true
enabled: viewModel.trusted
MvvmBinding {
viewModel: _exportSetupView.viewModel
viewModelProperty: "password"
view: _passwordEdit
viewProperty: "text"
type: MvvmBinding.OneWayToViewModel
}
}
}
standardButtons: Dialog.Ok | Dialog.Cancel
onAccepted: viewModel.completeSetup()
Component.onCompleted: standardButton(Dialog.Ok).enabled = Qt.binding(function(){ return viewModel.valid; })
}

16
src/imports/mvvmdatasyncquick/IdentityEditView.qml

@ -2,9 +2,9 @@ import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import de.skycoder42.QtMvvm.Core 1.0 import de.skycoder42.QtMvvm.Core 1.1
import de.skycoder42.QtMvvm.Quick 1.0 import de.skycoder42.QtMvvm.Quick 1.1
import de.skycoder42.QtMvvm.DataSync.Core 1.0 import de.skycoder42.QtMvvm.DataSync.Core 1.1
AlertDialog { AlertDialog {
id: _identityEditView id: _identityEditView
@ -17,11 +17,10 @@ AlertDialog {
id: _layout id: _layout
anchors.fill: parent anchors.fill: parent
Label { DecorLabel {
text: qsTr("Device Name:") text: qsTr("Device Name:")
Layout.fillWidth: true Layout.fillWidth: true
color: _nameEdit.focus ? _nameEdit.selectionColor : palette.text edit: _nameEdit
opacity: _nameEdit.focus ? 1 : 0.5
} }
TextField { TextField {
@ -36,15 +35,16 @@ AlertDialog {
} }
} }
Label { DecorLabel {
id: _fpLabel id: _fpLabel
text: qsTr("Device Fingerprint:") text: qsTr("Device Fingerprint:")
Layout.fillWidth: true Layout.fillWidth: true
opacity: 0.5
Layout.topMargin: 16 Layout.topMargin: 16
edit: _fpText
} }
Label { Label {
id: _fpText
text: viewModel.fingerPrint text: viewModel.fingerPrint
Layout.fillWidth: true Layout.fillWidth: true
wrapMode: Text.Wrap wrapMode: Text.Wrap

62
src/imports/mvvmdatasyncquick/IdentityEditView11.qml

@ -1,62 +0,0 @@
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import QtQuick.Window 2.2
import de.skycoder42.QtMvvm.Core 1.1
import de.skycoder42.QtMvvm.Quick 1.1
import de.skycoder42.QtMvvm.DataSync.Core 1.1
AlertDialog {
id: _identityEditView
property PIdentityEditViewModel viewModel: null
title: qsTr("Edit Identity")
ColumnLayout {
id: _layout
anchors.fill: parent
DecorLabel {
text: qsTr("Device Name:")
Layout.fillWidth: true
edit: _nameEdit
}
TextField {
id: _nameEdit
Layout.fillWidth: true
MvvmBinding {
viewModel: _identityEditView.viewModel
viewModelProperty: "name"
view: _nameEdit
viewProperty: "text"
}
}
DecorLabel {
id: _fpLabel
text: qsTr("Device Fingerprint:")
Layout.fillWidth: true
Layout.topMargin: 16
edit: _fpText
}
Label {
id: _fpText
text: viewModel.fingerPrint
Layout.fillWidth: true
wrapMode: Text.Wrap
verticalAlignment: Qt.AlignVCenter
font.pointSize: _fpLabel.font.pointSize * 0.8
Layout.topMargin: 8
}
}
standardButtons: Dialog.Save | Dialog.Cancel
onAccepted: viewModel.save()
Component.onCompleted: standardButton(Dialog.Save).enabled = Qt.binding(function(){ return viewModel.valid; })
}

33
src/imports/mvvmdatasyncquick/NetworkExchangeView.qml

@ -1,12 +1,11 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.3
import QtQuick.Controls.Universal 2.3
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import de.skycoder42.QtDataSync 4.0 import de.skycoder42.QtDataSync 4.0
import de.skycoder42.QtMvvm.Core 1.0 import de.skycoder42.QtMvvm.Core 1.1
import de.skycoder42.QtMvvm.Quick 1.0 import de.skycoder42.QtMvvm.Quick 1.1
import de.skycoder42.QtMvvm.DataSync.Core 1.0 import de.skycoder42.QtMvvm.DataSync.Core 1.1
import de.skycoder42.QtMvvm.DataSync.Quick 1.1
/*! @brief The view implementation for the QtMvvm::NetworkExchangeViewModel /*! @brief The view implementation for the QtMvvm::NetworkExchangeViewModel
* *
@ -43,15 +42,19 @@ Page {
Pane { Pane {
anchors.fill: parent anchors.fill: parent
ColorHelper {
id: helper
}
ColumnLayout { ColumnLayout {
id: _layout id: _layout
anchors.fill: parent anchors.fill: parent
Label { DecorLabel {
text: qsTr("Port:") text: qsTr("Port:")
Layout.fillWidth: true Layout.fillWidth: true
color: _portEdit.focus ? _nameEdit.selectionColor : palette.text edit: _portEdit
opacity: _portEdit.focus ? 1 : 0.5
} }
SpinBox { SpinBox {
@ -69,11 +72,10 @@ Page {
} }
} }
Label { DecorLabel {
text: qsTr("Name:") text: qsTr("Name:")
Layout.fillWidth: true Layout.fillWidth: true
color: _nameEdit.focus ? _nameEdit.selectionColor : palette.text edit: _nameEdit
opacity: _nameEdit.focus ? 1 : 0.5
} }
TextField { TextField {
@ -92,14 +94,7 @@ Page {
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumHeight: 1 Layout.minimumHeight: 1
Layout.maximumHeight: 1 Layout.maximumHeight: 1
color: { color: helper.text
if(QuickPresenter.currentStyle === "Material")
return Material.foreground;
else if(QuickPresenter.currentStyle === "Universal")
return Universal.foreground;
else
return "black";
}
} }
Switch { Switch {

152
src/imports/mvvmdatasyncquick/NetworkExchangeView11.qml

@ -1,152 +0,0 @@
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import de.skycoder42.QtDataSync 4.0
import de.skycoder42.QtMvvm.Core 1.1
import de.skycoder42.QtMvvm.Quick 1.1
import de.skycoder42.QtMvvm.DataSync.Core 1.1
import de.skycoder42.QtMvvm.DataSync.Quick 1.1
/*! @brief The view implementation for the QtMvvm::NetworkExchangeViewModel
*
* @extends QtQuick.Controls.Page
*
* @details This is the view used to present a network exchange view model. You can extend the
* class if you need to extend that view.
*
* @sa QtMvvm::NetworkExchangeViewModel
*/
Page {
id: _networkExchangeView
/*! @brief The viewmodel to use
*
* @default{<i>Injected</i>}
*
* @accessors{
* @memberAc{viewModel}
* @notifyAc{viewModelChanged()}
* }
*
* @sa QtMvvm::NetworkExchangeViewModel
*/
property NetworkExchangeViewModel viewModel: null
header: ContrastToolBar {
ToolBarLabel {
id: _titleLabel
anchors.fill: parent
text: qsTr("Network Exchange")
}
}
Pane {
anchors.fill: parent
ColorHelper {
id: helper
}
ColumnLayout {
id: _layout
anchors.fill: parent
DecorLabel {
text: qsTr("Port:")
Layout.fillWidth: true
edit: _portEdit
}
SpinBox {
id: _portEdit
Layout.fillWidth: true
editable: true
from: 0
to: 65535
MvvmBinding {
viewModel: _networkExchangeView.viewModel
viewModelProperty: "port"
view: _portEdit
viewProperty: "value"
}
}
DecorLabel {
text: qsTr("Name:")
Layout.fillWidth: true
edit: _nameEdit
}
TextField {
id: _nameEdit
Layout.fillWidth: true
MvvmBinding {
viewModel: _networkExchangeView.viewModel
viewModelProperty: "deviceName"
view: _nameEdit
viewProperty: "text"
}
}
Rectangle {
Layout.fillWidth: true
Layout.minimumHeight: 1
Layout.maximumHeight: 1
color: helper.text
}
Switch {
id: _exchangeSwitch
text: qsTr("Exchange active:")
MvvmBinding {
viewModel: _networkExchangeView.viewModel
viewModelProperty: "active"
view: _exchangeSwitch
viewProperty: "checked"
}
}
ScrollView {
id: _exchangeScrollView
Layout.fillWidth: true
Layout.fillHeight: true
clip: true
ListView {
id: _exchangeList
model: viewModel.sortedModel
delegate: ItemDelegate {
width: _exchangeScrollView.width
contentItem: ColumnLayout {
id: _delegateLayout
spacing: 8
Label {
id: _nameLabel
Layout.fillWidth: true
text: name
}
Label {
id: _addressLabel
font.pointSize: _nameLabel.font.pointSize * 0.8
Layout.fillWidth: true
Layout.leftMargin: 8
text: address
opacity: 0.75
}
}
onClicked: viewModel.exportTo(index)
}
}
}
}
}
}

74
src/imports/mvvmdatasyncquick/SubButton.qml

@ -1,74 +0,0 @@
import QtQuick 2.10
import QtQuick.Controls 2.3
import de.skycoder42.QtMvvm.Quick 1.0
RoundActionButton {
id: _subButton
property Item reference: parent
property real btnSpacing: 16
property bool expanded: false
highlighted: false
anchors.horizontalCenter: reference.horizontalCenter
anchors.verticalCenter: reference.verticalCenter
implicitHeight: 40 + padding
implicitWidth: 40 + padding
state: expanded ? "expanded" : "collapsed"
states: [
State {
name: "collapsed"
PropertyChanges {
target: _subButton
anchors.verticalCenterOffset: 0
visible: false
}
},
State {
name: "expanded"
PropertyChanges {
target: _subButton
anchors.verticalCenterOffset: -1 * (reference.height/2 + _subButton.height/2 + btnSpacing)
visible: true
}
}
]
transitions: [
Transition {
from: "collapsed"
to: "expanded"
SequentialAnimation {
PropertyAnimation {
target: _subButton
property: "visible"
duration: 0
}
PropertyAnimation {
target: _subButton
property: "anchors.verticalCenterOffset"
duration: 250
easing.type: Easing.OutCubic
}
}
},
Transition {
from: "expanded"
to: "collapsed"
SequentialAnimation {
PropertyAnimation {
target: _subButton
property: "anchors.verticalCenterOffset"
duration: 250
easing.type: Easing.InCubic
}
PropertyAnimation {
target: _subButton
property: "visible"
duration: 0
}
}
}
]
}

8
src/imports/mvvmdatasyncquick/mvvmdatasyncquick.pro

@ -13,17 +13,11 @@ SOURCES += \
qtmvvmdatasyncquick_plugin.cpp qtmvvmdatasyncquick_plugin.cpp
QML_FILES += \ QML_FILES += \
SubButton.qml \
DataSyncView.qml \ DataSyncView.qml \
DataSyncView11.qml \
NetworkExchangeView.qml \ NetworkExchangeView.qml \
NetworkExchangeView11.qml \
IdentityEditView.qml \ IdentityEditView.qml \
IdentityEditView11.qml \
ExportSetupView.qml \ ExportSetupView.qml \
ExportSetupView11.qml \ ChangeRemoteView.qml
ChangeRemoteView.qml \
ChangeRemoteView11.qml
RESOURCES += \ RESOURCES += \
qtmvvmdatasyncquick_plugin.qrc qtmvvmdatasyncquick_plugin.qrc

7
src/imports/mvvmdatasyncquick/qmldir

@ -5,17 +5,10 @@ typeinfo plugins.qmltypes
depends de.skycoder42.QtMvvm.DataSync.Core 1.0 depends de.skycoder42.QtMvvm.DataSync.Core 1.0
depends de.skycoder42.QtMvvm.Quick 1.0 depends de.skycoder42.QtMvvm.Quick 1.0
internal SubButton SubButton.qml
IdentityEditView 1.0 IdentityEditView.qml IdentityEditView 1.0 IdentityEditView.qml
IdentityEditView 1.1 IdentityEditView11.qml
ExportSetupView 1.0 ExportSetupView.qml ExportSetupView 1.0 ExportSetupView.qml
ExportSetupView 1.1 ExportSetupView11.qml
ChangeRemoteView 1.0 ChangeRemoteView.qml ChangeRemoteView 1.0 ChangeRemoteView.qml
ChangeRemoteView 1.1 ChangeRemoteView11.qml
DataSyncView 1.0 DataSyncView.qml DataSyncView 1.0 DataSyncView.qml
DataSyncView 1.1 DataSyncView11.qml
NetworkExchangeView 1.0 NetworkExchangeView.qml NetworkExchangeView 1.0 NetworkExchangeView.qml
NetworkExchangeView 1.1 NetworkExchangeView11.qml

9
src/imports/mvvmquick/ActionButton.qml

@ -1,6 +1,6 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import de.skycoder42.QtMvvm.Quick 1.0 import de.skycoder42.QtMvvm.Quick 1.1
/*! @brief An extension of the @ref QtQuick.Controls.ToolButton "ToolButton" for better appearance /*! @brief An extension of the @ref QtQuick.Controls.ToolButton "ToolButton" for better appearance
* *
@ -28,11 +28,16 @@ ToolButton {
display: AbstractButton.IconOnly display: AbstractButton.IconOnly
implicitHeight: 48 implicitHeight: 48
implicitWidth: 48 //implicitWidth: 48
icon.width: 24 icon.width: 24
icon.height: 24 icon.height: 24
ColorHelper {
id: helper
}
icon.color: helper.text
ToolTip.visible: pressed && _toolButton.toolTip != "" ToolTip.visible: pressed && _toolButton.toolTip != ""
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
ToolTip.text: _toolButton.toolTip ToolTip.text: _toolButton.toolTip

4
src/imports/mvvmquick/AndroidFileDialog.qml

@ -1,6 +1,6 @@
import QtQuick 2.10 import QtQuick 2.10
import de.skycoder42.QtMvvm.Core 1.0 import de.skycoder42.QtMvvm.Core 1.1
import de.skycoder42.QtMvvm.Quick 1.0 import de.skycoder42.QtMvvm.Quick 1.1
FileChooser { FileChooser {
id: _fileChooser id: _fileChooser

4
src/imports/mvvmquick/AndroidFolderDialog.qml

@ -1,6 +1,6 @@
import QtQuick 2.10 import QtQuick 2.10
import de.skycoder42.QtMvvm.Core 1.0 import de.skycoder42.QtMvvm.Core 1.1
import de.skycoder42.QtMvvm.Quick 1.0 import de.skycoder42.QtMvvm.Quick 1.1
FileChooser { FileChooser {
id: _folderChooser id: _folderChooser

27
src/imports/mvvmquick/ContrastToolBar.qml

@ -1,6 +1,7 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.3 import QtQuick.Controls.Material 2.3
import de.skycoder42.QtMvvm.Quick 1.1
/*! @brief An extension of the @ref QtQuick.Controls.ToolBar "ToolBar" for better appearance /*! @brief An extension of the @ref QtQuick.Controls.ToolBar "ToolBar" for better appearance
* *
@ -16,30 +17,10 @@ ToolBar {
height: 56 height: 56
/*! @brief Calculates the optimal text color based on the background color // @copydoc QuickPresenter::accentTextColor
*
* @param type:color accentColor The color to find a contrasting text color for
* @param type:color baseColor The current default text color
* @return type:color A color for text that is easy to read when used with accentColor as
* the background
*
* The method calculates whether the color should be light or dark and then either returns
* white or black, depending on which color fits better. If baseColor is specified, then
* the color value is checked, too. If baseColor is easily readable, it is simply returned
* as result. Otherwise the method proceeds as usual.
*/
function accentTextColor(accentColor, baseColor) { function accentTextColor(accentColor, baseColor) {
var a = (0.299 * accentColor.r + 0.587 * accentColor.g + 0.144 * accentColor.b); return QuickPresenter.accentTextColor(accentColor, baseColor);
if(typeof baseColor !== "undefined") {
var b = (0.299 * baseColor.r + 0.587 * baseColor.g + 0.144 * baseColor.b);
if (Math.abs(a - b) >= 0.5)
return baseColor;
}
if(a < 0.5)
return "#FFFFFF";
else
return "#000000";
} }
Material.foreground: accentTextColor(Material.primary) Material.foreground: QuickPresenter.accentTextColor(Material.primary, Material.foreground)
} }

26
src/imports/mvvmquick/ContrastToolBar11.qml

@ -1,26 +0,0 @@
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.3
import de.skycoder42.QtMvvm.Quick 1.1
/*! @brief An extension of the @ref QtQuick.Controls.ToolBar "ToolBar" for better appearance
*
* @extends QtQuick.Controls.ToolBar
*
* @details This version basically adjusts size and text color of the toolbar itself and
* controls within the toolbar to look better and improve contrast
*
* @sa ActionButton, ToolBarLabel, MenuButton
*/
ToolBar {
id: _contrastToolBar
height: 56
// @copydoc QuickPresenter::accentTextColor
function accentTextColor(accentColor, baseColor) {
return QuickPresenter.accentTextColor(accentColor, baseColor);
}
Material.foreground: QuickPresenter.accentTextColor(Material.primary, Material.foreground)
}

12
src/imports/mvvmquick/DateEdit.qml

@ -98,12 +98,22 @@ ListView {
DayOfWeekRow { DayOfWeekRow {
Layout.fillWidth: true Layout.fillWidth: true
delegate: Label {
text: model.shortName
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
} }
WeekNumberColumn { WeekNumberColumn {
month: model.month month: model.month
year: model.year year: model.year
Layout.fillHeight: true Layout.fillHeight: true
delegate: Label {
text: model.weekNumber
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
} }
MonthGrid { MonthGrid {
@ -128,7 +138,7 @@ ListView {
opacity: model.month === grid.month ? 1 : 0.5 opacity: model.month === grid.month ? 1 : 0.5
text: model.day text: model.day
font: grid.font font: grid.font
color: isCurrent ? QuickPresenter.accentTextColor(highlightColor, palette.text) : palette.text color: isCurrent ? QuickPresenter.accentTextColor(highlightColor, helper.text) : helper.text
background: Rectangle { background: Rectangle {
readonly property double size: Math.max(dayDelegate.width, dayDelegate.height) * 1.2 readonly property double size: Math.max(dayDelegate.width, dayDelegate.height) * 1.2

4
src/imports/mvvmquick/FileDialog.qml

@ -1,8 +1,8 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import Qt.labs.platform 1.0 as Labs import Qt.labs.platform 1.0 as Labs
import de.skycoder42.QtMvvm.Core 1.0 import de.skycoder42.QtMvvm.Core 1.1
import de.skycoder42.QtMvvm.Quick 1.0 import de.skycoder42.QtMvvm.Quick 1.1
/*! @brief A file dialog implementation based on the labs file dialog /*! @brief A file dialog implementation based on the labs file dialog
* *

4
src/imports/mvvmquick/FolderDialog.qml

@ -1,8 +1,8 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import Qt.labs.platform 1.0 as Labs import Qt.labs.platform 1.0 as Labs
import de.skycoder42.QtMvvm.Core 1.0 import de.skycoder42.QtMvvm.Core 1.1
import de.skycoder42.QtMvvm.Quick 1.0 import de.skycoder42.QtMvvm.Quick 1.1
/*! @brief A folder dialog implementation based on the labs folder dialog /*! @brief A folder dialog implementation based on the labs folder dialog
* *

2
src/imports/mvvmquick/InputDialog.qml

@ -1,7 +1,7 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import de.skycoder42.QtMvvm.Quick 1.0 import de.skycoder42.QtMvvm.Quick 1.1
MsgBoxBase { MsgBoxBase {
id: _inputDialog id: _inputDialog

2
src/imports/mvvmquick/MenuButton.qml

@ -1,6 +1,6 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import de.skycoder42.QtMvvm.Quick 1.0 import de.skycoder42.QtMvvm.Quick 1.1
/*! @brief An extension of the ActionButton to provide a simple "more menu" button /*! @brief An extension of the ActionButton to provide a simple "more menu" button
* *

2
src/imports/mvvmquick/PresenterProgress.qml

@ -1,6 +1,6 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import de.skycoder42.QtMvvm.Quick 1.0 import de.skycoder42.QtMvvm.Quick 1.1
/*! @brief A @ref QtQuick.Controls.ProgressBar "ProgressBar" with automatic bindings to the /*! @brief A @ref QtQuick.Controls.ProgressBar "ProgressBar" with automatic bindings to the
* presenters view loading progress * presenters view loading progress

2
src/imports/mvvmquick/RoundActionButton.qml

@ -1,6 +1,6 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import de.skycoder42.QtMvvm.Quick 1.0 import de.skycoder42.QtMvvm.Quick 1.1
/*! @brief An extension of the @ref QtQuick.Controls.RoundButton "RoundButton" for better appearance /*! @brief An extension of the @ref QtQuick.Controls.RoundButton "RoundButton" for better appearance
* *

2
src/imports/mvvmquick/SectionListView.qml

@ -1,7 +1,7 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import de.skycoder42.QtMvvm.Quick 1.0 import de.skycoder42.QtMvvm.Quick 1.1
ListView { ListView {
id: _listView id: _listView

139
src/imports/mvvmquick/SettingsView.qml

@ -1,8 +1,8 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import de.skycoder42.QtMvvm.Core 1.0 import de.skycoder42.QtMvvm.Core 1.1
import de.skycoder42.QtMvvm.Quick 1.0 import de.skycoder42.QtMvvm.Quick 1.1
/*! @brief The view implementation for the QtMvvm::SettingsViewModel /*! @brief The view implementation for the QtMvvm::SettingsViewModel
* *
@ -66,37 +66,15 @@ Page {
anchors.fill: parent anchors.fill: parent
spacing: 0 spacing: 0
Item { SearchBar {
id: _labelContainer id: _searchBar
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
Layout.leftMargin: 16
ToolBarLabel { title: qsTr("Settings")
id: _titleLabel allowSearch: _builder.allowSearch
anchors.fill: parent searchToolTip: qsTr("Search in settings")
leftPadding: 0
text: qsTr("Settings")
visible: !_searchField.visible
}
TextField {
id: _searchField
horizontalAlignment: Qt.AlignLeft
verticalAlignment: Qt.AlignVCenter
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
height: Math.min(implicitHeight, parent.height)
width: parent.width
}
}
ActionButton {
id: _searchButton
visible: _builder.allowSearch
text: qsTr("Search in settings")
onClicked: toggleSearchState()
} }
ActionButton { ActionButton {
@ -109,107 +87,6 @@ Page {
} }
} }
states: [
State {
name: "title"
PropertyChanges {
target: _searchButton
icon.name: "search"
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_search.svg"
}
PropertyChanges {
target: _titleLabel
visible: true
}
PropertyChanges {
target: _searchField
visible: false
width: 0
}
StateChangeScript {
name: "focusScript"
script: _searchField.clear();
}
},
State {
name: "search"
PropertyChanges {
target: _searchButton
icon.name: "gtk-close"
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_close.svg"
}
PropertyChanges {
target: _titleLabel
visible: false
}
PropertyChanges {
target: _searchField
visible: true
width: _labelContainer.width
}
StateChangeScript {
name: "focusScript"
script: _searchField.forceActiveFocus();
}
}
]
transitions: [
Transition {
from: "title"
to: "search"
SequentialAnimation {
PropertyAnimation {
target: _searchField
property: "visible"
duration: 0
}
PropertyAnimation {
target: _searchField
property: "width"
duration: 250
easing.type: Easing.InOutCubic
}
PropertyAnimation {
target: _titleLabel
property: "visible"
duration: 0
}
}
},
Transition {
from: "search"
to: "title"
SequentialAnimation {
PropertyAnimation {
target: _titleLabel
property: "visible"
duration: 0
}
PropertyAnimation {
target: _searchField
property: "width"
duration: 250
easing.type: Easing.InOutCubic
}
PropertyAnimation {
target: _searchField
property: "visible"
duration: 0
}
}
}
]
state: "title"
//! @brief Can be called to toggle the state of the search bar
function toggleSearchState() {
if(state == "title")
state = "search";
else
state = "title";
}
PresenterProgress {} PresenterProgress {}
StackView { StackView {
@ -265,7 +142,7 @@ Page {
id: _builder id: _builder
buildView: _settingsView buildView: _settingsView
viewModel: _settingsView.viewModel viewModel: _settingsView.viewModel
filterText: _searchField.text filterText: _searchBar.searchText
onPresentOverview: _overviewComponent.incubateObject(_settingsStack, { onPresentOverview: _overviewComponent.incubateObject(_settingsStack, {
model: model, model: model,

159
src/imports/mvvmquick/SettingsView11.qml

@ -1,159 +0,0 @@
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import de.skycoder42.QtMvvm.Core 1.1
import de.skycoder42.QtMvvm.Quick 1.1
/*! @brief The view implementation for the QtMvvm::SettingsViewModel
*
* @extends QtQuick.Controls.Page
*
* @details This is the view used to present a settings view model. You can extend the class
* if you need to extend that view.
*
* @sa QtMvvm::SettingsViewModel
*/
Page {
id: _settingsView
/*! @brief The viewmodel to use
*
* @default{<i>Injected</i>}
*
* @accessors{
* @memberAc{viewModel}
* @notifyAc{viewModelChanged()}
* }
*
* @sa QtMvvm::SettingsViewModel
*/
property SettingsViewModel viewModel: null
/*! @brief Specifiy if a back action should always close the full settings
*
* @default{`false`}
*
* The settings view consists of an internal stack view to present settings pages. By
* default only one page is closed at a time. By setting this property to true, a close
* action will always close all of them.
*
* @accessors{
* @memberAc{fullClose}
* @notifyAc{fullCloseChanged()}
* }
*/
property bool fullClose: false
/*! @brief Can be called to try to close a single settings page
*
* @return type:bool `true` if a page was closed, `false` if not
*
* This method is called by the presenter to close the pages of the settings view one at
* a time.
*
* @note if SettingsView::fullClose is true, this method will always return false.
*
* @sa SettingsView::fullClose, PresentingStackView::closeAction
*/
function closeAction() {
return !fullClose && _settingsStack.closeAction();
}
header: ContrastToolBar {
id: _toolBar
RowLayout {
id: _toolLayout
anchors.fill: parent
spacing: 0
SearchBar {
id: _searchBar
Layout.fillWidth: true
Layout.fillHeight: true
title: qsTr("Settings")
allowSearch: _builder.allowSearch
searchToolTip: qsTr("Search in settings")
}
ActionButton {
id: _restoreButton
visible: _builder.allowRestore
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_settings_backup_restore.svg"
text: qsTr("Restore settings")
onClicked: _builder.restoreDefaults()
}
}
}
PresenterProgress {}
StackView {
id: _settingsStack
anchors.fill: parent
function closeAction() {
if(_settingsStack.depth <= 1)
return false;
else {
_settingsStack.pop();
return true;
}
}
}
Component {
id: _overviewComponent
ScrollView {
id: __ovScrollView
property alias model: __ovListView.model
property alias showSections: __ovListView.showSections
clip: true
OverviewListView {
id: __ovListView
builder: _builder
}
Component.onCompleted: _settingsStack.push(__ovScrollView)
}
}
Component {
id: _sectionViewComponent
ScrollView {
id: __secScrollView
property alias model: __secListView.model
clip: true
SectionListView {
id: __secListView
builder: _builder
}
Component.onCompleted: _settingsStack.push(__secScrollView)
}
}
SettingsUiBuilder {
id: _builder
buildView: _settingsView
viewModel: _settingsView.viewModel
filterText: _searchBar.searchText
onPresentOverview: _overviewComponent.incubateObject(_settingsStack, {
model: model,
showSections: hasSections
}, Qt.Synchronous)
onPresentSection: _sectionViewComponent.incubateObject(_settingsStack, {
model: model
}, Qt.Synchronous)
onCloseSettings: {
_settingsView.fullClose = true;
QuickPresenter.popView();
}
}
}

6
src/imports/mvvmquick/TintIcon.qml

@ -8,6 +8,7 @@ Item {
property alias icon: _imgBtn.icon property alias icon: _imgBtn.icon
property alias source: _imgBtn.icon.source property alias source: _imgBtn.icon.source
property alias color: _imgBtn.icon.color
implicitWidth: _imgBtn.icon.width implicitWidth: _imgBtn.icon.width
implicitHeight: _imgBtn.icon.height implicitHeight: _imgBtn.icon.height
@ -25,6 +26,11 @@ Item {
padding: 0 padding: 0
anchors.fill: parent anchors.fill: parent
ColorHelper {
id: helper
}
icon.color: helper.text
background: Item {} background: Item {}
} }
} }

2
src/imports/mvvmquick/mvvmquick.pro

@ -37,7 +37,6 @@ QML_FILES += \
TintIcon.qml \ TintIcon.qml \
AlertDialog.qml \ AlertDialog.qml \
ContrastToolBar.qml \ ContrastToolBar.qml \
ContrastToolBar11.qml \
ToolBarLabel.qml \ ToolBarLabel.qml \
ActionButton.qml \ ActionButton.qml \
RoundActionButton.qml \ RoundActionButton.qml \
@ -50,7 +49,6 @@ QML_FILES += \
SectionListView.qml \ SectionListView.qml \
OverviewListView.qml \ OverviewListView.qml \
SettingsView.qml \ SettingsView.qml \
SettingsView11.qml \
SearchBar.qml \ SearchBar.qml \
RoundMenuButton.qml \ RoundMenuButton.qml \
DecorLabel.qml \ DecorLabel.qml \

2
src/imports/mvvmquick/qmldir

@ -22,7 +22,6 @@ ColorHelper 1.1 ColorHelper.qml
AlertDialog 1.0 AlertDialog.qml AlertDialog 1.0 AlertDialog.qml
ContrastToolBar 1.0 ContrastToolBar.qml ContrastToolBar 1.0 ContrastToolBar.qml
ContrastToolBar 1.1 ContrastToolBar11.qml
ToolBarLabel 1.0 ToolBarLabel.qml ToolBarLabel 1.0 ToolBarLabel.qml
ActionButton 1.0 ActionButton.qml ActionButton 1.0 ActionButton.qml
RoundActionButton 1.0 RoundActionButton.qml RoundActionButton 1.0 RoundActionButton.qml
@ -47,7 +46,6 @@ DialogPresenter 1.1 DialogPresenter11.qml
PresentingDrawer 1.0 PresentingDrawer.qml PresentingDrawer 1.0 PresentingDrawer.qml
SettingsView 1.0 SettingsView.qml SettingsView 1.0 SettingsView.qml
SettingsView 1.1 SettingsView11.qml
QtMvvmApp 1.0 QtMvvmApp.qml QtMvvmApp 1.0 QtMvvmApp.qml
QtMvvmApp 1.1 QtMvvmApp11.qml QtMvvmApp 1.1 QtMvvmApp11.qml

40
tests/auto/mvvmcore/settingsgenerator/test_de.ts

@ -9,4 +9,44 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>generatortest.xml</name>
<message>
<location filename="../../../../../build-qtmvvm-Desktop_Qt_5_11_1_GCC_64bit-Debug/tests/auto/mvvmcore/settingsgenerator/generatortest.cpp" line="+34"/>
<source>translate me</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>import_config.xml</name>
<message>
<location filename="../../../../../build-qtmvvm-Desktop_Qt_5_11_1_GCC_64bit-Debug/tests/auto/mvvmcore/settingsgenerator/importtest.cpp" line="+29"/>
<source>42</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>import_normal.xml</name>
<message>
<location line="-3"/>
<source>false</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>some_context</name>
<message>
<location filename="../../../../../build-qtmvvm-Desktop_Qt_5_11_1_GCC_64bit-Debug/tests/auto/mvvmcore/settingsgenerator/generatortest.cpp" line="-5"/>
<source>Hello World</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>translatortest.xml</name>
<message>
<location filename="../../../../../build-qtmvvm-Desktop_Qt_5_11_1_GCC_64bit-Debug/tests/auto/mvvmcore/settingsgenerator/.tr-dummies/translatortest.tsdummy.cpp" line="+7"/>
<source>dummy</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS> </TS>

2
tests/auto/testrun.pri

@ -13,7 +13,7 @@ win32 {
runtarget.commands += $$escape_expand(\\n\\t)@set QT_QPA_PLATFORM=minimal runtarget.commands += $$escape_expand(\\n\\t)@set QT_QPA_PLATFORM=minimal
runtarget.commands += $$escape_expand(\\n\\t)start /w call $(DESTDIR_TARGET) ^> $(DESTDIR)test.log ^|^| echo FAIL ^> fail ^& exit 0 runtarget.commands += $$escape_expand(\\n\\t)start /w call $(DESTDIR_TARGET) ^> $(DESTDIR)test.log ^|^| echo FAIL ^> fail ^& exit 0
runtarget.commands += $$escape_expand(\\n\\t)type $(DESTDIR)test.log runtarget.commands += $$escape_expand(\\n\\t)type $(DESTDIR)test.log
runtarget.commands += $$escape_expand(\\n\\t)@if exist fail exit 1 runtarget.commands += $$escape_expand(\\n\\t)@if exist fail exit 42
QMAKE_EXTRA_TARGETS += runtarget QMAKE_EXTRA_TARGETS += runtarget
} }
} else { } else {

Loading…
Cancel
Save