bring qml to standard

This commit is contained in:
Zach Pomerantz 2017-06-14 10:25:41 -04:00
parent b24681125d
commit bc44e7beaf
2 changed files with 63 additions and 71 deletions

View file

@ -21,65 +21,56 @@ import "../../windows"
import "./" as Audio import "./" as Audio
Rectangle { Rectangle {
id: audio; id: root;
HifiConstants { id: hifi; } HifiConstants { id: hifi; }
property var eventBridge; property var eventBridge;
property string title: "Audio Settings - " + Audio.context property string title: "Audio Settings - " + Audio.context;
signal sendToScript(var message); signal sendToScript(var message);
color: hifi.colors.baseGray; color: hifi.colors.baseGray;
// only show the title if loaded through a "loader" // only show the title if loaded through a "loader"
function showTitle() { function showTitle() {
return audio.parent.objectName == "loader"; return root.parent.objectName == "loader";
} }
Column { Column {
y: 16 // padding does not work y: 16; // padding does not work
spacing: 16 spacing: 16;
width: parent.width width: parent.width;
RalewayRegular { RalewayRegular {
x: 16 // padding does not work x: 16; // padding does not work
size: 16 size: 16;
color: "white" color: "white";
text: audio.title text: root.title;
visible: audio.showTitle() visible: root.showTitle();
} }
Separator { visible: audio.showTitle() } Separator { visible: root.showTitle() }
Grid { Grid {
columns: 2 columns: 2;
x: 16 // padding does not work x: 16; // padding does not work
spacing: 16 spacing: 16;
Audio.CheckBox { Audio.CheckBox {
text: qsTr("Mute microphone"); text: qsTr("Mute microphone");
checked: Audio.muted checked: Audio.muted;
onClicked: { onCheckedChanged: { Audio.muted = checked; }
Audio.muted = checked;
checked = Qt.binding(function() { return Audio.muted; }); // restore binding
}
} }
Audio.CheckBox { Audio.CheckBox {
text: qsTr("Enable noise reduction"); text: qsTr("Enable noise reduction");
checked: Audio.noiseReduction checked: Audio.noiseReduction;
onClicked: { onCheckedChanged: { Audio.noiseReduction = checked; }
Audio.noiseReduction = checked;
checked = Qt.binding(function() { return Audio.noiseReduction; }); // restore binding
}
} }
Audio.CheckBox { Audio.CheckBox {
text: qsTr("Show audio level meter"); text: qsTr("Show audio level meter");
checked: AvatarInputs.showAudioTools checked: AvatarInputs.showAudioTools;
onClicked: { onCheckedChanged: { AvatarInputs.showAudioTools = checked; }
AvatarInputs.showAudioTools = checked;
checked = Qt.binding(function() { return AvatarInputs.showAudioTools }); // restore binding
}
} }
} }
@ -87,32 +78,32 @@ Rectangle {
RowLayout { RowLayout {
HiFiGlyphs { HiFiGlyphs {
text: hifi.glyphs.mic text: hifi.glyphs.mic;
color: hifi.colors.primaryHighlight color: hifi.colors.primaryHighlight;
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter;
size: 28 size: 28;
} }
RalewayRegular { RalewayRegular {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter;
size: 16 size: 16;
color: "#AFAFAF" color: hifi.colors.lightGrayText;
text: qsTr("CHOOSE INPUT DEVICE") text: qsTr("CHOOSE INPUT DEVICE");
} }
} }
ListView { ListView {
anchors { left: parent.left; right: parent.right; leftMargin: 70 } anchors { left: parent.left; right: parent.right; leftMargin: 70 }
height: 125 height: 125;
spacing: 0 spacing: 0;
snapMode: ListView.SnapToItem snapMode: ListView.SnapToItem;
clip: true clip: true;
model: Audio.devices.input model: Audio.devices.input;
delegate: Item { delegate: Item {
width: parent.width width: parent.width;
height: 36 height: 36;
Audio.CheckBox { Audio.CheckBox {
text: display; text: display;
checked: selected checked: selected;
onClicked: { onClicked: {
selected = checked; selected = checked;
checked = Qt.binding(function() { return selected; }); // restore binding checked = Qt.binding(function() { return selected; }); // restore binding
@ -125,32 +116,32 @@ Rectangle {
RowLayout { RowLayout {
HiFiGlyphs { HiFiGlyphs {
text: hifi.glyphs.unmuted text: hifi.glyphs.unmuted;
color: hifi.colors.primaryHighlight color: hifi.colors.primaryHighlight;
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter;
size: 36 size: 36;
} }
RalewayRegular { RalewayRegular {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter;
size: 16 size: 16;
color: "#AFAFAF" color: hifi.colors.lightGrayText;
text: qsTr("CHOOSE OUTPUT DEVICE") text: qsTr("CHOOSE OUTPUT DEVICE");
} }
} }
ListView { ListView {
anchors { left: parent.left; right: parent.right; leftMargin: 70 } anchors { left: parent.left; right: parent.right; leftMargin: 70 }
height: 125 height: 125;
spacing: 0 spacing: 0;
snapMode: ListView.SnapToItem snapMode: ListView.SnapToItem;
clip: true clip: true;
model: Audio.devices.output model: Audio.devices.output;
delegate: Item { delegate: Item {
width: parent.width width: parent.width;
height: 36 height: 36;
Audio.CheckBox { Audio.CheckBox {
text: display; text: display;
checked: selected checked: selected;
onClicked: { onClicked: {
selected = checked; selected = checked;
checked = Qt.binding(function() { return selected; }); // restore binding checked = Qt.binding(function() { return selected; }); // restore binding

View file

@ -12,15 +12,16 @@ import "../../windows"
import "../audio" import "../audio"
ScrollingWindow { ScrollingWindow {
resizable: true id: root;
destroyOnHidden: true
width: 400
height: 577
minSize: Qt.vector2d(400, 500)
Audio { id: audioDialog; width: audio.width } resizable: true;
destroyOnHidden: true;
width: 400;
height: 577;
minSize: Qt.vector2d(400, 500);
id: audio Audio { id: audio; width: root.width }
objectName: "AudioDialog"
title: audioDialog.title objectName: "AudioDialog";
title: audio.title;
} }