-Make the SampleNav app yellow. 93/7093/1
authorBocklage, Jens <Jens_Bocklage@mentor.com>
Tue, 8 Nov 2016 18:46:21 +0000 (19:46 +0100)
committerBocklage, Jens <Jens_Bocklage@mentor.com>
Tue, 8 Nov 2016 18:46:21 +0000 (19:46 +0100)
-Preparation for the new ApplicationFramework binding. The App Framework provides more information.
--Adding afm D-Bus-interface introspection
--Updating the AppInfo datatype to hold the new data:
  The application info consists of:
  string id;
  string version;
  int width;
  int height;
  string name;
  string description;
  string shortname;
  string author;
  string iconPath;
-When pressing the AppLauncher Button or the Settings Button, the app layer is hidden.
--Therefore, shideLayer and showLayer is introduced in the WindowManager API
-If an application does not create its surface instantly, the HomeScreen retries to show the surface related to the pid.
-New WindowManager function deleteLayoutById
-Implement the complete HomeScreen API in the libhomescreen

Signed-off-by: Bocklage, Jens <Jens_Bocklage@mentor.com>
21 files changed:
HomeScreen/src/applauncherwidget.cpp
HomeScreen/src/applauncherwidget.h
HomeScreen/src/controlbarwidget.cpp
HomeScreen/src/controlbarwidget.h
HomeScreen/src/layouthandler.cpp
HomeScreen/src/layouthandler.h
HomeScreen/src/main.cpp
HomeScreen/src/mainwindow.cpp
SampleHomeScreenInterfaceApp/src/sampleclass.cpp
SampleHomeScreenInterfaceApp/src/sampleclass.hpp
WindowManager/src/windowmanager.cpp
WindowManager/src/windowmanager.hpp
interfaces/appframework.xml
interfaces/include/afm_user_daemon.hpp [new file with mode: 0644]
interfaces/include/appframework.hpp
interfaces/include/windowmanager.hpp
interfaces/interfaces.pro
interfaces/src/appframework.cpp
interfaces/windowmanager.xml
libhomescreen/include/libhomescreen.hpp
libhomescreen/src/libhomescreen.cpp

index 3d47d93..2cd5b17 100644 (file)
 AppLauncherWidget::AppLauncherWidget(QWidget *parent) :
     QWidget(parent),
     mp_ui(new Ui::AppLauncherWidget),
-    mp_appList(new QList<AppInfo>()),
+    m_appList(),
     mp_appTable(0),
     mp_dBusAppFrameworkProxy()
 {
     mp_ui->setupUi(this);
 
-    AppInfo ai;
+    /*AppInfo ai;
     for (int i = 0; i < 100; ++i)
     {
         ai.setName("test" + QString::number(i));
         mp_appList->append(ai);
-    }
+    }*/
 
     qDebug("D-Bus: connect to org.agl.homescreenappframeworkbinder /AppFramework");
     mp_dBusAppFrameworkProxy = new org::agl::appframework("org.agl.homescreenappframeworkbinder",
@@ -54,7 +54,6 @@ AppLauncherWidget::~AppLauncherWidget()
     {
         delete mp_appTable;
     }
-    delete mp_appList;
     delete mp_ui;
 }
 
@@ -101,12 +100,11 @@ void AppLauncherWidget::populateAppList()
 
     int i;
 
-    QStringList apps = mp_dBusAppFrameworkProxy->getAvailableAppNames();
-    mp_appList->clear();
+    m_appList = mp_dBusAppFrameworkProxy->getAvailableApps();
 
-    mp_appTable->setRowCount((apps.size() + (APP_LIST_COLUMN_COUNT - 1)) / APP_LIST_COLUMN_COUNT);
+    mp_appTable->setRowCount((m_appList.size() + (APP_LIST_COLUMN_COUNT - 1)) / APP_LIST_COLUMN_COUNT);
 
-    if (apps.size() >= (9 * APP_LIST_COLUMN_COUNT))
+    if (m_appList.size() >= (9 * APP_LIST_COLUMN_COUNT))
     {
         mp_appTable->resize(1000, 1920 - 40 - 40 - 60 - 60);
     }
@@ -122,19 +120,11 @@ void AppLauncherWidget::populateAppList()
         mp_appTable->horizontalHeader()->resizeSection(i, 190);
     }
 
-    AppInfo ai;
-    for (i = 0; i < apps.size(); ++i)
-    {
-        qDebug("new app: %s", apps.at(i).toStdString().c_str());
-        ai.setName(apps.at(i));
-        mp_appList->append(ai);
-    }
-
-    for (i = 0; i < mp_appList->size(); i++)
+    for (i = 0; i < m_appList.size(); i++)
     {
        mp_appTable->setItem(i / APP_LIST_COLUMN_COUNT,
                             i % APP_LIST_COLUMN_COUNT,
-                            new QTableWidgetItem(mp_appList->at(i).getName()));
+                            new QTableWidgetItem(m_appList.at(i).name));
        mp_appTable->item(i / APP_LIST_COLUMN_COUNT,
                          i % APP_LIST_COLUMN_COUNT)->setFlags(Qt::ItemIsEnabled);
        mp_appTable->item(i / APP_LIST_COLUMN_COUNT,
@@ -144,13 +134,15 @@ void AppLauncherWidget::populateAppList()
 
 void AppLauncherWidget::on_tableView_clicked(int row, int col)
 {
-    if (mp_appList->size() > row * APP_LIST_COLUMN_COUNT + col)
+    if (m_appList.size() > row * APP_LIST_COLUMN_COUNT + col)
     {
-        int pid = mp_dBusAppFrameworkProxy->launchApp(mp_appList->at(row * APP_LIST_COLUMN_COUNT + col).getName());
-        qDebug("%d, %d: start app %s", row, col, mp_appList->at(row * APP_LIST_COLUMN_COUNT + col).getName().toStdString().c_str());
+        int pid = mp_dBusAppFrameworkProxy->launchApp(m_appList.at(row * APP_LIST_COLUMN_COUNT + col).id);
+        qDebug("%d, %d: start app %s", row, col, m_appList.at(row * APP_LIST_COLUMN_COUNT + col).id.toStdString().c_str());
         qDebug("pid: %d", pid);
 
         // the new app wants to be visible by default
         newRequestsToBeVisibleApp(pid);
+
+        showAppLayer();
     }
 }
index a58148e..d6bc615 100644 (file)
@@ -45,10 +45,11 @@ private slots:
 
 signals:
     void newRequestsToBeVisibleApp(int pid);
+    void showAppLayer();
 
 private:
     Ui::AppLauncherWidget *mp_ui;
-    QList<AppInfo> *mp_appList;
+    QList<AppInfo> m_appList;
     QTableWidget *mp_appTable;
     org::agl::appframework *mp_dBusAppFrameworkProxy;
 };
index c061a4c..486378b 100644 (file)
@@ -69,11 +69,13 @@ void ControlBarWidget::updateColorScheme()
 
 void ControlBarWidget::on_pushButton_home_clicked()
 {
+    hideAppLayer();
     homeButtonPressed();
 }
 
 void ControlBarWidget::on_pushButton_settings_clicked()
 {
+    hideAppLayer();
     settingsButtonPressed();
 }
 
index a8bd91c..e47d2ba 100644 (file)
@@ -34,6 +34,8 @@ public:
 public slots:
     void updateColorScheme();
 signals:
+    void hideAppLayer();
+
     void settingsButtonPressed();
     void homeButtonPressed();
 
index 35304e6..11dd2cb 100644 (file)
@@ -1,7 +1,9 @@
 #include "layouthandler.h"
+#include <QTimerEvent>
 
 LayoutHandler::LayoutHandler(QObject *parent) :
     QObject(parent),
+    m_secondsTimerId(-1),
     mp_dBusWindowManagerProxy(0),
     mp_dBusPopupProxy(0),
     m_visibleSurfaces(),
@@ -112,65 +114,109 @@ void LayoutHandler::setUpLayouts()
     mp_dBusWindowManagerProxy->addLayout(3, "side by side", surfaceAreas);
 }
 
+void LayoutHandler::showAppLayer()
+{
+    mp_dBusWindowManagerProxy->showLayer(1); //1==app layer
+}
+
+void LayoutHandler::hideAppLayer()
+{
+    mp_dBusWindowManagerProxy->hideLayer(1); //1==app layer
+}
+
 void LayoutHandler::makeMeVisible(int pid)
 {
     qDebug("makeMeVisible %d", pid);
 
-    QList<int> allSurfaces = mp_dBusWindowManagerProxy->getAllSurfacesOfProcess(pid);
-    qSort(allSurfaces);
+    m_requestsToBeVisiblePids.append(pid);
 
-    if (0 != allSurfaces.size())
+    // callback every second
+    if (-1 != m_secondsTimerId)
     {
-        m_requestsToBeVisibleSurfaces.append(allSurfaces.at(0));
-
-        qDebug("m_visibleSurfaces %d", m_visibleSurfaces.size());
-        qDebug("m_invisibleSurfaces %d", m_invisibleSurfaces.size());
-        qDebug("m_requestsToBeVisibleSurfaces %d", m_requestsToBeVisibleSurfaces.size());
-
-        QList<int> availableLayouts = mp_dBusWindowManagerProxy->getAvailableLayouts(m_visibleSurfaces.size() + m_requestsToBeVisibleSurfaces.size());
-        if (0 == availableLayouts.size())
-        {
-            // no layout fits the need!
-            // replace the last app
-            qDebug("no layout fits the need!");
-            qDebug("replace the last surface");
+        killTimer(m_secondsTimerId);
+        m_secondsTimerId = -1;
+    }
+    m_secondsTimerId = startTimer(1000);
+}
 
-            m_invisibleSurfaces.append(m_visibleSurfaces.last());
-            m_visibleSurfaces.removeLast();
+void LayoutHandler::checkToDoQueue()
+{
+    if ((-1 != m_secondsTimerId) && (0 == m_requestsToBeVisiblePids.size()))
+    {
+        killTimer(m_secondsTimerId);
+        m_secondsTimerId = -1;
+    }
 
-            m_visibleSurfaces.append(m_requestsToBeVisibleSurfaces);
-            m_requestsToBeVisibleSurfaces.clear();
+    if (0 != m_requestsToBeVisiblePids.size())
+    {
+        int pid = m_requestsToBeVisiblePids.at(0);
+        qDebug("pid %d wants to be visible", pid);
 
-            for (int i = 0; i < m_visibleSurfaces.size(); ++i)
-            {
-                mp_dBusWindowManagerProxy->setSurfaceToLayoutArea(m_visibleSurfaces.at(i), i);
-            }
-        }
-        if (1 == availableLayouts.size())
+        QList<int> allSurfaces;
+        allSurfaces = mp_dBusWindowManagerProxy->getAllSurfacesOfProcess(pid);
+        if (0 == allSurfaces.size())
         {
-            // switch to new layout
-            qDebug("switch to new layout %d", availableLayouts.at(0));
-            m_visibleSurfaces.append(m_requestsToBeVisibleSurfaces);
-            m_requestsToBeVisibleSurfaces.clear();
-
-            mp_dBusWindowManagerProxy->setLayoutById(availableLayouts.at(0));
-            for (int i = 0; i < m_visibleSurfaces.size(); ++i)
-            {
-                mp_dBusWindowManagerProxy->setSurfaceToLayoutArea(m_visibleSurfaces.at(i), i);
-            }
+            qDebug("no surfaces for pid %d. retrying!", pid);
         }
-        if (1 < availableLayouts.size())
+        else
         {
-            // more than one layout possible! Ask user.
-            qDebug("more than one layout possible! Ask user.");
+            m_requestsToBeVisiblePids.removeAt(0);
+            qSort(allSurfaces);
 
-            QStringList choices;
-            for (int i = 0; i < availableLayouts.size(); ++i)
+            if (0 != allSurfaces.size())
             {
-                choices.append(mp_dBusWindowManagerProxy->getLayoutName(availableLayouts.at(i)));
+                m_requestsToBeVisibleSurfaces.append(allSurfaces.at(0));
+
+                qDebug("m_visibleSurfaces %d", m_visibleSurfaces.size());
+                qDebug("m_invisibleSurfaces %d", m_invisibleSurfaces.size());
+                qDebug("m_requestsToBeVisibleSurfaces %d", m_requestsToBeVisibleSurfaces.size());
+
+                QList<int> availableLayouts = mp_dBusWindowManagerProxy->getAvailableLayouts(m_visibleSurfaces.size() + m_requestsToBeVisibleSurfaces.size());
+                if (0 == availableLayouts.size())
+                {
+                    // no layout fits the need!
+                    // replace the last app
+                    qDebug("no layout fits the need!");
+                    qDebug("replace the last surface");
+
+                    m_invisibleSurfaces.append(m_visibleSurfaces.last());
+                    m_visibleSurfaces.removeLast();
+
+                    m_visibleSurfaces.append(m_requestsToBeVisibleSurfaces);
+                    m_requestsToBeVisibleSurfaces.clear();
+
+                    for (int i = 0; i < m_visibleSurfaces.size(); ++i)
+                    {
+                        mp_dBusWindowManagerProxy->setSurfaceToLayoutArea(m_visibleSurfaces.at(i), i);
+                    }
+                }
+                if (1 == availableLayouts.size())
+                {
+                    // switch to new layout
+                    qDebug("switch to new layout %d", availableLayouts.at(0));
+                    m_visibleSurfaces.append(m_requestsToBeVisibleSurfaces);
+                    m_requestsToBeVisibleSurfaces.clear();
+
+                    mp_dBusWindowManagerProxy->setLayoutById(availableLayouts.at(0));
+                    for (int i = 0; i < m_visibleSurfaces.size(); ++i)
+                    {
+                        mp_dBusWindowManagerProxy->setSurfaceToLayoutArea(m_visibleSurfaces.at(i), i);
+                    }
+                }
+                if (1 < availableLayouts.size())
+                {
+                    // more than one layout possible! Ask user.
+                    qDebug("more than one layout possible! Ask user.");
+
+                    QStringList choices;
+                    for (int i = 0; i < availableLayouts.size(); ++i)
+                    {
+                        choices.append(mp_dBusWindowManagerProxy->getLayoutName(availableLayouts.at(i)));
+                    }
+
+                    mp_dBusPopupProxy->showPopupComboBox("Select Layout", choices);
+                }
             }
-
-            mp_dBusPopupProxy->showPopupComboBox("Select Layout", choices);
         }
     }
 }
@@ -225,3 +271,12 @@ void LayoutHandler::setLayoutByName(QString layoutName)
         mp_dBusWindowManagerProxy->setSurfaceToLayoutArea(i, i);
     }
 }
+
+void LayoutHandler::timerEvent(QTimerEvent *e)
+{
+    if (e->timerId() == m_secondsTimerId)
+    {
+        checkToDoQueue();
+    }
+}
+
index 1ba270b..7487be5 100644 (file)
@@ -17,22 +17,29 @@ public:
 signals:
 
 public slots:
+    void showAppLayer();
+    void hideAppLayer();
     void makeMeVisible(int pid);
-
+private:
+    void checkToDoQueue();
+public slots:
     QList<int> requestGetAllSurfacesOfProcess(int pid);
     int requestGetSurfaceStatus(int surfaceId);
     void requestRenderSurfaceToArea(int surfaceId, const QRect &renderArea);
     void requestSurfaceIdToFullScreen(int surfaceId);
     void setLayoutByName(QString layoutName);
 
+protected:
+    void timerEvent(QTimerEvent *e);
 private:
+    int m_secondsTimerId;
     org::agl::windowmanager *mp_dBusWindowManagerProxy;
     org::agl::popup *mp_dBusPopupProxy;
 
+    QList<int> m_requestsToBeVisiblePids;
     QList<int> m_visibleSurfaces;
     QList<int> m_invisibleSurfaces;
     QList<int> m_requestsToBeVisibleSurfaces;
-
 };
 
 #endif // LAYOUTHANDLER_H
index f1f5a22..4d626d9 100644 (file)
@@ -40,6 +40,9 @@ int main(int argc, char *argv[])
 
     qDebug("%s, v%s", QCoreApplication::applicationName().toStdString().c_str(), QCoreApplication::applicationVersion().toStdString().c_str());
 
+    qDBusRegisterMetaType<AppInfo>();
+    qDBusRegisterMetaType<QList<AppInfo> >();
+
     MainWindow w;
     w.show();
 #ifdef __arm__
index f4891b3..e1a8371 100644 (file)
@@ -86,8 +86,10 @@ MainWindow::MainWindow(QWidget *parent) :
 
     QObject::connect(mp_controlBarWidget, SIGNAL(settingsButtonPressed()), mp_settingsWidget, SLOT(raise()));
     QObject::connect(mp_controlBarWidget, SIGNAL(homeButtonPressed()), mp_applauncherwidget, SLOT(raise()));
+    QObject::connect(mp_controlBarWidget, SIGNAL(hideAppLayer()), mp_layoutHandler, SLOT(hideAppLayer()));
 
     QObject::connect(mp_applauncherwidget, SIGNAL(newRequestsToBeVisibleApp(int)), mp_layoutHandler, SLOT(makeMeVisible(int)));
+    QObject::connect(mp_applauncherwidget, SIGNAL(showAppLayer()), mp_layoutHandler, SLOT(showAppLayer()));
 
 
     // apply color scheme
index 6a46f2b..f4c1c83 100644 (file)
@@ -11,10 +11,14 @@ SampleClass::~SampleClass()
     delete mp_libHomeScreen;
 }
 
+std::list<int> SampleClass::getAllSurfacesOfProcess(int pid)
+{
+    return mp_libHomeScreen->getAllSurfacesOfProcess(pid);
+}
 
 sRectangle SampleClass::getLayoutRenderAreaForSurfaceId(int surfaceId)
 {
-    mp_libHomeScreen->getLayoutRenderAreaForSurfaceId(surfaceId);
+    return mp_libHomeScreen->getLayoutRenderAreaForSurfaceId(surfaceId);
 }
 
 void SampleClass::hardKeyPressed(int key)
@@ -22,6 +26,11 @@ void SampleClass::hardKeyPressed(int key)
     mp_libHomeScreen->hardKeyPressed(key);
 }
 
+int SampleClass::getSurfaceStatus(int surfaceId)
+{
+    return mp_libHomeScreen->getSurfaceStatus(surfaceId);
+}
+
 void SampleClass::renderSurfaceToArea(int surfaceId, const sRectangle &renderArea)
 {
     mp_libHomeScreen->renderSurfaceToArea(surfaceId, renderArea);
index acffcf6..f5a5d13 100644 (file)
@@ -2,6 +2,7 @@
 #define SAMPLECLASS_HPP
 
 #include "libhomescreen.hpp"
+#include <list>
 
 class SampleClass
 {
@@ -9,7 +10,9 @@ public:
     SampleClass();
     ~SampleClass();
 
+    std::list<int> getAllSurfacesOfProcess(int pid);
     sRectangle getLayoutRenderAreaForSurfaceId(int surfaceId);
+    int getSurfaceStatus(int surfaceId);
     void hardKeyPressed(int key);
     void renderSurfaceToArea(int surfaceId, const sRectangle &renderArea);
     void requestSurfaceIdToFullScreen(int surfaceId);
index ed38c49..48f8d38 100644 (file)
@@ -413,6 +413,37 @@ int WindowManager::addLayout(int layoutId, const QString &layoutName, const QLis
     return WINDOWMANAGER_NO_ERROR;
 }
 
+int WindowManager::deleteLayoutById(int layoutId)
+{
+    qDebug("-=[deleteLayoutById]=-");
+    qDebug("layoutId: %d", layoutId);
+    int result = WINDOWMANAGER_NO_ERROR;
+
+    if (m_currentLayout == layoutId)
+    {
+        result = WINDOWMANAGER_ERROR_ID_IN_USE;
+    }
+    else
+    {
+        QList<Layout>::iterator i = m_layouts.begin();
+        result = WINDOWMANAGER_ERROR_ID_IN_USE;
+        while (i != m_layouts.constEnd())
+        {
+            if (i->id == layoutId)
+            {
+                m_layouts.erase(i);
+                result = WINDOWMANAGER_NO_ERROR;
+                break;
+            }
+
+            ++i;
+        }
+    }
+
+    return result;
+}
+
+
 QList<Layout> WindowManager::getAllLayouts()
 {
     qDebug("-=[getAllLayouts]=-");
@@ -483,6 +514,27 @@ QString WindowManager::getLayoutName(int layoutId)
     return result;
 }
 
+void WindowManager::hideLayer(int layer)
+{
+    qDebug("-=[hideLayer]=-");
+    qDebug("layer %d", layer);
+
+#ifdef __arm__
+    if (0 == layer)
+    {
+        ilm_layerSetVisibility(WINDOWMANAGER_LAYER_POPUP, ILM_FALSE);
+    }
+    if (1 == layer)
+    {
+        ilm_layerSetVisibility(WINDOWMANAGER_LAYER_APPLICATIONS, ILM_FALSE);
+    }
+    if (2 == layer)
+    {
+        ilm_layerSetVisibility(WINDOWMANAGER_LAYER_HOMESCREEN, ILM_FALSE);
+    }
+    ilm_commitChanges();
+#endif
+}
 
 int WindowManager::setLayoutById(int layoutId)
 {
@@ -536,3 +588,25 @@ int WindowManager::setSurfaceToLayoutArea(int surfaceId, int layoutAreaId)
 
     return result;
 }
+
+void WindowManager::showLayer(int layer)
+{
+    qDebug("-=[showLayer]=-");
+    qDebug("layer %d", layer);
+
+#ifdef __arm__
+    if (0 == layer)
+    {
+        ilm_layerSetVisibility(WINDOWMANAGER_LAYER_POPUP, ILM_TRUE);
+    }
+    if (1 == layer)
+    {
+        ilm_layerSetVisibility(WINDOWMANAGER_LAYER_APPLICATIONS, ILM_TRUE);
+    }
+    if (2 == layer)
+    {
+        ilm_layerSetVisibility(WINDOWMANAGER_LAYER_HOMESCREEN, ILM_TRUE);
+    }
+    ilm_commitChanges();
+#endif
+}
index 6c11760..5b0a552 100644 (file)
@@ -92,14 +92,17 @@ public: // PROPERTIES
 
 public Q_SLOTS: // METHODS
     int addLayout(int layoutId, const QString &layoutName, const QList<LayoutArea> &surfaceAreas);
+    int deleteLayoutById(int layoutId);
     QList<Layout> getAllLayouts();
     QList<int> getAllSurfacesOfProcess(int pid);
     QList<int> getAvailableLayouts(int numberOfAppSurfaces);
     QList<int> getAvailableSurfaces();
     QString getLayoutName(int layoutId);
+    void hideLayer(int layer);
     int setLayoutById(int layoutId);
     int setLayoutByName(const QString &layoutName);
     int setSurfaceToLayoutArea(int surfaceId, int layoutAreaId);
+    void showLayer(int layer);
 };
 
 
index 1324386..e2c088e 100644 (file)
  See the License for the specific language governing permissions and
  limitations under the License. -->
 <node>
-  <interface name="org.agl.appframework">
-      <method name="getAvailableAppNames">
-        <arg name="names" type="as" direction="out"/>
-      </method>
-      <method name="launchApp">
-        <arg name="name" type="s" direction="in"/>
-        <arg name="pid" type="i" direction="out"/>
-      </method>
-  </interface>
+       <!--
+         org.agl.appframework:
+         @short_description: The interface of the app framework binder.
+
+         The app framework has to provide some basic functionality like 
+         getting a list of applications and start them. In further versions,
+         also pausing or stopping, .
+       -->
+       <interface name="org.agl.appframework">
+               <!--
+                 getAvailableApps:
+                 @apps: A list of applications that can be launched.
+
+                 The application info consists of:
+                 string id;
+                 string version;
+                 int width;
+                 int height;
+                 string name;
+                 string description;
+                 string shortname;
+                 string author;
+                 string iconPath;
+               -->
+               <method name="getAvailableApps">
+                       <arg name="apps" type="{ssiisssss}" direction="out"/>
+                       <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;AppInfo&gt;"/>
+               </method>
+               <!--
+                 launchApp:
+                 @name: The name of the application that shall be launched.
+                 @pid: Returns the pid of the process.
+
+                 Use the id of the application info to launch the app.
+               -->
+               <method name="launchApp">
+                       <arg name="name" type="s" direction="in"/>
+                       <arg name="pid" type="i" direction="out"/>
+               </method>
+       </interface>
 </node>
 
diff --git a/interfaces/include/afm_user_daemon.hpp b/interfaces/include/afm_user_daemon.hpp
new file mode 100644 (file)
index 0000000..256292b
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2016 Mentor Graphics Development (Deutschland) GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AFM_USER_DAEMON_HPP
+#define AFM_USER_DAEMON_HPP
+
+
+#endif // AFM_USER_DAEMON_HPP
index d95cd9d..d4abefb 100644 (file)
 #ifndef APPFRAMEWORK_HPP
 #define APPFRAMEWORK_HPP
 
-#include <QObject>
 #include <QtDBus>
-#include <QString>
 
-class AppInfo : public QObject
+class AppInfo
 {
-    Q_OBJECT
 public:
-    explicit AppInfo(QObject *parent = 0);
-    AppInfo(const AppInfo &other);
-    AppInfo& operator=(const AppInfo &other);
-    ~AppInfo();
+    AppInfo();
+    virtual ~AppInfo();
 
-    //register Message with the Qt type system
-    static void registerMetaType();
-
-    friend QDBusArgument &operator<<(QDBusArgument &argument, const AppInfo &appInfo);
-    friend const QDBusArgument &operator>>(const QDBusArgument &argument, AppInfo &appInfo);
-
-    void setName(const QString name) {this->name = name;}
-    QString getName() const {return name;}
-    void setIconPath(const QString iconPath) {this->iconPath = iconPath;}
-    QString getIconPath() const {return iconPath;}
-    void setDescription(const QString description) {this->description = description;}
-    QString getDescription() const {return description;}
-
-private:
+    QString id;
+    QString version;
+    int width;
+    int height;
     QString name;
-    QString iconPath;
     QString description;
+    QString shortname;
+    QString author;
+    QString iconPath;
+
+    void read(const QJsonObject &json);
+
+    friend QDBusArgument &operator <<(QDBusArgument &argument, const AppInfo &mAppInfo);
+    friend const QDBusArgument &operator >>(const QDBusArgument &argument, AppInfo &mAppInfo);
 };
 
+
 Q_DECLARE_METATYPE(AppInfo)
+Q_DECLARE_METATYPE(QList<AppInfo>)
 
 #endif // APPFRAMEWORK_HPP
index 45c7c6e..ebab2d7 100644 (file)
@@ -24,6 +24,7 @@
 #define WINDOWMANAGER_ERROR_NAME_ALREADY_DEFINED 2
 #define WINDOWMANAGER_ERROR_ID_NOT_FOUND 3
 #define WINDOWMANAGER_ERROR_NAME_NOT_FOUND 4
+#define WINDOWMANAGER_ERROR_ID_IN_USE 5
 
 class SimplePoint
 {
index bd3fa39..1dad460 100644 (file)
@@ -28,6 +28,7 @@ SOURCES += src/appframework.cpp \
 
 XMLSOURCES = \
     appframework.xml \
+    afm_user_daemon.xml \
     daynightmode.xml \
     homescreen.xml \
     inputevent.xml \
index afd6114..40515d5 100644 (file)
 
 #include "include/appframework.hpp"
 
-AppInfo::AppInfo(QObject *parent) :
-    QObject(parent)
-{
-}
-
-AppInfo::AppInfo(const AppInfo &other) :
-    QObject(other.parent()),
-    name(other.getName()),
-    iconPath(other.getIconPath()),
-    description(other.getDescription())
-{
-}
 
-AppInfo& AppInfo::operator=(const AppInfo &other)
+AppInfo::AppInfo()
 {
-    setParent(other.parent());
-    name = other.getName();
-    iconPath = other.getIconPath();
-    description = other.getDescription();
-
-    return *this;
 }
 
 AppInfo::~AppInfo()
 {
 }
 
-void AppInfo::registerMetaType()
+void AppInfo::read(const QJsonObject &json)
 {
-    qRegisterMetaType<AppInfo>("AppInfo");
-    qDBusRegisterMetaType<AppInfo>();
+    id = json["id"].toString();
+    version = json["id"].toString();
+    width = json["id"].toInt();
+    height = json["id"].toInt();
+    name = json["id"].toString();
+    description = json["id"].toString();
+    shortname = json["id"].toString();
+    author = json["id"].toString();
+    iconPath = json["id"].toString();
 }
 
-
-// Marshall the MyStructure data into a D-Bus argument
-QDBusArgument &operator<<(QDBusArgument &argument, const AppInfo &appInfo)
+QDBusArgument &operator <<(QDBusArgument &argument, const AppInfo &mAppInfo)
 {
     argument.beginStructure();
-    argument << appInfo.name << appInfo.iconPath << appInfo.description;
+    argument << mAppInfo.id;
+    argument << mAppInfo.version;
+    argument << mAppInfo.width;
+    argument << mAppInfo.height;
+    argument << mAppInfo.name;
+    argument << mAppInfo.description;
+    argument << mAppInfo.shortname;
+    argument << mAppInfo.author;
+    argument << mAppInfo.iconPath;
     argument.endStructure();
-    qDebug("appInfo.name:<< %s", appInfo.name.toStdString().c_str());
+
     return argument;
 }
 
-// Retrieve the MyStructure data from the D-Bus argument
-const QDBusArgument &operator>>(const QDBusArgument &argument, AppInfo &appInfo)
+const QDBusArgument &operator >>(const QDBusArgument &argument, AppInfo &mAppInfo)
 {
     argument.beginStructure();
-    argument >> appInfo.name >> appInfo.iconPath >> appInfo.description;
+    argument >> mAppInfo.id;
+    argument >> mAppInfo.version;
+    argument >> mAppInfo.width;
+    argument >> mAppInfo.height;
+    argument >> mAppInfo.name;
+    argument >> mAppInfo.description;
+    argument >> mAppInfo.shortname;
+    argument >> mAppInfo.author;
+    argument >> mAppInfo.iconPath;
     argument.endStructure();
-    qDebug("appInfo.name:>> %s", appInfo.name.toStdString().c_str());
     return argument;
 }
index c15ca2c..a4be58f 100644 (file)
                        <arg name="error" type="i" direction="out"/>
                </method>
 
+               <!--
+                 deleteLayoutById:
+                 @layoutId: The ID of the layout to delete.
+                 @error: WINDOWMANAGER_NO_ERROR or the first error that occurred.
+
+                 Deletes the layout with the given ID. This cannot be the current active layout!
+               -->
+               <method name="deleteLayoutById">
+                       <arg name="layoutId" type="i" direction="in"/>
+                       <arg name="error" type="i" direction="out"/>
+               </method>
+
                <!--
                  setLayoutById:
                  @layoutId: The ID of the layout to activate.
                        <arg name="surfaceIds" type="a(i)" direction="out"/>
                        <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;int&gt;"/> 
                </method>
+
+               <!--
+                 showLayer:
+                 @layer: The ID of the layer to show. POPUP=0, APPS=1, HOMESCREEN=2
+
+                 Show complete layers.
+                 By default, all layers are shown.
+               -->
+               <method name="showLayer">
+                       <arg name="layer" type="i" direction="in"/>
+               </method>
+               <!--
+                 hideLayer:
+                 @layer: The ID of the layer to hide. POPUP=0, APPS=1, HOMESCREEN=2
+
+                 Hide complete layers.
+                 By default, all layers are shown.
+               -->
+               <method name="hideLayer">
+                       <arg name="layer" type="i" direction="in"/>
+               </method>
        </interface>
 </node>
 
index db6ca2d..c028617 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef LIBHOMESCREEN_HPP
 #define LIBHOMESCREEN_HPP
 
+#include <list>
+
 // forward declarations
 struct _LibHomeScreenHomescreen;
 typedef struct _LibHomeScreenHomescreen LibHomeScreenHomescreen;
@@ -20,7 +22,9 @@ public:
     ~LibHomeScreen();
 
     // these are representing the D-Bus methods:
+    std::list<int> getAllSurfacesOfProcess(int pid);
     sRectangle getLayoutRenderAreaForSurfaceId(int surfaceId);
+    int getSurfaceStatus(int surfaceId);
     void hardKeyPressed(int key);
     void renderSurfaceToArea(int surfaceId, const sRectangle &renderArea);
     void requestSurfaceIdToFullScreen(int surfaceId);
index 39af1c3..03e95d6 100644 (file)
@@ -29,6 +29,44 @@ LibHomeScreen::~LibHomeScreen()
     g_object_unref(mp_libHomeScreenHomescreen_Proxy);
 }
 
+std::list<int> LibHomeScreen::getAllSurfacesOfProcess(int pid)
+{
+    std::list<int> result;
+
+    GError *err = NULL;
+
+    GVariant *out_surfaceIds;
+
+    lib_home_screen_homescreen_call_get_all_surfaces_of_process_sync(
+                mp_libHomeScreenHomescreen_Proxy,
+                pid,
+                &out_surfaceIds,
+                NULL,
+                &err);
+
+    if (NULL != err)
+    {
+        fprintf(stderr, "Unable to call getAllSurfacesOfProcess: %s\n", err->message);
+    }
+
+
+    GVariant *element;
+    GVariantIter iter;
+    int i;
+
+    if (g_variant_iter_init(&iter, out_surfaceIds))
+    {
+        while ((element = g_variant_iter_next_value(&iter)) != NULL)
+        {
+            g_variant_get(element, "i", &i);
+            result.push_back(i);
+            g_variant_unref(element);
+        }
+    }
+
+    return result;
+}
+
 sRectangle LibHomeScreen::getLayoutRenderAreaForSurfaceId(int surfaceId)
 {
     sRectangle result;
@@ -53,6 +91,28 @@ sRectangle LibHomeScreen::getLayoutRenderAreaForSurfaceId(int surfaceId)
     return result;
 }
 
+int LibHomeScreen::getSurfaceStatus(int surfaceId)
+{
+    int result;
+    GError *err = NULL;
+
+    GVariant *out_renderArea;
+
+    lib_home_screen_homescreen_call_get_surface_status_sync(
+                mp_libHomeScreenHomescreen_Proxy,
+                surfaceId,
+                &result,
+                NULL,
+                &err);
+
+    if (NULL != err)
+    {
+        fprintf(stderr, "Unable to call getSurfaceStatus: %s\n", err->message);
+    }
+
+    return result;
+}
+
 void LibHomeScreen::hardKeyPressed(int key)
 {
     GError *err = NULL;