From 05e251eba4f5e2d77524df1bf64e0cd32cc41df3 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 30 May 2015 12:01:50 -0700 Subject: [PATCH] Add icon to address bar dialog --- .../resources/images/address-bar-icon.svg | 63 +++++++++++++++++++ .../images/address-bar-submit-active.svg | 18 ------ .../resources/images/address-bar-submit.svg | 18 ------ interface/resources/qml/AddressBarDialog.qml | 48 +++++++++++--- 4 files changed, 102 insertions(+), 45 deletions(-) create mode 100644 interface/resources/images/address-bar-icon.svg delete mode 100644 interface/resources/images/address-bar-submit-active.svg delete mode 100644 interface/resources/images/address-bar-submit.svg diff --git a/interface/resources/images/address-bar-icon.svg b/interface/resources/images/address-bar-icon.svg new file mode 100644 index 0000000000..a6d67aabae --- /dev/null +++ b/interface/resources/images/address-bar-icon.svg @@ -0,0 +1,63 @@ + + + + + + image/svg+xml + + + + + + + + + + diff --git a/interface/resources/images/address-bar-submit-active.svg b/interface/resources/images/address-bar-submit-active.svg deleted file mode 100644 index 313b366033..0000000000 --- a/interface/resources/images/address-bar-submit-active.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/interface/resources/images/address-bar-submit.svg b/interface/resources/images/address-bar-submit.svg deleted file mode 100644 index df4d7e90f6..0000000000 --- a/interface/resources/images/address-bar-submit.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/interface/resources/qml/AddressBarDialog.qml b/interface/resources/qml/AddressBarDialog.qml index 42a0a7dd7e..a3f7c6ba18 100644 --- a/interface/resources/qml/AddressBarDialog.qml +++ b/interface/resources/qml/AddressBarDialog.qml @@ -23,8 +23,12 @@ Item { AddressBarDialog { id: addressBarDialog - implicitWidth: box.width - implicitHeight: addressLine.height + hifi.layout.spacing * 2 + property int iconOverlap: 15 // Let the circle overlap window edges and rectangular part of dialog + property int maximumX: root.parent.width - root.width + property int maximumY: root.parent.height - root.height + + implicitWidth: box.width + icon.width - iconOverlap * 2 + implicitHeight: addressLine.height + hifi.layout.spacing * 2 Border { id: box @@ -35,6 +39,8 @@ Item { radius: 6 color: "#ededee" + x: icon.width - addressBarDialog.iconOverlap * 2 // W.r.t. addressBarDialog + MouseArea { id: boxDrag @@ -42,18 +48,18 @@ Item { drag { target: root - minimumX: 0 - minimumY: 0 - maximumX: root.parent ? root.parent.width - root.width : 0 - maximumY: root.parent ? root.parent.height - root.height : 0 - } + minimumX: 0 + minimumY: 0 + maximumX: root.parent ? addressBarDialog.maximumX : 0 + maximumY: root.parent ? addressBarDialog.maximumY : 0 + } } TextInput { id: addressLine anchors.fill: parent - anchors.leftMargin: hifi.layout.spacing * 2 + anchors.leftMargin: addressBarDialog.iconOverlap + hifi.layout.spacing * 2 anchors.rightMargin: hifi.layout.spacing * 2 anchors.topMargin: hifi.layout.spacing anchors.bottomMargin: hifi.layout.spacing @@ -67,7 +73,31 @@ Item { } } } - } + + Image { + id: icon + source: "../images/address-bar-icon.svg" + width: 80 + height: 80 + anchors.right: box.left + anchors.rightMargin: -addressBarDialog.iconOverlap + anchors.verticalCenter: parent.verticalCenter + + MouseArea { + id: iconDrag + + anchors.fill: parent + + drag { + target: root + minimumX: 0 + minimumY: 0 + maximumX: root.parent ? addressBarDialog.maximumX : 0 + maximumY: root.parent ? addressBarDialog.maximumY : 0 + } + } + } + } // The UI enables an object, rather than manipulating its visibility, so that we can do animations in both directions. // Because visibility and enabled are booleans, they cannot be animated. So when enabled is changed, we modify a property