New concept of dynamically placing surfaces in static defined layout areas.
[staging/HomeScreen.git] / HomeScreen / src / homescreencontrolinterface.cpp
1 #include "homescreencontrolinterface.h"
2
3 HomeScreenControlInterface::HomeScreenControlInterface(QObject *parent) :
4     QObject(parent),
5     mp_homeScreenAdaptor(0),
6     mp_dBusAppFrameworkProxy()
7 {
8     // publish dbus homescreen interface
9     mp_homeScreenAdaptor = new HomescreenAdaptor((QObject*)this);
10     QDBusConnection dbus = QDBusConnection::sessionBus();
11     dbus.registerObject("/HomeScreen", this);
12     dbus.registerService("org.agl.homescreen");
13
14     qDebug("D-Bus: connect to org.agl.homescreenappframeworkbindertizen /AppFramework");
15     mp_dBusAppFrameworkProxy = new org::agl::appframework("org.agl.homescreenappframeworkbindertizen",
16                                               "/AppFramework",
17                                               QDBusConnection::sessionBus(),
18                                               0);
19 }
20
21 HomeScreenControlInterface::~HomeScreenControlInterface()
22 {
23     delete mp_dBusAppFrameworkProxy;
24     delete mp_homeScreenAdaptor;
25 }
26
27 QRect HomeScreenControlInterface::getLayoutRenderAreaForSurfaceId(int surfaceId)
28 {
29     qDebug("getLayoutRenderAreaForSurfaceId %d", surfaceId);
30     return newRequestGetLayoutRenderAreaForSurfaceId(surfaceId);
31 }
32
33 void HomeScreenControlInterface::hardKeyPressed(int key)
34 {
35     int pid = -1;
36
37     switch (key)
38     {
39     case InputEvent::HARDKEY_NAV:
40         qDebug("hardKeyPressed NAV key pressed!");
41         pid = mp_dBusAppFrameworkProxy->launchApp("demoapp");
42         qDebug("pid: %d", pid);
43         newRequestsToBeVisibleApp(pid);
44         break;
45     default:
46         qDebug("hardKeyPressed %d", key);
47         break;
48     }
49 }
50
51 void HomeScreenControlInterface::renderSurfaceToArea(int surfaceId, const QRect &renderArea)
52 {
53     qDebug("requestSurfaceIdToFullScreen %d", surfaceId);
54     newRequestRenderSurfaceToArea(surfaceId, renderArea);
55 }
56
57 void HomeScreenControlInterface::requestSurfaceIdToFullScreen(int surfaceId)
58 {
59     qDebug("requestSurfaceIdToFullScreen %d", surfaceId);
60     newRequestSurfaceIdToFullScreen(surfaceId);
61 }