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

Moved virtual screen device to advanced

This commit is contained in:
Bumsik Kim 2018-05-31 19:53:17 -04:00
parent 7f3448a25e
commit 710864a44d
No known key found for this signature in database
GPG key ID: E31041C8EC5B01C6
7 changed files with 145 additions and 53 deletions

View file

@ -277,6 +277,17 @@ ApplicationWindow {
}
}
Loader {
id: displayOptionsLoader
active: false
source: "DisplayOptionsDialog.qml"
onLoaded: {
item.onClosed.connect(function() {
displayOptionsLoader.active = false;
});
}
}
Loader {
id: vncOptionsLoader
active: false

View file

@ -0,0 +1,70 @@
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.3
import QtQuick.Layouts 1.3
Dialog {
title: "Display Options"
focus: true
modal: true
visible: true
standardButtons: Dialog.Ok
x: (window.width - width) / 2
y: (window.width - height) / 2
width: popupWidth
height: 250
ColumnLayout {
anchors.fill: parent
RowLayout {
anchors.left: parent.left
anchors.right: parent.right
Label { id: deviceLabel; text: "Device"; }
ComboBox {
id: deviceComboBox
anchors.left: deviceLabel.right
anchors.right: parent.right
anchors.leftMargin: 100
textRole: "name"
model: backend.screens
currentIndex: {
if (settings.virt.device) {
for (var i = 0; i < model.length; i++) {
if (model[i].name == settings.virt.device) {
return i;
}
}
}
settings.virt.device = '';
return -1;
}
onActivated: function(index) {
settings.virt.device = model[index].name;
}
delegate: ItemDelegate {
width: deviceComboBox.width
text: modelData.name
font.weight: deviceComboBox.currentIndex === index ? Font.Bold : Font.Normal
enabled: modelData.connected ? false : true
}
}
}
Text {
font { pointSize: 10 }
wrapMode: Text.WordWrap
text: "<b>Warning</b>: Edit only if 'VIRTUAL1' is not available<br/>" +
"If so, please note that the virtual screen may be<br/>" +
"unstable/unavailable depending on a graphic<br/>" +
"card and its driver."
}
RowLayout {
// Empty layout
Layout.fillHeight: true
}
}
onAccepted: {}
onRejected: {}
}

View file

@ -59,26 +59,14 @@ ColumnLayout {
}
}
RowLayout {
anchors.left: parent.left
anchors.right: parent.right
Label { id: deviceLabel; text: "Device"; }
ComboBox {
id: deviceComboBox
anchors.left: deviceLabel.right
anchors.right: parent.right
anchors.leftMargin: 100
textRole: "name"
model: backend.screens
currentIndex: backend.virtScreenIndex
onActivated: function(index) {
backend.virtScreenIndex = index
}
delegate: ItemDelegate {
width: deviceComboBox.width
text: modelData.name
font.weight: deviceComboBox.currentIndex === index ? Font.Bold : Font.Normal
enabled: modelData.connected ? false : true
}
Layout.alignment: Qt.AlignRight
Button {
text: "Advanced"
font.capitalization: Font.MixedCase
onClicked: displayOptionsLoader.active = true;
background.opacity : 0
onHoveredChanged: hovered ? background.opacity = 0.4
:background.opacity = 0;
}
}
}

View file

@ -4,7 +4,6 @@ import QtQuick.Controls.Material 2.3
import QtQuick.Layouts 1.3
Dialog {
id: preferenceDialog
title: "VNC Options"
focus: true
modal: true

View file

@ -84,7 +84,7 @@ ColumnLayout {
GroupBox {
title: "Available IP addresses"
Layout.fillWidth: true
implicitHeight: 150
implicitHeight: 145
ColumnLayout {
anchors.fill: parent
ListView {

View file

@ -10,6 +10,12 @@ Item {
property var settings: JSON.parse(backend.settings)
property bool autostart: settings.vnc.autostart
function createVirtScreen () {
backend.createVirtScreen(settings.virt.device, settings.virt.width,
settings.virt.height, settings.virt.portrait,
settings.virt.hidpi);
}
function startVNC () {
var options = '';
var data = settings.x11vncOptions;
@ -185,8 +191,7 @@ Item {
// Give a very short delay to show busyDialog.
timer.setTimeout (function() {
if (!backend.virtScreenCreated) {
backend.createVirtScreen(settings.virt.width, settings.virt.height,
settings.virt.portrait, settings.virt.hidpi);
createVirtScreen();
} else {
// If auto start enabled, stop VNC first then
if (autostart && (backend.vncState != Backend.OFF)) {