mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 06:24:20 +02:00
Merge pull request #9224 from fayeli/friday
Tablet Main Screen QML Iteration 2
This commit is contained in:
commit
f808c0232f
2 changed files with 151 additions and 100 deletions
interface/resources/qml/hifi/tablet
|
@ -49,17 +49,17 @@ Item {
|
|||
}
|
||||
|
||||
Rectangle {
|
||||
id: bgAudio
|
||||
id: bgTopBar
|
||||
height: 90
|
||||
gradient: Gradient {
|
||||
GradientStop {
|
||||
position: 0
|
||||
color: "#6b6b6b"
|
||||
color: "#2b2b2b"
|
||||
}
|
||||
|
||||
GradientStop {
|
||||
position: 1
|
||||
color: "#595959"
|
||||
color: "#1e1e1e"
|
||||
}
|
||||
}
|
||||
anchors.right: parent.right
|
||||
|
@ -80,50 +80,6 @@ Item {
|
|||
anchors.right: parent.right
|
||||
spacing: 5
|
||||
|
||||
Rectangle {
|
||||
id: muteButton
|
||||
width: 128
|
||||
height: 40
|
||||
color: "#464646"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Text {
|
||||
id: muteText
|
||||
color: "#ffffff"
|
||||
text: "MUTE"
|
||||
z: 1
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
font.pixelSize: 16
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font.bold: true
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onEntered: {
|
||||
console.log("Mute Botton Hovered!");
|
||||
parent.color = "#2d2d2d";
|
||||
parent.border.width = 2;
|
||||
parent.border.color = "#ffffff";
|
||||
}
|
||||
onExited: {
|
||||
console.log("Mute Botton Unhovered!");
|
||||
parent.color = "#464646";
|
||||
parent.border.width = 0;
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
console.log("Mute Button Clicked! current tablet state: " + tablet.state );
|
||||
if (tablet.state === "muted state") {
|
||||
tablet.state = "base state";
|
||||
} else {
|
||||
tablet.state = "muted state";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
id: muteIcon
|
||||
width: 40
|
||||
|
@ -180,13 +136,13 @@ Item {
|
|||
gradient: Gradient {
|
||||
GradientStop {
|
||||
position: 0
|
||||
color: "#787878"
|
||||
color: "#2b2b2b"
|
||||
|
||||
}
|
||||
|
||||
GradientStop {
|
||||
position: 1
|
||||
color: "#000000"
|
||||
color: "#0f212e"
|
||||
}
|
||||
}
|
||||
anchors.bottom: parent.bottom
|
||||
|
@ -195,12 +151,12 @@ Item {
|
|||
anchors.rightMargin: 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
anchors.top: bgAudio.bottom
|
||||
anchors.top: bgTopBar.bottom
|
||||
anchors.topMargin: 0
|
||||
|
||||
Flow {
|
||||
id: flowMain
|
||||
spacing: 12
|
||||
spacing: 16
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 30
|
||||
anchors.left: parent.left
|
||||
|
@ -215,30 +171,20 @@ Item {
|
|||
console.log("Tablet.onCompleted!");
|
||||
var component = Qt.createComponent("TabletButton.qml");
|
||||
var buttons = [];
|
||||
for (var i = 0; i < 9; i++) {
|
||||
for (var i = 0; i < 5; i++) {
|
||||
buttons.push(component.createObject(flowMain));
|
||||
}
|
||||
|
||||
// set button color
|
||||
var green = "#1FC6A6";
|
||||
var lightblue = "#00B4EF";
|
||||
buttons[3].color = lightblue;
|
||||
buttons[4].color = lightblue;
|
||||
buttons[5].color = lightblue;
|
||||
buttons[6].color = green;
|
||||
buttons[7].color = green;
|
||||
buttons[8].color = green;
|
||||
|
||||
// set button text
|
||||
buttons[0].text = "GO TO";
|
||||
buttons[1].text = "BUBBLE";
|
||||
buttons[0].text = "MUTE";
|
||||
buttons[1].text = "VR";
|
||||
buttons[2].text = "MENU";
|
||||
buttons[3].text = "MARKET";
|
||||
buttons[4].text = "SWITCH";
|
||||
buttons[5].text = "PAUSE";
|
||||
buttons[6].text = "EDIT";
|
||||
buttons[7].text = "SNAP";
|
||||
buttons[8].text = "SCRIPTS";
|
||||
buttons[3].text = "BUBBLE";
|
||||
buttons[4].text = "SNAP";
|
||||
buttons[5].text = "HELP";
|
||||
|
||||
// set button icon
|
||||
buttons[0].icon = "icons/tablet-mute-icon.svg"
|
||||
}
|
||||
}
|
||||
states: [
|
||||
|
|
|
@ -3,12 +3,13 @@ import QtGraphicalEffects 1.0
|
|||
|
||||
Item {
|
||||
id: tabletButton
|
||||
property string color: "#1080B8"
|
||||
property var uuid;
|
||||
property string text: "EDIT"
|
||||
property string icon: "icons/edit-icon.svg"
|
||||
property var uuid;
|
||||
width: 132
|
||||
height: 132
|
||||
property bool isActive: false
|
||||
property bool inDebugMode: true
|
||||
width: 129
|
||||
height: 129
|
||||
|
||||
signal clicked()
|
||||
|
||||
|
@ -18,9 +19,9 @@ Item {
|
|||
|
||||
Rectangle {
|
||||
id: buttonBg
|
||||
color: tabletButton.color
|
||||
border.width: 0
|
||||
border.color: "#00000000"
|
||||
color: "#000000"
|
||||
opacity: 0.1
|
||||
radius: 8
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 0
|
||||
anchors.left: parent.left
|
||||
|
@ -31,10 +32,43 @@ Item {
|
|||
anchors.topMargin: 0
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: buttonOutline
|
||||
color: "#00000000"
|
||||
opacity: 0.2
|
||||
radius: 8
|
||||
z: 1
|
||||
border.width: 2
|
||||
border.color: "#ffffff"
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 0
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0
|
||||
}
|
||||
|
||||
DropShadow {
|
||||
id: glow
|
||||
visible: false
|
||||
anchors.fill: parent
|
||||
horizontalOffset: 0
|
||||
verticalOffset: 0
|
||||
color: "#ffffff"
|
||||
radius: 20
|
||||
z: -1
|
||||
samples: 41
|
||||
source: buttonOutline
|
||||
}
|
||||
|
||||
|
||||
Image {
|
||||
id: icon
|
||||
width: 60
|
||||
height: 60
|
||||
width: 50
|
||||
height: 50
|
||||
visible: false
|
||||
anchors.bottom: text.top
|
||||
anchors.bottomMargin: 5
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
@ -42,6 +76,13 @@ Item {
|
|||
source: "../../../" + tabletButton.icon
|
||||
}
|
||||
|
||||
ColorOverlay {
|
||||
id: iconColorOverlay
|
||||
anchors.fill: icon
|
||||
source: icon
|
||||
color: "#ffffff"
|
||||
}
|
||||
|
||||
Text {
|
||||
id: text
|
||||
color: "#ffffff"
|
||||
|
@ -54,29 +95,37 @@ Item {
|
|||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
|
||||
DropShadow {
|
||||
id: dropshadow
|
||||
anchors.fill: parent
|
||||
horizontalOffset: 0
|
||||
verticalOffset: 3
|
||||
color: "#aa000000"
|
||||
radius: 20
|
||||
z: -1
|
||||
samples: 41
|
||||
source: buttonBg
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: tabletButton.clicked();
|
||||
onClicked: {
|
||||
console.log("Tablet Button Clicked!");
|
||||
if (tabletButton.inDebugMode) {
|
||||
if (tabletButton.isActive) {
|
||||
tabletButton.state = "base state";
|
||||
tabletButton.isActive = false;
|
||||
} else {
|
||||
tabletButton.state = "active state";
|
||||
tabletButton.isActive = true;
|
||||
}
|
||||
}
|
||||
tabletButton.clicked();
|
||||
}
|
||||
onEntered: {
|
||||
console.log("Tablet Button Hovered!");
|
||||
tabletButton.state = "hover state";
|
||||
if (tabletButton.isActive) {
|
||||
tabletButton.state = "hover active state";
|
||||
} else {
|
||||
tabletButton.state = "hover state";
|
||||
}
|
||||
}
|
||||
onExited: {
|
||||
console.log("Tablet Button Unhovered!");
|
||||
tabletButton.state = "base state";
|
||||
if (tabletButton.isActive) {
|
||||
tabletButton.state = "active state";
|
||||
} else {
|
||||
tabletButton.state = "base state";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,15 +134,71 @@ Item {
|
|||
name: "hover state"
|
||||
|
||||
PropertyChanges {
|
||||
target: buttonBg
|
||||
border.width: 2
|
||||
border.color: "#ffffff"
|
||||
target: buttonOutline
|
||||
border.color: "#1fc6a6"
|
||||
opacity: 1
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: dropshadow
|
||||
verticalOffset: 0
|
||||
color: "#ffffff"
|
||||
target: glow
|
||||
visible: true
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "active state"
|
||||
|
||||
PropertyChanges {
|
||||
target: buttonOutline
|
||||
border.color: "#1fc6a6"
|
||||
opacity: 1
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: buttonBg
|
||||
color: "#1fc6a6"
|
||||
opacity: 1
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: text
|
||||
color: "#333333"
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: iconColorOverlay
|
||||
color: "#333333"
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "hover active state"
|
||||
|
||||
PropertyChanges {
|
||||
target: glow
|
||||
visible: true
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: buttonOutline
|
||||
border.color: "#ffffff"
|
||||
opacity: 1
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: buttonBg
|
||||
color: "#1fc6a6"
|
||||
opacity: 1
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: text
|
||||
color: "#333333"
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: iconColorOverlay
|
||||
color: "#333333"
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue