Initial upload
authorMalte Marquarding <malte@marquarding.com>
Thu, 18 Nov 2010 00:03:11 +0000 (11:03 +1100)
committerMalte Marquarding <malte@marquarding.com>
Thu, 18 Nov 2010 00:03:11 +0000 (11:03 +1100)
24 files changed:
appeventlistener.cpp [new file with mode: 0644]
appeventlistener.hpp [new file with mode: 0644]
data/quick-widgets [new file with mode: 0644]
data/quick-widgets-48x48.png [new file with mode: 0644]
data/quick-widgets-48x48.png.en [new file with mode: 0644]
data/quick-widgets.desktop [new file with mode: 0644]
data/quick-widgets.png [new file with mode: 0644]
data/quick-widgets.svg [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/dirs [new file with mode: 0644]
debian/postinst [new file with mode: 0644]
debian/prerm [new file with mode: 0644]
debian/rules [new file with mode: 0755]
main.cpp [new file with mode: 0644]
quick-widgets.pro [new file with mode: 0644]
quick-widgets.pro.user [new file with mode: 0644]
quickwidget.cpp [new file with mode: 0644]
quickwidget.hpp [new file with mode: 0644]
quickwidgetsettings.cpp [new file with mode: 0644]
quickwidgetsettings.hpp [new file with mode: 0644]
quickwidgetsettings.ui [new file with mode: 0644]

diff --git a/appeventlistener.cpp b/appeventlistener.cpp
new file mode 100644 (file)
index 0000000..4dfdd81
--- /dev/null
@@ -0,0 +1,38 @@
+#include <QtCore>\r
+#include <QtGui>\r
+#include <q-extras/qtsingleapplication.h>\r
+\r
+#include "appeventlistener.hpp"\r
+#include "quickwidgetsettings.hpp"\r
+\r
+static AppEventListener *_instance = NULL;\r
+\r
+AppEventListener* AppEventListener::instance()\r
+{\r
+    if (_instance == NULL)\r
+        _instance = new AppEventListener(QCoreApplication::instance());\r
+\r
+    return _instance;\r
+}\r
+\r
+AppEventListener::AppEventListener(QObject *parent) :\r
+    QObject(parent)\r
+{\r
+    // Connect to the QtSingleApplication's event\r
+    QObject::connect(QtSingleApplication::instance(), SIGNAL(messageReceived(const QString&)), this, SLOT(receiveMessage(const QString&)));\r
+}\r
+\r
+void AppEventListener::receiveMessage(const QString& message)\r
+{\r
+    if (message == APP_MESSAGE_ADDWIDGET)\r
+    {\r
+        qDebug() << "TTTTTTEEEEST";\r
+        QuickWidgetSettings settings;\r
+        settings.exec();\r
+    }\r
+    else if (message == APP_MESSAGE_CLOSE)\r
+    {\r
+        ((QApplication*)sender())->quit();\r
+    }\r
+}\r
+\r
diff --git a/appeventlistener.hpp b/appeventlistener.hpp
new file mode 100644 (file)
index 0000000..9b5e76e
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef APPEVENTLISTENER_HPP\r
+#define APPEVENTLISTENER_HPP\r
+\r
+#include <QObject>\r
+\r
+#define APP_MESSAGE_ADDWIDGET "Add widget"\r
+#define APP_MESSAGE_CLOSE "Close"\r
+\r
+class AppEventListener : public QObject\r
+{\r
+    Q_OBJECT\r
+\r
+private:\r
+    explicit AppEventListener(QObject *parent = 0);\r
+\r
+public:\r
+    static AppEventListener *instance();\r
+\r
+public slots:\r
+    void receiveMessage(const QString& message);\r
+\r
+};\r
+\r
+#endif // APPEVENTLISTENER_HPP\r
diff --git a/data/quick-widgets b/data/quick-widgets
new file mode 100644 (file)
index 0000000..9004490
--- /dev/null
@@ -0,0 +1,11 @@
+description "starts Quick Widgets"
+
+start on started hildon-desktop
+
+respawn
+
+console none
+
+script
+  exec su - user -c "exec /opt/quick-widgets/quick-widgets in-background"
+end script
diff --git a/data/quick-widgets-48x48.png b/data/quick-widgets-48x48.png
new file mode 100644 (file)
index 0000000..17640cb
Binary files /dev/null and b/data/quick-widgets-48x48.png differ
diff --git a/data/quick-widgets-48x48.png.en b/data/quick-widgets-48x48.png.en
new file mode 100644 (file)
index 0000000..ff11657
--- /dev/null
@@ -0,0 +1,38 @@
+begin-base64 644 ../data/quick-widgets-48x48.png
+iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABHNCSVQICAgI
+fAhkiAAAAAlwSFlzAAAUwwAAFM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5r/cEsHhj
+kcidCJ2DnTj6Heiazuqfq6zNrTHywQhWZ3Fejz6IYhomW+nytY5pmizdXELX
+dERRLACk1TTRf6L43/EjbpMsdQOoSyqROxH87/rxniieD/sCPmZ/mGV+cp7R
+D0dL2jj6HSiLCrKr9KUZX4mTzWRp97TX7KPuMRC5G8HqtOI9Xnq4LdtkBgID
+qI9VnkWfldQ533CiazqZRKakPPowStdQV10+6gZ49vQZnYOdFc+2nb5cniej
+yZJy2SbT3tOOtqEVCw2IhWK4j7oxtmr/faEuAGPLQE/qtHZUXjlKVglRFElv
+psvqXH4XmqKBmfuuPFYQBAGHz4FpmDV7qQtAEAUEQYBtOsw0TQyMik/HNejC
+yBqkEzm49YfrdA135eLVoV0N4tW51cLWL6+EkmDh5gKJzUTZ9dlMFiWiIP8r
+k0zk0kiJKDy6/Qiby4bVbkWLaRhZg9h8jJHzI3WZrwogtUroKZ1UPEUqniqt
+FEFZUmh1tpb1dDKaRE/rZLNZ4mtxADKpDMmNJKZgYnPZ2FzeZGNhA6lVwu61
+NwfAf9qPsqxgmuW56RpwMT85j2AK9Iz2FFIgk8iQWE7QM9zDwMmBwvXqgkq3
+vxvHgANjy+DR5CMWbywW5vymALR1tdHWtf3G3u62M39tnuhfUdp729GTOokn
+CboGuxg9P4pkK4ZfnlnGc8SD+2huu6qtacTCMdxvVt++3v/xfslT7j/Zj+uw
+qzpANXlGPHR4O1CXVLSohqZpWFosHPvoGKJYOj/4Tvlo6y52Rv+pfuxee0mZ
+94SXlo7iltbmseEL+Mru++I1JedCe1VKSXH3+7t4T3g5NH6oESGrSgSeNiqY
+1WnFP+4ncjfCyq2VRoXdSSkJ+AMYblTE3hO9SDYJh29f/jNyWwS+BLRqV9ai
+7uFuZGvTTzkM4HMxeDH4EBgDfgdSOzZ5NaSTy5r3gxeDk/8BCkGAHh5D9sIA
+AAAASUVORK5CYII=
+====
diff --git a/data/quick-widgets.desktop b/data/quick-widgets.desktop
new file mode 100644 (file)
index 0000000..bff27cd
--- /dev/null
@@ -0,0 +1,9 @@
+[Desktop Entry]\r
+\r
+Encoding=UTF-8\r
+Version=1.0\r
+Type=Application\r
+Name=Quick Widgets\r
+Icon=quick-widgets\r
+Exec=/opt/quick-widgets/quick-widgets\r
+X-Osso-Type=application/x-executable\r
diff --git a/data/quick-widgets.png b/data/quick-widgets.png
new file mode 100644 (file)
index 0000000..89a36f4
Binary files /dev/null and b/data/quick-widgets.png differ
diff --git a/data/quick-widgets.svg b/data/quick-widgets.svg
new file mode 100644 (file)
index 0000000..b98e93c
--- /dev/null
@@ -0,0 +1,112 @@
+<?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="32px"
+   height="32px"
+   id="svg12136"
+   version="1.1"
+   inkscape:version="0.47 r22583"
+   sodipodi:docname="quick-widgets.svg"
+   inkscape:export-filename="/home/mar637/scratchbox/quick-widgets-0.1.0/data/quick-widgets.png"
+   inkscape:export-xdpi="180"
+   inkscape:export-ydpi="180">
+  <defs
+     id="defs12138">
+    <inkscape:perspective
+       sodipodi:type="inkscape:persp3d"
+       inkscape:vp_x="-2.3919674e-05 : 15.596825 : 1"
+       inkscape:vp_y="0 : 1097.3588 : 0"
+       inkscape:vp_z="32.000375 : 15.596825 : 1"
+       inkscape:persp3d-origin="16.000176 : 9.7442447 : 1"
+       id="perspective12144" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="11.197802"
+     inkscape:cx="-14.139352"
+     inkscape:cy="23.331556"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     inkscape:grid-bbox="true"
+     inkscape:document-units="px"
+     inkscape:window-width="1680"
+     inkscape:window-height="995"
+     inkscape:window-x="1276"
+     inkscape:window-y="-3"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata12141">
+    <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
+     id="layer1"
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer">
+    <a
+       id="a12460"
+       transform="matrix(1.0000125,0,0,1.0973588,-2.3919674e-5,-1.1545661)">
+      <rect
+         ry="5.5968828"
+         y="1.0744904"
+         x="0.042544093"
+         height="29.16679"
+         width="32.006035"
+         id="rect12160"
+         style="fill:#5fa35f;fill-opacity:1"
+         inkscape:export-xdpi="135"
+         inkscape:export-ydpi="135" />
+    </a>
+    <text
+       xml:space="preserve"
+       style="font-size:10.39394474px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#273927;fill-opacity:1;stroke:none;font-family:Droid Sans;-inkscape-font-specification:Droid Sans"
+       x="8.6485262"
+       y="28.209742"
+       id="text12386"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan12388"
+         x="8.6485262"
+         y="28.209742">QML</tspan></text>
+    <rect
+       style="opacity:0.53479997000000001;fill:none;stroke:#000000;stroke-width:1.524;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+       id="rect12471"
+       width="14.452447"
+       height="14.452447"
+       x="5.4832077"
+       y="11.815102"
+       ry="0"
+       rx="0" />
+    <rect
+       style="opacity:0.53479997000000001;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.1;stroke-miterlimit:4;stroke-dasharray:none"
+       id="rect14911"
+       width="0.35721296"
+       height="0.26790971"
+       x="-11.430815"
+       y="-17.920511" />
+    <path
+       style="opacity:0.7990652;fill:none;stroke:#000000;stroke-width:1.73299003;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+       d="M 1.9741213,14.625299 12.809796,3.7896262 23.645468,14.625299"
+       id="path14923" />
+  </g>
+</svg>
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..11ce80f
--- /dev/null
@@ -0,0 +1,11 @@
+quick-widgets (0.1.1) unstable; urgency=low
+  * Packaging changes
+
+ -- Malte Marquarding <malte@marquarding.com>  Thu, 18 Nov 2010 10:27:43 +1100
+
+quick-widgets (0.1.0) unstable; urgency=low
+  * Initial public release.
+
+ -- Malte Marquarding <malte@marquarding.com>  Thu, 18 Nov 2010 10:27:43 +1100
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..923087c
--- /dev/null
@@ -0,0 +1,54 @@
+Source: quick-widgets
+Section: user/desktop
+Priority: extra
+Maintainer: Malte Marquarding <malte@marquarding.com>
+Build-Depends: debhelper (>= 5), libqt4-dev, libhildon-extras1-dev (>=0.9.5), q-extras-dev (>=1.0.5)
+Standards-Version: 3.7.3
+Homepage: http://quick-widgets.garage.maemo.org/
+
+Package: quick-widgets
+Architecture: any
+Depends: ${shlibs:Depends}, libhildon-extras1, q-extras (>=1.0.5)
+XB-Maemo-Display-Name: Quick Widgets
+Description: This application simplifies running Qt Quick applications as
+ home desktop widgets. It only needs the file. Thanks to Timur Kristóf (Venemo)
+ for doing all the had work in q-extras.
+ This application is licensed under LGPL.
+XB-Maemo-Icon-26:
+ iVBORw0KGgoAAAANSUhEUgAAADAAAA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Dk/8BCkGAHh5D9sIA
+ AAAASUVORK5CYII=
+
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..4859e8d
--- /dev/null
@@ -0,0 +1,24 @@
+Upstream Author(s):
+
+    Malte Marquarding
+
+Copyright:
+
+    Copyright (C) 2010, Malte Marquarding
+
+License:
+
+    This package is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This package is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this package; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
diff --git a/debian/dirs b/debian/dirs
new file mode 100644 (file)
index 0000000..04f51e1
--- /dev/null
@@ -0,0 +1,4 @@
+opt/quick-widgets
+usr/share/applications/hildon
+usr/share/pixmaps
+etc/event.d
diff --git a/debian/postinst b/debian/postinst
new file mode 100644 (file)
index 0000000..0832f84
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+chmod +x /opt/quick-widgets/quick-widgets
+echo "Quick Widgets install done"
+echo "Starting Quick Widgets..."
+start --quiet quick-widgets
+
diff --git a/debian/prerm b/debian/prerm
new file mode 100644 (file)
index 0000000..ac1a54e
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+echo "Killing Quick widgets if it is running"
+if [ ! -z "$(pidof quick-widgets)" ]; then stop quick-widgets; fi
+if [ ! -z "$(pidof quick-widgets)" ]; then killall -9 quick-widgets; fi
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..e0e6660
--- /dev/null
@@ -0,0 +1,96 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+
+
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       # Add here commands to configure the package.
+
+       qmake
+       touch configure-stamp
+
+
+build: build-stamp
+
+build-stamp: configure-stamp  
+       dh_testdir
+
+       # Add here commands to compile the package.
+       $(MAKE)
+       #docbook-to-man debian/quick-widgets.sgml > quick-widgets.1
+
+       touch $@
+
+clean: 
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+
+       # Add here commands to clean up after the build process.
+       -$(MAKE) clean
+
+       dh_clean 
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k 
+       dh_installdirs
+
+       # Add here commands to install the package into debian/quick-widgets.
+       $(MAKE) INSTALL_ROOT="$(CURDIR)/debian/quick-widgets" install
+       cp "$(CURDIR)/build/quick-widgets" "$(CURDIR)/debian/quick-widgets/opt/quick-widgets/"
+       cp "$(CURDIR)/data/quick-widgets" "$(CURDIR)/debian/quick-widgets/etc/event.d/"
+       cp "$(CURDIR)/data/quick-widgets.desktop" "$(CURDIR)/debian/quick-widgets/usr/share/applications/hildon/"
+       cp "$(CURDIR)/data/quick-widgets.png" "$(CURDIR)/debian/quick-widgets/usr/share/pixmaps/"
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs 
+       dh_installdocs
+       dh_installexamples
+#      dh_install
+#      dh_installmenu
+#      dh_installdebconf       
+#      dh_installlogrotate
+#      dh_installemacsen
+#      dh_installpam
+#      dh_installmime
+#      dh_python
+#      dh_installinit
+#      dh_installcron
+#      dh_installinfo
+       dh_installman
+       dh_link
+       dh_strip
+       dh_compress
+       dh_fixperms
+#      dh_perl
+#      dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/main.cpp b/main.cpp
new file mode 100644 (file)
index 0000000..082d8b8
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,61 @@
+#include <QApplication>\r
+#include <q-extras/qemaemo5dynamicwidgethelper.h>\r
+#include <q-extras/qtsingleapplication.h>\r
+#include <q-extras/qesettingsmanager.h>\r
+#include "quickwidget.hpp"\r
+#include "quickwidgetsettings.hpp"\r
+#include "appeventlistener.hpp"\r
+\r
+int main(int argc, char *argv[])\r
+{\r
+    QApplication::setApplicationName("Quick Widgets");\r
+    QApplication::setOrganizationName("Marquarding");\r
+    // APP_VERSION and APP_BETA are defined in the .pro file\r
+    QApplication::setApplicationVersion(QString(APP_VERSION)\r
+#if APP_BETA\r
+        + " beta"\r
+#endif\r
+        );\r
+\r
+    QtSingleApplication app(argc, argv);\r
+    qDebug() << "Launched quick widgets app";\r
+\r
+    if (app.isRunning())\r
+    {\r
+        qDebug() << "Another instance of the app is running.";\r
+        if (app.arguments().contains("in-background"))\r
+        {\r
+            qDebug() << "Closing that other instance.";\r
+            app.sendMessage(APP_MESSAGE_CLOSE);\r
+        }\r
+        else\r
+        {\r
+            qDebug() << "Asking it to offer to create a new widget.";\r
+            app.sendMessage(APP_MESSAGE_ADDWIDGET);\r
+            return 0;\r
+        }\r
+    }\r
+\r
+    app.setQuitOnLastWindowClosed(false);\r
+    AppEventListener::instance();\r
+\r
+    if (app.arguments().contains("forget-widgets"))\r
+    {\r
+        qDebug() << "We were asked to forget all widgets!";\r
+        QeMaemo5DynamicWidgetHelper::globalInstance()->forgetAllWidgets();\r
+    }\r
+    else\r
+    {\r
+        qDebug() << "Restoring all widgets";\r
+        QeMaemo5DynamicWidgetHelper::globalInstance()->restoreWidgets<QuickWidget>();\r
+    }\r
+\r
+    if (!app.arguments().contains("in-background"))\r
+    {\r
+        // setting for new widget\r
+        QuickWidgetSettings settingsDialog;\r
+        settingsDialog.exec();\r
+        //app.sendMessage(APP_MESSAGE_ADDWIDGET);\r
+    }\r
+    return app.exec();\r
+}\r
diff --git a/quick-widgets.pro b/quick-widgets.pro
new file mode 100644 (file)
index 0000000..019ded9
--- /dev/null
@@ -0,0 +1,49 @@
+QT += core gui maemo5 declarative
+
+TARGET = quick-widgets
+TEMPLATE = app
+VERSION = 0.1.0
+
+DEFINES += APP_VERSION=\\\"$$VERSION\\\"
+DEFINES += APP_BETA
+
+HEADERS += \
+    quickwidget.hpp \
+    quickwidgetsettings.hpp \
+    appeventlistener.hpp
+
+SOURCES += \
+    main.cpp\
+    quickwidget.cpp \
+    quickwidgetsettings.cpp \
+    appeventlistener.cpp
+
+FORMS += \
+    quickwidgetsettings.ui
+
+OTHER_FILES += \
+    data/quick-widgets.desktop \
+    data/quick-widgets-widget.desktop \
+    data/quick-widgets
+
+#    data/quick-widgets.png
+#    data/quick-widgets-48x48.png
+
+CONFIG += link_pkgconfig
+PKGCONFIG += hildon-extras-1 q-extras
+
+# All generated files should go to the same directory
+OBJECTS_DIR = build
+MOC_DIR = build
+UI_DIR = build
+DESTDIR = build
+
+# Targets for debian source and binary package creation
+debian-src.commands = dpkg-buildpackage -S -sa -r -us -uc -d
+debian-bin.commands = dpkg-buildpackage -b -r -uc -d
+debian-all.depends = debian-src debian-bin
+
+# Clean all but Makefile
+compiler_clean.commands = -$(DEL_FILE) $(TARGET)
+
+QMAKE_EXTRA_TARGETS += debian-all debian-src debian-bin compiler_clean
diff --git a/quick-widgets.pro.user b/quick-widgets.pro.user
new file mode 100644 (file)
index 0000000..9a83c73
--- /dev/null
@@ -0,0 +1,228 @@
+<!DOCTYPE QtCreatorProject>
+<qtcreator>
+ <data>
+  <variable>ProjectExplorer.Project.ActiveTarget</variable>
+  <value type="int">0</value>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.EditorSettings</variable>
+  <valuemap type="QVariantMap">
+   <value key="EditorConfiguration.Codec" type="QByteArray">System</value>
+  </valuemap>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.Target.0</variable>
+  <valuemap type="QVariantMap">
+   <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Desktop</value>
+   <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.DesktopTarget</value>
+   <value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">0</value>
+   <value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
+   <valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+     <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList">
+      <value type="QString">-spec</value>
+      <value type="QString">/targets/FREMANTLE_X86/usr/share/qt4/mkspecs/linux-g++</value>
+     </valuelist>
+    </valuemap>
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+      <value type="QString">debug</value>
+     </valuelist>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString">/usr/local/bin/sbox-make</value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+    <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+      <value type="QString">clean</value>
+     </valuelist>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString">/usr/local/bin/sbox-make</value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+    <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+    <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Debug</value>
+    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">10</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/scratchbox/users/mar637/home/mar637/scratchbox/quick-widgets-build</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">13</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">false</value>
+   </valuemap>
+   <valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+     <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+    </valuemap>
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString">/usr/local/bin/sbox-make</value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+    <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+      <value type="QString">clean</value>
+     </valuelist>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString">/usr/local/bin/sbox-make</value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+    <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+    <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Release</value>
+    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/scratchbox/users/mar637/home/mar637/scratchbox/quick-widgets-build-desktop</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">13</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+   </valuemap>
+   <value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">2</value>
+   <valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
+    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">quick-widgets</value>
+    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value>
+    <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments" type="QVariantList"/>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.ProFile" type="QString">quick-widgets.pro</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix" type="bool">false</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value>
+    <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetName" type="bool">false</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetWorkingDirectory" type="bool">false</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString"></value>
+   </valuemap>
+   <value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
+  </valuemap>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.Target.1</variable>
+  <valuemap type="QVariantMap">
+   <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Maemo</value>
+   <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.MaemoDeviceTarget</value>
+   <value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">0</value>
+   <value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
+   <valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+     <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+    </valuemap>
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.2" type="QVariantMap">
+     <value key="Packaging Enabled" type="bool">true</value>
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MaemoPackageCreationStep</value>
+     <valuelist key="Qt4ProjectManager.BuildStep.MaemoPackage.LocalFiles" type="QVariantList"/>
+     <value key="Qt4ProjectManager.BuildStep.MaemoPackage.Modified" type="bool">true</value>
+     <value key="Qt4ProjectManager.BuildStep.MaemoPackage.RemoteExe" type="QString"></value>
+     <valuelist key="Qt4ProjectManager.BuildStep.MaemoPackage.RemoteFiles" type="QVariantList"/>
+     <value key="Version Number" type="QString">0.0.1</value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">3</value>
+    <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+      <value type="QString">clean</value>
+     </valuelist>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+    <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+    <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Debug</value>
+    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/scratchbox/users/mar637/home/mar637/scratchbox/quick-widgets-build-maemo</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">9</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">9</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+   </valuemap>
+   <valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+     <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+    </valuemap>
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.2" type="QVariantMap">
+     <value key="Packaging Enabled" type="bool">true</value>
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MaemoPackageCreationStep</value>
+     <valuelist key="Qt4ProjectManager.BuildStep.MaemoPackage.LocalFiles" type="QVariantList"/>
+     <value key="Qt4ProjectManager.BuildStep.MaemoPackage.Modified" type="bool">true</value>
+     <value key="Qt4ProjectManager.BuildStep.MaemoPackage.RemoteExe" type="QString"></value>
+     <valuelist key="Qt4ProjectManager.BuildStep.MaemoPackage.RemoteFiles" type="QVariantList"/>
+     <value key="Version Number" type="QString">0.0.1</value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">3</value>
+    <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+      <value type="QString">clean</value>
+     </valuelist>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+    <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+    <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Release</value>
+    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/scratchbox/users/mar637/home/mar637/scratchbox/quick-widgets-build-maemo</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">9</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">9</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+   </valuemap>
+   <value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">2</value>
+   <valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
+    <value key=".ProFile" type="QString">quick-widgets.pro</value>
+    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">New Maemo Run Configuration</value>
+    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MaemoRunConfiguration</value>
+    <valuelist key="Qt4ProjectManager.MaemoRunConfiguration.Arguments" type="QVariantList"/>
+    <value key="Qt4ProjectManager.MaemoRunConfiguration.DeviceId" type="qulonglong">1</value>
+    <valuelist key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedFiles" type="QVariantList"/>
+    <valuelist key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedHosts" type="QVariantList"/>
+    <valuelist key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedRemotePaths" type="QVariantList"/>
+    <valuelist key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedTimes" type="QVariantList"/>
+   </valuemap>
+   <value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
+  </valuemap>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.TargetCount</variable>
+  <value type="int">2</value>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
+  <value type="int">4</value>
+ </data>
+</qtcreator>
diff --git a/quickwidget.cpp b/quickwidget.cpp
new file mode 100644 (file)
index 0000000..63c9563
--- /dev/null
@@ -0,0 +1,119 @@
+#include <QtDeclarative>\r
+#include <QtMaemo5>\r
+#include <QtGui/QX11Info>\r
+#include <X11/Xlib.h>\r
+#include <X11/Xatom.h>\r
+#include <X11/Xutil.h>\r
+#include "quickwidget.hpp"\r
+\r
+#define SETTING_QUICK_FILE "QuickWidgetFile"\r
+#define SETTING_QUICK_SIZE "QuickWidgetSize"\r
+#define SETTING_SAVE_WAITINTERVAL 3000\r
+\r
+static Atom onCurrentHomescreenAtom;\r
+static bool _atomsInitialized = false;\r
+\r
+QuickWidget *QuickWidget::createAndShowNew(const QString& fileName, const QSize& size)\r
+{\r
+    QuickWidget *widget = new QuickWidget;\r
+    widget->initView(fileName, size);\r
+    widget->show();\r
+    QeMaemo5DynamicWidgetHelper::globalInstance()->registerWidget(widget);\r
+    return widget;\r
+}\r
+\r
+void QuickWidget::initView(const QString& fileName, const QSize& size)\r
+{\r
+    size_ = size;\r
+    saveSetting(SETTING_QUICK_FILE, fileName);\r
+    saveSetting(SETTING_QUICK_SIZE, size_);\r
+    view_->setSource(QUrl::fromLocalFile(fileName));\r
+    if ( view_->status() == QDeclarativeView::Error) {\r
+        errorWidget();\r
+    }\r
+    else if (size_.isValid())\r
+    {\r
+        // use given fixed size and scale to it\r
+        qDebug() << "scaling";\r
+        view_->setResizeMode(QDeclarativeView::SizeRootObjectToView);\r
+    }\r
+    else\r
+    {\r
+        size_ = view_->sceneRect().size().toSize();\r
+    }\r
+    view_->setFixedSize(size_);\r
+    view_->show();\r
+}\r
+\r
+\r
+QuickWidget::QuickWidget(QWidget *parent)\r
+    : QeMaemo5DynamicHomescreenWidget(true, parent),\r
+    size_(QSize()),\r
+    view_(0)\r
+{\r
+    if (!_atomsInitialized) {\r
+       onCurrentHomescreenAtom = XInternAtom(QX11Info::display(),\r
+                                             "_HILDON_APPLET_ON_CURRENT_DESKTOP",\r
+                                             false);\r
+       _atomsInitialized = true;\r
+    }\r
+    view_ = new QDeclarativeView(this);\r
+    view_->setStyleSheet("background:transparent");\r
+    view_->setAttribute(Qt::WA_TranslucentBackground);\r
+    wrapper_ = new QuickWidgetWrapper(this);\r
+    view_->rootContext()->setContextProperty("runtime", wrapper_);\r
+\r
+}\r
+\r
+QuickWidget::~QuickWidget()\r
+{\r
+    delete wrapper_;\r
+}\r
+\r
+bool QuickWidget::x11Event(XEvent *event)\r
+{\r
+    bool passon = QeMaemo5DynamicHomescreenWidget::x11Event(event);\r
+\r
+    if (event->xclient.message_type == onCurrentHomescreenAtom)\r
+    {\r
+        bool visible = isVisibleOnCurrentHomescreen() ;\r
+        if (visible != wrapper_->onHomeScreen())\r
+        {\r
+            wrapper_->setOnHomeScreen(visible);\r
+        }\r
+    }\r
+    return passon;\r
+}\r
+\r
+bool QuickWidget::restoreWidgetState()\r
+{\r
+    QString fileName = loadSetting(SETTING_QUICK_FILE).toString();\r
+    QSize size = loadSetting(SETTING_QUICK_SIZE, QSize()).value<QSize>();\r
+    initView(fileName, size);\r
+    return true;\r
+}\r
+\r
+void QuickWidget::errorWidget()\r
+{\r
+    const QList<QDeclarativeError>& errs = view_->errors();\r
+    qDebug() << errs;\r
+    QByteArray errmsg;\r
+    QTextStream qts(&errmsg);\r
+    qts << "import Qt 4.7" << endl\r
+        << "Rectangle { width: 200; height: txt.height; color: \"#ff0000\"; radius: 8" << endl\r
+        << "Text { id: txt; anchors.centerIn: parent; text: \"";\r
+    for (int i = 0; i < errs.size(); ++i) {\r
+        qts << errs.at(i).toString().replace(QString("\""), QString("\\\"")) <<\r
+endl;\r
+    }\r
+    qts << "\"; font.pixelSize: 15; wrapMode: Text.Wrap; width: parent.width-20}" << endl\r
+        << "}" << endl;\r
+    qDebug() <<  errmsg;\r
+    QDeclarativeComponent component(view_->engine());\r
+    component.setData(errmsg, QUrl());\r
+    qDebug() << component.errorString();\r
+    QDeclarativeItem *errwdgt =\r
+      qobject_cast<QDeclarativeItem*>(component.create(view_->rootContext()));\r
+    view_->scene()->addItem(errwdgt);\r
+    size_ = QSize(errwdgt->width(), errwdgt->height());\r
+}\r
diff --git a/quickwidget.hpp b/quickwidget.hpp
new file mode 100644 (file)
index 0000000..f0a6bd2
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef QUICKWIDGET_HPP\r
+#define QUICKWIDGET_HPP\r
+\r
+#include <QtCore>\r
+#include <QtGui>\r
+#include <q-extras/qemaemo5dynamicwidgethelper.h>\r
+\r
+class QDeclarativeView;\r
+class QuickWidgetWrapper;\r
+\r
+\r
+class QuickWidget : public QeMaemo5DynamicHomescreenWidget\r
+{\r
+    Q_OBJECT\r
+\r
+private:\r
+    void initView(const QString& fileName, const QSize& size=QSize());\r
+    QSize size_;\r
+    QDeclarativeView* view_;\r
+    QuickWidgetWrapper* wrapper_;\r
+\r
+protected:\r
+//    void showSettingsDialog();\r
+    bool restoreWidgetState();\r
+    void errorWidget();\r
+    bool x11Event(XEvent *event);\r
+\r
+public:\r
+    static QuickWidget *createAndShowNew(const QString& fileName, const QSize& size=QSize());\r
+\r
+    explicit QuickWidget(QWidget *parent = 0);\r
+    Q_INVOKABLE bool onHomescreen() { return isVisibleOnCurrentHomescreen(); }\r
+    ~QuickWidget();\r
+\r
+};\r
+\r
+class QuickWidgetWrapper : public QObject\r
+{\r
+    Q_OBJECT\r
+\r
+public:\r
+    QuickWidgetWrapper(QuickWidget *owner) : m_owner(owner) {;}\r
+    Q_PROPERTY(bool isActiveWindow READ onHomeScreen NOTIFY onHomeScreenChanged);\r
+\r
+    bool onHomeScreen() const { return homeScreen; }\r
+\r
+    void setOnHomeScreen(bool active)\r
+    {\r
+        if (active == homeScreen)\r
+            return;\r
+        homeScreen = active;\r
+        emit onHomeScreenChanged();\r
+    }\r
+\r
+Q_SIGNALS:\r
+    void onHomeScreenChanged();\r
+\r
+private:\r
+    QuickWidget *m_owner;\r
+    bool homeScreen;\r
+};\r
+\r
+#endif // QuickWidget_HPP\r
diff --git a/quickwidgetsettings.cpp b/quickwidgetsettings.cpp
new file mode 100644 (file)
index 0000000..22f2650
--- /dev/null
@@ -0,0 +1,45 @@
+#include <QFileDialog>
+#include "quickwidgetsettings.hpp"
+#include "quickwidget.hpp"
+#include "ui_quickwidgetsettings.h"
+
+QuickWidgetSettings::QuickWidgetSettings(QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::QuickWidgetSettings)
+{
+    ui->setupUi(this);
+    connect(ui->fileButton, SIGNAL(clicked()), this, SLOT(getQml()));
+}
+
+QuickWidgetSettings::~QuickWidgetSettings()
+{
+    delete ui;
+}
+
+void QuickWidgetSettings::accept() {
+    QFile f(ui->fileEdit->text());
+    QSize size;
+    if (ui->sizingCheckBox->isChecked()) {
+        bool wok, hok;
+        int width = ui->widthEdit->text().toInt(&wok);
+        int height = ui->heightEdit->text().toInt(&hok);
+        if ( wok && hok && width < 800 && width > 10 && height < 400 && height > 10) {
+            size.setWidth(width);
+            size.setHeight(height);
+        }
+    }
+    if (f.exists())
+    {
+        QuickWidget::createAndShowNew(ui->fileEdit->text(), size);
+    }
+
+    QDialog::accept();
+}
+
+void QuickWidgetSettings::getQml()
+{
+    QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"),
+                                                    QDir::homePath(),
+                                                    tr("QML files (*.qml)"));
+    ui->fileEdit->setText(fileName);
+}
diff --git a/quickwidgetsettings.hpp b/quickwidgetsettings.hpp
new file mode 100644 (file)
index 0000000..8a6f977
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef QUICKWIDGETSETTINGS_H
+#define QUICKWIDGETSETTINGS_H
+
+#include <QDialog>
+
+namespace Ui {
+    class QuickWidgetSettings;
+}
+
+class QuickWidgetSettings : public QDialog
+{
+    Q_OBJECT
+
+public slots:
+    void accept();
+    void getQml();
+
+public:
+    explicit QuickWidgetSettings(QWidget *parent = 0);
+    ~QuickWidgetSettings();
+
+private:
+    Ui::QuickWidgetSettings *ui;
+};
+
+#endif // QUICKWIDGETSETTINGS_H
diff --git a/quickwidgetsettings.ui b/quickwidgetsettings.ui
new file mode 100644 (file)
index 0000000..74b15be
--- /dev/null
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>QuickWidgetSettings</class>
+ <widget class="QDialog" name="QuickWidgetSettings">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>400</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>QtQuick Widget Selection</string>
+  </property>
+  <widget class="QDialogButtonBox" name="buttonBox">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>310</y>
+     <width>751</width>
+     <height>61</height>
+    </rect>
+   </property>
+   <property name="standardButtons">
+    <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+   </property>
+  </widget>
+  <widget class="QWidget" name="">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>10</y>
+     <width>771</width>
+     <height>261</height>
+    </rect>
+   </property>
+   <layout class="QGridLayout" name="gridLayout">
+    <item row="0" column="0">
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <item>
+       <widget class="QPushButton" name="fileButton">
+        <property name="text">
+         <string>qml</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLineEdit" name="fileEdit"/>
+      </item>
+     </layout>
+    </item>
+    <item row="1" column="0">
+     <widget class="QCheckBox" name="sizingCheckBox">
+      <property name="text">
+       <string>Fixed Size</string>
+      </property>
+     </widget>
+    </item>
+    <item row="2" column="0">
+     <layout class="QHBoxLayout" name="horizontalLayout_2">
+      <item>
+       <spacer name="horizontalSpacer">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeType">
+         <enum>QSizePolicy::Expanding</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>13</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item>
+       <widget class="QLineEdit" name="widthEdit">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLabel" name="label">
+        <property name="text">
+         <string>x</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLineEdit" name="heightEdit">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <spacer name="horizontalSpacer_2">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>40</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>sizingCheckBox</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>widthEdit</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>180</x>
+     <y>120</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>120</x>
+     <y>156</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>sizingCheckBox</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>heightEdit</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>180</x>
+     <y>120</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>257</x>
+     <y>156</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>QuickWidgetSettings</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>395</x>
+     <y>310</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>399</x>
+     <y>199</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>