1
0
Fork 0
mirror of https://github.com/kbumsik/VirtScreen.git synced 2025-03-09 15:40:18 +00:00

QML: Switched to use layout instead of anchors

This commit is contained in:
Bumsik Kim 2018-05-14 15:45:39 -04:00
parent ce1debd8ad
commit 67b0e43c89
No known key found for this signature in database
GPG key ID: E31041C8EC5B01C6

View file

@ -18,8 +18,8 @@ ApplicationWindow {
// Material.background: Material.Grey // Material.background: Material.Grey
width: 380 width: 380
height: 525 height: 540
property int margin: 8 property int margin: 10
property int popupWidth: width - 26 property int popupWidth: width - 26
// hide screen when loosing focus // hide screen when loosing focus
@ -113,7 +113,6 @@ ApplicationWindow {
y: parent.height / 2 - height y: parent.height / 2 - height
BusyIndicator { BusyIndicator {
anchors.fill: parent anchors.fill: parent
Material.accent: Material.Cyan
running: true running: true
} }
background: Rectangle { background: Rectangle {
@ -203,21 +202,21 @@ ApplicationWindow {
} }
onRejected: passwordFIeld.text = "" onRejected: passwordFIeld.text = ""
} }
StackLayout { SwipeView {
width: parent.width
anchors.top: tabBar.bottom anchors.top: tabBar.bottom
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: margin
clip: true
currentIndex: tabBar.currentIndex currentIndex: tabBar.currentIndex
ColumnLayout { ColumnLayout {
anchors.fill: parent
anchors.margins: margin
GroupBox { GroupBox {
title: "Virtual Display" title: "Virtual Display"
anchors.left: parent.left Layout.fillWidth: true
anchors.right: parent.right
enabled: backend.virtScreenCreated ? false : true enabled: backend.virtScreenCreated ? false : true
ColumnLayout { ColumnLayout {
anchors.left: parent.left anchors.left: parent.left
@ -294,65 +293,65 @@ ApplicationWindow {
} }
} }
} }
Button {
id: virtScreenButton ColumnLayout {
text: virtScreenAction.text Layout.margins: margin / 2
highlighted: true Button {
anchors.left: parent.left id: virtScreenButton
anchors.right: parent.right Layout.fillWidth: true
// Material.accent: Material.Teal text: virtScreenAction.text
// Material.theme: Material.Dark highlighted: true
enabled: virtScreenAction.enabled enabled: virtScreenAction.enabled
onClicked: { onClicked: {
busyDialog.open(); busyDialog.open();
virtScreenAction.onTriggered(); virtScreenAction.onTriggered();
connectOnce(backend.onVirtScreenCreatedChanged, function(created) { connectOnce(backend.onVirtScreenCreatedChanged, function(created) {
busyDialog.close(); busyDialog.close();
}); });
}
}
Button {
id: displaySettingButton
text: "Open Display Setting"
anchors.left: parent.left
anchors.right: parent.right
// Material.accent: Material.Teal
// Material.theme: Material.Dark
enabled: backend.virtScreenCreated ? true : false
onClicked: {
busyDialog.open();
window.autoClose = false;
if (backend.vncState != Backend.OFF) {
console.log("vnc is running");
var restoreVNC = true;
if (autostart) {
autostart = false;
var restoreAutoStart = true;
}
} }
connectOnce(backend.onDisplaySettingClosed, function() {
window.autoClose = true;
busyDialog.close();
if (restoreAutoStart) {
autostart = true;
}
if (restoreVNC) {
backend.startVNC(settings.vnc.port);
}
});
backend.stopVNC();
backend.openDisplaySetting();
} }
Button {
id: displaySettingButton
Layout.fillWidth: true
text: "Open Display Setting"
enabled: backend.virtScreenCreated ? true : false
onClicked: {
busyDialog.open();
window.autoClose = false;
if (backend.vncState != Backend.OFF) {
console.log("vnc is running");
var restoreVNC = true;
if (autostart) {
autostart = false;
var restoreAutoStart = true;
}
}
connectOnce(backend.onDisplaySettingClosed, function() {
window.autoClose = true;
busyDialog.close();
if (restoreAutoStart) {
autostart = true;
}
if (restoreVNC) {
backend.startVNC(settings.vnc.port);
}
});
backend.stopVNC();
backend.openDisplaySetting();
}
}
}
RowLayout {
// Empty layout
Layout.fillHeight: true
} }
} }
ColumnLayout { ColumnLayout {
anchors.fill: parent
anchors.margins: margin
GroupBox { GroupBox {
title: "VNC Server" title: "VNC Server"
anchors.left: parent.left Layout.fillWidth: true
anchors.right: parent.right
enabled: backend.vncState == Backend.OFF ? true : false enabled: backend.vncState == Backend.OFF ? true : false
ColumnLayout { ColumnLayout {
anchors.left: parent.left anchors.left: parent.left
@ -392,25 +391,19 @@ ApplicationWindow {
} }
} }
} }
Button {
id: vncButton
anchors.left: parent.left
anchors.right: parent.right
anchors.bottomMargin: 0
highlighted: true
text: vncAction.text
enabled: vncAction.enabled
// Material.background: Material.Teal
// Material.foreground: Material.Grey
onClicked: vncAction.onTriggered()
}
RowLayout { RowLayout {
id: autoSwitchLayout Layout.fillWidth: true
anchors.top: vncButton.top Layout.margins: margin / 2
anchors.right: parent.right Button {
anchors.topMargin: vncButton.height - 10 id: vncButton
Label { text: "Auto start"; } Layout.fillWidth: true
Switch { text: vncAction.text
highlighted: true
enabled: vncAction.enabled
onClicked: vncAction.onTriggered()
}
CheckBox {
checked: autostart checked: autostart
onToggled: { onToggled: {
autostart = checked; autostart = checked;
@ -420,22 +413,19 @@ ApplicationWindow {
} }
} }
} }
Label { text: "Auto"; }
} }
GroupBox { GroupBox {
title: "Available IP addresses" title: "Available IP addresses"
anchors.top: autoSwitchLayout.bottom Layout.fillWidth: true
anchors.bottom: parent.bottom implicitHeight: 150
anchors.left: parent.left
anchors.right: parent.right
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
ListView { ListView {
id: ipListView id: ipListView
anchors.fill: parent anchors.fill: parent
// anchors.top: parent.top clip: true
// anchors.left: parent.left
// anchors.right: parent.right
// height: 100
ScrollBar.vertical: ScrollBar { ScrollBar.vertical: ScrollBar {
parent: ipListView.parent parent: ipListView.parent
anchors.top: ipListView.top anchors.top: ipListView.top
@ -454,6 +444,11 @@ ApplicationWindow {
} }
} }
} }
RowLayout {
// Empty layout
Layout.fillHeight: true
}
} }
} }
} }