Added qml plugin exposing QProcess functionality.
[quick-widgets] / quickwidget.hpp
1 #ifndef QUICKWIDGET_HPP\r
2 #define QUICKWIDGET_HPP\r
3 \r
4 #include <QtCore>\r
5 #include <QtGui>\r
6 #include <q-extras/qemaemo5dynamicwidgethelper.h>\r
7 \r
8 class QDeclarativeView;\r
9 class QuickWidgetWrapper;\r
10 \r
11 \r
12 class QuickWidget : public QeMaemo5DynamicHomescreenWidget\r
13 {\r
14     Q_OBJECT\r
15 \r
16 private:\r
17     void initView(const QString& fileName, const QSize& size=QSize());\r
18     QSize size_;\r
19     QDeclarativeView* view_;\r
20     QuickWidgetWrapper* wrapper_;\r
21 \r
22 protected:\r
23 //    void showSettingsDialog();\r
24     bool restoreWidgetState();\r
25     void errorWidget();\r
26     bool x11Event(XEvent *event);\r
27 \r
28 public:\r
29     static QuickWidget *createAndShowNew(const QString& fileName, const QSize& size=QSize());\r
30 \r
31     explicit QuickWidget(QWidget *parent = 0);\r
32     Q_INVOKABLE bool onHomescreen() { return isVisibleOnCurrentHomescreen(); }\r
33     ~QuickWidget();\r
34 \r
35 };\r
36 \r
37 class QuickWidgetWrapper : public QObject\r
38 {\r
39     Q_OBJECT\r
40 \r
41 public:\r
42     QuickWidgetWrapper(QuickWidget *owner) : m_owner(owner) {;}\r
43     Q_PROPERTY(bool isActiveWindow READ onHomeScreen NOTIFY onHomeScreenChanged);\r
44 \r
45     bool onHomeScreen() const { return homeScreen; }\r
46 \r
47     void setOnHomeScreen(bool active)\r
48     {\r
49         if (active == homeScreen)\r
50             return;\r
51         homeScreen = active;\r
52         emit onHomeScreenChanged();\r
53     }\r
54 \r
55 Q_SIGNALS:\r
56     void onHomeScreenChanged();\r
57 \r
58 private:\r
59     QuickWidget *m_owner;\r
60     bool homeScreen;\r
61 };\r
62 \r
63 #endif // QuickWidget_HPP\r