New view selector behaviour. Update icons

This commit is contained in:
Gabriel Calero 2018-04-11 18:43:39 -03:00
parent 578012b662
commit 8010fd2420
9 changed files with 74 additions and 225 deletions

View file

@ -3,13 +3,11 @@
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.7;}
.st1{fill:none;stroke:#FFFFFF;stroke-width:6.4193;stroke-linecap:round;stroke-miterlimit:10;}
.st0{opacity:0.85;fill:#FFFFFF;}
</style>
<g id="Layer_2_1_">
</g>
<g class="st0">
<polyline class="st1" points="24.3,43.4 5.8,25.2 5.8,25.1 24,6.6 "/>
<line class="st1" x1="7.2" y1="25" x2="44.2" y2="25"/>
</g>
<path class="st0" d="M44.2,21.8H13.6L26.3,8.9c1.2-1.3,1.2-3.3,0-4.5s-3.3-1.2-4.5,0L3.5,22.8c-0.6,0.6-0.9,1.4-0.9,2.3v0.1
c0,0.9,0.3,1.7,1,2.3L22,45.7c0.6,0.6,1.4,0.9,2.3,0.9c0.8,0,1.7-0.3,2.3-1c1.2-1.3,1.2-3.3,0-4.5L13.4,28.2h30.8
c1.8,0,3.2-1.4,3.2-3.2S46,21.8,44.2,21.8z"/>
</svg>

Before

Width:  |  Height:  |  Size: 688 B

After

Width:  |  Height:  |  Size: 735 B

92
interface/resources/icons/+android/mic-unmute-a.svg Normal file → Executable file
View file

@ -1,70 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 50 50"
style="enable-background:new 0 0 50 50;"
xml:space="preserve"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="mic-unmute-a.svg"><metadata
id="metadata22"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs20" /><sodipodi:namedview
pagecolor="#ff0000"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="852"
inkscape:window-height="480"
id="namedview18"
showgrid="false"
inkscape:zoom="4.72"
inkscape:cx="25"
inkscape:cy="25"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="svg2" /><style
type="text/css"
id="style4">
.st0{fill:#FFFFFF;}
</style><g
id="Layer_2" /><g
id="Layer_1"
style="fill:#b2b2b2;fill-opacity:1"><path
class="st0"
d="M31.4,14.1l2.2-2.2c-2.1-2.5-5.3-4.1-8.8-4.1c-3.4,0-6.4,1.5-8.5,3.8c0.7,0.7,1.5,1.5,2.2,2.2 c1.6-1.7,3.8-2.9,6.3-2.9C27.5,10.9,29.9,12.1,31.4,14.1z"
id="path8"
style="fill:#b2b2b2;fill-opacity:1" /><path
class="st0"
d="M36.5,9l2.2-2.2C35.3,3,30.3,0.6,24.8,0.6c-5.3,0-10.2,2.3-13.6,5.9c0.7,0.7,1.5,1.5,2.2,2.2 c2.9-3,6.9-5,11.4-5C29.5,3.7,33.6,5.8,36.5,9z"
id="path10"
style="fill:#b2b2b2;fill-opacity:1" /><path
class="st0"
d="M28.5,22.7v-4.4c0-2-1.6-3.6-3.7-3.6h0c-2,0-3.7,1.6-3.7,3.6v4.4H28.5z"
id="path12"
style="fill:#b2b2b2;fill-opacity:1" /><path
class="st0"
d="M21.1,26.5v4.3c0,2,1.7,3.6,3.7,3.6h0c2,0,3.7-1.6,3.7-3.6v-4.3H21.1z"
id="path14"
style="fill:#b2b2b2;fill-opacity:1" /><path
class="st0"
d="M36,31.5c0-0.1,0-5.1,0-5.3c0-1-0.9-1.7-1.8-1.7c-1,0-1.7,0.8-1.7,1.8c0,0.3,0,4.8,0,5.2 c0,3.7-3.4,6.7-7.5,6.7c-4.1,0-7.5-3-7.5-6.7c0-0.4,0-4.9,0-5.3c0-1-0.7-1.8-1.6-1.8C14.9,24.3,14,25,14,26c0,0.3,0,5.4,0,5.5 c0,5.1,4,9.3,9.2,10.1l0,3.4h-4.3c-1,0-1.8,0.8-1.8,1.8c0,1,0.8,1.8,1.8,1.8h12.3c1,0,1.8-0.8,1.8-1.8c0-1-0.8-1.8-1.8-1.8h-4.4 l0-3.4C32,40.7,36,36.6,36,31.5z"
id="path16"
style="fill:#b2b2b2;fill-opacity:1" /></g></svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.85;}
.st1{fill:#FFFFFF;}
</style>
<g id="Layer_2_1_" class="st0">
</g>
<g class="st0">
<path class="st1" d="M31.5,14.5l2.2-2.2c-2.1-2.5-5.3-4.1-8.8-4.1c-3.4,0-6.4,1.5-8.5,3.8c0.7,0.7,1.5,1.5,2.2,2.2
c1.6-1.7,3.8-2.9,6.3-2.9C27.5,11.3,30,12.5,31.5,14.5z"/>
<path class="st1" d="M24.8,1c-5.3,0-10.2,2.3-13.6,5.9c0.7,0.7,1.5,1.5,2.2,2.2c2.9-3,6.9-5,11.4-5c4.7,0,8.8,2.1,11.7,5.3l2.2-2.2
C35.3,3.4,30.3,1,24.8,1z"/>
<path class="st1" d="M28.5,18.7c0-2-1.6-3.6-3.7-3.6c-2,0-3.7,1.6-3.7,3.6v4.4h7.4V18.7z"/>
<path class="st1" d="M21.1,31.2c0,2,1.7,3.6,3.7,3.6s3.7-1.6,3.7-3.6v-4.3h-7.4V31.2z"/>
<path class="st1" d="M34.3,24.9c-1,0-1.7,0.8-1.7,1.8c0,0.3,0,4.8,0,5.2c0,3.7-3.4,6.7-7.5,6.7s-7.5-3-7.5-6.7c0-0.4,0-4.9,0-5.3
c0-1-0.7-1.8-1.6-1.8c-1-0.1-1.9,0.6-1.9,1.6c0,0.3,0,5.4,0,5.5c0,5.1,4,9.3,9.2,10.1v3.4H19c-1,0-1.8,0.8-1.8,1.8S18,49,19,49
h12.3c1,0,1.8-0.8,1.8-1.8s-0.8-1.8-1.8-1.8h-4.4V42C32,41.1,36,37,36,31.9c0-0.1,0-5.1,0-5.3C36,25.6,35.1,24.9,34.3,24.9z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -3,17 +3,17 @@
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.7;}
.st0{opacity:0.85;}
.st1{fill:#FFFFFF;stroke:#FFFFFF;stroke-width:2;stroke-miterlimit:10;}
</style>
<g id="Layer_2_1_">
</g>
<g class="st0">
<path class="st1" d="M48.1,22.5c-1.6-1.9-3.2-4-5.2-5.6c-5.2-4.4-11.1-6.9-17.8-7.1c-6,0.1-11.1,2-15.8,5.2c-3,2-5.6,4.4-7.6,7.4
<path class="st1" d="M48.1,22.6c-1.6-1.9-3.2-4-5.2-5.6c-5.2-4.4-11.1-6.9-17.8-7.1c-6,0.1-11.1,2-15.8,5.2c-3,2-5.6,4.4-7.6,7.4
c-1.1,1.7-1.1,3.3,0,5c1.8,2.7,4.1,4.8,6.6,6.7c4.9,3.6,10.4,5.9,16.6,5.9c5.8,0,10.9-2,15.6-5.2c3-2,5.6-4.4,7.6-7.4
C49.4,25.8,49.5,24.1,48.1,22.5z M46.4,27.1C41,34,33.9,38,26.2,38.5c-7.3-0.1-12.6-2.4-17.4-6c-2.2-1.6-4.1-3.5-5.6-5.8
c-0.7-1-0.9-2-0.1-3.1c4.8-7.1,16.4-14.6,28.2-11.1c6.2,1.9,11.3,5.3,15.2,10.5C47.8,24.7,47.8,25.3,46.4,27.1z"/>
<path class="st1" d="M25,15.6c-5.3,0-9.4,4.1-9.5,9.4c0,5.3,4.2,9.5,9.5,9.5c5.3,0,9.4-4.2,9.4-9.5C34.4,19.7,30.3,15.6,25,15.6z
M24.9,32.9c-4.2,0-7.8-3.6-7.8-7.9c0-4.2,3.6-7.8,7.8-7.8c4.2,0,7.9,3.6,7.8,7.8C32.8,29.3,29.2,32.9,24.9,32.9z"/>
C49.4,25.9,49.5,24.2,48.1,22.6z M46.4,27.2C41,34.1,33.9,38.1,26.2,38.6c-7.3-0.1-12.6-2.4-17.4-6c-2.2-1.6-4.1-3.5-5.6-5.8
c-0.7-1-0.9-2-0.1-3.1c4.8-7.1,16.4-14.6,28.2-11.1c6.2,1.9,11.3,5.3,15.2,10.5C47.8,24.8,47.8,25.4,46.4,27.2z"/>
<path class="st1" d="M25,15.7c-5.3,0-9.4,4.1-9.5,9.4c0,5.3,4.2,9.5,9.5,9.5s9.4-4.2,9.4-9.5S30.3,15.7,25,15.7z M24.9,33
c-4.2,0-7.8-3.6-7.8-7.9c0-4.2,3.6-7.8,7.8-7.8c4.2,0,7.9,3.6,7.8,7.8C32.8,29.4,29.2,33,24.9,33z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 31.87 31.87"><defs><style type="text/css">.cls-1{fill:#ffffff;}</style></defs><title>Asset 1</title><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M15.94,19.45a3.51,3.51,0,1,1,3.51-3.51A3.51,3.51,0,0,1,15.94,19.45Zm0-5.36a1.85,1.85,0,1,0,1.85,1.85A1.85,1.85,0,0,0,15.94,14.09Z"/><circle class="cls-1" cx="22.65" cy="20.94" r="1.85"/><path class="cls-1" d="M15.94,0A15.84,15.84,0,0,0,7.16,2.65,3.52,3.52,0,0,1,8.24,3.94,14.34,14.34,0,1,1,3.67,8.68a3.51,3.51,0,0,1-1.31-1A15.92,15.92,0,1,0,15.94,0Z"/><circle class="cls-1" cx="5.1" cy="5.48" r="1.85"/><path class="cls-1" d="M19.73,22.88A7.9,7.9,0,0,1,8.82,19.37a3.48,3.48,0,0,1-1.28.25,3.46,3.46,0,0,1-.46,0A9.55,9.55,0,0,0,21,24,3.52,3.52,0,0,1,19.73,22.88Z"/><path class="cls-1" d="M15.94,6.36a9.59,9.59,0,0,0-9,6.3,3.49,3.49,0,0,1,.59-.06,3.47,3.47,0,0,1,1.13.2,7.91,7.91,0,0,1,15,4.79,3.5,3.5,0,0,1,1.48.89A9.55,9.55,0,0,0,15.94,6.36Z"/><circle class="cls-1" cx="7.54" cy="16.11" r="1.85"/><!--<path class="cls-1" d="M5.2,38.52v2H4.09V35.37H5.71c1.39,0,2.09.5,2.09,1.55a1.42,1.42,0,0,1-1,1.4l1.34,2.23H6.87l-1.11-2Zm.58-.78c.58,0,.89-.24.89-.82s-.31-.77-1-.77H5.2v1.59Z"/><path class="cls-1" d="M9.9,39.39l-.29,1.16H8.46l1.6-5.19H11.4L13,40.55H11.82l-.29-1.16Zm.81-3.21-.6,2.39h1.21Z"/><path class="cls-1" d="M17.87,37.94a2.3,2.3,0,0,1-2.55,2.62H13.84V35.37H15.2C16.57,35.37,17.87,35.79,17.87,37.94Zm-2.93,1.81h.45c.76,0,1.33-.35,1.33-1.81s-.61-1.76-1.36-1.76h-.43Z"/><path class="cls-1" d="M19.69,39.39l-.29,1.16H18.25l1.6-5.19h1.34l1.59,5.19H21.61l-.29-1.16Zm.81-3.21-.6,2.39h1.21Z"/><path class="cls-1" d="M24.74,38.52v2h-1.1V35.37h1.62c1.39,0,2.09.5,2.09,1.55a1.42,1.42,0,0,1-1,1.4l1.34,2.23H26.41l-1.11-2Zm.58-.78c.58,0,.89-.24.89-.82s-.31-.77-1-.77h-.49v1.59Z"/>--></g></g></svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 31.87 31.87"><defs><style type="text/css">.cls-1{fill:#ffffff;}</style></defs><title>Asset 1</title><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M15.94,19.45a3.51,3.51,0,1,1,3.51-3.51A3.51,3.51,0,0,1,15.94,19.45Zm0-5.36a1.85,1.85,0,1,0,1.85,1.85A1.85,1.85,0,0,0,15.94,14.09Z"/><circle class="cls-1" cx="22.65" cy="20.94" r="1.85"/><path class="cls-1" d="M15.94,0A15.84,15.84,0,0,0,7.16,2.65,3.52,3.52,0,0,1,8.24,3.94,14.34,14.34,0,1,1,3.67,8.68a3.51,3.51,0,0,1-1.31-1A15.92,15.92,0,1,0,15.94,0Z"/><circle class="cls-1" cx="5.1" cy="5.48" r="1.85"/><path class="cls-1" d="M19.73,22.88A7.9,7.9,0,0,1,8.82,19.37a3.48,3.48,0,0,1-1.28.25,3.46,3.46,0,0,1-.46,0A9.55,9.55,0,0,0,21,24,3.52,3.52,0,0,1,19.73,22.88Z"/><path class="cls-1" d="M15.94,6.36a9.59,9.59,0,0,0-9,6.3,3.49,3.49,0,0,1,.59-.06,3.47,3.47,0,0,1,1.13.2,7.91,7.91,0,0,1,15,4.79,3.5,3.5,0,0,1,1.48.89A9.55,9.55,0,0,0,15.94,6.36Z"/><circle class="cls-1" cx="7.54" cy="16.11" r="1.85"/><!--<path class="cls-1" d="M5.2,38.52v2H4.09V35.37H5.71c1.39,0,2.09.5,2.09,1.55a1.42,1.42,0,0,1-1,1.4l1.34,2.23H6.87l-1.11-2Zm.58-.78c.58,0,.89-.24.89-.82s-.31-.77-1-.77H5.2v1.59Z"/><path class="cls-1" d="M9.9,39.39l-.29,1.16H8.46l1.6-5.19H11.4L13,40.55H11.82l-.29-1.16Zm.81-3.21-.6,2.39h1.21Z"/><path class="cls-1" d="M17.87,37.94a2.3,2.3,0,0,1-2.55,2.62H13.84V35.37H15.2C16.57,35.37,17.87,35.79,17.87,37.94Zm-2.93,1.81h.45c.76,0,1.33-.35,1.33-1.81s-.61-1.76-1.36-1.76h-.43Z"/><path class="cls-1" d="M19.69,39.39l-.29,1.16H18.25l1.6-5.19h1.34l1.59,5.19H21.61l-.29-1.16Zm.81-3.21-.6,2.39h1.21Z"/><path class="cls-1" d="M24.74,38.52v2h-1.1V35.37h1.62c1.39,0,2.09.5,2.09,1.55a1.42,1.42,0,0,1-1,1.4l1.34,2.23H26.41l-1.11-2Zm.58-.78c.58,0,.89-.24.89-.82s-.31-.77-1-.77h-.49v1.59Z"/>--></g></g></svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 31.87 31.87"><defs><style type="text/css">.cls-1{fill:#afafaf;}</style></defs><title>Asset 1</title><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M15.94,19.45a3.51,3.51,0,1,1,3.51-3.51A3.51,3.51,0,0,1,15.94,19.45Zm0-5.36a1.85,1.85,0,1,0,1.85,1.85A1.85,1.85,0,0,0,15.94,14.09Z"/><circle class="cls-1" cx="22.65" cy="20.94" r="1.85"/><path class="cls-1" d="M15.94,0A15.84,15.84,0,0,0,7.16,2.65,3.52,3.52,0,0,1,8.24,3.94,14.34,14.34,0,1,1,3.67,8.68a3.51,3.51,0,0,1-1.31-1A15.92,15.92,0,1,0,15.94,0Z"/><circle class="cls-1" cx="5.1" cy="5.48" r="1.85"/><path class="cls-1" d="M19.73,22.88A7.9,7.9,0,0,1,8.82,19.37a3.48,3.48,0,0,1-1.28.25,3.46,3.46,0,0,1-.46,0A9.55,9.55,0,0,0,21,24,3.52,3.52,0,0,1,19.73,22.88Z"/><path class="cls-1" d="M15.94,6.36a9.59,9.59,0,0,0-9,6.3,3.49,3.49,0,0,1,.59-.06,3.47,3.47,0,0,1,1.13.2,7.91,7.91,0,0,1,15,4.79,3.5,3.5,0,0,1,1.48.89A9.55,9.55,0,0,0,15.94,6.36Z"/><circle class="cls-1" cx="7.54" cy="16.11" r="1.85"/><!--<path class="cls-1" d="M5.2,38.52v2H4.09V35.37H5.71c1.39,0,2.09.5,2.09,1.55a1.42,1.42,0,0,1-1,1.4l1.34,2.23H6.87l-1.11-2Zm.58-.78c.58,0,.89-.24.89-.82s-.31-.77-1-.77H5.2v1.59Z"/><path class="cls-1" d="M9.9,39.39l-.29,1.16H8.46l1.6-5.19H11.4L13,40.55H11.82l-.29-1.16Zm.81-3.21-.6,2.39h1.21Z"/><path class="cls-1" d="M17.87,37.94a2.3,2.3,0,0,1-2.55,2.62H13.84V35.37H15.2C16.57,35.37,17.87,35.79,17.87,37.94Zm-2.93,1.81h.45c.76,0,1.33-.35,1.33-1.81s-.61-1.76-1.36-1.76h-.43Z"/><path class="cls-1" d="M19.69,39.39l-.29,1.16H18.25l1.6-5.19h1.34l1.59,5.19H21.61l-.29-1.16Zm.81-3.21-.6,2.39h1.21Z"/><path class="cls-1" d="M24.74,38.52v2h-1.1V35.37h1.62c1.39,0,2.09.5,2.09,1.55a1.42,1.42,0,0,1-1,1.4l1.34,2.23H26.41l-1.11-2Zm.58-.78c.58,0,.89-.24.89-.82s-.31-.77-1-.77h-.49v1.59Z"/>--></g></g></svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View file

@ -11,18 +11,6 @@ import ".."
Item {
id: modesbar
y:20
Rectangle {
anchors.fill : parent
color: "transparent"
Flow {
id: flowMain
spacing: 0
flow: Flow.TopToBottom
layoutDirection: Flow.TopToBottom
anchors.fill: parent
anchors.margins: 4
}
}
Component.onCompleted: {
width = 300; // That 30 is extra regardless the qty of items shown
@ -35,7 +23,7 @@ Item {
console.log("load button");
if (component.status == Component.Ready) {
console.log("load button 2");
var button = component.createObject(flowMain);
var button = component.createObject(modesbar);
// copy all properites to button
var keys = Object.keys(properties).forEach(function (key) {
button[key] = properties[key];
@ -59,14 +47,12 @@ Item {
function fromScript(message) {
switch (message.type) {
case "allButtonsShown":
modesbar.height = flowMain.children.length * 300 + 30; // That 30 is extra regardless the qty of items shown
break;
case "inactiveButtonsHidden":
modesbar.height = 300 + 30;
break;
case "switch":
// message.params.to
// still not needed
break;
default:
break;
break;
}
}

View file

@ -11,15 +11,21 @@
//
(function() { // BEGIN LOCAL_SCOPE
var modesbar;
var modesButtons;
var currentSelectedBtn;
var modeButton;
var currentMode;
var barQml;
var SETTING_CURRENT_MODE_KEY = 'Android/Mode';
var MODE_VR = "VR", MODE_RADAR = "RADAR", MODE_MY_VIEW = "MY VIEW";
var DEFAULT_MODE = MODE_MY_VIEW;
var logEnabled = true;
var nextMode = {};
nextMode[MODE_RADAR]=MODE_MY_VIEW;
nextMode[MODE_MY_VIEW]=MODE_RADAR;
var modeLabel = {};
modeLabel[MODE_RADAR]="TOP VIEW";
modeLabel[MODE_MY_VIEW]="MY VIEW";
var logEnabled = false;
var radar = Script.require('./radar.js');
var uniqueColor = Script.require('./uniqueColor.js');
@ -32,87 +38,30 @@ function printd(str) {
function init() {
radar.setUniqueColor(uniqueColor);
radar.init();
setupModesBar();
}
function shutdown() {
}
function setupModesBar() {
var bar = new QmlFragment({
barQml = new QmlFragment({
qml: "hifi/modesbar.qml"
});
var buttonRadarMode = bar.addButton({
icon: "icons/radar-i.svg",
activeIcon: "icons/radar-a.svg",
hoverIcon: "icons/radar-a.svg",
modeButton = barQml.addButton({
icon: "icons/myview-a.svg",
activeBgOpacity: 0.0,
hoverBgOpacity: 0.0,
activeHoverBgOpacity: 0.0,
text: "RADAR",
text: "MODE",
height:240,
bottomMargin: 6,
textSize: 45
});
var buttonMyViewMode = bar.addButton({
icon: "icons/myview-i.svg",
activeIcon: "icons/myview-a.svg",
hoverIcon: "icons/myview-a.svg",
activeBgOpacity: 0.0,
hoverBgOpacity: 0.0,
activeHoverBgOpacity: 0.0,
text: "MY VIEW",
height: 240,
bottomMargin: 6,
textSize: 45
});
modesButtons = [buttonRadarMode, buttonMyViewMode];
switchToMode(getCurrentModeSetting());
var mode = getCurrentModeSetting();
var buttonsRevealed = false;
bar.sendToQml({type: "inactiveButtonsHidden"});
modesbar = {
restoreMyViewButton: function() {
switchModeButtons(buttonMyViewMode);
saveCurrentModeSetting(MODE_MY_VIEW);
},
sendToQml: function(o) { bar.sendToQml(o); },
qmlFragment: bar
};
buttonRadarMode.clicked.connect(function() {
//if (connections.isVisible()) return;
saveCurrentModeSetting(MODE_RADAR);
printd("Radar clicked");
onButtonClicked(buttonRadarMode, function() {
radar.startRadarMode();
});
});
buttonMyViewMode.clicked.connect(function() {
//if (connections.isVisible()) return;
saveCurrentModeSetting(MODE_MY_VIEW);
printd("My View clicked");
onButtonClicked(buttonMyViewMode, function() {
if (currentSelectedBtn == buttonRadarMode) {
radar.endRadarMode();
}
});
modeButton.clicked.connect(function() {
switchToMode(nextMode[currentMode]);
});
}
var savedButton;
if (mode == MODE_MY_VIEW) {
savedButton = buttonMyViewMode;
} else {
savedButton = buttonRadarMode;
}
printd("[MODE] previous mode " + mode);
function shutdown() {
savedButton.clicked();
}
function saveCurrentModeSetting(mode) {
@ -123,62 +72,29 @@ function getCurrentModeSetting(mode) {
return Settings.getValue(SETTING_CURRENT_MODE_KEY, DEFAULT_MODE);
}
function showAllButtons() {
for (var i=0; i<modesButtons.length; i++) {
modesButtons[i].visible = true;
function switchToMode(newMode) {
// before leaving radar mode
if (currentMode == MODE_RADAR) {
radar.endRadarMode();
}
buttonsRevealed = true;
print("Modesbar: " + modesbar);
modesbar.sendToQml({type: "allButtonsShown"});
}
currentMode = newMode;
modeButton.text = modeLabel[currentMode];
function hideAllButtons() {
for (var i=0; i<modesButtons.length; i++) {
modesButtons[i].visible = false;
}
}
saveCurrentModeSetting(currentMode);
function hideOtherButtons(thisButton) {
printd("Hiding all but " + thisButton);
printd("modesButtons: " + modesButtons.length);
for (var i=0; i<modesButtons.length; i++) {
if (modesButtons[i] != thisButton) {
printd("----Hiding " + thisButton);
modesButtons[i].visible = false;
} else {
// be sure to keep it visible
modesButtons[i].visible = true;
}
}
buttonsRevealed = false;
print("Modesbar: " + modesbar);
modesbar.sendToQml({type: "inactiveButtonsHidden"});
}
function switchModeButtons(clickedButton, hideAllAfter) {
if (currentSelectedBtn) {
currentSelectedBtn.isActive = false;
}
currentSelectedBtn = clickedButton;
clickedButton.isActive = true;
if (hideAllAfter) {
hideAllButtons();
if (currentMode == MODE_RADAR) {
radar.startRadarMode();
} else if (currentMode == MODE_MY_VIEW) {
// nothing to do yet
} else {
hideOtherButtons(clickedButton);
printd("Unknown view mode " + currentMode);
}
}
function onButtonClicked(clickedButton, whatToDo, hideAllAfter) {
if (currentSelectedBtn == clickedButton) {
if (buttonsRevealed) {
hideOtherButtons(clickedButton);
} else {
showAllButtons();
}
} else {
// mode change
whatToDo();
switchModeButtons(clickedButton, hideAllAfter);
function sendToQml(o) {
if(barQml) {
barQml.sendToQml(o);
}
}