mirror of
https://github.com/kbumsik/VirtScreen.git
synced 2025-03-09 15:40:18 +00:00
Preference: Selecting preferred display settings app
This commit is contained in:
parent
6436dbd8ff
commit
34f8847f67
3 changed files with 47 additions and 2 deletions
|
|
@ -76,8 +76,7 @@ ColumnLayout {
|
||||||
delegate: ItemDelegate {
|
delegate: ItemDelegate {
|
||||||
width: deviceComboBox.width
|
width: deviceComboBox.width
|
||||||
text: modelData.name
|
text: modelData.name
|
||||||
font.weight: deviceComboBox.currentIndex === index ? Font.DemiBold : Font.Normal
|
font.weight: deviceComboBox.currentIndex === index ? Font.Bold : Font.Normal
|
||||||
highlighted: ListView.isCurrentItem
|
|
||||||
enabled: modelData.connected ? false : true
|
enabled: modelData.connected ? false : true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,16 +12,19 @@
|
||||||
},
|
},
|
||||||
"displaySettingApps": {
|
"displaySettingApps": {
|
||||||
"gnome": {
|
"gnome": {
|
||||||
|
"value": "gnome",
|
||||||
"name": "GNOME",
|
"name": "GNOME",
|
||||||
"args": "gnome-control-center display",
|
"args": "gnome-control-center display",
|
||||||
"XDG_CURRENT_DESKTOP": ["gnome", "unity"]
|
"XDG_CURRENT_DESKTOP": ["gnome", "unity"]
|
||||||
},
|
},
|
||||||
"kde": {
|
"kde": {
|
||||||
|
"value": "kde",
|
||||||
"name": "KDE",
|
"name": "KDE",
|
||||||
"args": "kcmshell5 kcm_kscreen",
|
"args": "kcmshell5 kcm_kscreen",
|
||||||
"XDG_CURRENT_DESKTOP": ["kde"]
|
"XDG_CURRENT_DESKTOP": ["kde"]
|
||||||
},
|
},
|
||||||
"arandr": {
|
"arandr": {
|
||||||
|
"value": "arandr",
|
||||||
"name": "ARandR",
|
"name": "ARandR",
|
||||||
"args": "arandr",
|
"args": "arandr",
|
||||||
"XDG_CURRENT_DESKTOP": []
|
"XDG_CURRENT_DESKTOP": []
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,46 @@ Dialog {
|
||||||
x: (window.width - width) / 2
|
x: (window.width - width) / 2
|
||||||
y: (window.width - height) / 2
|
y: (window.width - height) / 2
|
||||||
width: popupWidth
|
width: popupWidth
|
||||||
|
height: 250
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
var request = new XMLHttpRequest();
|
||||||
|
request.open('GET', 'data.json');
|
||||||
|
request.onreadystatechange = function(event) {
|
||||||
|
if (request.readyState == XMLHttpRequest.DONE) {
|
||||||
|
var data = JSON.parse(request.responseText).displaySettingApps;
|
||||||
|
var combobox = displaySettingAppComboBox;
|
||||||
|
combobox.model = Object.keys(data).map(function(k){return data[k]});
|
||||||
|
combobox.currentIndex = Object.keys(data).indexOf(settings.displaySettingApp);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
request.send();
|
||||||
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
Label { id: displaySettingAppLabel; text: "Display setting program"; }
|
||||||
|
ComboBox {
|
||||||
|
id: displaySettingAppComboBox
|
||||||
|
anchors.left: displaySettingAppLabel.right
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.leftMargin: 10
|
||||||
|
textRole: "name"
|
||||||
|
onActivated: function(index) {
|
||||||
|
settings.displaySettingApp = model[index].value;
|
||||||
|
}
|
||||||
|
delegate: ItemDelegate {
|
||||||
|
width: parent.width
|
||||||
|
text: modelData.name
|
||||||
|
font.weight: displaySettingAppComboBox.currentIndex === index ? Font.Bold : Font.Normal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
@ -52,6 +90,11 @@ Dialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
// Empty layout
|
||||||
|
Layout.fillHeight: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onAccepted: {}
|
onAccepted: {}
|
||||||
onRejected: {}
|
onRejected: {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue