Changeset 69313 in webkit


Ignore:
Timestamp:
Oct 7, 2010, 9:23:07 AM (14 years ago)
Author:
diegohcg@webkit.org
Message:

[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):

Location:
trunk
Files:
1 added
5 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r69312 r69313  
     12010-10-05  Diego Gonzalez  <diegohcg@webkit.org>
     2
     3        Reviewed by Andreas Kling.
     4
     5        [Qt] Hook up accelerometer data via Qt DeviceMotion
     6        https://bugs.webkit.org/show_bug.cgi?id=47105
     7
     8        Get accelerometer necessary data via Qt mobility library using a
     9        provider class. Enable, also the RotationRate using the current device
     10        orientation provider.
     11
     12        * WebCore.pro:
     13
    1142010-10-07  Luiz Agostini  <luiz.agostini@openbossa.org>
    215
  • trunk/WebCore/WebCore.pro

    r69284 r69313  
    32953295    HEADERS += \
    32963296        ../WebKit/qt/WebCoreSupport/DeviceMotionClientQt.h \
     3297        ../WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.h \
    32973298        ../WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h \
    32983299        ../WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.h \
     
    33003301    SOURCES += \
    33013302        ../WebKit/qt/WebCoreSupport/DeviceMotionClientQt.cpp \
     3303        ../WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.cpp \
    33023304        ../WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.cpp \
    33033305        ../WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.cpp \
  • trunk/WebKit/qt/ChangeLog

    r69312 r69313  
     12010-10-05  Diego Gonzalez  <diegohcg@webkit.org>
     2
     3        Reviewed by Andreas Kling.
     4
     5        [Qt] Hook up accelerometer data via Qt DeviceMotion
     6        https://bugs.webkit.org/show_bug.cgi?id=47105
     7
     8        Get accelerometer necessary data via Qt mobility library using a
     9        provider class. Enable, also the RotationRate using the current device
     10        orientation provider.
     11
     12        * WebCoreSupport/DeviceMotionClientQt.cpp:
     13        (WebCore::DeviceMotionClientQt::DeviceMotionClientQt):
     14        (WebCore::DeviceMotionClientQt::~DeviceMotionClientQt):
     15        (WebCore::DeviceMotionClientQt::startUpdating):
     16        (WebCore::DeviceMotionClientQt::stopUpdating):
     17        (WebCore::DeviceMotionClientQt::currentDeviceMotion):
     18        (WebCore::DeviceMotionClientQt::changeDeviceMotion):
     19        * WebCoreSupport/DeviceMotionClientQt.h:
     20        * WebCoreSupport/DeviceMotionProviderQt.cpp: Added.
     21        (WebCore::DeviceMotionProviderQt::DeviceMotionProviderQt):
     22        (WebCore::DeviceMotionProviderQt::~DeviceMotionProviderQt):
     23        (WebCore::DeviceMotionProviderQt::start):
     24        (WebCore::DeviceMotionProviderQt::stop):
     25        (WebCore::DeviceMotionProviderQt::filter):
     26        * WebCoreSupport/DeviceMotionProviderQt.h: Added.
     27        (WebCore::DeviceMotionProviderQt::currentDeviceMotion):
     28
    1292010-10-07  Luiz Agostini  <luiz.agostini@openbossa.org>
    230
  • trunk/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.cpp

    r68978 r69313  
    2121#include "DeviceMotionClientQt.h"
    2222
     23#include "DeviceMotionController.h"
     24#include "DeviceMotionProviderQt.h"
     25
    2326#include "qwebpage.h"
    2427
     
    2831    : m_page(page)
    2932    , m_controller(0)
     33    , m_provider(new DeviceMotionProviderQt())
    3034{
     35
     36    connect(m_provider, SIGNAL(deviceMotionChanged()), SLOT(changeDeviceMotion()));
     37}
     38
     39DeviceMotionClientQt::~DeviceMotionClientQt()
     40{
     41    disconnect();
     42    delete m_provider;
    3143}
    3244
     
    3850void DeviceMotionClientQt::startUpdating()
    3951{
    40     // call start method from a motion provider.
     52    m_provider->start();
    4153}
    4254
    4355void DeviceMotionClientQt::stopUpdating()
    4456{
    45     // call stop method from a motion provider.
     57    m_provider->stop();
    4658}
    4759
    4860DeviceMotionData* DeviceMotionClientQt::currentDeviceMotion() const
    4961{
    50     return 0;
     62    return m_provider->currentDeviceMotion();
    5163}
    5264
     
    5668}
    5769
     70void DeviceMotionClientQt::changeDeviceMotion()
     71{
     72    if (!m_controller)
     73        return;
     74
     75    m_controller->didChangeDeviceMotion(currentDeviceMotion());
     76}
     77
    5878} // namespace WebCore
    5979
  • trunk/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.h

    r68978 r69313  
    3030namespace WebCore {
    3131
     32class DeviceMotionProviderQt;
     33
    3234class DeviceMotionClientQt : public QObject, public DeviceMotionClient {
    3335    Q_OBJECT
    3436public:
    3537    DeviceMotionClientQt(QWebPage*);
    36     virtual ~DeviceMotionClientQt() {}
     38    virtual ~DeviceMotionClientQt();
    3739
    3840    virtual void setController(DeviceMotionController*);
     
    4244    virtual void deviceMotionControllerDestroyed();
    4345
     46public Q_SLOTS:
     47    void changeDeviceMotion();
     48
    4449private:
    4550    QWebPage* m_page;
    4651    DeviceMotionController* m_controller;
     52    DeviceMotionProviderQt* m_provider;
    4753};
    4854
  • trunk/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.h

    r69312 r69313  
    1818 *
    1919 */
    20 #ifndef DeviceMotionClientQt_h
    21 #define DeviceMotionClientQt_h
     20#ifndef DeviceMotionProviderQt_h
     21#define DeviceMotionProviderQt_h
    2222
    23 #include "DeviceMotionClient.h"
    2423#include "DeviceMotionData.h"
     24#include "RefPtr.h"
    2525
     26#include <QAccelerometerFilter>
    2627#include <QObject>
    2728
    28 class QWebPage;
     29QTM_USE_NAMESPACE
    2930
    3031namespace WebCore {
    3132
    32 class DeviceMotionClientQt : public QObject, public DeviceMotionClient {
     33class DeviceOrientationProviderQt;
     34
     35class DeviceMotionProviderQt : public QObject, public QAccelerometerFilter {
    3336    Q_OBJECT
    3437public:
    35     DeviceMotionClientQt(QWebPage*);
    36     virtual ~DeviceMotionClientQt() {}
     38    DeviceMotionProviderQt();
     39    ~DeviceMotionProviderQt();
    3740
    38     virtual void setController(DeviceMotionController*);
    39     virtual void startUpdating();
    40     virtual void stopUpdating();
    41     virtual DeviceMotionData* currentDeviceMotion() const;
    42     virtual void deviceMotionControllerDestroyed();
     41    bool filter(QAccelerometerReading*);
     42    void start();
     43    void stop();
     44    DeviceMotionData* currentDeviceMotion() const { return m_motion.get(); }
     45
     46Q_SIGNALS:
     47    void deviceMotionChanged();
    4348
    4449private:
    45     QWebPage* m_page;
    46     DeviceMotionController* m_controller;
     50    RefPtr<DeviceMotionData> m_motion;
     51    QAccelerometer m_acceleration;
     52    DeviceOrientationProviderQt* m_deviceOrientation;
    4753};
    4854
    49 } // namespece WebCore
     55} // namespace WebCore
    5056
    51 #endif // DeviceMotionClientQt_h
     57#endif // DeviceMotionProviderQt_h
Note: See TracChangeset for help on using the changeset viewer.