aboutsummaryrefslogtreecommitdiffstats
path: root/HomeScreen
diff options
context:
space:
mode:
authorBocklage, Jens <Jens_Bocklage@mentor.com>2016-11-08 19:46:21 +0100
committerBocklage, Jens <Jens_Bocklage@mentor.com>2016-11-08 19:46:21 +0100
commitdd8c90f87463d370c3076e13b7c6cc0e27c0d2f5 (patch)
treef5ec587cfda6ea802ebf0a87ad0fca5712968d3d /HomeScreen
parentd364a5eea428db2eadbb77f3e5da7b74dc36127f (diff)
-Make the SampleNav app yellow.
-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>
Diffstat (limited to 'HomeScreen')
-rw-r--r--HomeScreen/src/applauncherwidget.cpp34
-rw-r--r--HomeScreen/src/applauncherwidget.h3
-rw-r--r--HomeScreen/src/controlbarwidget.cpp2
-rw-r--r--HomeScreen/src/controlbarwidget.h2
-rw-r--r--HomeScreen/src/layouthandler.cpp143
-rw-r--r--HomeScreen/src/layouthandler.h11
-rw-r--r--HomeScreen/src/main.cpp3
-rw-r--r--HomeScreen/src/mainwindow.cpp2
8 files changed, 132 insertions, 68 deletions
diff --git a/HomeScreen/src/applauncherwidget.cpp b/HomeScreen/src/applauncherwidget.cpp
index 3d47d93..2cd5b17 100644
--- a/HomeScreen/src/applauncherwidget.cpp
+++ b/HomeScreen/src/applauncherwidget.cpp
@@ -27,18 +27,18 @@
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();
}
}
diff --git a/HomeScreen/src/applauncherwidget.h b/HomeScreen/src/applauncherwidget.h
index a58148e..d6bc615 100644
--- a/HomeScreen/src/applauncherwidget.h
+++ b/HomeScreen/src/applauncherwidget.h
@@ -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;
};
diff --git a/HomeScreen/src/controlbarwidget.cpp b/HomeScreen/src/controlbarwidget.cpp
index c061a4c..486378b 100644
--- a/HomeScreen/src/controlbarwidget.cpp
+++ b/HomeScreen/src/controlbarwidget.cpp
@@ -69,11 +69,13 @@ void ControlBarWidget::updateColorScheme()
void ControlBarWidget::on_pushButton_home_clicked()
{
+ hideAppLayer();
homeButtonPressed();
}
void ControlBarWidget::on_pushButton_settings_clicked()
{
+ hideAppLayer();
settingsButtonPressed();
}
diff --git a/HomeScreen/src/controlbarwidget.h b/HomeScreen/src/controlbarwidget.h
index a8bd91c..e47d2ba 100644
--- a/HomeScreen/src/controlbarwidget.h
+++ b/HomeScreen/src/controlbarwidget.h
@@ -34,6 +34,8 @@ public:
public slots:
void updateColorScheme();
signals:
+ void hideAppLayer();
+
void settingsButtonPressed();
void homeButtonPressed();
diff --git a/HomeScreen/src/layouthandler.cpp b/HomeScreen/src/layouthandler.cpp
index 35304e6..11dd2cb 100644
--- a/HomeScreen/src/layouthandler.cpp
+++ b/HomeScreen/src/layouthandler.cpp
@@ -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();
+ }
+}
+
diff --git a/HomeScreen/src/layouthandler.h b/HomeScreen/src/layouthandler.h
index 1ba270b..7487be5 100644
--- a/HomeScreen/src/layouthandler.h
+++ b/HomeScreen/src/layouthandler.h
@@ -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
diff --git a/HomeScreen/src/main.cpp b/HomeScreen/src/main.cpp
index f1f5a22..4d626d9 100644
--- a/HomeScreen/src/main.cpp
+++ b/HomeScreen/src/main.cpp
@@ -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__
diff --git a/HomeScreen/src/mainwindow.cpp b/HomeScreen/src/mainwindow.cpp
index f4891b3..e1a8371 100644
--- a/HomeScreen/src/mainwindow.cpp
+++ b/HomeScreen/src/mainwindow.cpp
@@ -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