9 changed files with 539 additions and 2 deletions
@ -0,0 +1,211 @@ |
|||
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 |
|||
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 |
|||
|
|||
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 |
|||
|
|||
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(); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,74 @@ |
|||
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; }) |
|||
} |
@ -0,0 +1,62 @@ |
|||
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; }) |
|||
} |
@ -0,0 +1,155 @@ |
|||
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::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 |
|||
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: { |
|||
if(QuickPresenter.currentStyle === "Material") |
|||
return Material.foreground; |
|||
else if(QuickPresenter.currentStyle === "Universal") |
|||
return Universal.foreground; |
|||
else |
|||
return "black"; |
|||
} |
|||
} |
|||
|
|||
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) |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,25 @@ |
|||
import QtQuick 2.10 |
|||
import QtQuick.Controls 2.3 |
|||
import QtQuick.Controls.Material 2.3 |
|||
import QtQuick.Controls.Universal 2.3 |
|||
import de.skycoder42.QtMvvm.Quick 1.1 |
|||
|
|||
Label { |
|||
id: _decorLabel |
|||
|
|||
property Item edit: _decorLabel.nextItemInFocusChain() |
|||
|
|||
readonly property bool editHasFocus: edit && edit.focus |
|||
|
|||
function highlightColor() { |
|||
if(QuickPresenter.currentStyle === "Material") |
|||
return Material.accentColor; |
|||
else if(QuickPresenter.currentStyle === "Universal") |
|||
return Universal.accent; |
|||
else |
|||
return palette.highlight; |
|||
} |
|||
|
|||
color: editHasFocus ? highlightColor() : palette.text |
|||
opacity: editHasFocus ? 1 : 0.5 |
|||
} |
Loading…
Reference in new issue