Prototype of Tablet.qml hacked to appear on ALL web entities.

This commit is contained in:
Anthony J. Thibault 2016-12-08 15:31:00 -08:00
parent 6edd3a9338
commit 319bb9ce78
6 changed files with 252 additions and 2 deletions

View file

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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"
width="70mm"
height="70mm"
viewBox="0 0 248.0315 248.03149"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="circle.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.979899"
inkscape:cx="79.162615"
inkscape:cy="188.36943"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="2560"
inkscape:window-height="1377"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<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>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-804.33071)">
<circle
style="fill:#4b504f;fill-opacity:1;stroke:#feffff;stroke-width:0.22076035;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4140"
cx="124.46446"
cy="928.42853"
r="121.41819" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -0,0 +1,68 @@
<?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 49.999998"
xml:space="preserve"
id="svg4239"
inkscape:version="0.91 r13725"
sodipodi:docname="edit-icon.svg"
width="50"
height="50"><metadata
id="metadata4336"><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="defs4334" /><sodipodi:namedview
pagecolor="#615f71"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1663"
inkscape:window-height="1023"
id="namedview4332"
showgrid="false"
inkscape:zoom="4.717641"
inkscape:cx="27.234437"
inkscape:cy="40.361616"
inkscape:window-x="412"
inkscape:window-y="188"
inkscape:window-maximized="0"
inkscape:current-layer="svg4239" /><style
type="text/css"
id="style4241">
.st0{fill:#414042;}
.st1{fill:#FFFFFF;}
.st2{fill:#1E1E1E;}
.st3{fill:#333333;}
</style><g
id="Layer_3"
transform="matrix(2.0055009,0,0,2.0055009,-26.481547,-324.23978)" /><path
style="fill:#ffffff;fill-opacity:1"
inkscape:connector-curvature="0"
id="path4268"
d="m 17.615466,29.206401 c -2.807702,2.807702 -5.615403,5.615403 -8.4231037,8.423104 -0.601651,-0.60165 -1.403851,-1.40385 -2.005501,-2.005501 2.807701,-2.807701 5.6154017,-5.615402 8.4231037,-8.423104 l -2.406601,-2.206051 c -3.2088017,3.208802 -6.4176027,6.417603 -9.8269547,9.626405 -0.60165,0.60165 -1.00275,1.40385 -1.2033,2.406601 -0.401101,2.607151 -0.802201,5.214302 -1.20330104,8.022004 0.20055004,0 0.40110004,0 0.60165004,0 2.607151,-0.601651 5.013753,-1.002751 7.620904,-1.604401 0.4011,-0.20055 1.0027497,-0.4011 1.4038497,-0.802201 3.409352,-3.409351 6.818703,-6.818703 10.228055,-10.228054 l -3.208801,-3.208802 z"
class="st3" /><path
style="fill:#ffffff;fill-opacity:1"
inkscape:connector-curvature="0"
id="path4270"
d="m 30.851772,7.3464388 c 1.00275,-1.00275 2.206051,-2.206051 3.409351,-3.409351 0.4011,-0.4011 1.002751,-0.4011 1.403851,0 2.005501,2.005501 4.011002,4.011002 6.016502,6.016503 0.401101,0.4011002 0.401101,1.0027502 0,1.6044002 -1.2033,1.203303 -2.406601,2.406603 -3.409351,3.409354 -2.406601,-2.406603 -4.813202,-5.0137542 -7.420353,-7.6209062 z"
class="st3" /><path
style="fill:#ffffff;fill-opacity:1"
inkscape:connector-curvature="0"
id="path4272"
d="m 33.659473,25.9976 c -0.60165,0.20055 -0.802201,0 -1.203301,-0.4011 -0.8022,-0.802201 -1.6044,-1.604401 -2.406601,-2.406601 2.005501,-2.005501 3.810452,-3.810452 5.815953,-5.815953 0.20055,-0.20055 0.4011,-0.4011 0.4011,-0.4011 -2.607151,-2.607151 -5.013752,-5.013754 -7.620903,-7.8214562 -0.200551,0.20055 -0.200551,0.4011 -0.401101,0.601651 -2.005501,2.0055002 -3.810451,3.8104532 -5.815952,5.8159542 -3.609902,-3.609903 -7.019253,-7.0192552 -10.629155,-10.6291572 -0.20055,-0.20055 -0.60165,-0.60165 -0.8022,-0.8022 -2.0055007,-1.403851 -4.4121017,-1.203301 -6.0165027,0.60165 -1.604401,1.804951 -1.403851,4.412102 0.20055,6.0165032 5.2143017,5.214304 10.6291547,10.629157 15.8434567,15.843459 1.804951,1.804951 3.409352,3.409352 5.214302,5.214303 0.200551,0.20055 0.401101,0.4011 0.200551,0.8022 -0.200551,0.8022 -0.401101,1.604401 -0.401101,2.406601 -0.4011,5.013752 2.807702,9.425854 7.821454,10.829705 2.005501,0.60165 4.011002,0.4011 6.217053,-0.4011 -0.20055,-0.20055 -0.4011,-0.4011 -0.601651,-0.4011 -1.40385,-1.403851 -3.008251,-3.008252 -4.412102,-4.412102 -1.00275,-1.002751 -1.2033,-2.807702 -0.20055,-3.810452 0.802201,-0.802201 1.604401,-1.604401 2.406601,-2.406601 1.203301,-1.002751 2.607152,-1.002751 3.609902,0 0.20055,0.20055 0.4011,0.4011 0.60165,0.60165 1.403851,1.403851 3.008252,3.008251 4.412102,4.412102 0,0 0.20055,0 0.20055,0 0.200551,-0.8022 0.401101,-1.604401 0.401101,-2.607151 C 47.697979,29.607502 40.678726,23.992099 33.659473,25.9976 Z M 8.1896113,9.1513898 c -0.8022,0 -1.40385,-0.60165 -1.40385,-1.40385 0,-0.802201 0.60165,-1.604401 1.40385,-1.604401 0.802201,0 1.604401,0.8022 1.604401,1.403851 0,0.8022 -0.8022,1.6044 -1.604401,1.6044 z M 29.046821,13.764044 c 0.60165,0.601651 1.2033,1.403851 2.005501,2.005501 -1.403851,1.403851 -2.807702,2.807702 -4.211552,4.211552 -0.601651,-0.60165 -1.403851,-1.40385 -2.005501,-2.005501 1.40385,-1.40385 2.807701,-2.807701 4.211552,-4.211552 z"
class="st3" /></svg>

After

Width:  |  Height:  |  Size: 5 KiB

View file

@ -0,0 +1,76 @@
import QtQuick 2.0
import "../../styles-uit/"
Item {
id: item1
width: 480
height: 720
Rectangle {
id: bg
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
anchors.top: parent.top
anchors.topMargin: 0
gradient: Gradient {
GradientStop {
position: 0
color: "#7c7c7c"
}
GradientStop {
position: 1
color: "#000000"
}
}
Flow {
id: flow
spacing: 12
anchors.right: parent.right
anchors.rightMargin: 17
anchors.left: parent.left
anchors.leftMargin: 17
anchors.bottom: parent.bottom
anchors.bottomMargin: 8
anchors.top: parent.top
anchors.topMargin: 123
}
Image {
id: muteIcon
x: 205
width: 70
height: 70
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 28
fillMode: Image.Stretch
source: "../../../icons/circle.svg"
RalewaySemiBold {
id: muteText
x: 15
y: 27
color: "#ffffff"
text: qsTr("MUTE")
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 14
}
}
Component.onCompleted: {
console.log("AJT: Tablet.onCompleted!");
// AJT: test flow by adding buttons
var component = Qt.createComponent("TabletButton.qml");
for (var i = 0; i < 10; i++) {
component.createObject(flow);
}
}
}
}

View file

@ -0,0 +1,28 @@
import QtQuick 2.0
import "../../styles-uit/"
Rectangle {
id: tabletButton
width: 140
height: 140
color: "#1794c3"
Image {
id: icon
x: 40
y: 30
width: 60
height: 60
source: "../../../icons/edit-icon.svg"
}
RalewaySemiBold {
id: text
x: 50
y: 96
color: "#ffffff"
text: qsTr("EDIT")
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 18
}
}

View file

@ -116,6 +116,16 @@ bool RenderableWebEntityItem::buildWebSurface(QSharedPointer<EntityTreeRenderer>
// member variables, since they would implicitly refer to a this that
// is no longer valid
_webSurface->create(currentContext);
#define AJT_TABLET_HACK
#ifdef AJT_TABLET_HACK
_webSurface->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "qml/hifi/tablet/"));
_webSurface->load("Tablet.qml", [&](QQmlContext* context, QObject* obj) {
;
});
_webSurface->resume();
#else
_webSurface->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/controls/"));
_webSurface->load("WebView.qml", [&](QQmlContext* context, QObject* obj) {
context->setContextProperty("eventBridgeJavaScriptToInject", QVariant(javaScriptToInject));
@ -123,6 +133,7 @@ bool RenderableWebEntityItem::buildWebSurface(QSharedPointer<EntityTreeRenderer>
_webSurface->resume();
_webSurface->getRootItem()->setProperty("url", _sourceUrl);
_webSurface->getRootContext()->setContextProperty("desktop", QVariant());
#endif
// FIXME - Keyboard HMD only: Possibly add "HMDinfo" object to context for WebView.qml.
// forward web events to EntityScriptingInterface

View file

@ -743,8 +743,12 @@ void OffscreenQmlSurface::resume() {
_paused = false;
_render = true;
getRootItem()->setProperty("eventBridge", QVariant::fromValue(this));
getRootContext()->setContextProperty("webEntity", this);
if (getRootItem()) {
getRootItem()->setProperty("eventBridge", QVariant::fromValue(this));
}
if (getRootContext()) {
getRootContext()->setContextProperty("webEntity", this);
}
}
bool OffscreenQmlSurface::isPaused() const {