Here are instructions how you can create a simple W3C widget that runs on Qt Web Runtime (WRT) e.g. on Nokia N900.
Widgets are just ZIP packages containing at least two files: Configuration file (config.xml) and resource files (index.html and other HTML, CSS, JavaScript and image files).
- widget.wgt – zip archive renamed to *.wgt, containing:
- config.xml - configurations
- index.html - content
Configuration file contains information about the widget like name, version, author, icon etc. Example of simple config.xml file:
<?xml version="1.0" ?> <widget xmlns="http://www.w3.org/ns/widgets" id="http://www.substanceofcode.com/hellowidget" version="0.1.0"> <!-- Name of the widget --> <name>Hello World</name> <!-- Description is shown when installing widget --> <description>Simple hello world widget</description> <!-- Start page for widget --> <content src="index.html" /> <!-- Default icon for widget --> <icon src="icon.png" /> <!-- Widget author --> <author>Tommi Laukkanen</author> </widget>
Content is good old HTML, CSS, JavaScript etc. files. For example simple HTML page like this:
<html>
<head>
<title>Hello!</title>
</head>
<body>
<h1>Hello W3C Widget World!</h1>
</body>
</html>
When these two files are packaged into a ZIP archive and renamed to Hello.wgt you can install it on your Nokia N900 just by clicking the file in file browser. When you run the app it’ll look something like this:
I hope that you find this tutorial helpful and start crafting your own widgets!
