[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
diegohcg at webkit.org
diegohcg at webkit.org
Wed Dec 22 14:23:09 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 2713c77efa21b7bc7436c3da87ea4ca1ef2e9ad4
Author: diegohcg at webkit.org <diegohcg at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Oct 7 16:23:07 2010 +0000
[Qt] Hook up accelerometer data via Qt DeviceMotion
https://bugs.webkit.org/show_bug.cgi?id=47105
Reviewed by Andreas Kling.
Get accelerometer necessary data via Qt mobility library using a
provider class. Enable, also the RotationRate using the current device
orientation provider.
WebCore:
* WebCore.pro:
WebKit/qt:
* WebCoreSupport/DeviceMotionClientQt.cpp:
(WebCore::DeviceMotionClientQt::DeviceMotionClientQt):
(WebCore::DeviceMotionClientQt::~DeviceMotionClientQt):
(WebCore::DeviceMotionClientQt::startUpdating):
(WebCore::DeviceMotionClientQt::stopUpdating):
(WebCore::DeviceMotionClientQt::currentDeviceMotion):
(WebCore::DeviceMotionClientQt::changeDeviceMotion):
* WebCoreSupport/DeviceMotionClientQt.h:
* WebCoreSupport/DeviceMotionProviderQt.cpp: Added.
(WebCore::DeviceMotionProviderQt::DeviceMotionProviderQt):
(WebCore::DeviceMotionProviderQt::~DeviceMotionProviderQt):
(WebCore::DeviceMotionProviderQt::start):
(WebCore::DeviceMotionProviderQt::stop):
(WebCore::DeviceMotionProviderQt::filter):
* WebCoreSupport/DeviceMotionProviderQt.h: Added.
(WebCore::DeviceMotionProviderQt::currentDeviceMotion):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69313 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 40ab18b..85c7bdf 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2010-10-05 Diego Gonzalez <diegohcg at webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Hook up accelerometer data via Qt DeviceMotion
+ https://bugs.webkit.org/show_bug.cgi?id=47105
+
+ Get accelerometer necessary data via Qt mobility library using a
+ provider class. Enable, also the RotationRate using the current device
+ orientation provider.
+
+ * WebCore.pro:
+
2010-10-07 Luiz Agostini <luiz.agostini at openbossa.org>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 40921e4..6bcfeef 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -3294,11 +3294,13 @@ contains(DEFINES, ENABLE_GEOLOCATION=1) {
contains(DEFINES, ENABLE_DEVICE_ORIENTATION=1) {
HEADERS += \
../WebKit/qt/WebCoreSupport/DeviceMotionClientQt.h \
+ ../WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.h \
../WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h \
../WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.h \
bindings/generic/RuntimeEnabledFeatures.h
SOURCES += \
../WebKit/qt/WebCoreSupport/DeviceMotionClientQt.cpp \
+ ../WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.cpp \
../WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.cpp \
../WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.cpp \
bindings/generic/RuntimeEnabledFeatures.cpp
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index b935863..712ae75 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,31 @@
+2010-10-05 Diego Gonzalez <diegohcg at webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Hook up accelerometer data via Qt DeviceMotion
+ https://bugs.webkit.org/show_bug.cgi?id=47105
+
+ Get accelerometer necessary data via Qt mobility library using a
+ provider class. Enable, also the RotationRate using the current device
+ orientation provider.
+
+ * WebCoreSupport/DeviceMotionClientQt.cpp:
+ (WebCore::DeviceMotionClientQt::DeviceMotionClientQt):
+ (WebCore::DeviceMotionClientQt::~DeviceMotionClientQt):
+ (WebCore::DeviceMotionClientQt::startUpdating):
+ (WebCore::DeviceMotionClientQt::stopUpdating):
+ (WebCore::DeviceMotionClientQt::currentDeviceMotion):
+ (WebCore::DeviceMotionClientQt::changeDeviceMotion):
+ * WebCoreSupport/DeviceMotionClientQt.h:
+ * WebCoreSupport/DeviceMotionProviderQt.cpp: Added.
+ (WebCore::DeviceMotionProviderQt::DeviceMotionProviderQt):
+ (WebCore::DeviceMotionProviderQt::~DeviceMotionProviderQt):
+ (WebCore::DeviceMotionProviderQt::start):
+ (WebCore::DeviceMotionProviderQt::stop):
+ (WebCore::DeviceMotionProviderQt::filter):
+ * WebCoreSupport/DeviceMotionProviderQt.h: Added.
+ (WebCore::DeviceMotionProviderQt::currentDeviceMotion):
+
2010-10-07 Luiz Agostini <luiz.agostini at openbossa.org>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.cpp b/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.cpp
index 825da3e..4761514 100644
--- a/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.cpp
@@ -20,6 +20,9 @@
#include "config.h"
#include "DeviceMotionClientQt.h"
+#include "DeviceMotionController.h"
+#include "DeviceMotionProviderQt.h"
+
#include "qwebpage.h"
namespace WebCore {
@@ -27,7 +30,16 @@ namespace WebCore {
DeviceMotionClientQt::DeviceMotionClientQt(QWebPage* page)
: m_page(page)
, m_controller(0)
+ , m_provider(new DeviceMotionProviderQt())
+{
+
+ connect(m_provider, SIGNAL(deviceMotionChanged()), SLOT(changeDeviceMotion()));
+}
+
+DeviceMotionClientQt::~DeviceMotionClientQt()
{
+ disconnect();
+ delete m_provider;
}
void DeviceMotionClientQt::setController(DeviceMotionController* controller)
@@ -37,17 +49,17 @@ void DeviceMotionClientQt::setController(DeviceMotionController* controller)
void DeviceMotionClientQt::startUpdating()
{
- // call start method from a motion provider.
+ m_provider->start();
}
void DeviceMotionClientQt::stopUpdating()
{
- // call stop method from a motion provider.
+ m_provider->stop();
}
DeviceMotionData* DeviceMotionClientQt::currentDeviceMotion() const
{
- return 0;
+ return m_provider->currentDeviceMotion();
}
void DeviceMotionClientQt::deviceMotionControllerDestroyed()
@@ -55,6 +67,14 @@ void DeviceMotionClientQt::deviceMotionControllerDestroyed()
delete this;
}
+void DeviceMotionClientQt::changeDeviceMotion()
+{
+ if (!m_controller)
+ return;
+
+ m_controller->didChangeDeviceMotion(currentDeviceMotion());
+}
+
} // namespace WebCore
#include "moc_DeviceMotionClientQt.cpp"
diff --git a/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.h b/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.h
index 29abe96..ea843e2 100644
--- a/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.h
+++ b/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.h
@@ -29,11 +29,13 @@ class QWebPage;
namespace WebCore {
+class DeviceMotionProviderQt;
+
class DeviceMotionClientQt : public QObject, public DeviceMotionClient {
Q_OBJECT
public:
DeviceMotionClientQt(QWebPage*);
- virtual ~DeviceMotionClientQt() {}
+ virtual ~DeviceMotionClientQt();
virtual void setController(DeviceMotionController*);
virtual void startUpdating();
@@ -41,9 +43,13 @@ public:
virtual DeviceMotionData* currentDeviceMotion() const;
virtual void deviceMotionControllerDestroyed();
+public Q_SLOTS:
+ void changeDeviceMotion();
+
private:
QWebPage* m_page;
DeviceMotionController* m_controller;
+ DeviceMotionProviderQt* m_provider;
};
} // namespece WebCore
diff --git a/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.cpp b/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.cpp
new file mode 100644
index 0000000..ccf7697
--- /dev/null
+++ b/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.cpp
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#include "config.h"
+#include "DeviceMotionProviderQt.h"
+
+#include "DeviceOrientationProviderQt.h"
+
+namespace WebCore {
+
+DeviceMotionProviderQt::DeviceMotionProviderQt()
+{
+ m_acceleration.addFilter(this);
+ m_motion = DeviceMotionData::create();
+ m_deviceOrientation = new DeviceOrientationProviderQt();
+}
+
+DeviceMotionProviderQt::~DeviceMotionProviderQt()
+{
+ delete m_deviceOrientation;
+}
+
+void DeviceMotionProviderQt::start()
+{
+ m_acceleration.start();
+ m_deviceOrientation->start();
+}
+
+void DeviceMotionProviderQt::stop()
+{
+ m_acceleration.stop();
+ m_deviceOrientation->stop();
+}
+
+bool DeviceMotionProviderQt::filter(QAccelerometerReading* reading)
+{
+ RefPtr<DeviceMotionData::Acceleration> accel = DeviceMotionData::Acceleration::create(
+ /* x available */ true, reading->x(),
+ /* y available */ true, reading->y(),
+ /* z available */ true, reading->z());
+
+ RefPtr<DeviceMotionData::RotationRate> rotation = DeviceMotionData::RotationRate::create(
+ m_deviceOrientation->hasAlpha(), m_deviceOrientation->orientation()->alpha(),
+ /* beta available */ true, m_deviceOrientation->orientation()->beta(),
+ /* gamma available */ true, m_deviceOrientation->orientation()->gamma());
+
+ m_motion = DeviceMotionData::create(accel,
+ accel, /* FIXME: Needs to provide acceleration include gravity. */
+ rotation,
+ false, 0 /* The interval is treated internally by Qt mobility */);
+
+ emit deviceMotionChanged();
+
+ return false;
+}
+
+} // namespace WebCore
+
+#include "moc_DeviceMotionProviderQt.cpp"
diff --git a/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.h b/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.h
new file mode 100644
index 0000000..f3200d5
--- /dev/null
+++ b/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef DeviceMotionProviderQt_h
+#define DeviceMotionProviderQt_h
+
+#include "DeviceMotionData.h"
+#include "RefPtr.h"
+
+#include <QAccelerometerFilter>
+#include <QObject>
+
+QTM_USE_NAMESPACE
+
+namespace WebCore {
+
+class DeviceOrientationProviderQt;
+
+class DeviceMotionProviderQt : public QObject, public QAccelerometerFilter {
+ Q_OBJECT
+public:
+ DeviceMotionProviderQt();
+ ~DeviceMotionProviderQt();
+
+ bool filter(QAccelerometerReading*);
+ void start();
+ void stop();
+ DeviceMotionData* currentDeviceMotion() const { return m_motion.get(); }
+
+Q_SIGNALS:
+ void deviceMotionChanged();
+
+private:
+ RefPtr<DeviceMotionData> m_motion;
+ QAccelerometer m_acceleration;
+ DeviceOrientationProviderQt* m_deviceOrientation;
+};
+
+} // namespace WebCore
+
+#endif // DeviceMotionProviderQt_h
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list