rhodes 5.5.0.3 → 5.5.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -0
  3. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/NotificationSingleton.java +20 -8
  4. data/lib/commonAPI/coreapi/ext/platform/iphone/cpp_based_impl/SystemImpl.mm +1 -2
  5. data/lib/commonAPI/coreapi/ext/system.xml +1 -1
  6. data/platform/android/build/android.rake +1 -0
  7. data/platform/iphone/Classes/AppManager/AppManager.m +44 -3
  8. data/platform/iphone/Classes/NativeView/RhoNativeViewManager.mm +4 -3
  9. data/platform/iphone/Classes/NativeView/RhoNativeViewManagerOC.h +1 -1
  10. data/platform/iphone/Classes/RhoMainView.h +8 -2
  11. data/platform/iphone/Classes/RhoUIWebView.h +75 -0
  12. data/platform/iphone/Classes/RhoUIWebView.m +142 -0
  13. data/platform/iphone/Classes/RhoWKWebView.h +87 -0
  14. data/platform/iphone/Classes/RhoWKWebView.m +187 -0
  15. data/platform/iphone/Classes/RhoWebView.h +72 -0
  16. data/platform/iphone/Classes/RhoWebViewFabrique.h +35 -0
  17. data/platform/iphone/Classes/RhoWebViewFabrique.m +87 -0
  18. data/platform/iphone/Classes/Rhodes.m +17 -6
  19. data/platform/iphone/Classes/Signature.old/SignatureDelegate.m +11 -4
  20. data/platform/iphone/Classes/Signature/SignatureDelegate.m +3 -4
  21. data/platform/iphone/Classes/SimpleMainView.h +7 -5
  22. data/platform/iphone/Classes/SimpleMainView.m +174 -179
  23. data/platform/iphone/Classes/SplitView/RightViewController.h +2 -2
  24. data/platform/iphone/Classes/SplitView/RightViewController.m +9 -10
  25. data/platform/iphone/Classes/SplitView/SplittedMainView.h +2 -3
  26. data/platform/iphone/Classes/SplitView/SplittedMainView.m +10 -7
  27. data/platform/iphone/Classes/TabbedMainView.h +2 -1
  28. data/platform/iphone/Classes/TabbedMainView.m +13 -10
  29. data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.m +21 -5
  30. data/platform/iphone/Classes/WebView.m +1 -1
  31. data/platform/iphone/RhoAppBaseLib/RhoAppBaseLib.xcodeproj/project.pbxproj +40 -3
  32. data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +4 -0
  33. data/platform/iphone/rbuild/iphone.rake +51 -0
  34. data/platform/shared/common/RhoNativeViewManager.h +9 -9
  35. data/platform/shared/common/RhodesApp.cpp +13 -1
  36. data/platform/shared/net/HttpServer.cpp +12 -2
  37. data/platform/shared/qt/rhodes/ExternalWebView.ui +11 -2
  38. data/platform/shared/qt/rhodes/QtMainWindow.cpp +9 -7
  39. data/platform/shared/qt/rhodes/QtMainWindow.ui +13 -4
  40. data/platform/shared/qt/rhodes/qkineticscroller.cpp +1245 -0
  41. data/platform/shared/qt/rhodes/qkineticscroller.h +165 -0
  42. data/platform/shared/qt/rhodes/qkineticscroller_p.h +168 -0
  43. data/platform/shared/qt/rhodes/qtflickgesture.cpp +696 -0
  44. data/platform/shared/qt/rhodes/qtflickgesture_p.h +107 -0
  45. data/platform/shared/qt/rhodes/qtscroller.cpp +2080 -0
  46. data/platform/shared/qt/rhodes/qtscroller.h +138 -0
  47. data/platform/shared/qt/rhodes/qtscroller_p.h +205 -0
  48. data/platform/shared/qt/rhodes/qtscrollerfilter.cpp +350 -0
  49. data/platform/shared/qt/rhodes/qtscrollerfilter_p.h +110 -0
  50. data/platform/shared/qt/rhodes/qtscrollerproperties.cpp +412 -0
  51. data/platform/shared/qt/rhodes/qtscrollerproperties.h +135 -0
  52. data/platform/shared/qt/rhodes/qtscrollerproperties_p.h +90 -0
  53. data/platform/shared/qt/rhodes/qtscrollevent.cpp +190 -0
  54. data/platform/shared/qt/rhodes/qtscrollevent.h +100 -0
  55. data/platform/shared/qt/rhodes/qtscrollevent_p.h +33 -0
  56. data/platform/shared/qt/rhodes/qwebviewkineticscroller.cpp +347 -0
  57. data/platform/shared/qt/rhodes/qwebviewkineticscroller.h +90 -0
  58. data/platform/shared/qt/rhodes/qwebviewselectionsuppressor.h +113 -0
  59. data/platform/shared/qt/rhodes/rhodes.pro +19 -0
  60. data/res/generators/rhogen.rb +307 -15
  61. data/res/generators/templates/application/app/Settings/err_sync.erb +12 -6
  62. data/res/generators/templates/application/app/Settings/home.erb +32 -17
  63. data/res/generators/templates/application/app/Settings/index.erb +55 -26
  64. data/res/generators/templates/application/app/Settings/javascript_index.html +111 -0
  65. data/res/generators/templates/application/app/Settings/javascript_login.html +65 -0
  66. data/res/generators/templates/application/app/Settings/login.erb +25 -19
  67. data/res/generators/templates/application/app/Settings/reset.erb +18 -9
  68. data/res/generators/templates/application/app/Settings/wait.erb +10 -7
  69. data/res/generators/templates/application/app/index.erb +32 -20
  70. data/res/generators/templates/application/app/javascript_index.html +66 -0
  71. data/res/generators/templates/application/app/javascript_index.js +250 -0
  72. data/res/generators/templates/application/app/layout.erb +12 -67
  73. data/res/generators/templates/application/javascript_build.yml +41 -0
  74. data/res/generators/templates/application/javascript_rhoconfig.txt +123 -0
  75. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.css +587 -0
  76. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.css.map +1 -0
  77. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.min.css +6 -0
  78. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.min.css.map +1 -0
  79. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.css +6757 -0
  80. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.css.map +1 -0
  81. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.min.css +6 -0
  82. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.min.css.map +1 -0
  83. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.eot +0 -0
  84. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.svg +288 -0
  85. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.ttf +0 -0
  86. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff +0 -0
  87. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff2 +0 -0
  88. data/res/generators/templates/application/public/bootstrap-3.3.7/js/bootstrap.js +2377 -0
  89. data/res/generators/templates/application/public/bootstrap-3.3.7/js/bootstrap.min.js +7 -0
  90. data/res/generators/templates/application/public/bootstrap-3.3.7/js/npm.js +13 -0
  91. data/res/generators/templates/application/public/css/style.css +3 -0
  92. data/res/generators/templates/application/public/jquery/jquery-3.1.1.min.js +4 -0
  93. data/res/generators/templates/application/public/jquery/jquery-3.1.1.min.map +1 -0
  94. data/res/generators/templates/application/rhoconfig.txt +16 -0
  95. data/res/generators/templates/iphone_project/Bremen7.xcodeproj/project.pbxproj +4 -0
  96. data/res/generators/templates/model/edit.erb +22 -21
  97. data/res/generators/templates/model/index.erb +24 -22
  98. data/res/generators/templates/model/javascript_edit.html +65 -0
  99. data/res/generators/templates/model/javascript_index.html +56 -0
  100. data/res/generators/templates/model/javascript_index.js +83 -0
  101. data/res/generators/templates/model/javascript_model.js +16 -0
  102. data/res/generators/templates/model/javascript_new.html +64 -0
  103. data/res/generators/templates/model/javascript_show.html +66 -0
  104. data/res/generators/templates/model/new.erb +22 -19
  105. data/res/generators/templates/model/show.erb +22 -14
  106. data/res/prebuild_base_app/app/index.erb +31 -18
  107. data/res/prebuild_base_app/app/layout.erb +11 -56
  108. data/version +1 -1
  109. metadata +59 -24
  110. data/res/generators/templates/application/public/css/android.css +0 -418
  111. data/res/generators/templates/application/public/css/iphone.css +0 -378
  112. data/res/generators/templates/application/public/css/jqmobile-patch.css +0 -62
  113. data/res/generators/templates/application/public/css/re_webkit.css +0 -736
  114. data/res/generators/templates/application/public/css/re_webkit_flat.css +0 -753
  115. data/res/generators/templates/application/public/css/windows_mobile.css +0 -327
  116. data/res/generators/templates/application/public/jqmobile/images/ajax-loader.gif +0 -0
  117. data/res/generators/templates/application/public/jqmobile/images/icon-search-black.png +0 -0
  118. data/res/generators/templates/application/public/jqmobile/images/icons-18-black.png +0 -0
  119. data/res/generators/templates/application/public/jqmobile/images/icons-18-white.png +0 -0
  120. data/res/generators/templates/application/public/jqmobile/images/icons-36-black.png +0 -0
  121. data/res/generators/templates/application/public/jqmobile/images/icons-36-white.png +0 -0
  122. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.4.5.min.css +0 -3
  123. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.4.5.min.js +0 -10
  124. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.4.5.min.map +0 -1
  125. data/res/generators/templates/application/public/jqmobile/jquery.mobile.structure-1.4.5.min.css +0 -3
  126. data/res/generators/templates/application/public/jqmobile/jquery.mobile.theme-1.4.5.min.css +0 -3
  127. data/res/generators/templates/application/public/jquery/jquery-1.9.1.min.js +0 -5
  128. data/res/generators/templates/application/public/jquery/jquery-1.9.1.min.map +0 -1
  129. data/res/generators/templates/application/public/js/application.js +0 -1
  130. data/res/generators/templates/application/public/js/jqmobile-patch.js +0 -466
  131. data/res/generators/templates/application/public/js/syncengine.js +0 -504
@@ -0,0 +1,33 @@
1
+ #ifndef QSCROLLEVENT_P_H
2
+ #define QSCROLLEVENT_P_H
3
+
4
+ #include "qtscrollevent.h"
5
+
6
+ class QtScrollPrepareEventPrivate
7
+ {
8
+ public:
9
+ inline QtScrollPrepareEventPrivate()
10
+ : target(0)
11
+ {
12
+ }
13
+
14
+ QObject* target;
15
+ QPointF startPos;
16
+ QSizeF viewportSize;
17
+ QRectF contentPosRange;
18
+ QPointF contentPos;
19
+ };
20
+
21
+ class QtScrollEventPrivate
22
+ {
23
+ public:
24
+ inline QtScrollEventPrivate()
25
+ {
26
+ }
27
+
28
+ QPointF contentPos;
29
+ QPointF overshoot;
30
+ QtScrollEvent::ScrollState state;
31
+ };
32
+
33
+ #endif // QSCROLLEVENT_P_H
@@ -0,0 +1,347 @@
1
+ /****************************************************************************
2
+ **
3
+ ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ** All rights reserved.
5
+ ** Contact: Nokia Corporation (qt-info@nokia.com)
6
+ **
7
+ ** This file is part of the QtGui module of the Qt Toolkit.
8
+ **
9
+ ** $QT_BEGIN_LICENSE:LGPL$
10
+ ** No Commercial Usage
11
+ ** This file contains pre-release code and may not be distributed.
12
+ ** You may use this file in accordance with the terms and conditions
13
+ ** contained in the Technology Preview License Agreement accompanying
14
+ ** this package.
15
+ **
16
+ ** GNU Lesser General Public License Usage
17
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
18
+ ** General Public License version 2.1 as published by the Free Software
19
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
20
+ ** packaging of this file. Please review the following information to
21
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
22
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23
+ **
24
+ ** In addition, as a special exception, Nokia gives you certain additional
25
+ ** rights. These rights are described in the Nokia Qt LGPL Exception
26
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27
+ **
28
+ ** If you have questions regarding the use of this file, please contact
29
+ ** Nokia at qt-info@nokia.com.
30
+ **
31
+ **
32
+ **
33
+ **
34
+ **
35
+ **
36
+ **
37
+ **
38
+ ** $QT_END_LICENSE$
39
+ **
40
+ ****************************************************************************/
41
+
42
+ #include <qwebviewkineticscroller.h>
43
+ #include <QApplication>
44
+ #include <QGraphicsView>
45
+ #include <QWebView>
46
+ #include <QWebFrame>
47
+ #include <QScrollBar>
48
+ #include <QPointF>
49
+ #include <QPointer>
50
+ #include <QMouseEvent>
51
+ #include <QTouchEvent>
52
+ #if QT_VERSION < 0x040700
53
+ # include <QTime>
54
+ #else
55
+ # include <QElapsedTimer>
56
+ #endif
57
+
58
+ #include <QtDebug>
59
+
60
+ QT_BEGIN_NAMESPACE
61
+
62
+ bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event);
63
+
64
+ class QWebViewKineticScrollerPrivate
65
+ {
66
+ public:
67
+ QWebViewKineticScroller *q_ptr;
68
+
69
+ QWebView *web;
70
+ bool ignoreEvents;
71
+ bool touchActive;
72
+ bool pressed;
73
+ QPointF fractionalPosition;
74
+ QPointer<QWebFrame> scrollFrame;
75
+ Qt::ScrollBarPolicy oldHorizontalSBP;
76
+ Qt::ScrollBarPolicy oldVerticalSBP;
77
+
78
+ QEvent::Type pressType;
79
+ QPoint pressPos;
80
+ QPoint pressGlobalPos;
81
+ Qt::MouseButton pressButton;
82
+ Qt::MouseButtons pressButtons;
83
+ Qt::KeyboardModifiers pressModifiers;
84
+
85
+ #if QT_VERSION < 0x040700
86
+ QTime timer;
87
+ #else
88
+ QElapsedTimer timer;
89
+ #endif
90
+
91
+ QWebViewKineticScrollerPrivate()
92
+ : q_ptr(0)
93
+ , web(0)
94
+ , ignoreEvents(false)
95
+ , touchActive(false)
96
+ , pressed(false)
97
+ , pressType(QEvent::None)
98
+ {}
99
+
100
+ void init()
101
+ {
102
+ timer.start();
103
+ }
104
+
105
+ void sendEvent(QWidget *w, QEvent *e)
106
+ {
107
+ ignoreEvents = true;
108
+ qt_sendSpontaneousEvent(w, e);
109
+ ignoreEvents = false;
110
+ }
111
+
112
+ QWebFrame *currentFrame() const;
113
+ QWebFrame *scrollingFrameAt(const QPointF &pos) const;
114
+ };
115
+
116
+ /*!
117
+ * The QWebViewKineticScroller class implements the QKineticScroller for the QWebView
118
+ */
119
+ QWebViewKineticScroller::QWebViewKineticScroller()
120
+ : QObject()
121
+ , QKineticScroller()
122
+ , d_ptr(new QWebViewKineticScrollerPrivate())
123
+ {
124
+ Q_D(QWebViewKineticScroller);
125
+ d->q_ptr = this;
126
+ d->init();
127
+ }
128
+
129
+ /*!
130
+ Destroys the scroller.
131
+ */
132
+ QWebViewKineticScroller::~QWebViewKineticScroller()
133
+ { }
134
+
135
+ void QWebViewKineticScroller::setWidget(QWebView *widget)
136
+ {
137
+ Q_D(QWebViewKineticScroller);
138
+
139
+ if (d->web) {
140
+ d->web->removeEventFilter(this);
141
+ d->web->setAttribute(Qt::WA_AcceptTouchEvents, false);
142
+
143
+ QWebFrame *mainFrame = d->web->page()->mainFrame();
144
+ mainFrame->setScrollBarPolicy(Qt::Vertical, d->oldVerticalSBP);
145
+ mainFrame->setScrollBarPolicy(Qt::Horizontal, d->oldHorizontalSBP);
146
+ }
147
+
148
+ d->scrollFrame = 0;
149
+ reset();
150
+ d->web = widget;
151
+ d->fractionalPosition = QPointF();
152
+ setParent(d->web);
153
+
154
+ if (d->web) {
155
+ QWebFrame *mainFrame = d->web->page()->mainFrame();
156
+ d->oldVerticalSBP = mainFrame->scrollBarPolicy(Qt::Vertical);
157
+ d->oldHorizontalSBP = mainFrame->scrollBarPolicy(Qt::Horizontal);
158
+ mainFrame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
159
+ mainFrame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
160
+ d->web->setAttribute(Qt::WA_AcceptTouchEvents, true);
161
+ d->web->installEventFilter(this);
162
+ }
163
+ }
164
+
165
+ bool QWebViewKineticScroller::eventFilter(QObject *o, QEvent *e)
166
+ {
167
+ Q_D(QWebViewKineticScroller);
168
+
169
+ qint64 timestamp = d->timer.elapsed();
170
+ bool res = false;
171
+
172
+ if (d->web && (o == d->web) && !d->ignoreEvents && d->web->isEnabled() && isEnabled()) {
173
+ switch (e->type()) {
174
+ case QEvent::TouchBegin:
175
+ case QEvent::TouchUpdate:
176
+ case QEvent::TouchEnd: {
177
+ qWarning("TOUCH%s", e->type() == QEvent::TouchBegin ? "BEGIN" : (e->type() == QEvent::TouchEnd ? "END" : "UPDATE"));
178
+ Input type = (e->type() == QEvent::TouchBegin) ? InputPress :
179
+ ((e->type() == QEvent::TouchEnd) ? InputRelease : InputMove);
180
+ QTouchEvent *te = static_cast<QTouchEvent *>(e);
181
+ int idx = (te->device()->type() == QTouchDevice::TouchScreen) ? 0 : 1;
182
+
183
+ if (te->touchPoints().count() == (idx + 1)) {
184
+ QPointF p = te->touchPoints().at(idx).pos();
185
+ if (type == InputPress) {
186
+ // remember the frame where the button was pressed
187
+ QWebFrame *hitFrame = d->scrollingFrameAt(p);
188
+ if (hitFrame)
189
+ d->scrollFrame = hitFrame;
190
+ }
191
+
192
+ res = handleInput(type, p, timestamp);
193
+ if (type == InputPress) {
194
+ d->touchActive = true;
195
+ res = true; // we need to swallow this event, since WebKit would reject it otherwise
196
+ } else if (type == InputRelease) {
197
+ d->touchActive = false;
198
+ }
199
+ qWarning(" TOUCH%s (%d): %d", type == InputPress ? "BEGIN" : (type == InputRelease ? "END" : "UPDATE"), d->touchActive, res);
200
+ }
201
+ break;
202
+ }
203
+ case QEvent::Wheel:
204
+ // the two-finger gesture on the Mac is mapped to wheel events by default
205
+ qWarning("WHEEL");
206
+ res = d->touchActive;
207
+ break;
208
+
209
+ case QEvent::MouseButtonPress:
210
+ // re-install the event filter so that we get the mouse release before all other filters.
211
+ // this is an evil hack, but hard to work around without prioritized event filters.
212
+ d->web->removeEventFilter(this);
213
+ d->web->installEventFilter(this);
214
+ // fall through
215
+
216
+ case QEvent::MouseButtonDblClick:
217
+ case QEvent::MouseMove:
218
+ case QEvent::MouseButtonRelease:
219
+ if (!d->touchActive) {
220
+ Input type = (e->type() == QEvent::MouseButtonRelease) ? InputRelease :
221
+ ((e->type() == QEvent::MouseMove) ? InputMove : InputPress);
222
+ QPointF p = static_cast<QMouseEvent *>(e)->pos();
223
+
224
+ if (type == InputPress) {
225
+ // remember the frame where the button was pressed
226
+ QWebFrame *hitFrame = d->scrollingFrameAt(p);
227
+ if (hitFrame)
228
+ d->scrollFrame = hitFrame;
229
+ d->pressed = true;
230
+ } else if (type == InputRelease) {
231
+ d->pressed = false;
232
+ }
233
+
234
+ if (type != InputMove || d->pressed)
235
+ res = handleInput(type, p, timestamp);
236
+
237
+ if (e->type() == QEvent::MouseButtonPress && !res) {
238
+ // eat the event but store it for further reference
239
+ QMouseEvent *me = reinterpret_cast<QMouseEvent *>(e);
240
+
241
+ d->pressType = me->type();
242
+ d->pressPos = me->pos();
243
+ d->pressGlobalPos = me->globalPos();
244
+ d->pressButton = me->button();
245
+ d->pressButtons = me->buttons();
246
+ d->pressModifiers = me->modifiers();
247
+
248
+ res = true;
249
+ }
250
+
251
+ if (type == InputRelease && !res) {
252
+ if (d->pressType == QEvent::MouseButtonPress) {
253
+ // replay the mouse press
254
+ QMouseEvent me(d->pressType, d->pressPos, d->pressGlobalPos,
255
+ d->pressButton, d->pressButtons, d->pressModifiers);
256
+ d->sendEvent(d->web, &me);
257
+ d->pressType = QEvent::None;
258
+ }
259
+ }
260
+ }
261
+ break;
262
+
263
+ default:
264
+ break;
265
+ }
266
+ }
267
+
268
+ if (res)
269
+ e->accept();
270
+ return res;
271
+ }
272
+
273
+
274
+ bool QWebViewKineticScroller::canStartScrollingAt(const QPointF & /*pos*/) const
275
+ {
276
+ return true;
277
+ }
278
+
279
+ void QWebViewKineticScroller::cancelPress(const QPointF & /*pressPos*/)
280
+ {
281
+ Q_D(QWebViewKineticScroller);
282
+
283
+ d->pressType = QEvent::None;
284
+ }
285
+
286
+ QWebFrame *QWebViewKineticScrollerPrivate::currentFrame() const
287
+ {
288
+ if (web && scrollFrame)
289
+ return scrollFrame;
290
+ else if (web)
291
+ return web->page()->mainFrame();
292
+ else
293
+ return 0;
294
+ }
295
+
296
+ // returns the innermost frame at the given position that can be scrolled
297
+ QWebFrame *QWebViewKineticScrollerPrivate::scrollingFrameAt(const QPointF &pos) const
298
+ {
299
+ QWebFrame *hitFrame = 0;
300
+ if (web) {
301
+ QWebFrame *mainFrame = web->page()->mainFrame();
302
+ hitFrame = mainFrame->hitTestContent(pos.toPoint()).frame();
303
+ QSize range = hitFrame->contentsSize() - hitFrame->geometry().size();
304
+
305
+ while (hitFrame && range.width() <= 1 && range.height() <= 1)
306
+ hitFrame = hitFrame->parentFrame();
307
+ }
308
+ return hitFrame;
309
+ }
310
+
311
+ QSizeF QWebViewKineticScroller::viewportSize() const
312
+ {
313
+ Q_D(const QWebViewKineticScroller);
314
+
315
+ return d->web ? d->web->page()->viewportSize() : QSize();
316
+ }
317
+
318
+ QPointF QWebViewKineticScroller::maximumContentPosition() const
319
+ {
320
+ Q_D(const QWebViewKineticScroller);
321
+
322
+ QWebFrame *frame = d->currentFrame();
323
+ QSize s = frame ? frame->contentsSize() - frame->geometry().size() : QSize();
324
+ return QPointF(qMax(0, s.width()), qMax(0, s.height()));
325
+ }
326
+
327
+ QPointF QWebViewKineticScroller::contentPosition() const
328
+ {
329
+ Q_D(const QWebViewKineticScroller);
330
+
331
+ QWebFrame *frame = d->currentFrame();
332
+ return frame ? QPointF(frame->scrollPosition()) + d->fractionalPosition : QPointF();
333
+ }
334
+
335
+ void QWebViewKineticScroller::setContentPosition(const QPointF &p, const QPointF & /*overshoot*/)
336
+ {
337
+ Q_D(QWebViewKineticScroller);
338
+
339
+ QWebFrame *frame = d->currentFrame();
340
+ if (frame) {
341
+ QPoint pint(int(p.x()), int(p.y()));
342
+ frame->setScrollPosition(pint);
343
+ d->fractionalPosition = p - QPointF(pint);
344
+ }
345
+ }
346
+
347
+ QT_END_NAMESPACE
@@ -0,0 +1,90 @@
1
+ /****************************************************************************
2
+ **
3
+ ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ** All rights reserved.
5
+ ** Contact: Nokia Corporation (qt-info@nokia.com)
6
+ **
7
+ ** This file is part of the QtGui module of the Qt Toolkit.
8
+ **
9
+ ** $QT_BEGIN_LICENSE:LGPL$
10
+ ** No Commercial Usage
11
+ ** This file contains pre-release code and may not be distributed.
12
+ ** You may use this file in accordance with the terms and conditions
13
+ ** contained in the Technology Preview License Agreement accompanying
14
+ ** this package.
15
+ **
16
+ ** GNU Lesser General Public License Usage
17
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
18
+ ** General Public License version 2.1 as published by the Free Software
19
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
20
+ ** packaging of this file. Please review the following information to
21
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
22
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23
+ **
24
+ ** In addition, as a special exception, Nokia gives you certain additional
25
+ ** rights. These rights are described in the Nokia Qt LGPL Exception
26
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27
+ **
28
+ ** If you have questions regarding the use of this file, please contact
29
+ ** Nokia at qt-info@nokia.com.
30
+ **
31
+ **
32
+ **
33
+ **
34
+ **
35
+ **
36
+ **
37
+ **
38
+ ** $QT_END_LICENSE$
39
+ **
40
+ ****************************************************************************/
41
+
42
+ #ifndef QWEBVIEWKINETICSCROLLER_H
43
+ #define QWEBVIEWKINETICSCROLLER_H
44
+
45
+ #include <qkineticscroller.h>
46
+ #include <QWebView>
47
+
48
+ QT_BEGIN_HEADER
49
+
50
+ QT_BEGIN_NAMESPACE
51
+
52
+ QT_MODULE(Gui)
53
+
54
+ class QWebViewKineticScrollerPrivate;
55
+
56
+ class QWebViewKineticScroller : public QObject, public QKineticScroller
57
+ {
58
+ Q_OBJECT
59
+
60
+ public:
61
+ QWebViewKineticScroller();
62
+ // QWebViewKineticScroller(QWebViewKineticScrollerPrivate &dd);
63
+ ~QWebViewKineticScroller();
64
+
65
+ void setWidget(QWebView *widget);
66
+
67
+ bool eventFilter(QObject *o, QEvent *e);
68
+
69
+ protected:
70
+
71
+ virtual QSizeF viewportSize() const;
72
+ virtual QPointF maximumContentPosition() const;
73
+ virtual QPointF contentPosition() const;
74
+ virtual void setContentPosition(const QPointF &pos, const QPointF &overshootDelta);
75
+
76
+ virtual bool canStartScrollingAt(const QPointF &pos) const;
77
+ virtual void cancelPress(const QPointF &pressPos);
78
+
79
+ QScopedPointer<QWebViewKineticScrollerPrivate> d_ptr;
80
+
81
+ private:
82
+ Q_DISABLE_COPY(QWebViewKineticScroller)
83
+ Q_DECLARE_PRIVATE(QWebViewKineticScroller)
84
+ };
85
+
86
+ QT_END_NAMESPACE
87
+
88
+ QT_END_HEADER
89
+
90
+ #endif // QWEBVIEWSCROLLER_H