rhodes 5.5.0.3 → 5.5.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +10 -0
- data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/NotificationSingleton.java +20 -8
- data/lib/commonAPI/coreapi/ext/platform/iphone/cpp_based_impl/SystemImpl.mm +1 -2
- data/lib/commonAPI/coreapi/ext/system.xml +1 -1
- data/platform/android/build/android.rake +1 -0
- data/platform/iphone/Classes/AppManager/AppManager.m +44 -3
- data/platform/iphone/Classes/NativeView/RhoNativeViewManager.mm +4 -3
- data/platform/iphone/Classes/NativeView/RhoNativeViewManagerOC.h +1 -1
- data/platform/iphone/Classes/RhoMainView.h +8 -2
- data/platform/iphone/Classes/RhoUIWebView.h +75 -0
- data/platform/iphone/Classes/RhoUIWebView.m +142 -0
- data/platform/iphone/Classes/RhoWKWebView.h +87 -0
- data/platform/iphone/Classes/RhoWKWebView.m +187 -0
- data/platform/iphone/Classes/RhoWebView.h +72 -0
- data/platform/iphone/Classes/RhoWebViewFabrique.h +35 -0
- data/platform/iphone/Classes/RhoWebViewFabrique.m +87 -0
- data/platform/iphone/Classes/Rhodes.m +17 -6
- data/platform/iphone/Classes/Signature.old/SignatureDelegate.m +11 -4
- data/platform/iphone/Classes/Signature/SignatureDelegate.m +3 -4
- data/platform/iphone/Classes/SimpleMainView.h +7 -5
- data/platform/iphone/Classes/SimpleMainView.m +174 -179
- data/platform/iphone/Classes/SplitView/RightViewController.h +2 -2
- data/platform/iphone/Classes/SplitView/RightViewController.m +9 -10
- data/platform/iphone/Classes/SplitView/SplittedMainView.h +2 -3
- data/platform/iphone/Classes/SplitView/SplittedMainView.m +10 -7
- data/platform/iphone/Classes/TabbedMainView.h +2 -1
- data/platform/iphone/Classes/TabbedMainView.m +13 -10
- data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.m +21 -5
- data/platform/iphone/Classes/WebView.m +1 -1
- data/platform/iphone/RhoAppBaseLib/RhoAppBaseLib.xcodeproj/project.pbxproj +40 -3
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +4 -0
- data/platform/iphone/rbuild/iphone.rake +51 -0
- data/platform/shared/common/RhoNativeViewManager.h +9 -9
- data/platform/shared/common/RhodesApp.cpp +13 -1
- data/platform/shared/net/HttpServer.cpp +12 -2
- data/platform/shared/qt/rhodes/ExternalWebView.ui +11 -2
- data/platform/shared/qt/rhodes/QtMainWindow.cpp +9 -7
- data/platform/shared/qt/rhodes/QtMainWindow.ui +13 -4
- data/platform/shared/qt/rhodes/qkineticscroller.cpp +1245 -0
- data/platform/shared/qt/rhodes/qkineticscroller.h +165 -0
- data/platform/shared/qt/rhodes/qkineticscroller_p.h +168 -0
- data/platform/shared/qt/rhodes/qtflickgesture.cpp +696 -0
- data/platform/shared/qt/rhodes/qtflickgesture_p.h +107 -0
- data/platform/shared/qt/rhodes/qtscroller.cpp +2080 -0
- data/platform/shared/qt/rhodes/qtscroller.h +138 -0
- data/platform/shared/qt/rhodes/qtscroller_p.h +205 -0
- data/platform/shared/qt/rhodes/qtscrollerfilter.cpp +350 -0
- data/platform/shared/qt/rhodes/qtscrollerfilter_p.h +110 -0
- data/platform/shared/qt/rhodes/qtscrollerproperties.cpp +412 -0
- data/platform/shared/qt/rhodes/qtscrollerproperties.h +135 -0
- data/platform/shared/qt/rhodes/qtscrollerproperties_p.h +90 -0
- data/platform/shared/qt/rhodes/qtscrollevent.cpp +190 -0
- data/platform/shared/qt/rhodes/qtscrollevent.h +100 -0
- data/platform/shared/qt/rhodes/qtscrollevent_p.h +33 -0
- data/platform/shared/qt/rhodes/qwebviewkineticscroller.cpp +347 -0
- data/platform/shared/qt/rhodes/qwebviewkineticscroller.h +90 -0
- data/platform/shared/qt/rhodes/qwebviewselectionsuppressor.h +113 -0
- data/platform/shared/qt/rhodes/rhodes.pro +19 -0
- data/res/generators/rhogen.rb +307 -15
- data/res/generators/templates/application/app/Settings/err_sync.erb +12 -6
- data/res/generators/templates/application/app/Settings/home.erb +32 -17
- data/res/generators/templates/application/app/Settings/index.erb +55 -26
- data/res/generators/templates/application/app/Settings/javascript_index.html +111 -0
- data/res/generators/templates/application/app/Settings/javascript_login.html +65 -0
- data/res/generators/templates/application/app/Settings/login.erb +25 -19
- data/res/generators/templates/application/app/Settings/reset.erb +18 -9
- data/res/generators/templates/application/app/Settings/wait.erb +10 -7
- data/res/generators/templates/application/app/index.erb +32 -20
- data/res/generators/templates/application/app/javascript_index.html +66 -0
- data/res/generators/templates/application/app/javascript_index.js +250 -0
- data/res/generators/templates/application/app/layout.erb +12 -67
- data/res/generators/templates/application/javascript_build.yml +41 -0
- data/res/generators/templates/application/javascript_rhoconfig.txt +123 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.css +587 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.css.map +1 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.min.css +6 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.min.css.map +1 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.css +6757 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.css.map +1 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.min.css +6 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.min.css.map +1 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.eot +0 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.svg +288 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff +0 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/js/bootstrap.js +2377 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/js/bootstrap.min.js +7 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/js/npm.js +13 -0
- data/res/generators/templates/application/public/css/style.css +3 -0
- data/res/generators/templates/application/public/jquery/jquery-3.1.1.min.js +4 -0
- data/res/generators/templates/application/public/jquery/jquery-3.1.1.min.map +1 -0
- data/res/generators/templates/application/rhoconfig.txt +16 -0
- data/res/generators/templates/iphone_project/Bremen7.xcodeproj/project.pbxproj +4 -0
- data/res/generators/templates/model/edit.erb +22 -21
- data/res/generators/templates/model/index.erb +24 -22
- data/res/generators/templates/model/javascript_edit.html +65 -0
- data/res/generators/templates/model/javascript_index.html +56 -0
- data/res/generators/templates/model/javascript_index.js +83 -0
- data/res/generators/templates/model/javascript_model.js +16 -0
- data/res/generators/templates/model/javascript_new.html +64 -0
- data/res/generators/templates/model/javascript_show.html +66 -0
- data/res/generators/templates/model/new.erb +22 -19
- data/res/generators/templates/model/show.erb +22 -14
- data/res/prebuild_base_app/app/index.erb +31 -18
- data/res/prebuild_base_app/app/layout.erb +11 -56
- data/version +1 -1
- metadata +59 -24
- data/res/generators/templates/application/public/css/android.css +0 -418
- data/res/generators/templates/application/public/css/iphone.css +0 -378
- data/res/generators/templates/application/public/css/jqmobile-patch.css +0 -62
- data/res/generators/templates/application/public/css/re_webkit.css +0 -736
- data/res/generators/templates/application/public/css/re_webkit_flat.css +0 -753
- data/res/generators/templates/application/public/css/windows_mobile.css +0 -327
- data/res/generators/templates/application/public/jqmobile/images/ajax-loader.gif +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icon-search-black.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-18-black.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-18-white.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-36-black.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-36-white.png +0 -0
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.4.5.min.css +0 -3
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.4.5.min.js +0 -10
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.4.5.min.map +0 -1
- data/res/generators/templates/application/public/jqmobile/jquery.mobile.structure-1.4.5.min.css +0 -3
- data/res/generators/templates/application/public/jqmobile/jquery.mobile.theme-1.4.5.min.css +0 -3
- data/res/generators/templates/application/public/jquery/jquery-1.9.1.min.js +0 -5
- data/res/generators/templates/application/public/jquery/jquery-1.9.1.min.map +0 -1
- data/res/generators/templates/application/public/js/application.js +0 -1
- data/res/generators/templates/application/public/js/jqmobile-patch.js +0 -466
- 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
|