summaryrefslogtreecommitdiff
path: root/examples/hybridshell/index.html
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2013-11-06 17:18:11 +0100
committerMilian Wolff <milian.wolff@kdab.com>2013-11-14 16:41:54 +0100
commit6e88c68e1bd46faa2a96bbc409052f27bf445736 (patch)
treeb5ac962971eb8b065fc3b2d54de0064f97bd3d79 /examples/hybridshell/index.html
parentbc06e88886ca33ce68c3ae3a72cf011257d1fadd (diff)
downloadqtwebchannel-6e88c68e1bd46faa2a96bbc409052f27bf445736.tar.gz
Cleanup sources, mostly by removing QtCreator generated bloat.
This removes a lot of obsolete files and simplifies the build system of the examples. Furthermore, the examples can now be run without running make install first. It reuses the same import path as the test does. Note that the examples are not installable anymore now though. If this is required, it can be added again. Change-Id: Ic7ff80f734b035a03fb1a11a2df492c97298ceff Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'examples/hybridshell/index.html')
-rw-r--r--examples/hybridshell/index.html82
1 files changed, 82 insertions, 0 deletions
diff --git a/examples/hybridshell/index.html b/examples/hybridshell/index.html
new file mode 100644
index 0000000..23a765c
--- /dev/null
+++ b/examples/hybridshell/index.html
@@ -0,0 +1,82 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>QML/HTML Hybrid Shell</title>
+ <style type="text/css">
+ html, body {
+ margin:0;
+ padding:0;
+ width:100%;
+ height:100%;
+ }
+ #layout {
+ height:100%;
+ width:92%;
+ margin: 0 auto;
+ }
+ #output {
+ width:100%;
+ margin-top:1%;
+ height: 94%;
+ display: block;
+ border-radius: 5px;
+ border-style: solid;
+ border-color: #666666;
+ background-image: -webkit-linear-gradient(left top,#dddddd, #ffffff)
+ }
+ #input {
+ width:100%;
+ height: 3%;
+ margin-top:1%;
+ margin-bottom:1%;
+ display: block;
+ background-color: #dddddd;
+ border-radius: 3px;
+ border-style: solid;
+ border-color: #dddddd;
+ background-image: -webkit-linear-gradient(left,#eeeeee, #cccccc)
+ }
+ </style>
+ <script type="text/javascript" src="qrc:///qwebchannel/webchannel.js"></script>
+ <script type="text/javascript">
+ function out(line)
+ {
+ document.querySelector("#output").value += line + "\r\n";
+ }
+ function send()
+ {
+ var input = document.querySelector("#input");
+ var text = input.value;
+ out("> " + text);
+ input.value = "";
+ navigator.webChannel.exec(text);
+ }
+
+ function handleKey(code)
+ {
+ switch (code) {
+ case 13:
+ send();
+ break;
+ }
+ }
+
+ window.onload = function() {
+ out("Starting...");
+
+ var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]);
+ new QWebChannel(baseUrl, function(webChannel) {
+ window.navigator.webChannel = webChannel;
+ out("Ready");
+ webChannel.subscribe("stdout", out);
+ });
+ }
+ </script>
+ </head>
+ <body>
+ <div id="layout">
+ <textarea readonly id="output" ></textarea>
+ <input type="text" id="input" onkeyup="handleKey(event.keyCode)"></input>
+ </div>
+ </body>
+</html>