Skycoder42
6 years ago
34 changed files with 161 additions and 1344 deletions
@ -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(); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
@ -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() |
|||
} |
|||
} |
|||
} |
@ -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; }) |
|||
} |
@ -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; }) |
|||
} |
@ -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) |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
@ -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 |
|||
} |
|||
} |
|||
} |
|||
] |
|||
} |
@ -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) |
|||
} |
@ -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(); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue