From 55dda691f5aa78910996945d20d963a120871bb5 Mon Sep 17 00:00:00 2001 From: Skycoder42 Date: Fri, 3 Aug 2018 11:56:57 +0200 Subject: [PATCH] qml cleanup (remove unneccesary 1.1 versions) --- .../DataSyncSampleQuick/main.qml | 1 + .../mvvmdatasyncquick/ChangeRemoteView.qml | 33 +- .../mvvmdatasyncquick/ChangeRemoteView11.qml | 211 ------------- .../mvvmdatasyncquick/DataSyncView.qml | 81 ++--- .../mvvmdatasyncquick/DataSyncView11.qml | 292 ------------------ .../mvvmdatasyncquick/ExportSetupView.qml | 11 +- .../mvvmdatasyncquick/ExportSetupView11.qml | 74 ----- .../mvvmdatasyncquick/IdentityEditView.qml | 16 +- .../mvvmdatasyncquick/IdentityEditView11.qml | 62 ---- .../mvvmdatasyncquick/NetworkExchangeView.qml | 33 +- .../NetworkExchangeView11.qml | 152 --------- src/imports/mvvmdatasyncquick/SubButton.qml | 74 ----- .../mvvmdatasyncquick/mvvmdatasyncquick.pro | 8 +- src/imports/mvvmdatasyncquick/qmldir | 7 - src/imports/mvvmquick/ActionButton.qml | 9 +- src/imports/mvvmquick/AndroidFileDialog.qml | 4 +- src/imports/mvvmquick/AndroidFolderDialog.qml | 4 +- src/imports/mvvmquick/ContrastToolBar.qml | 27 +- src/imports/mvvmquick/ContrastToolBar11.qml | 26 -- src/imports/mvvmquick/DateEdit.qml | 12 +- src/imports/mvvmquick/FileDialog.qml | 4 +- src/imports/mvvmquick/FolderDialog.qml | 4 +- src/imports/mvvmquick/InputDialog.qml | 2 +- src/imports/mvvmquick/MenuButton.qml | 2 +- src/imports/mvvmquick/PresenterProgress.qml | 2 +- src/imports/mvvmquick/RoundActionButton.qml | 2 +- src/imports/mvvmquick/SectionListView.qml | 2 +- src/imports/mvvmquick/SettingsView.qml | 139 +-------- src/imports/mvvmquick/SettingsView11.qml | 159 ---------- src/imports/mvvmquick/TintIcon.qml | 6 + src/imports/mvvmquick/mvvmquick.pro | 2 - src/imports/mvvmquick/qmldir | 2 - .../mvvmcore/settingsgenerator/test_de.ts | 40 +++ tests/auto/testrun.pri | 2 +- 34 files changed, 161 insertions(+), 1344 deletions(-) delete mode 100644 src/imports/mvvmdatasyncquick/ChangeRemoteView11.qml delete mode 100644 src/imports/mvvmdatasyncquick/DataSyncView11.qml delete mode 100644 src/imports/mvvmdatasyncquick/ExportSetupView11.qml delete mode 100644 src/imports/mvvmdatasyncquick/IdentityEditView11.qml delete mode 100644 src/imports/mvvmdatasyncquick/NetworkExchangeView11.qml delete mode 100644 src/imports/mvvmdatasyncquick/SubButton.qml delete mode 100644 src/imports/mvvmquick/ContrastToolBar11.qml delete mode 100644 src/imports/mvvmquick/SettingsView11.qml diff --git a/examples/mvvmdatasyncquick/DataSyncSampleQuick/main.qml b/examples/mvvmdatasyncquick/DataSyncSampleQuick/main.qml index 36878b4..bc587f1 100644 --- a/examples/mvvmdatasyncquick/DataSyncSampleQuick/main.qml +++ b/examples/mvvmdatasyncquick/DataSyncSampleQuick/main.qml @@ -5,6 +5,7 @@ import de.skycoder42.QtMvvm.Quick 1.1 QtMvvmApp { Material.accent: Material.DeepPurple Material.primary: Material.Lime + Material.theme: Material.Dark title: qsTr("QtMvvm Quick Sample") } diff --git a/src/imports/mvvmdatasyncquick/ChangeRemoteView.qml b/src/imports/mvvmdatasyncquick/ChangeRemoteView.qml index 6a0436c..2b7ecf0 100644 --- a/src/imports/mvvmdatasyncquick/ChangeRemoteView.qml +++ b/src/imports/mvvmdatasyncquick/ChangeRemoteView.qml @@ -2,9 +2,9 @@ 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.0 -import de.skycoder42.QtMvvm.Quick 1.0 -import de.skycoder42.QtMvvm.DataSync.Core 1.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 { @@ -33,13 +33,10 @@ Page { text: qsTr("Change Remote") } - ToolButton { + ActionButton { 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 @@ -59,17 +56,17 @@ Page { id: _layout anchors.fill: parent - Label { + DecorLabel { text: qsTr("Remote url:") Layout.fillWidth: true - color: _urlEdit.focus ? _urlEdit.selectionColor : palette.text - opacity: _urlEdit.focus ? 1 : 0.5 + edit: _urlEdit } TextField { id: _urlEdit Layout.fillWidth: true + placeholderText: "wss://example.org/qdsapp/" validator: UrlValidator { allowedSchemes: ["ws", "wss"] } @@ -83,17 +80,17 @@ Page { } } - Label { + DecorLabel { text: qsTr("Access key:") Layout.fillWidth: true - color: _accessKeyEdit.focus ? _accessKeyEdit.selectionColor : palette.text - opacity: _accessKeyEdit.focus ? 1 : 0.5 + edit: _accessKeyEdit } TextField { id: _accessKeyEdit Layout.fillWidth: true echoMode: TextInput.Password + placeholderText: "Optional access secret" MvvmBinding { viewModel: _changeRemoteView.viewModel @@ -104,11 +101,10 @@ Page { } } - Label { + DecorLabel { text: qsTr("Keep-Alive timout:") Layout.fillWidth: true - color: _keepAliveEdit.focus ? _accessKeyEdit.selectionColor : palette.text - opacity: _keepAliveEdit.focus ? 1 : 0.5 + edit: _keepAliveEdit } SpinBox { @@ -138,11 +134,10 @@ Page { } } - Label { + DecorLabel { text: qsTr("Extra Headers:") Layout.fillWidth: true - color: _headerScrollView.focus ? _accessKeyEdit.selectionColor : palette.text - opacity: _headerScrollView.focus ? 1 : 0.5 + edit: _headerScrollView } ScrollView { diff --git a/src/imports/mvvmdatasyncquick/ChangeRemoteView11.qml b/src/imports/mvvmdatasyncquick/ChangeRemoteView11.qml deleted file mode 100644 index 2c6c7e4..0000000 --- a/src/imports/mvvmdatasyncquick/ChangeRemoteView11.qml +++ /dev/null @@ -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(); - } - } - } - } - } - } - } -} diff --git a/src/imports/mvvmdatasyncquick/DataSyncView.qml b/src/imports/mvvmdatasyncquick/DataSyncView.qml index d4b7147..d595825 100644 --- a/src/imports/mvvmdatasyncquick/DataSyncView.qml +++ b/src/imports/mvvmdatasyncquick/DataSyncView.qml @@ -4,9 +4,9 @@ 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.0 -import de.skycoder42.QtMvvm.Quick 1.0 -import de.skycoder42.QtMvvm.DataSync.Core 1.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 * @@ -95,6 +95,11 @@ Page { Pane { anchors.fill: parent + + ColorHelper { + id: helper + } + ColumnLayout { id: _layout anchors.fill: parent @@ -146,14 +151,7 @@ Page { Layout.fillWidth: true Layout.minimumHeight: 1 Layout.maximumHeight: 1 - color: { - if(QuickPresenter.currentStyle === "Material") - return Material.foreground; - else if(QuickPresenter.currentStyle === "Universal") - return Universal.foreground; - else - return "black"; - } + color: helper.text } Label { @@ -253,65 +251,42 @@ Page { } } - RoundActionButton { + RoundMenuButton { id: _addButton - z: 7 + anchors.right: parent.right anchors.bottom: parent.bottom anchors.margins: 16 - checkable: true + 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" - } - - SubButton { - id: _exchangeButton - z: 3 - reference: _addButton - expanded: _addButton.checked + stickyToolTips: true - text: qsTr("Network Exchange") - icon.name: "network-connect" - icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_exchange.svg" + Action { + text: qsTr("Network Exchange") + icon.name: "network-connect" + icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_exchange.svg" - onClicked: { - viewModel.startNetworkExchange(); - _addButton.checked = false; + onTriggered: viewModel.startNetworkExchange() } - } - SubButton { - id: _exportButton - z: 3 - reference: _exchangeButton - expanded: _addButton.checked + Action { + text: qsTr("Export to file") + icon.name: "document-export" + icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_export.svg" - text: qsTr("Export to file") - icon.name: "document-export" - icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_export.svg" - - onClicked: { - viewModel.startExport(); - _addButton.checked = false; + onTriggered: viewModel.startExport() } - } - - SubButton { - id: _importButton - z: 3 - reference: _exportButton - expanded: _addButton.checked - text: qsTr("Import from file") - icon.name: "document-import" - icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_import.svg" + Action { + text: qsTr("Import from file") + icon.name: "document-import" + icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_import.svg" - onClicked: { - viewModel.startImport(); - _addButton.checked = false; + onTriggered: viewModel.startImport() } } } diff --git a/src/imports/mvvmdatasyncquick/DataSyncView11.qml b/src/imports/mvvmdatasyncquick/DataSyncView11.qml deleted file mode 100644 index d595825..0000000 --- a/src/imports/mvvmdatasyncquick/DataSyncView11.qml +++ /dev/null @@ -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{Injected} - * - * @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() - } - } -} diff --git a/src/imports/mvvmdatasyncquick/ExportSetupView.qml b/src/imports/mvvmdatasyncquick/ExportSetupView.qml index 9548698..f1ffd48 100644 --- a/src/imports/mvvmdatasyncquick/ExportSetupView.qml +++ b/src/imports/mvvmdatasyncquick/ExportSetupView.qml @@ -2,9 +2,9 @@ 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.0 -import de.skycoder42.QtMvvm.Quick 1.0 -import de.skycoder42.QtMvvm.DataSync.Core 1.0 +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 @@ -43,11 +43,10 @@ AlertDialog { } } - Label { + DecorLabel { text: qsTr("Password:") Layout.fillWidth: true - color: _passwordEdit.focus ? _passwordEdit.selectionColor : palette.text - opacity: _passwordEdit.focus ? 1 : 0.5 + edit: _passwordEdit enabled: viewModel.trusted } diff --git a/src/imports/mvvmdatasyncquick/ExportSetupView11.qml b/src/imports/mvvmdatasyncquick/ExportSetupView11.qml deleted file mode 100644 index f1ffd48..0000000 --- a/src/imports/mvvmdatasyncquick/ExportSetupView11.qml +++ /dev/null @@ -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; }) -} diff --git a/src/imports/mvvmdatasyncquick/IdentityEditView.qml b/src/imports/mvvmdatasyncquick/IdentityEditView.qml index b2fc9d8..ac6e1f1 100644 --- a/src/imports/mvvmdatasyncquick/IdentityEditView.qml +++ b/src/imports/mvvmdatasyncquick/IdentityEditView.qml @@ -2,9 +2,9 @@ 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.0 -import de.skycoder42.QtMvvm.Quick 1.0 -import de.skycoder42.QtMvvm.DataSync.Core 1.0 +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 @@ -17,11 +17,10 @@ AlertDialog { id: _layout anchors.fill: parent - Label { + DecorLabel { text: qsTr("Device Name:") Layout.fillWidth: true - color: _nameEdit.focus ? _nameEdit.selectionColor : palette.text - opacity: _nameEdit.focus ? 1 : 0.5 + edit: _nameEdit } TextField { @@ -36,15 +35,16 @@ AlertDialog { } } - Label { + DecorLabel { id: _fpLabel text: qsTr("Device Fingerprint:") Layout.fillWidth: true - opacity: 0.5 Layout.topMargin: 16 + edit: _fpText } Label { + id: _fpText text: viewModel.fingerPrint Layout.fillWidth: true wrapMode: Text.Wrap diff --git a/src/imports/mvvmdatasyncquick/IdentityEditView11.qml b/src/imports/mvvmdatasyncquick/IdentityEditView11.qml deleted file mode 100644 index ac6e1f1..0000000 --- a/src/imports/mvvmdatasyncquick/IdentityEditView11.qml +++ /dev/null @@ -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; }) -} diff --git a/src/imports/mvvmdatasyncquick/NetworkExchangeView.qml b/src/imports/mvvmdatasyncquick/NetworkExchangeView.qml index bbb5873..3c462f0 100644 --- a/src/imports/mvvmdatasyncquick/NetworkExchangeView.qml +++ b/src/imports/mvvmdatasyncquick/NetworkExchangeView.qml @@ -1,12 +1,11 @@ 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.0 -import de.skycoder42.QtMvvm.Quick 1.0 -import de.skycoder42.QtMvvm.DataSync.Core 1.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 * @@ -43,15 +42,19 @@ Page { Pane { anchors.fill: parent + + ColorHelper { + id: helper + } + ColumnLayout { id: _layout anchors.fill: parent - Label { + DecorLabel { text: qsTr("Port:") Layout.fillWidth: true - color: _portEdit.focus ? _nameEdit.selectionColor : palette.text - opacity: _portEdit.focus ? 1 : 0.5 + edit: _portEdit } SpinBox { @@ -69,11 +72,10 @@ Page { } } - Label { + DecorLabel { text: qsTr("Name:") Layout.fillWidth: true - color: _nameEdit.focus ? _nameEdit.selectionColor : palette.text - opacity: _nameEdit.focus ? 1 : 0.5 + edit: _nameEdit } TextField { @@ -92,14 +94,7 @@ Page { Layout.fillWidth: true Layout.minimumHeight: 1 Layout.maximumHeight: 1 - color: { - if(QuickPresenter.currentStyle === "Material") - return Material.foreground; - else if(QuickPresenter.currentStyle === "Universal") - return Universal.foreground; - else - return "black"; - } + color: helper.text } Switch { diff --git a/src/imports/mvvmdatasyncquick/NetworkExchangeView11.qml b/src/imports/mvvmdatasyncquick/NetworkExchangeView11.qml deleted file mode 100644 index 3c462f0..0000000 --- a/src/imports/mvvmdatasyncquick/NetworkExchangeView11.qml +++ /dev/null @@ -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{Injected} - * - * @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) - } - } - } - } - } -} diff --git a/src/imports/mvvmdatasyncquick/SubButton.qml b/src/imports/mvvmdatasyncquick/SubButton.qml deleted file mode 100644 index 495601f..0000000 --- a/src/imports/mvvmdatasyncquick/SubButton.qml +++ /dev/null @@ -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 - } - } - } - ] -} diff --git a/src/imports/mvvmdatasyncquick/mvvmdatasyncquick.pro b/src/imports/mvvmdatasyncquick/mvvmdatasyncquick.pro index ddab1b9..7900106 100644 --- a/src/imports/mvvmdatasyncquick/mvvmdatasyncquick.pro +++ b/src/imports/mvvmdatasyncquick/mvvmdatasyncquick.pro @@ -13,17 +13,11 @@ SOURCES += \ qtmvvmdatasyncquick_plugin.cpp QML_FILES += \ - SubButton.qml \ DataSyncView.qml \ - DataSyncView11.qml \ NetworkExchangeView.qml \ - NetworkExchangeView11.qml \ IdentityEditView.qml \ - IdentityEditView11.qml \ ExportSetupView.qml \ - ExportSetupView11.qml \ - ChangeRemoteView.qml \ - ChangeRemoteView11.qml + ChangeRemoteView.qml RESOURCES += \ qtmvvmdatasyncquick_plugin.qrc diff --git a/src/imports/mvvmdatasyncquick/qmldir b/src/imports/mvvmdatasyncquick/qmldir index 0f33ba1..d99fe02 100644 --- a/src/imports/mvvmdatasyncquick/qmldir +++ b/src/imports/mvvmdatasyncquick/qmldir @@ -5,17 +5,10 @@ typeinfo plugins.qmltypes depends de.skycoder42.QtMvvm.DataSync.Core 1.0 depends de.skycoder42.QtMvvm.Quick 1.0 -internal SubButton SubButton.qml - IdentityEditView 1.0 IdentityEditView.qml -IdentityEditView 1.1 IdentityEditView11.qml ExportSetupView 1.0 ExportSetupView.qml -ExportSetupView 1.1 ExportSetupView11.qml ChangeRemoteView 1.0 ChangeRemoteView.qml -ChangeRemoteView 1.1 ChangeRemoteView11.qml DataSyncView 1.0 DataSyncView.qml -DataSyncView 1.1 DataSyncView11.qml NetworkExchangeView 1.0 NetworkExchangeView.qml -NetworkExchangeView 1.1 NetworkExchangeView11.qml diff --git a/src/imports/mvvmquick/ActionButton.qml b/src/imports/mvvmquick/ActionButton.qml index 78ca657..a7c7843 100644 --- a/src/imports/mvvmquick/ActionButton.qml +++ b/src/imports/mvvmquick/ActionButton.qml @@ -1,6 +1,6 @@ import QtQuick 2.10 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 * @@ -28,11 +28,16 @@ ToolButton { display: AbstractButton.IconOnly implicitHeight: 48 - implicitWidth: 48 + //implicitWidth: 48 icon.width: 24 icon.height: 24 + ColorHelper { + id: helper + } + icon.color: helper.text + ToolTip.visible: pressed && _toolButton.toolTip != "" ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval ToolTip.text: _toolButton.toolTip diff --git a/src/imports/mvvmquick/AndroidFileDialog.qml b/src/imports/mvvmquick/AndroidFileDialog.qml index 84ac553..a17ac27 100644 --- a/src/imports/mvvmquick/AndroidFileDialog.qml +++ b/src/imports/mvvmquick/AndroidFileDialog.qml @@ -1,6 +1,6 @@ import QtQuick 2.10 -import de.skycoder42.QtMvvm.Core 1.0 -import de.skycoder42.QtMvvm.Quick 1.0 +import de.skycoder42.QtMvvm.Core 1.1 +import de.skycoder42.QtMvvm.Quick 1.1 FileChooser { id: _fileChooser diff --git a/src/imports/mvvmquick/AndroidFolderDialog.qml b/src/imports/mvvmquick/AndroidFolderDialog.qml index 3a9810b..b13af89 100644 --- a/src/imports/mvvmquick/AndroidFolderDialog.qml +++ b/src/imports/mvvmquick/AndroidFolderDialog.qml @@ -1,6 +1,6 @@ import QtQuick 2.10 -import de.skycoder42.QtMvvm.Core 1.0 -import de.skycoder42.QtMvvm.Quick 1.0 +import de.skycoder42.QtMvvm.Core 1.1 +import de.skycoder42.QtMvvm.Quick 1.1 FileChooser { id: _folderChooser diff --git a/src/imports/mvvmquick/ContrastToolBar.qml b/src/imports/mvvmquick/ContrastToolBar.qml index c6a09a0..abf5abb 100644 --- a/src/imports/mvvmquick/ContrastToolBar.qml +++ b/src/imports/mvvmquick/ContrastToolBar.qml @@ -1,6 +1,7 @@ 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 * @@ -16,30 +17,10 @@ ToolBar { height: 56 - /*! @brief Calculates the optimal text color based on the background color - * - * @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. - */ + // @copydoc QuickPresenter::accentTextColor function accentTextColor(accentColor, baseColor) { - var a = (0.299 * accentColor.r + 0.587 * accentColor.g + 0.144 * accentColor.b); - 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"; + return QuickPresenter.accentTextColor(accentColor, baseColor); } - Material.foreground: accentTextColor(Material.primary) + Material.foreground: QuickPresenter.accentTextColor(Material.primary, Material.foreground) } diff --git a/src/imports/mvvmquick/ContrastToolBar11.qml b/src/imports/mvvmquick/ContrastToolBar11.qml deleted file mode 100644 index abf5abb..0000000 --- a/src/imports/mvvmquick/ContrastToolBar11.qml +++ /dev/null @@ -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) -} diff --git a/src/imports/mvvmquick/DateEdit.qml b/src/imports/mvvmquick/DateEdit.qml index fae957f..15b0a89 100644 --- a/src/imports/mvvmquick/DateEdit.qml +++ b/src/imports/mvvmquick/DateEdit.qml @@ -98,12 +98,22 @@ ListView { DayOfWeekRow { Layout.fillWidth: true + delegate: Label { + text: model.shortName + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } } WeekNumberColumn { month: model.month year: model.year Layout.fillHeight: true + delegate: Label { + text: model.weekNumber + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } } MonthGrid { @@ -128,7 +138,7 @@ ListView { opacity: model.month === grid.month ? 1 : 0.5 text: model.day font: grid.font - color: isCurrent ? QuickPresenter.accentTextColor(highlightColor, palette.text) : palette.text + color: isCurrent ? QuickPresenter.accentTextColor(highlightColor, helper.text) : helper.text background: Rectangle { readonly property double size: Math.max(dayDelegate.width, dayDelegate.height) * 1.2 diff --git a/src/imports/mvvmquick/FileDialog.qml b/src/imports/mvvmquick/FileDialog.qml index 2b0f652..deb5706 100644 --- a/src/imports/mvvmquick/FileDialog.qml +++ b/src/imports/mvvmquick/FileDialog.qml @@ -1,8 +1,8 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 import Qt.labs.platform 1.0 as Labs -import de.skycoder42.QtMvvm.Core 1.0 -import de.skycoder42.QtMvvm.Quick 1.0 +import de.skycoder42.QtMvvm.Core 1.1 +import de.skycoder42.QtMvvm.Quick 1.1 /*! @brief A file dialog implementation based on the labs file dialog * diff --git a/src/imports/mvvmquick/FolderDialog.qml b/src/imports/mvvmquick/FolderDialog.qml index 842e3b8..67a3712 100644 --- a/src/imports/mvvmquick/FolderDialog.qml +++ b/src/imports/mvvmquick/FolderDialog.qml @@ -1,8 +1,8 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 import Qt.labs.platform 1.0 as Labs -import de.skycoder42.QtMvvm.Core 1.0 -import de.skycoder42.QtMvvm.Quick 1.0 +import de.skycoder42.QtMvvm.Core 1.1 +import de.skycoder42.QtMvvm.Quick 1.1 /*! @brief A folder dialog implementation based on the labs folder dialog * diff --git a/src/imports/mvvmquick/InputDialog.qml b/src/imports/mvvmquick/InputDialog.qml index 0f65a3f..034b254 100644 --- a/src/imports/mvvmquick/InputDialog.qml +++ b/src/imports/mvvmquick/InputDialog.qml @@ -1,7 +1,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.3 -import de.skycoder42.QtMvvm.Quick 1.0 +import de.skycoder42.QtMvvm.Quick 1.1 MsgBoxBase { id: _inputDialog diff --git a/src/imports/mvvmquick/MenuButton.qml b/src/imports/mvvmquick/MenuButton.qml index 45ba345..f11b401 100644 --- a/src/imports/mvvmquick/MenuButton.qml +++ b/src/imports/mvvmquick/MenuButton.qml @@ -1,6 +1,6 @@ import QtQuick 2.10 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 * diff --git a/src/imports/mvvmquick/PresenterProgress.qml b/src/imports/mvvmquick/PresenterProgress.qml index a3f161c..031d3b6 100644 --- a/src/imports/mvvmquick/PresenterProgress.qml +++ b/src/imports/mvvmquick/PresenterProgress.qml @@ -1,6 +1,6 @@ import QtQuick 2.10 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 * presenters view loading progress diff --git a/src/imports/mvvmquick/RoundActionButton.qml b/src/imports/mvvmquick/RoundActionButton.qml index f2dd840..db43330 100644 --- a/src/imports/mvvmquick/RoundActionButton.qml +++ b/src/imports/mvvmquick/RoundActionButton.qml @@ -1,6 +1,6 @@ import QtQuick 2.10 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 * diff --git a/src/imports/mvvmquick/SectionListView.qml b/src/imports/mvvmquick/SectionListView.qml index 8665fb0..53bb8da 100644 --- a/src/imports/mvvmquick/SectionListView.qml +++ b/src/imports/mvvmquick/SectionListView.qml @@ -1,7 +1,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.3 -import de.skycoder42.QtMvvm.Quick 1.0 +import de.skycoder42.QtMvvm.Quick 1.1 ListView { id: _listView diff --git a/src/imports/mvvmquick/SettingsView.qml b/src/imports/mvvmquick/SettingsView.qml index ed08edd..a87c34d 100644 --- a/src/imports/mvvmquick/SettingsView.qml +++ b/src/imports/mvvmquick/SettingsView.qml @@ -1,8 +1,8 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.3 -import de.skycoder42.QtMvvm.Core 1.0 -import de.skycoder42.QtMvvm.Quick 1.0 +import de.skycoder42.QtMvvm.Core 1.1 +import de.skycoder42.QtMvvm.Quick 1.1 /*! @brief The view implementation for the QtMvvm::SettingsViewModel * @@ -66,37 +66,15 @@ Page { anchors.fill: parent spacing: 0 - Item { - id: _labelContainer + SearchBar { + id: _searchBar Layout.fillWidth: true Layout.fillHeight: true - Layout.leftMargin: 16 - ToolBarLabel { - id: _titleLabel - anchors.fill: parent - 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() + title: qsTr("Settings") + allowSearch: _builder.allowSearch + searchToolTip: qsTr("Search in settings") } 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 {} StackView { @@ -265,7 +142,7 @@ Page { id: _builder buildView: _settingsView viewModel: _settingsView.viewModel - filterText: _searchField.text + filterText: _searchBar.searchText onPresentOverview: _overviewComponent.incubateObject(_settingsStack, { model: model, diff --git a/src/imports/mvvmquick/SettingsView11.qml b/src/imports/mvvmquick/SettingsView11.qml deleted file mode 100644 index a87c34d..0000000 --- a/src/imports/mvvmquick/SettingsView11.qml +++ /dev/null @@ -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{Injected} - * - * @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(); - } - } -} diff --git a/src/imports/mvvmquick/TintIcon.qml b/src/imports/mvvmquick/TintIcon.qml index bde56e2..a873ecb 100644 --- a/src/imports/mvvmquick/TintIcon.qml +++ b/src/imports/mvvmquick/TintIcon.qml @@ -8,6 +8,7 @@ Item { property alias icon: _imgBtn.icon property alias source: _imgBtn.icon.source + property alias color: _imgBtn.icon.color implicitWidth: _imgBtn.icon.width implicitHeight: _imgBtn.icon.height @@ -25,6 +26,11 @@ Item { padding: 0 anchors.fill: parent + ColorHelper { + id: helper + } + icon.color: helper.text + background: Item {} } } diff --git a/src/imports/mvvmquick/mvvmquick.pro b/src/imports/mvvmquick/mvvmquick.pro index b92db8d..2edcec2 100644 --- a/src/imports/mvvmquick/mvvmquick.pro +++ b/src/imports/mvvmquick/mvvmquick.pro @@ -37,7 +37,6 @@ QML_FILES += \ TintIcon.qml \ AlertDialog.qml \ ContrastToolBar.qml \ - ContrastToolBar11.qml \ ToolBarLabel.qml \ ActionButton.qml \ RoundActionButton.qml \ @@ -50,7 +49,6 @@ QML_FILES += \ SectionListView.qml \ OverviewListView.qml \ SettingsView.qml \ - SettingsView11.qml \ SearchBar.qml \ RoundMenuButton.qml \ DecorLabel.qml \ diff --git a/src/imports/mvvmquick/qmldir b/src/imports/mvvmquick/qmldir index f678df0..100f1c1 100644 --- a/src/imports/mvvmquick/qmldir +++ b/src/imports/mvvmquick/qmldir @@ -22,7 +22,6 @@ ColorHelper 1.1 ColorHelper.qml AlertDialog 1.0 AlertDialog.qml ContrastToolBar 1.0 ContrastToolBar.qml -ContrastToolBar 1.1 ContrastToolBar11.qml ToolBarLabel 1.0 ToolBarLabel.qml ActionButton 1.0 ActionButton.qml RoundActionButton 1.0 RoundActionButton.qml @@ -47,7 +46,6 @@ DialogPresenter 1.1 DialogPresenter11.qml PresentingDrawer 1.0 PresentingDrawer.qml SettingsView 1.0 SettingsView.qml -SettingsView 1.1 SettingsView11.qml QtMvvmApp 1.0 QtMvvmApp.qml QtMvvmApp 1.1 QtMvvmApp11.qml diff --git a/tests/auto/mvvmcore/settingsgenerator/test_de.ts b/tests/auto/mvvmcore/settingsgenerator/test_de.ts index 8f6b9d9..2303444 100644 --- a/tests/auto/mvvmcore/settingsgenerator/test_de.ts +++ b/tests/auto/mvvmcore/settingsgenerator/test_de.ts @@ -9,4 +9,44 @@ + + generatortest.xml + + + translate me + + + + + import_config.xml + + + 42 + + + + + import_normal.xml + + + false + + + + + some_context + + + Hello World + + + + + translatortest.xml + + + dummy + + + diff --git a/tests/auto/testrun.pri b/tests/auto/testrun.pri index 50ecab2..f655a2b 100644 --- a/tests/auto/testrun.pri +++ b/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)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)@if exist fail exit 1 + runtarget.commands += $$escape_expand(\\n\\t)@if exist fail exit 42 QMAKE_EXTRA_TARGETS += runtarget } } else {