Implementing app launch and app surface control workflow. Using WindowManager to...
authorBocklage, Jens <Jens_Bocklage@mentor.com>
Fri, 30 Sep 2016 12:31:09 +0000 (14:31 +0200)
committerBocklage, Jens <Jens_Bocklage@mentor.com>
Fri, 30 Sep 2016 12:59:21 +0000 (14:59 +0200)
Defining three layouts. Adding combobox selection feature to popup widget.

Known issue: IVI-shell is currently disabled in AGL due to issues (porting to Yocto 2.1.1).

Signed-off-by: Bocklage, Jens <Jens_Bocklage@mentor.com>
40 files changed:
HomeScreen/HomeScreen.pro
HomeScreen/README.md
HomeScreen/resources/popupwidget.ui
HomeScreen/src/applauncherwidget.cpp
HomeScreen/src/applauncherwidget.h
HomeScreen/src/controlbarwidget.cpp
HomeScreen/src/homescreencontrolinterface.cpp
HomeScreen/src/homescreencontrolinterface.h
HomeScreen/src/layouthandler.cpp [new file with mode: 0644]
HomeScreen/src/layouthandler.h [new file with mode: 0644]
HomeScreen/src/main.cpp
HomeScreen/src/mainwindow.cpp
HomeScreen/src/mainwindow.h
HomeScreen/src/popupwidget.cpp
HomeScreen/src/popupwidget.h
HomeScreenAppFrameworkBinderTizen/README.md
HomeScreenAppFrameworkBinderTizen/src/main.cpp
HomeScreenSimulator/README.md
HomeScreenSimulator/resources/mainwindow.ui
HomeScreenSimulator/src/main.cpp
HomeScreenSimulator/src/mainwindow.cpp
HomeScreenSimulator/src/mainwindow.h
InputEventManager/README.md
InputEventManager/src/main.cpp
README.md
SampleAppTimeDate/README.md
SampleAppTimeDate/src/main.cpp
WindowManager/README.md
WindowManager/WindowManager.pro
WindowManager/src/main.cpp
WindowManager/src/windowmanager.cpp
WindowManager/src/windowmanager.hpp
interfaces/README.md
interfaces/homescreen.xml
interfaces/include/windowmanager.hpp [new file with mode: 0644]
interfaces/interfaces.pro
interfaces/popup.xml
interfaces/src/appframework.cpp
interfaces/src/windowmanager.cpp [new file with mode: 0644]
interfaces/windowmanager.xml [new file with mode: 0644]

index 458db51..e73539e 100644 (file)
@@ -27,7 +27,8 @@ SOURCES += \
     src/controlbarwidget.cpp \
     src/statusbarwidget.cpp \
     src/applauncherwidget.cpp \
-    src/homescreencontrolinterface.cpp
+    src/homescreencontrolinterface.cpp \
+    src/layouthandler.cpp
 
 HEADERS  += \
     ../interfaces/appframework.h \
@@ -40,7 +41,8 @@ HEADERS  += \
     src/controlbarwidget.h \
     src/statusbarwidget.h \
     src/applauncherwidget.h \
-    src/homescreencontrolinterface.h
+    src/homescreencontrolinterface.h \
+    src/layouthandler.h
 
 INCLUDEPATH += $$OUT_PWD/../interfaces
 INCLUDEPATH += ../interfaces/
index 7ebc287..01deabb 100644 (file)
@@ -9,6 +9,19 @@ https://gerrit.automotivelinux.org/gerrit/#/admin/projects/staging/HomeScreen
 AGL repo for bitbake recipe:
 https://gerrit.automotivelinux.org/gerrit/#/admin/projects/AGL/meta-agl-demo/recipes-demo-hmi/HomeScreen/HomeScreen_?.bb
 
+v0.3.0
+09/30/2016
+
+#new features
+- app launcher improved
+- added first popup combobox selection feature
+-- used for selecting layouts
+- implemented 3 layouts
+-- one app
+-- top on bottom
+-- side by side
+- first interaction with WindowManager
+
 v0.2.0
 08/05/2016
 
@@ -67,13 +80,16 @@ v0.0.1
 - define and implement control bar D-Bus-interface
 - many settings have to be read from the system somewhere during app startup. This is not available right now
 - interaction with application manager
+-- done for TIZEN
 - interaction with wayland compositor
+-- first version of WindowManager implemented
 - define and implement input device event handler
 - replace my HMI design with the official AGL design (graphics/icons...)
 - implement example HMI layouts
+-- three layouts implemented
 - fix font issues on target
 - more documentation ;)
-- add animations
+- add animations (?)
 - much more...
 
 Thanks to Umar Irshad for his free iconset available here:
index a982adf..4eb8a8b 100644 (file)
@@ -84,6 +84,16 @@ border-image: url(:/images/transparency.png);</string>
      <bool>true</bool>
     </property>
    </widget>
+   <widget class="QComboBox" name="comboBox">
+    <property name="geometry">
+     <rect>
+      <x>90</x>
+      <y>90</y>
+      <width>211</width>
+      <height>27</height>
+     </rect>
+    </property>
+   </widget>
   </widget>
  </widget>
  <resources/>
index 94dd357..18c373b 100644 (file)
@@ -18,6 +18,9 @@
 #include "ui_applauncherwidget.h"
 #include <include/daynightmode.hpp>
 #include <QSettings>
+#ifdef __i386__
+    #include <QProcess>
+#endif
 
 #define APP_LIST_COLUMN_COUNT 5
 
@@ -42,8 +45,6 @@ AppLauncherWidget::AppLauncherWidget(QWidget *parent) :
                                               "/AppFramework",
                                               QDBusConnection::sessionBus(),
                                               0);
-
-    populateAppList();
 }
 
 AppLauncherWidget::~AppLauncherWidget()
@@ -99,7 +100,13 @@ void AppLauncherWidget::populateAppList()
 
     int i;
 
+#ifdef __arm__
     QStringList apps = mp_dBusAppFrameworkProxy->getAvailableAppNames();
+#endif
+#ifdef __i386__
+    QStringList apps;
+    apps.append(QString("/usr/bin/gnome-terminal"));
+#endif
     mp_appList->clear();
 
     mp_appTable->setRowCount((apps.size() + (APP_LIST_COLUMN_COUNT - 1)) / APP_LIST_COLUMN_COUNT);
@@ -138,16 +145,24 @@ void AppLauncherWidget::populateAppList()
        mp_appTable->item(i / APP_LIST_COLUMN_COUNT,
                          i % APP_LIST_COLUMN_COUNT)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
     }
-
-
 }
 
 void AppLauncherWidget::on_tableView_clicked(int row, int col)
 {
     if (mp_appList->size() > row * APP_LIST_COLUMN_COUNT + col)
     {
+#ifdef __arm__
         int pid = mp_dBusAppFrameworkProxy->launchApp(mp_appList->at(row * APP_LIST_COLUMN_COUNT + col).getName());
+#endif
+#ifdef __i386__
+        QProcess *myProcess = new QProcess();
+        myProcess->start(mp_appList->at(row * APP_LIST_COLUMN_COUNT + col).getName(), NULL);
+        int pid = myProcess->pid();
+#endif
         qDebug("%d, %d: start app %s", row, col, mp_appList->at(row * APP_LIST_COLUMN_COUNT + col).getName().toStdString().c_str());
         qDebug("pid: %d", pid);
+
+        // the new app wants to be visible by default
+        newRequestsToBeVisibleApp(pid);
     }
 }
index 943f6d5..a58148e 100644 (file)
@@ -34,18 +34,23 @@ class AppLauncherWidget : public QWidget
 public:
     explicit AppLauncherWidget(QWidget *parent = 0);
     ~AppLauncherWidget();
+
+    void populateAppList();
+
 public slots:
     void updateColorScheme();
 
 private slots:
     void on_tableView_clicked(int row, int col);
 
+signals:
+    void newRequestsToBeVisibleApp(int pid);
+
 private:
     Ui::AppLauncherWidget *mp_ui;
     QList<AppInfo> *mp_appList;
     QTableWidget *mp_appTable;
     org::agl::appframework *mp_dBusAppFrameworkProxy;
-    void populateAppList();
 };
 
 #endif // APPLAUNCHERWIDGET_H
index 2cce30b..cafbb7b 100644 (file)
@@ -64,12 +64,12 @@ void ControlBarWidget::updateColorScheme()
 
 void ControlBarWidget::on_pushButton_Settings_clicked()
 {
-    emit settingsButtonPressed();
+    settingsButtonPressed();
 }
 
 void ControlBarWidget::on_pushButton_Home_clicked()
 {
-    emit homeButtonPressed();
+    homeButtonPressed();
 }
 
 void ControlBarWidget::on_pushButton_Nav_clicked()
index defc202..45c3cbd 100644 (file)
@@ -34,9 +34,15 @@ void HomeScreenControlInterface::hardKeyPressed(int key)
         qDebug("hardKeyPressed NAV key pressed!");
         pid = mp_dBusAppFrameworkProxy->launchApp("demoapp");
         qDebug("pid: %d", pid);
+        newRequestsToBeVisibleApp(pid);
         break;
     default:
         qDebug("hardKeyPressed %d", key);
         break;
     }
 }
+
+void HomeScreenControlInterface::setToFullscreen(int pid)
+{
+    qDebug("setToFullscreen %d", pid);
+}
index 3480d30..e406686 100644 (file)
@@ -16,11 +16,13 @@ public:
 
 signals:
 
-public slots:
+signals:
+    void newRequestsToBeVisibleApp(int pid);
 
 //from homescreen_adapter.h
 public Q_SLOTS: // METHODS
     void hardKeyPressed(int key);
+    void setToFullscreen(int pid);
 
 private:
     HomescreenAdaptor *mp_homeScreenAdaptor;
diff --git a/HomeScreen/src/layouthandler.cpp b/HomeScreen/src/layouthandler.cpp
new file mode 100644 (file)
index 0000000..a4d0f91
--- /dev/null
@@ -0,0 +1,180 @@
+#include "layouthandler.h"
+
+LayoutHandler::LayoutHandler(QObject *parent) :
+    QObject(parent),
+    mp_dBusWindowManagerProxy(0),
+    mp_dBusPopupProxy(0),
+    m_visibleApps(),
+    m_invisibleApps(),
+    m_requestsToBeVisibleApps()
+{
+    qDBusRegisterMetaType<SimplePoint>();
+    qDBusRegisterMetaType<QList<SimplePoint> >();
+    qDBusRegisterMetaType<SimpleRect>();
+    qDBusRegisterMetaType<QList<SimpleRect> >();
+
+    qDebug("D-Bus: connect to org.agl.windowmanager /windowmanager");
+    mp_dBusWindowManagerProxy = new org::agl::windowmanager("org.agl.windowmanager",
+                                              "/windowmanager",
+                                              QDBusConnection::sessionBus(),
+                                              0);
+    qDebug("D-Bus: connect to org.agl.homescreen /Popup");
+    mp_dBusPopupProxy = new org::agl::popup("org.agl.homescreen",
+                                              "/Popup",
+                                              QDBusConnection::sessionBus(),
+                                              0);
+}
+
+LayoutHandler::~LayoutHandler()
+{
+    delete mp_dBusPopupProxy;
+    delete mp_dBusWindowManagerProxy;
+}
+
+void LayoutHandler::setUpLayers()
+{
+    qDebug("setUpLayers");
+    QList<SimpleRect> surfaceAreas;
+    SimpleRect surfaceArea;
+
+    const int SCREEN_WIDTH = 1080;
+    const int SCREEN_HEIGHT = 1080;
+
+    const int STATUSBAR_HEIGHT = 60;
+    const int STATUSBAR_WIDTH = SCREEN_WIDTH;
+    const int STATUSBAR_X = 0;
+    const int STATUSBAR_Y = 0;
+    const int CONTROLBAR_HEIGHT = 60;
+    const int CONTROLBAR_WIDTH = SCREEN_WIDTH;
+    const int CONTROLBAR_X = 0;
+    const int CONTROLBAR_Y = SCREEN_HEIGHT - CONTROLBAR_HEIGHT;
+
+
+    // layout 1:
+    // one app surface, statusbar, control bar
+    surfaceArea.x = 0;
+    surfaceArea.y = STATUSBAR_HEIGHT;
+    surfaceArea.width = SCREEN_WIDTH;
+    surfaceArea.height = SCREEN_HEIGHT - STATUSBAR_HEIGHT - CONTROLBAR_HEIGHT;
+
+    surfaceAreas.append(surfaceArea);
+
+    mp_dBusWindowManagerProxy->addLayout(1, "one app", surfaceAreas);
+
+
+    surfaceAreas.clear();
+
+    // layout 2:
+    // two app surfaces (one on top of the other), statusbar, control bar
+
+    // top surface
+    surfaceArea.x = 0;
+    surfaceArea.y = STATUSBAR_HEIGHT;
+    surfaceArea.width = SCREEN_WIDTH;
+    surfaceArea.height = (SCREEN_HEIGHT - STATUSBAR_HEIGHT - CONTROLBAR_HEIGHT) / 2;
+
+    surfaceAreas.append(surfaceArea);
+
+    // bottom surface
+    surfaceArea.x = 0;
+    surfaceArea.y = STATUSBAR_HEIGHT / 2;
+    surfaceArea.width = SCREEN_WIDTH;
+    surfaceArea.height = (SCREEN_HEIGHT - STATUSBAR_HEIGHT - CONTROLBAR_HEIGHT) / 2;
+
+    surfaceAreas.append(surfaceArea);
+
+    mp_dBusWindowManagerProxy->addLayout(2, "top on bottom", surfaceAreas);
+
+
+    surfaceAreas.clear();
+
+    // layout 3:
+    // two app surfaces (one besides the other), statusbar, control bar
+
+    // left surface
+    surfaceArea.x = 0;
+    surfaceArea.y = STATUSBAR_HEIGHT;
+    surfaceArea.width = SCREEN_WIDTH / 2;
+    surfaceArea.height = SCREEN_HEIGHT - STATUSBAR_HEIGHT - CONTROLBAR_HEIGHT;
+
+    surfaceAreas.append(surfaceArea);
+
+    // right surface
+    surfaceArea.x = SCREEN_WIDTH / 2;
+    surfaceArea.y = STATUSBAR_HEIGHT;
+    surfaceArea.width = SCREEN_WIDTH / 2;
+    surfaceArea.height = SCREEN_HEIGHT - STATUSBAR_HEIGHT - CONTROLBAR_HEIGHT;
+
+    surfaceAreas.append(surfaceArea);
+
+    mp_dBusWindowManagerProxy->addLayout(3, "side by side", surfaceAreas);
+
+}
+
+void LayoutHandler::makeMeVisible(int pid)
+{
+    qDebug("makeMeVisible %d", pid);
+    m_requestsToBeVisibleApps.append(pid);
+
+    qDebug("m_visibleApps %d", m_visibleApps.size());
+    qDebug("m_invisibleApps %d", m_invisibleApps.size());
+    qDebug("m_requestsToBeVisibleApps %d", m_requestsToBeVisibleApps.size());
+
+    QList<int> availableLayouts = mp_dBusWindowManagerProxy->getAvailableLayouts(m_visibleApps.size() + m_requestsToBeVisibleApps.size());
+    if (0 == availableLayouts.size())
+    {
+        // no layout fits the need!
+        // replace the last app
+        qDebug("no layout fits the need!");
+        qDebug("replace the last app");
+
+        m_invisibleApps.append(m_visibleApps.last());
+        m_visibleApps.removeLast();
+
+        for (int i = 0; i < m_visibleApps.size(); ++i)
+        {
+            mp_dBusWindowManagerProxy->setSurfaceToLayoutArea(i, i);
+        }
+    }
+    if (1 == availableLayouts.size())
+    {
+        // switch to new layout
+        qDebug("switch to new layout %d", availableLayouts.at(0));
+        m_visibleApps.append(m_requestsToBeVisibleApps);
+        m_requestsToBeVisibleApps.clear();
+
+        mp_dBusWindowManagerProxy->setLayoutById(availableLayouts.at(0));
+        for (int i = 0; i < m_visibleApps.size(); ++i)
+        {
+            mp_dBusWindowManagerProxy->setSurfaceToLayoutArea(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);
+
+    }
+}
+
+void LayoutHandler::setLayoutByName(QString layoutName)
+{
+    // switch to new layout
+    qDebug("setLayout: switch to new layout %s", layoutName.toStdString().c_str());
+    m_visibleApps.append(m_requestsToBeVisibleApps);
+    m_requestsToBeVisibleApps.clear();
+
+    mp_dBusWindowManagerProxy->setLayoutByName(layoutName);
+    for (int i = 0; i < m_visibleApps.size(); ++i)
+    {
+        mp_dBusWindowManagerProxy->setSurfaceToLayoutArea(i, i);
+    }
+}
diff --git a/HomeScreen/src/layouthandler.h b/HomeScreen/src/layouthandler.h
new file mode 100644 (file)
index 0000000..62e4fb5
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef LAYOUTHANDLER_H
+#define LAYOUTHANDLER_H
+
+#include <QObject>
+#include "windowmanager_proxy.h"
+#include "popup_proxy.h"
+
+class LayoutHandler : public QObject
+{
+    Q_OBJECT
+public:
+    explicit LayoutHandler(QObject *parent = 0);
+    ~LayoutHandler();
+
+    void setUpLayers();
+
+signals:
+
+public slots:
+    void makeMeVisible(int pid);
+    void setLayoutByName(QString layoutName);
+
+private:
+    org::agl::windowmanager *mp_dBusWindowManagerProxy;
+    org::agl::popup *mp_dBusPopupProxy;
+
+    QList<int> m_visibleApps;
+    QList<int> m_invisibleApps;
+    QList<int> m_requestsToBeVisibleApps;
+
+};
+
+#endif // LAYOUTHANDLER_H
index cc552f2..264468b 100644 (file)
@@ -17,7 +17,8 @@
 #include "mainwindow.h"
 #include <QApplication>
 #include <QSysInfo>
-#include <QSharedMemory>
+//#include <QSharedMemory>
+#include <QSurfaceFormat>
 
 int main(int argc, char *argv[])
 {
@@ -36,7 +37,11 @@ int main(int argc, char *argv[])
     QCoreApplication::setOrganizationDomain("LinuxFoundation");
     QCoreApplication::setOrganizationName("AutomotiveGradeLinux");
     QCoreApplication::setApplicationName("HomeScreen");
-    QCoreApplication::setApplicationVersion("0.2.0");
+    QCoreApplication::setApplicationVersion("0.3.0");
+
+    QSurfaceFormat format;
+    format.setDepthBufferSize(16);
+    format.setStencilBufferSize(8);
 
     MainWindow w;
     w.show();
index 174f750..87558aa 100644 (file)
@@ -26,6 +26,7 @@ MainWindow::MainWindow(QWidget *parent) :
     mp_settingsWidget(0),
     mp_applauncherwidget(0),
     mp_popupWidget(0),
+    mp_layoutHandler(new LayoutHandler()),
     mp_dBusDayNightModeProxy(0),
     mp_homeScreenControlInterface(0)
 {
@@ -68,6 +69,7 @@ MainWindow::MainWindow(QWidget *parent) :
     // apply layout
     mp_applauncherwidget->move(0, 60);
 
+
     mp_popupWidget = new PopupWidget();
     mp_controlBarWidget->raise();
     // apply layout
@@ -83,6 +85,8 @@ 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_applauncherwidget, SIGNAL(newRequestsToBeVisibleApp(int)), mp_layoutHandler, SLOT(makeMeVisible(int)));
+
     // apply color scheme
     updateColorScheme();
     mp_statusBarWidget->updateColorScheme();
@@ -94,7 +98,13 @@ MainWindow::MainWindow(QWidget *parent) :
     // this is only useful during development and will be removed later
     setWindowIcon(QIcon(":/icons/home_day.png"));
 
+    mp_applauncherwidget->populateAppList();
+    mp_layoutHandler->setUpLayers();
+
     mp_homeScreenControlInterface = new HomeScreenControlInterface(this);
+    QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestsToBeVisibleApp(int)), mp_layoutHandler, SLOT(makeMeVisible(int)));
+
+    QObject::connect(mp_popupWidget, SIGNAL(comboBoxResult(QString)), mp_layoutHandler, SLOT(setLayoutByName(QString)));
 }
 
 MainWindow::~MainWindow()
@@ -102,6 +112,9 @@ MainWindow::~MainWindow()
     delete mp_homeScreenControlInterface;
 
     delete mp_dBusDayNightModeProxy;
+
+    delete mp_layoutHandler;
+
     delete mp_popupWidget;
     delete mp_applauncherwidget;
     delete mp_settingsWidget;
@@ -151,11 +164,3 @@ void MainWindow::changeEvent(QEvent* event)
     QMainWindow::changeEvent(event);
 }
 
-void MainWindow::on_pushButton_clicked()
-{
-    // start app
-    QProcess process;
-        QString file = "vlc";
-        process.startDetached(file);
-    // manage ivi shell
-}
index cb2243e..d94546a 100644 (file)
@@ -28,6 +28,8 @@
 #include "applauncherwidget.h"
 #include "popupwidget.h"
 
+#include "layouthandler.h"
+
 
 namespace Ui {
 class MainWindow;
@@ -53,8 +55,6 @@ protected:
     // called when the translator loaded a new language set
     void changeEvent(QEvent* event);
 
-private slots:
-    void on_pushButton_clicked();
 
 private:
     Ui::MainWindow *mp_ui;
@@ -67,6 +67,8 @@ private:
     AppLauncherWidget *mp_applauncherwidget;
     PopupWidget *mp_popupWidget;
 
+    LayoutHandler *mp_layoutHandler;
+
     org::agl::daynightmode *mp_dBusDayNightModeProxy;
 
     HomeScreenControlInterface *mp_homeScreenControlInterface;
index 0a27dff..919bea0 100644 (file)
@@ -21,7 +21,8 @@
 PopupWidget::PopupWidget(QWidget *parent) :
     QWidget(parent),
     mp_ui(new Ui::PopupWidget),
-    mp_popupAdaptor(0)
+    mp_popupAdaptor(0),
+    m_sendComboBoxChoice(false)
 {
     // publish dbus popup interface
     mp_popupAdaptor = new PopupAdaptor((QObject*)this);
@@ -60,6 +61,18 @@ void PopupWidget::updateColorScheme()
 
 void PopupWidget::showPopup(int /*type*/, const QString &text)
 {
+    m_sendComboBoxChoice = false;
+    mp_ui->comboBox->hide();
+    this->show();
+    this->raise();
+    mp_ui->label_Text->setText(text);
+}
+
+void PopupWidget::showPopupComboBox(const QString &text, const QStringList &choices)
+{
+    m_sendComboBoxChoice = true;
+    mp_ui->comboBox->addItems(choices);
+    mp_ui->comboBox->show();
     this->show();
     this->raise();
     mp_ui->label_Text->setText(text);
@@ -67,5 +80,10 @@ void PopupWidget::showPopup(int /*type*/, const QString &text)
 
 void PopupWidget::on_pushButton_OK_clicked()
 {
+    if (m_sendComboBoxChoice)
+    {
+        comboBoxResult(mp_ui->comboBox->currentText());
+        m_sendComboBoxChoice = false;
+    }
     this->close();
 }
index 7a73b92..eaf41de 100644 (file)
@@ -38,14 +38,19 @@ public slots:
     // from popup_adapter.h
 public Q_SLOTS: // METHODS
     void showPopup(int /*type*/, const QString &text);
+    void showPopupComboBox(const QString &text, const QStringList &choices);
 
 private slots:
     void on_pushButton_OK_clicked();
 
+signals:
+    void comboBoxResult(QString choice);
+
 private:
     Ui::PopupWidget *mp_ui;
 
     PopupAdaptor *mp_popupAdaptor;
+    bool m_sendComboBoxChoice;
     // for showPupupFor LayoutSelection
     //QList<QPushButton> m_pushButtons;
 };
index 17d181c..7a28ada 100644 (file)
@@ -9,6 +9,12 @@ https://gerrit.automotivelinux.org/gerrit/#/admin/projects/staging/HomeScreen
 AGL repo for bitbake recipe:
 https://gerrit.automotivelinux.org/gerrit/#/admin/projects/AGL/meta-agl-demo/recipes-demo-hmi/HomeScreen/HomeScreen_?.bb
 
+v0.3.0
+09/30/2016
+
+#changes
+- updated version number
+
 v0.2.0
 08/05/2016
 
index 2f7d3a8..f2168d0 100644 (file)
@@ -27,7 +27,7 @@ int main(int argc, char *argv[])
     QCoreApplication::setOrganizationDomain("LinuxFoundation");
     QCoreApplication::setOrganizationName("AutomotiveGradeLinux");
     QCoreApplication::setApplicationName("HomeScreenAppFrameworkBinderTizen");
-    QCoreApplication::setApplicationVersion("0.2.0");
+    QCoreApplication::setApplicationVersion("0.3.0");
 
     HomeScreenAppFrameworkBinderTizen *tdp = new HomeScreenAppFrameworkBinderTizen();
 
index 0a10780..2f4bd17 100644 (file)
@@ -9,6 +9,12 @@ https://gerrit.automotivelinux.org/gerrit/#/admin/projects/staging/HomeScreen
 AGL repo for bitbake recipe:
 https://gerrit.automotivelinux.org/gerrit/#/admin/projects/AGL/meta-agl-demo/recipes-demo-hmi/HomeScreen/HomeScreen_?.bb
 
+v0.3.0
+09/30/2016
+
+#changes
+- added popup choice example
+
 v0.2.0
 08/05/2016
 
index 289c237..1915a24 100644 (file)
        <string>&quot;Hello World&quot; Example</string>
       </property>
      </widget>
+     <widget class="QPushButton" name="pushButton_comboBoxExample">
+      <property name="geometry">
+       <rect>
+        <x>230</x>
+        <y>380</y>
+        <width>191</width>
+        <height>27</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>ComboBox Example</string>
+      </property>
+     </widget>
     </widget>
     <widget class="QWidget" name="tab_DayNightMode">
      <attribute name="title">
index 5a165f8..00c7ac2 100644 (file)
@@ -36,12 +36,11 @@ int main(int argc, char *argv[])
     QCoreApplication::setOrganizationDomain("LinuxFoundation");
     QCoreApplication::setOrganizationName("AutomotiveGradeLinux");
     QCoreApplication::setApplicationName("HomeScreenSimulator");
-    QCoreApplication::setApplicationVersion("0.2.0");
+    QCoreApplication::setApplicationVersion("0.3.0");
 
     MainWindow w;
     w.show();
 
-    // start input and system settings simulator on developer PCs
 #ifdef __arm__
     qDebug("Running on ARM architecture");
 #endif
index 74c02d7..d670154 100644 (file)
@@ -149,3 +149,13 @@ void MainWindow::on_pushButton_PopupExample_clicked()
 {
     mp_dBusPopupProxy->showPopup(0, "Hello Popup!\nNice to see you!");
 }
+
+void MainWindow::on_pushButton_comboBoxExample_clicked()
+{
+    QStringList choices;
+    choices.append("Item1");
+    choices.append("Item2");
+    choices.append("Item3");
+    choices.append("Item4");
+    mp_dBusPopupProxy->showPopupComboBox("Make your choice!", choices);
+}
index 7c2f19b..dd412a3 100644 (file)
@@ -57,6 +57,8 @@ private slots:
 
     void on_pushButton_PopupExample_clicked();
 
+    void on_pushButton_comboBoxExample_clicked();
+
 private:
     Ui::MainWindow *mp_ui;
     DaynightmodeAdaptor *mp_dBusDayNightModeAdapter;
index 078305d..d7dcf55 100644 (file)
@@ -9,6 +9,12 @@ https://gerrit.automotivelinux.org/gerrit/#/admin/projects/staging/HomeScreen
 AGL repo for bitbake recipe:
 https://gerrit.automotivelinux.org/gerrit/#/admin/projects/AGL/meta-agl-demo/recipes-demo-hmi/HomeScreen/HomeScreen_?.bb
 
+v0.3.0
+09/30/2016
+
+#changes
+- updated version number
+
 v0.2.0
 08/05/2016
 
index 4862dbd..1025bc3 100644 (file)
@@ -25,7 +25,7 @@ int main(int argc, char *argv[])
     QCoreApplication::setOrganizationDomain("LinuxFoundation");
     QCoreApplication::setOrganizationName("AutomotiveGradeLinux");
     QCoreApplication::setApplicationName("InputEventManager");
-    QCoreApplication::setApplicationVersion("0.2.0");
+    QCoreApplication::setApplicationVersion("0.3.0");
 
     InputEventManager *inputEventManager = new InputEventManager();
 
index 1cf76a1..945957f 100644 (file)
--- a/README.md
+++ b/README.md
@@ -2,9 +2,10 @@ This project contains:
 
 HomeScreen: AGL Home Screen reference implementation
 HomeScreenSimulator: AGL Home Screen Simulator for development
+InputEventManager: AGL Input event manager
 interfaces: library with the D-Bus interfaces
 SampleAppTimeDate: AGL Sample Application for Home Screen Statusbar
-
+HomeScreenAppFrameworkBinderTizen: Binder for the TIZEN application framework
 
 AGL repo for source code:
 https://gerrit.automotivelinux.org/gerrit/#/admin/projects/staging/HomeScreen
@@ -12,3 +13,96 @@ https://gerrit.automotivelinux.org/gerrit/#/admin/projects/staging/HomeScreen
 AGL repo for bitbake recipe:
 https://gerrit.automotivelinux.org/gerrit/#/admin/projects/AGL/meta-agl-demo/recipes-demo-hmi/HomeScreen/HomeScreen_?.bb
 
+
+Instructions for running on porter board
+----------------------------------------
+
+Add "HomeScreen" to your image recipe.
+Right now, HomeScreen depends on the TIZEN application manager, because the HomeScreenAppFrameworkBinderTizen makes use of it.
+So also add this to your image recipe:
+"
+    tizen-platform-wrapper \
+    tizen-platform-config \
+    xdgmime \
+    libdlog \
+    dlogutil \
+    libiri \
+    \
+    smack \
+    libprivilege-control \
+    libslp-db-util \
+    \
+    vconf \
+    capi-base-common \
+    ail \
+    \
+    sensor \
+    libsf-common \
+    \
+    iniparser \
+    app-svc \
+    heynoti \
+    notification \
+    app-core-efl \
+    app-core-common \
+    capi-system-info \
+    \
+    pkgmgr-info \
+    librua \
+    bundle \
+    app-checker \
+    \
+    libcom-core \
+    privacy-manager-server \
+    pkgmgr \
+    pkgmgr-info \
+    pkgmgr-info-parser \
+    aul \
+    aul-test \
+    \
+    dlt-daemon \
+    dlt-daemon-systemd \
+    \
+    amhelloworld \
+    pkgmgr-first-setup-service \
+"
+
+
+All "HomeScreen" applications can be found in /opt/AGL/HomeScreen.
+
+Make sure, weston is using the IVI shell extension:
+
+/etc/xdg/weston/weston.ini:
+
+[core]
+shell=ivi-shell.so
+
+[ivi-shell]
+ivi-module=ivi-controller.so
+ivi-shell-user-interface=/usr/lib/weston/weston-ivi-shell-user-interface
+
+[output]
+name=HDMI-A-1
+transform=270
+
+
+
+If you want to use the TIZEN application manager to launch apps, you need to execute HomeScreen app with the user "aglglobalapp":
+
+Therefore you need to change the owner of the weston socket:
+
+chown aglglobalapp:aglglobalapp /tmp/wayland-0
+
+P.S.: the path may also something likle /run/user/0, depending on the XDG_RUNTIME_DIR.
+
+If not already stared, launch D-Bus:
+export `dbus-launch`
+
+Now you can start the HomeScreen apps:
+cd /opt/AGL/HomeScreen
+./WindowManager &
+./InputEventManager &
+./HomeScreenAppFrameworkBinderTizen &
+./HomeScreen &
+
+
index 7d37899..441751b 100644 (file)
@@ -9,6 +9,12 @@ https://gerrit.automotivelinux.org/gerrit/#/admin/projects/staging/HomeScreen
 AGL repo for bitbake recipe:
 https://gerrit.automotivelinux.org/gerrit/#/admin/projects/AGL/meta-agl-demo/recipes-demo-hmi/HomeScreen/HomeScreen_?.bb
 
+v0.3.0
+09/30/2016
+
+#changes
+- updated version number
+
 v0.2.0
 08/05/2016
 
index 5be8431..6c0d83c 100644 (file)
@@ -9,7 +9,7 @@ int main(int argc, char *argv[])
     QCoreApplication::setOrganizationDomain("LinuxFoundation");
     QCoreApplication::setOrganizationName("AutomotiveGradeLinux");
     QCoreApplication::setApplicationName("SampleAppTimeDate");
-    QCoreApplication::setApplicationVersion("0.2.0");
+    QCoreApplication::setApplicationVersion("0.3.0");
 
     TimeDateProvider *tdp = new TimeDateProvider();
     tdp->start();
index 64cf50b..135dbd2 100644 (file)
@@ -9,6 +9,12 @@ https://gerrit.automotivelinux.org/gerrit/#/admin/projects/staging/HomeScreen
 AGL repo for bitbake recipe:
 https://gerrit.automotivelinux.org/gerrit/#/admin/projects/AGL/meta-agl-demo/recipes-demo-hmi/HomeScreen/HomeScreen_?.bb
 
+v0.3.0
+09/30/2016
+
+#changes
+- implementation ongoing
+
 v0.2.0
 08/05/2016
 
index 74dfb3a..58ce08a 100644 (file)
@@ -19,8 +19,6 @@ TARGET = WindowManager
 CONFIG   += console
 CONFIG   -= app_bundle
 
-TEMPLATE = app
-
 
 SOURCES += src/main.cpp \
     src/windowmanager.cpp
@@ -31,15 +29,12 @@ HEADERS += \
 INCLUDEPATH += $$OUT_PWD/../interfaces
 INCLUDEPATH += ../interfaces/
 
-#LIBS += -L$$OUT_PWD/../interfaces -linterfaces
+LIBS += -L$$OUT_PWD/../interfaces -linterfaces
 contains(QT_ARCH, arm.*) {
     LIBS += -lilmControl -lilmCommon
 }
 
-#contains(QT_ARCH, arm.*) {
-#    LIBS += -lpkgmgr-info
-#    LIBS += -laul
-#}
+FORMS +=
 
 OTHER_FILES += \
     README.md
@@ -48,3 +43,4 @@ OTHER_FILES += \
 QMAKE_CLEAN += -r \
     $$OUT_PWD/WindowManager \
     $$OUT_PWD/Makefile
+
index 14e0e00..333d864 100644 (file)
@@ -25,9 +25,21 @@ int main(int argc, char *argv[])
     QCoreApplication::setOrganizationDomain("LinuxFoundation");
     QCoreApplication::setOrganizationName("AutomotiveGradeLinux");
     QCoreApplication::setApplicationName("WindowManager");
-    QCoreApplication::setApplicationVersion("0.2.0");
+    QCoreApplication::setApplicationVersion("0.3.0");
+
+    qDBusRegisterMetaType<SimplePoint>();
+    qDBusRegisterMetaType<QList<SimplePoint> >();
+    qDBusRegisterMetaType<SimpleRect>();
+    qDBusRegisterMetaType<QList<SimpleRect> >();
 
     WindowManager *windowManager = new WindowManager();
 
+#ifdef __arm__
+    qDebug("Running on ARM architecture");
+#endif
+#ifdef __i386__
+    qDebug("Running on x86 architecture");
+#endif
+
     return a.exec();
 }
index dcab2f4..d35db9b 100644 (file)
  */
 
 #include "windowmanager.hpp"
+#include <wayland-client.h>
+#include <QFile>
 
 //////////////////////////////////////////
 // THIS IS STILL UNDER HEAVY DEVELOPMENT!
 // DO NOT JUDGE THE SOURCE CODE :)
 //////////////////////////////////////////
 
+void* WindowManager::myThis = 0;
 
 WindowManager::WindowManager(QObject *parent) :
-    QObject(parent)
+    QObject(parent),
+    m_layouts(),
+    m_layoutNames(),
+    m_currentLayout(-1)
 {
     qDebug("WindowManager");
-#ifdef __arm__
-    ilmErrorTypes err;
-    if (true)//!ilm_isInitialized()) ...crashes...
-    {
-        err = ilm_init();
-        qDebug("ilm_init = %d", err);
-    }
+    // publish windowmanager interface
+    mp_windowManagerAdaptor = new WindowmanagerAdaptor((QObject*)this);
 
+    QDBusConnection dbus = QDBusConnection::sessionBus();
+    dbus.registerObject("/windowmanager", this);
+    dbus.registerService("org.agl.windowmanager");
 
-    t_ilm_uint screenID = 0;
-    t_ilm_uint width;
-    t_ilm_uint height;
-
-    err = ilm_getScreenResolution(screenID, &width, &height);
-    qDebug("ilm_getScreenResolution = %d", err);
-    qDebug("pWidth %d, pHeight %d", width, height);
+#ifdef __arm__
+    mp_processLayers = new QList<int>;
+    mp_surfaces = new QMap<t_ilm_uint, SurfaceInfo>;
 
+    ilmErrorTypes err;
 
-    t_ilm_layer layerId = 42; // does not matter
-    err = ilm_layerCreateWithDimension(&layerId, width, height);
-    qDebug("ilm_layerCreateWithDimension = %d", err);
-    qDebug("layerId = %d", layerId);
+    err = ilm_init();
+    qDebug("ilm_init = %d", err);
 
-    err = ilm_layerSetVisibility(layerId, true);
-    qDebug("ilm_layerSetVisibility = %d", err);
+    myThis = this;
+    err =  ilm_registerNotification(WindowManager::notificationFunc_static, this);
 
-    ilm_commitChanges();
 
-    err = ilm_displaySetRenderOrder(screenID, &layerId, 1);
-    qDebug("ilm_displaySetRenderOrder = %d", err);
+#endif
+}
 
-    ilm_commitChanges();
+WindowManager::~WindowManager()
+{
+    delete mp_windowManagerAdaptor;
+#ifdef __arm__
+    delete mp_surfaces;
 
-    err =  ilm_layerSetSourceRectangle(layerId, 0, 0, width, height);
-    qDebug("ilm_layerSetSourceRectangle = %d", err);
-    err =  ilm_layerSetDestinationRectangle(layerId, 0, 0, width, height);
-    qDebug("layerSetDestinationRectangle = %d", err);
+    ilm_destroy();
+#endif
+}
 
-    ilm_commitChanges();
+void WindowManager::dumpScene()
+{
+    qDebug("\n");
+    qDebug("current layout   : %d", m_currentLayout);
+    qDebug("available layouts: %d", m_layouts.size());
+    QMap<int, QList<SimpleRect> >::iterator i = m_layouts.begin();
 
-    t_ilm_float opacity = 1.0;
+    QList<int> result;
+    while (i != m_layouts.constEnd())
+    {
+        qDebug("--[id: %d]--[%s]--", i.key(), m_layoutNames.find(i.key()).value().toStdString().c_str());
+        qDebug("  %d surface areas", i.value().size());
+        for (int j = 0; j < i.value().size(); ++j)
+        {
+            qDebug("  -area %d", j);
+            qDebug("    -x     : %d", i.value().at(j).x);
+            qDebug("    -y     : %d", i.value().at(j).y);
+            qDebug("    -width : %d", i.value().at(j).width);
+            qDebug("    -height: %d", i.value().at(j).height);
+        }
 
-    err =  ilm_layerSetOpacity(layerId, opacity);
-    qDebug("ilm_layerSetOpacity = %d", err);
+        ++i;
+    }
 
+}
 
-    t_ilm_int length;
-    t_ilm_surface* pArray;
+#ifdef __arm__
 
-    err = ilm_getSurfaceIDs(&length, &pArray);
-    qDebug("ilm_getSurfaceIDs = %d", err);
-    qDebug("length %d pArray[0] %d", length, pArray[0]);
+void WindowManager::createNewLayer(int layerId)
+{
+    ilmErrorTypes err;
 
-    if (length > 0)
-    {
-        t_ilm_surface surfaceId = pArray[0];
+    t_ilm_uint screenID = 0;
+    t_ilm_uint width;
+    t_ilm_uint height;
 
-        err = ilm_layerAddSurface(layerId, surfaceId);
-        qDebug("ilm_layerAddSurface = %d", err);
+    err = ilm_getScreenResolution(screenID, &width, &height);
 
-        t_ilm_bool visibility;
-        err = ilm_surfaceGetVisibility(surfaceId, &visibility);
-        qDebug("ilm_surfaceGetVisibility = %d", err);
-        qDebug("visibility %d", visibility);
+    t_ilm_layer newLayerId = layerId;
+    err = ilm_layerCreateWithDimension(&newLayerId, width, height);
+    qDebug("ilm_layerCreateWithDimension = %d", err);
+    qDebug("layerIdWallpaper = %d", newLayerId);
 
-        err = ilm_surfaceSetVisibility(surfaceId, true);
-        qDebug("ilm_surfaceSetVisibility = %d", err);
+    err = ilm_layerSetVisibility(newLayerId, true);
+    qDebug("ilm_layerSetVisibility = %d", err);
 
-        err = ilm_surfaceSetOpacity(surfaceId, opacity);
-        qDebug("ilm_surfaceSetOpacity = %d", err);
+    t_ilm_float opacity = 1.0;
+    err =  ilm_layerSetOpacity(newLayerId, opacity);
 
-        err = ilm_surfaceSetSourceRectangle(surfaceId, 0, 0, 200, 200);
-        qDebug("ilm_surfaceSetSourceRectangle = %d", err);
-        err = ilm_surfaceSetDestinationRectangle(surfaceId, 0, 0, 200, 200);
-        qDebug("surfaceSetDestinationRectangle = %d", err);
+    ilm_commitChanges();
+}
 
+void WindowManager::addSurfaceToLayer(int surfaceId, int layerId)
+{
+    t_ilm_int length;
+    t_ilm_layer* pArray;
 
+    ilm_getLayerIDs(&length, &pArray);
+    bool layerFound(false);
+    for (int i = 0; i< length; ++i)
+    {
+        if (layerId == pArray[i])
+        {
+            layerFound = true;
+        }
     }
 
-    ilm_commitChanges();
+    if (!layerFound)
+    {
+        createNewLayer(layerId);
+    }
 
-    struct ilmScreenProperties screenProperties;
-    struct ilmLayerProperties layerProperties;
     struct ilmSurfaceProperties surfaceProperties;
+    ilm_getPropertiesOfSurface(surfaceId, &surfaceProperties);
+    qDebug("  origSourceWidth : %d", surfaceProperties.origSourceWidth);
+    qDebug("  origSourceHeight: %d", surfaceProperties.origSourceHeight);
 
-    err =  ilm_getPropertiesOfScreen(0, &screenProperties);
-    qDebug("ilm_getPropertiesOfScreen = %d", err);
-    err =  ilm_getPropertiesOfLayer(layerId, &layerProperties);
-    qDebug("ilm_getPropertiesOfLayer = %d", err);
-    err =  ilm_getPropertiesOfSurface(pArray[0], &surfaceProperties);
-    qDebug("ilm_getPropertiesOfSurface = %d", err);
-
-
-    qDebug("screen");
-    qDebug("t_ilm_uint %d", screenProperties.layerCount);          /*!< number of layers displayed on the screen */
-    //qDebug("t_ilm_layer* %d", screenProperties.layerIds[0]);          /*!< array of layer ids */
-    qDebug("t_ilm_uint %d", screenProperties.harwareLayerCount);   /*!< number of hardware layers */
-    qDebug("t_ilm_uint %d", screenProperties.screenWidth);         /*!< width value of screen in pixels */
-    qDebug("t_ilm_uint %d", screenProperties.screenHeight);        /*!< height value of screen in pixels */
-
-    qDebug("layer");
-    qDebug("t_ilm_float %f", layerProperties.opacity);         /*!< opacity value of the layer */
-    qDebug("t_ilm_uint %d", layerProperties.sourceX);          /*!< x source position value of the layer */
-    qDebug("t_ilm_uint %d", layerProperties.sourceY);          /*!< y source position value of the layer */
-    qDebug("t_ilm_uint %d", layerProperties.sourceWidth);      /*!< source width value of the layer */
-    qDebug("t_ilm_uint %d", layerProperties.sourceHeight);     /*!< source height value of the layer */
-    qDebug("t_ilm_uint %d", layerProperties.origSourceWidth);  /*!< original source width value of the layer */
-    qDebug("t_ilm_uint %d", layerProperties.origSourceHeight); /*!< original source height value of the layer */
-    qDebug("t_ilm_uint %d", layerProperties.destX);            /*!< x destination position value of the layer */
-    qDebug("t_ilm_uint %d", layerProperties.destY);            /*!< y desitination position value of the layer */
-    qDebug("t_ilm_uint %d", layerProperties.destWidth);        /*!< destination width value of the layer */
-    qDebug("t_ilm_uint %d", layerProperties.destHeight);       /*!< destination height value of the layer */
-    qDebug("ilmOrientation%d",  layerProperties.orientation);  /*!< orientation value of the layer */
-    qDebug("t_ilm_bool %d", layerProperties.visibility);       /*!< visibility value of the layer */
-    qDebug("t_ilm_uint %d", layerProperties.type);             /*!< type of layer */
-    qDebug("t_ilm_int  %d", layerProperties.creatorPid);       /*!< process id of application that created this layer */
-
-    qDebug("surface");
-    qDebug("t_ilm_float %f", surfaceProperties.opacity);                    /*!< opacity value of the surface */
-    qDebug("t_ilm_uint %d", surfaceProperties.sourceX);                     /*!< x source position value of the surface */
-    qDebug("t_ilm_uint %d", surfaceProperties.sourceY);                     /*!< y source position value of the surface */
-    qDebug("t_ilm_uint %d", surfaceProperties.sourceWidth);                 /*!< source width value of the surface */
-    qDebug("t_ilm_uint %d", surfaceProperties.sourceHeight);                /*!< source height value of the surface */
-    qDebug("t_ilm_uint %d", surfaceProperties.origSourceWidth);             /*!< original source width value of the surface */
-    qDebug("t_ilm_uint %d", surfaceProperties.origSourceHeight);            /*!< original source height value of the surface */
-    qDebug("t_ilm_uint %d", surfaceProperties.destX);                       /*!< x destination position value of the surface */
-    qDebug("t_ilm_uint %d", surfaceProperties.destY);                       /*!< y desitination position value of the surface */
-    qDebug("t_ilm_uint %d", surfaceProperties.destWidth);                   /*!< destination width value of the surface */
-    qDebug("t_ilm_uint %d", surfaceProperties.destHeight);                  /*!< destination height value of the surface */
-    qDebug("ilmOrientation %d", surfaceProperties.orientation);             /*!< orientation value of the surface */
-    qDebug("t_ilm_bool %d", surfaceProperties.visibility);                  /*!< visibility value of the surface */
-    qDebug("t_ilm_uint %d", surfaceProperties.frameCounter);                /*!< already rendered frames of surface */
-    qDebug("t_ilm_uint %d", surfaceProperties.drawCounter);                 /*!< content updates of surface */
-    qDebug("t_ilm_uint %d", surfaceProperties.updateCounter);               /*!< content updates of surface */
-    qDebug("t_ilm_uint %d", surfaceProperties.pixelformat);                 /*!< pixel format of surface */
-    qDebug("t_ilm_uint %d", surfaceProperties.nativeSurface);               /*!< native surface handle of surface */
-    qDebug("t_ilm_int  %d", surfaceProperties.creatorPid);                  /*!< process id of application that created this surface */
-    qDebug("ilmInputDevice %d", surfaceProperties.focus);                   /*!< bitmask of every type of device that this surface has focus in */
+    ilm_surfaceSetDestinationRectangle(surfaceId, 0, 0, surfaceProperties.origSourceWidth, surfaceProperties.origSourceHeight);
+    ilm_surfaceSetSourceRectangle(surfaceId, 0, 0, surfaceProperties.origSourceWidth, surfaceProperties.origSourceHeight);
+    ilm_surfaceSetOpacity(surfaceId, 1.0);
+    ilm_surfaceSetVisibility(surfaceId, true);
 
-    err =  ilm_registerNotification(WindowManager::notificationFunc_static, this);
-#endif
-}
+    ilm_layerAddSurface(layerId, surfaceId);
 
-WindowManager::~WindowManager()
-{
-#ifdef __arm__
-    ilmErrorTypes err;
-    if (ilm_isInitialized())
-    {
-        err = ilm_destroy();
-        qDebug("ilm_destroy = %d", err);
-    }
-#endif
+    ilm_commitChanges();
 }
 
-#ifdef __arm__
 void WindowManager::notificationFunc_non_static(ilmObjectType object,
                                     t_ilm_uint id,
                                     t_ilm_bool created)
 {
-    qDebug("notificationFunc_non_static");
     if (ILM_SURFACE == object)
     {
         struct ilmSurfaceProperties surfaceProperties;
@@ -194,53 +163,74 @@ void WindowManager::notificationFunc_non_static(ilmObjectType object,
         if (created)
         {
             qDebug("Surface created, ID: %d", id);
-
-            ilm_layerAddSurface(42 /*always use layer 42 for now*/, id);
-            ilm_surfaceSetOpacity(id, 1.0);
-            ilm_surfaceSetVisibility(id, true);
             ilm_getPropertiesOfSurface(id, &surfaceProperties);
-            ilm_surfaceSetSourceRectangle(id, 0, 0, surfaceProperties.origSourceWidth, surfaceProperties.origSourceHeight);
+            qDebug("  origSourceWidth : %d", surfaceProperties.origSourceWidth);
+            qDebug("  origSourceHeight: %d", surfaceProperties.origSourceHeight);
+
+            addSurfaceToLayer(id, surfaceProperties.creatorPid);
+
+            t_ilm_int length;
+            t_ilm_surface* pArray;
+            ilm_getSurfaceIDs(&length, &pArray);
+            ilm_layerSetRenderOrder(42, pArray, length);
 
             ilm_commitChanges();
+
+            SurfaceInfo surfaceInfo;
+            surfaceInfo.pid = surfaceProperties.creatorPid;
+            QString procInfoFileName = QString("/proc/") + QString::number(surfaceInfo.pid) + QString("/comm");
+            QFile procInfo(procInfoFileName);
+            if (procInfo.open(QIODevice::ReadOnly))
+            {
+                QTextStream in(&procInfo);
+                surfaceInfo.processName = in.readLine();
+                qDebug("surface id %d, pid %d: %s", id, surfaceInfo.pid, surfaceInfo.processName.toStdString().c_str());
+            }
+
+            mp_surfaces->insert(id, surfaceInfo);
+            ilm_surfaceAddNotification(id, surfaceCallbackFunction_static);
         }
         else
         {
             qDebug("Surface destroyed, ID: %d", id);
+            mp_surfaces->erase(mp_surfaces->find(id));
+            ilm_surfaceRemoveNotification(id);
         }
 
+        // rearrange surfaces on screen
         t_ilm_uint screenID = 0;
         t_ilm_uint width;
         t_ilm_uint height;
         ilm_getScreenResolution(screenID, &width, &height);
 
-        t_ilm_int length;
-        t_ilm_surface* pArray;
-
-        ilm_getSurfaceIDs(&length, &pArray);
-        qDebug("length %d", length);
-
+        qDebug("%d surfaces to show", mp_surfaces->count());
 
-        for (int i = 0; i < length; ++i)
+        QMap<t_ilm_uint, SurfaceInfo>::const_iterator i = mp_surfaces->constBegin();
+        int counter(0);
+        while (i != mp_surfaces->constEnd())
         {
-            //ilm_getPropertiesOfSurface(pArray[i], &surfaceProperties);
-            qDebug("place surface %d at x: %f, y: %f, width: %f, height: %f",
-                   pArray[i],
-                   i * (width / (1.0 * length)),
+            qDebug("place surface %d at x: %f, y: %d, width: %f, height: %d",
+                   i.key(),
+                   counter * (width / (1.0 * mp_surfaces->count())),
                    0,
-                   width / (1.0 * length),
+                   width / (1.0 * mp_surfaces->count()),
                    height);
-            ilm_surfaceSetDestinationRectangle(pArray[(int)i],
-                    i * (width / (1.0 * length)),
+            ilm_surfaceSetDestinationRectangle(i.key(),
+                    counter * (width / (1.0 * mp_surfaces->count())),
                     0,
-                    width / (1.0 * length),
+                    width / (1.0 * mp_surfaces->count()),
                     height);
+
+            ++i;
+            ++counter;
         }
 
+
         ilm_commitChanges();
     }
     if (ILM_LAYER == object)
     {
-        qDebug("Layer.. we don't care...");
+        //qDebug("Layer.. we don't care...");
     }
 }
 
@@ -249,7 +239,132 @@ void WindowManager::notificationFunc_static(ilmObjectType object,
                                             t_ilm_bool created,
                                             void* user_data)
 {
-    qDebug("notificationFunc_static");
-    static_cast<WindowManager*>(user_data)->notificationFunc_non_static(object, id, created);
+    static_cast<WindowManager*>(WindowManager::myThis)->notificationFunc_non_static(object, id, created);
+}
+
+
+
+
+void WindowManager::surfaceCallbackFunction_non_static(t_ilm_surface surface,
+                                    struct ilmSurfaceProperties* surfaceProperties,
+                                    t_ilm_notification_mask mask)
+{
+    qDebug("surfaceCallbackFunction_non_static changes for surface %d", surface);
+    if (ILM_NOTIFICATION_VISIBILITY & mask)
+    {
+        qDebug("ILM_NOTIFICATION_VISIBILITY");
+    }
+
+    if (ILM_NOTIFICATION_OPACITY & mask)
+    {
+        qDebug("ILM_NOTIFICATION_OPACITY");
+    }
+
+    if (ILM_NOTIFICATION_ORIENTATION & mask)
+    {
+        qDebug("ILM_NOTIFICATION_ORIENTATION");
+    }
+
+    if (ILM_NOTIFICATION_SOURCE_RECT & mask)
+    {
+        qDebug("ILM_NOTIFICATION_SOURCE_RECT");
+    }
+
+    if (ILM_NOTIFICATION_DEST_RECT & mask)
+    {
+        qDebug("ILM_NOTIFICATION_DEST_RECT");
+    }
+}
+
+void WindowManager::surfaceCallbackFunction_static(t_ilm_surface surface,
+                                    struct ilmSurfaceProperties* surfaceProperties,
+                                    t_ilm_notification_mask mask)
+
+{
+    static_cast<WindowManager*>(WindowManager::myThis)->surfaceCallbackFunction_non_static(surface, surfaceProperties, mask);
 }
 #endif
+
+int WindowManager::addLayout(int layoutId, const QString &layoutName, const QList<SimpleRect> &surfaceAreas)
+{
+    m_layouts.insert(layoutId, surfaceAreas);
+    m_layoutNames.insert(layoutId, layoutName);
+    qDebug("addLayout %d %s, size %d", layoutId, layoutName.toStdString().c_str(), surfaceAreas.size());
+
+    dumpScene();
+
+    return true;
+}
+
+QList<int> WindowManager::getAvailableLayouts(int numberOfAppSurfaces)
+{
+    QMap<int, QList<SimpleRect> >::iterator i = m_layouts.begin();
+
+    QList<int> result;
+    while (i != m_layouts.constEnd())
+    {
+        if (i.value().size() == numberOfAppSurfaces)
+        {
+            result.append(i.key());
+        }
+
+        ++i;
+    }
+
+    return result;
+}
+
+// maybe not needed anymore
+QList<SimplePoint> WindowManager::getAvailableSurfaces()
+{
+    QList<SimplePoint> points;
+    SimplePoint point;
+    point.x = 1;
+    point.y = 2;
+    points.append(point);
+    point.x = 11;
+    point.y = 22;
+    points.append(point);
+    point.x = 111;
+    point.y = 222;
+    points.append(point);
+
+    return points;
+}
+
+int WindowManager::getLayout()
+{
+    return m_currentLayout;
+}
+
+QString WindowManager::getLayoutName(int layoutId)
+{
+    return m_layoutNames.find(layoutId).value();
+}
+
+void WindowManager::setLayoutById(int layoutId)
+{
+    m_currentLayout = layoutId;
+
+    dumpScene();
+}
+
+void WindowManager::setLayoutByName(const QString &layoutName)
+{
+    QMap<int, QString>::iterator i = m_layoutNames.begin();
+    while (i != m_layoutNames.constEnd())
+    {
+        if (i.value() == layoutName)
+        {
+            m_currentLayout = i.key();
+        }
+        ++i;
+    }
+
+    dumpScene();
+}
+
+void WindowManager::setSurfaceToLayoutArea(int surfaceId, int layoutAreaId)
+{
+    dumpScene();
+}
index ee779aa..8fb716d 100644 (file)
 #define WINDOWMANAGER_HPP
 
 #include <QObject>
+#include <QList>
+#include <QMap>
 
+#include "windowmanager_adapter.h"
+
+
+typedef struct
+{
+    int pid;
+    QString processName;
+} SurfaceInfo;
 
 #ifdef __arm__
 extern "C" {
@@ -26,19 +36,37 @@ extern "C" {
 }
 #endif
 
-
 class WindowManager : public QObject
 {
     Q_OBJECT
+
 public:
     explicit WindowManager(QObject *parent = 0);
+    QMutex callbackMutex;
+
     ~WindowManager();
 private:
+    WindowmanagerAdaptor *mp_windowManagerAdaptor;
+    QMap<int, QList<SimpleRect> > m_layouts;
+    QMap<int, QString> m_layoutNames;
+    int m_currentLayout;
+    void dumpScene();
 
+#ifdef __arm__
+    void createNewLayer(int layerId);
+    void addSurfaceToLayer(int surfaceId, int layerId);
+
+    QMap<t_ilm_uint, SurfaceInfo> *mp_surfaces;
+    /* one layer per pid is created
+    where the surfaces are added that are created by the process */
+    QList<int> *mp_processLayers;
+#endif
 
 public:
+    static void* myThis;
 
 #ifdef __arm__
+    // for general notifications
     void notificationFunc_non_static(ilmObjectType object,
                                         t_ilm_uint id,
                                         t_ilm_bool created);
@@ -46,9 +74,32 @@ public:
                                         t_ilm_uint id,
                                         t_ilm_bool created,
                                         void* user_data);
+
+
+    // for surface notifications
+    void surfaceCallbackFunction_non_static(t_ilm_surface surface,
+                                        struct ilmSurfaceProperties* surfaceProperties,
+                                        t_ilm_notification_mask mask);
+    static void surfaceCallbackFunction_static(t_ilm_surface surface,
+                                        struct ilmSurfaceProperties* surfaceProperties,
+                                        t_ilm_notification_mask mask);
+
 #endif
 public slots:
 
+
+// from windowmanager_adapter.h
+public Q_SLOTS: // METHODS
+    int addLayout(int layoutId, const QString &layoutName, const QList<SimpleRect> &surfaceAreas);
+    QList<int> getAvailableLayouts(int numberOfAppSurfaces);
+    QList<SimplePoint> getAvailableSurfaces();
+    int getLayout();
+    QString getLayoutName(int layoutId);
+    void setLayoutById(int layoutId);
+    void setLayoutByName(const QString &layoutName);
+    void setSurfaceToLayoutArea(int surfaceId, int layoutAreaId);
+
 };
 
+
 #endif // WINDOWMANAGER_HPP
index 0d11315..c669548 100644 (file)
@@ -9,6 +9,12 @@ https://gerrit.automotivelinux.org/gerrit/#/admin/projects/staging/HomeScreen
 AGL repo for bitbake recipe:
 https://gerrit.automotivelinux.org/gerrit/#/admin/projects/AGL/meta-agl-demo/recipes-demo-hmi/HomeScreen/HomeScreen_?.bb
 
+v0.3.0
+09/30/2016
+
+#changes
+- interface definition ongoing
+
 v0.1.1
 07/06/2016
 
index 55f4305..3eb66d0 100644 (file)
@@ -17,6 +17,9 @@
     <method name="hardKeyPressed">
       <arg name="key" type="i" direction="in"/> <!-- using the inputevent.hpp InputEvent::HardKey type -->
     </method>
+    <method name="setToFullscreen">
+      <arg name="pid" type="i" direction="in"/>
+    </method>
   </interface>
 </node>
 
diff --git a/interfaces/include/windowmanager.hpp b/interfaces/include/windowmanager.hpp
new file mode 100644 (file)
index 0000000..b587b70
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * 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 WINDOWMANAGER_H
+#define WINDOWMANAGER_H
+
+#include <QtDBus>
+
+class SimplePoint
+{
+public:
+    SimplePoint();
+    virtual ~SimplePoint();
+
+       int x;
+       int y;
+
+    friend QDBusArgument &operator <<(QDBusArgument &argument, const SimplePoint &mSimplePoint);
+    friend const QDBusArgument &operator >>(const QDBusArgument &argument, SimplePoint &mSimplePoint);
+};
+
+
+class SimpleRect
+{
+public:
+    SimpleRect();
+    virtual ~SimpleRect();
+
+       int x;
+       int y;
+       int width;
+       int height;
+
+    friend QDBusArgument &operator <<(QDBusArgument &argument, const SimpleRect &mSimpleRect);
+    friend const QDBusArgument &operator >>(const QDBusArgument &argument, SimpleRect &mSimpleRect);
+};
+
+
+Q_DECLARE_METATYPE(SimplePoint)
+Q_DECLARE_METATYPE(QList<SimplePoint>)
+
+Q_DECLARE_METATYPE(SimpleRect)
+Q_DECLARE_METATYPE(QList<SimpleRect>)
+
+
+#endif // WINDOWMANAGER_H
index 75b4412..d776564 100644 (file)
@@ -21,8 +21,12 @@ TEMPLATE = lib
 CONFIG += staticlib
 TARGET = interfaces
 
-HEADERS += include/appframework.hpp
-SOURCES += src/appframework.cpp
+HEADERS += \
+    include/appframework.hpp \
+    include/windowmanager.hpp
+
+SOURCES += src/appframework.cpp \
+    src/windowmanager.cpp
 
 XMLSOURCES = \
     appframework.xml \
@@ -30,7 +34,8 @@ XMLSOURCES = \
     homescreen.xml \
     inputevent.xml \
     popup.xml \
-    statusbar.xml
+    statusbar.xml \
+    windowmanager.xml
 
 gen_adapter_cpp.input = XMLSOURCES
 gen_adapter_cpp.commands = \
index 0ec8db3..c144f84 100644 (file)
@@ -18,5 +18,9 @@
       <arg name="type" type="i" direction="in"/>
       <arg name="text" type="s" direction="in"/>
     </method>
+    <method name="showPopupComboBox">
+      <arg name="text" type="s" direction="in"/>
+      <arg name="choices" type="as" direction="in"/>
+    </method>
   </interface>
 </node>
index 3a5ebda..afd6114 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
 #include "include/appframework.hpp"
 
 AppInfo::AppInfo(QObject *parent) :
diff --git a/interfaces/src/windowmanager.cpp b/interfaces/src/windowmanager.cpp
new file mode 100644 (file)
index 0000000..12f425e
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+#include "include/windowmanager.hpp"
+
+SimplePoint::SimplePoint()
+{
+}
+
+SimplePoint::~SimplePoint()
+{
+}
+
+
+SimpleRect::SimpleRect()
+{
+}
+
+SimpleRect::~SimpleRect()
+{
+}
+
+QDBusArgument &operator <<(QDBusArgument &argument, const SimplePoint &mSimplePoint)
+{
+       argument.beginStructure();
+       argument << mSimplePoint.x;
+       argument << mSimplePoint.y;
+       argument.endStructure();
+
+       return argument;
+}
+
+const QDBusArgument &operator >>(const QDBusArgument &argument, SimplePoint &mSimplePoint)
+{
+       argument.beginStructure();
+    argument >> mSimplePoint.x;
+    argument >> mSimplePoint.y;
+       argument.endStructure();
+       return argument;
+}
+
+QDBusArgument &operator <<(QDBusArgument &argument, const SimpleRect &mSimpleRect)
+{
+       argument.beginStructure();
+       argument << mSimpleRect.x;
+       argument << mSimpleRect.y;
+       argument << mSimpleRect.width;
+       argument << mSimpleRect.height;
+       argument.endStructure();
+
+       return argument;
+}
+
+const QDBusArgument &operator >>(const QDBusArgument &argument, SimpleRect &mSimpleRect)
+{
+       argument.beginStructure();
+    argument >> mSimpleRect.x;
+    argument >> mSimpleRect.y;
+    argument >> mSimpleRect.width;
+    argument >> mSimpleRect.height;
+       argument.endStructure();
+       return argument;
+}
+
diff --git a/interfaces/windowmanager.xml b/interfaces/windowmanager.xml
new file mode 100644 (file)
index 0000000..9c1e7fe
--- /dev/null
@@ -0,0 +1,52 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<!-- 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. -->
+<node>
+  <interface name="org.agl.windowmanager">
+      <method name="addLayout">
+        <arg name="layoutId" type="i" direction="in"/>
+        <arg name="layoutName" type="s" direction="in"/>
+        <arg name="surfaceAreas" type="a(iiii)" direction="in"/>
+        <annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QList&lt;SimpleRect&gt;"/>
+        <arg name="error" type="i" direction="out"/>
+      </method>
+      <method name="getAvailableLayouts">
+        <arg name="numberOfAppSurfaces" type="i" direction="in"/>
+        <arg name="layoutIds" type="ai" direction="out"/>
+        <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;int&gt;"/>
+      </method>
+      <method name="setLayoutById">
+        <arg name="layoutId" type="i" direction="in"/>
+      </method>
+      <method name="setLayoutByName">
+        <arg name="layoutName" type="s" direction="in"/>
+      </method>
+      <method name="getLayout">
+        <arg name="layoutId" type="i" direction="out"/>
+      </method>
+      <method name="setSurfaceToLayoutArea">
+        <arg name="surfaceId" type="i" direction="in"/>
+        <arg name="layoutAreaId" type="i" direction="in"/>
+      </method>
+      <method name="getAvailableSurfaces">
+        <arg name="surfacesAndPids" type="a(ii)" direction="out"/>
+        <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;SimplePoint&gt;"/>
+      </method>
+      <method name="getLayoutName">
+        <arg name="layoutId" type="i" direction="in"/>
+        <arg name="layoutName" type="s" direction="out"/>
+      </method>
+  </interface>
+</node>
+