1 /* |
1 /* |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * |
5 * under the terms of "Eclipse Public License v1.0" |
5 * This program is free software: you can redistribute it and/or modify |
6 * which accompanies this distribution, and is available |
6 * it under the terms of the GNU Lesser General Public License as published by |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * the Free Software Foundation, version 2.1 of the License. |
8 * |
8 * |
9 * Initial Contributors: |
9 * This program is distributed in the hope that it will be useful, |
10 * Nokia Corporation - initial contribution. |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * Contributors: |
12 * GNU Lesser General Public License for more details. |
13 * |
13 * |
14 * Description: |
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: |
15 * |
19 * |
16 */ |
20 */ |
17 |
|
18 |
21 |
19 #ifndef __GINEBRA_CHROMEWIDGET_H__ |
22 #ifndef __GINEBRA_CHROMEWIDGET_H__ |
20 #define __GINEBRA_CHROMEWIDGET_H__ |
23 #define __GINEBRA_CHROMEWIDGET_H__ |
21 |
24 |
22 #include "BWFGlobal.h" |
25 #include "BWFGlobal.h" |
23 #include <QMap> |
26 #include <QMap> |
24 #include <QtGui> |
27 #include <QtGui> |
25 //#include <QtScript> |
28 //#include <QtScript> |
26 #include "wrtbrowsercontainer.h" |
29 #include "wrtbrowsercontainer.h" |
27 #include "GreenChromeSnippet.h" |
|
28 #include "ViewController.h" |
30 #include "ViewController.h" |
29 |
31 |
30 class QWebPage; |
32 class QWebPage; |
31 class QPixmap; |
33 class QPixmap; |
32 |
34 |
81 virtual ~ChromeWidget(); |
88 virtual ~ChromeWidget(); |
82 void setChromeBaseDirectory(const QString dir); |
89 void setChromeBaseDirectory(const QString dir); |
83 void setChromeFile(const QString file); |
90 void setChromeFile(const QString file); |
84 void addView(ControllableViewBase * controllableView); |
91 void addView(ControllableViewBase * controllableView); |
85 QGraphicsScene * getScene() { return m_scene; } //NB: change name to scene() !! |
92 QGraphicsScene * getScene() { return m_scene; } //NB: change name to scene() !! |
|
93 void setScene(QGraphicsScene *scene); |
86 ChromeRenderer * renderer() { return m_renderer; } |
94 ChromeRenderer * renderer() { return m_renderer; } |
87 ChromeDOM * dom() { return m_dom; } |
95 ChromeDOM * dom() { return m_dom; } |
88 QRect getSnippetRect(const QString &docElementId); |
96 QRect getSnippetRect(const QString &docElementId); |
89 ChromeSnippet * getSnippet(const QString & docElementId, QGraphicsItem * parent = 0); |
97 ChromeSnippet * getSnippet(const QString & docElementId, QGraphicsItem * parent = 0); |
90 // QScriptValue evalWithEngineContext(const QString& program); |
98 // QScriptValue evalWithEngineContext(const QString& program); |
102 QGraphicsView *graphicsView() { return m_view; } |
110 QGraphicsView *graphicsView() { return m_view; } |
103 void dump(); |
111 void dump(); |
104 QString getBaseDirectory() const { return m_baseDirectory; } |
112 QString getBaseDirectory() const { return m_baseDirectory; } |
105 ViewController * viewController() { return m_viewController; } // needed for UrlSearchSnippet |
113 ViewController * viewController() { return m_viewController; } // needed for UrlSearchSnippet |
106 QString currentView() {return m_viewController->currentView()->type() ;} |
114 QString currentView() {return m_viewController->currentView()->type() ;} |
107 public slots: //NB: Many of these should not be exported to JS, so a separate a JS delegate would be better |
115 int bottomBarHeight() { return m_bottomBarHeight;} |
|
116 void updateChromeLayout(); |
|
117 void sizeChange(QSize sz){ emit prepareForSizeChange(sz) ;} |
|
118 void emitPopupShown(const QString &popupId); |
|
119 void emitPopupHidden(const QString &popupId); |
|
120 |
|
121 public slots: |
108 int width(){return (int)size().width();} |
122 int width(){return (int)size().width();} |
109 void snippetShown(ChromeSnippet * snippet); |
123 void snippetShown(ChromeSnippet * snippet); |
110 void snippetHiding(ChromeSnippet * snippet); |
124 void snippetHiding(ChromeSnippet * snippet); |
111 void loadStarted(); |
125 void loadStarted(); |
112 void loadFinished(bool ok); |
126 void loadFinished(bool ok); |
113 void exportJSObjects(); |
127 void exportJSObjects(); |
114 void exportJSObjectsToPage(QWebPage *page); |
128 void exportJSObjectsToPage(QWebPage *page); |
115 void alert(const QString & msg); |
129 void alert(const QString & msg); |
116 qreal slideView(qreal delta); |
130 qreal slideView(qreal delta); |
|
131 qreal shrinkView(qreal delta); |
117 void onViewInstantiated(ControllableViewBase *view); |
132 void onViewInstantiated(ControllableViewBase *view); |
118 void onCurrentViewChanged(); |
133 void onCurrentViewChanged(); |
119 void chromeInitialized(); |
134 void chromeInitialized(); |
120 void reloadChrome(); |
135 void reloadChrome(); |
121 void loadUrlToCurrentPage(const QUrl & url); |
136 void loadUrlToCurrentPage(const QUrl & url); |
122 void pageCreated(WRT::WrtBrowserContainer * page); |
137 void pageCreated(WRT::WrtBrowserContainer * page); |
123 |
138 |
124 signals: |
139 signals: |
125 void internalChromeComplete(); |
140 void internalChromeComplete(); |
126 void chromeComplete(); |
141 void chromeComplete(); |
127 void aspectChanged(int aspect); |
142 void aspectChanged(int aspect); |
128 void prepareForGeometryChange(); |
143 void prepareForGeometryChange(); |
|
144 void prepareForSizeChange(QSize); |
129 //NB: This should be symbian ifdef'd but that would require symbian-specific chrome |
145 //NB: This should be symbian ifdef'd but that would require symbian-specific chrome |
130 void symbianCarriageReturn(); |
146 void symbianCarriageReturn(); |
|
147 void popupShown(const QString &id); |
|
148 void popupHidden(const QString &id); |
131 |
149 |
132 public: |
150 public: |
133 Q_PROPERTY(QObjectList snippets READ getSnippets) |
151 Q_PROPERTY(QObjectList snippets READ getSnippets) |
134 QObjectList getSnippets(); |
152 QObjectList getSnippets(); |
135 /// \brief Returns either "portrait" or "landscape". |
153 /// \brief Returns either "portrait" or "landscape". |
150 void addAnchors(); |
168 void addAnchors(); |
151 void addJSObjectToWindow(QObject *object); |
169 void addJSObjectToWindow(QObject *object); |
152 void addJSObjectToPage(QObject *object, QWebPage *page); |
170 void addJSObjectToPage(QObject *object, QWebPage *page); |
153 void updateMVGeometry(); |
171 void updateMVGeometry(); |
154 void addViewToLayout(ControllableViewBase * controllableView); |
172 void addViewToLayout(ControllableViewBase * controllableView); |
|
173 |
155 //void addJSObjectToEngine(QObject *object); |
174 //void addJSObjectToEngine(QObject *object); |
156 QGraphicsScene * m_scene; |
175 QGraphicsScene * m_scene; |
157 QGraphicsView *m_view; |
176 QGraphicsView *m_view; |
158 QGraphicsAnchorLayout *m_layout; |
177 QGraphicsAnchorLayout *m_layout; |
159 QString m_baseDirectory; |
178 QString m_baseDirectory; |
160 QWebPage * m_page; |
179 QWebPage * m_page; |
161 ChromeRenderer * m_renderer; |
180 ChromeRenderer * m_renderer; |
162 ChromeDOM * m_dom; |
181 ChromeDOM * m_dom; |
163 Snippets * m_snippets; |
182 Snippets * m_snippets; |
164 ViewController *m_viewController; |
183 ViewController *m_viewController; |
165 AppContentView * m_appView; |
184 //QList<QObject*> m_jsObjects; |
166 QList<QObject*> m_jsObjects; |
|
167 //QScriptEngine m_engine; |
185 //QScriptEngine m_engine; |
168 QGraphicsAnchorLayout *m_viewLayout; |
186 QGraphicsAnchorLayout *m_viewLayout; |
169 SlidingWidget *m_viewPort; |
187 SlidingWidget *m_viewPort; |
170 QGraphicsWidget *m_topBar; |
188 QGraphicsWidget *m_topBar; |
171 QGraphicsWidget *m_bottomBar; |
189 QGraphicsWidget *m_bottomBar; |
175 GinebraApplication *m_app; |
193 GinebraApplication *m_app; |
176 Aspect m_aspect; |
194 Aspect m_aspect; |
177 ChromeWidgetJSObject *m_jsObject; |
195 ChromeWidgetJSObject *m_jsObject; |
178 LocaleDelegate *m_localeDelegate; // Owned |
196 LocaleDelegate *m_localeDelegate; // Owned |
179 DeviceDelegate *m_deviceDelegate; |
197 DeviceDelegate *m_deviceDelegate; |
|
198 NetworkDelegate *m_networkDelegate; |
180 Downloads * m_downloads; // Owned |
199 Downloads * m_downloads; // Owned |
|
200 int m_bottomBarHeight; |
181 }; |
201 }; |
182 |
202 |
183 } // end of namespace GVA |
203 } // end of namespace GVA |
184 |
204 |
185 Q_DECLARE_METATYPE(QObjectList) |
205 Q_DECLARE_METATYPE(QObjectList) |