DeviceOrientationClientQt.cpp [plain text]
#include "config.h"
#include "DeviceOrientationClientQt.h"
#include "DeviceOrientationClientMockQt.h"
#include "DeviceOrientationController.h"
#include "DeviceOrientationProviderQt.h"
#include "qwebpage.h"
namespace WebCore {
DeviceOrientationClientQt::DeviceOrientationClientQt(QWebPage* page)
: m_page(page)
, m_controller(0)
, m_provider(new DeviceOrientationProviderQt())
{
connect(m_provider, SIGNAL(deviceOrientationChanged(DeviceOrientation*)), SLOT(changeDeviceOrientation(DeviceOrientation*)));
}
DeviceOrientationClientQt::~DeviceOrientationClientQt()
{
disconnect();
delete m_provider;
}
void DeviceOrientationClientQt::setController(DeviceOrientationController* controller)
{
m_controller = controller;
}
void DeviceOrientationClientQt::startUpdating()
{
m_provider->start();
}
void DeviceOrientationClientQt::stopUpdating()
{
m_provider->stop();
}
DeviceOrientation* DeviceOrientationClientQt::lastOrientation() const
{
return m_provider->orientation();
}
void DeviceOrientationClientQt::deviceOrientationControllerDestroyed()
{
delete this;
}
void DeviceOrientationClientQt::changeDeviceOrientation(DeviceOrientation* orientation)
{
if (!m_controller)
return;
m_controller->didChangeDeviceOrientation(orientation);
}
}
#include "moc_DeviceOrientationClientQt.cpp"