aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBocklage, Jens <Jens_Bocklage@mentor.com>2016-10-26 15:53:34 +0200
committerBocklage, Jens <Jens_Bocklage@mentor.com>2016-10-26 15:53:34 +0200
commitd19555c038f6f1f89f08f12c88908d84b32b1bbf (patch)
tree548d19680235aa91bc7a4948d78553e8f4a5c27b
parent4e34fd88f65f8c1cd094ed24bd62d2c7f5418080 (diff)
Implement toggle full screen mechanism.
Signed-off-by: Bocklage, Jens <Jens_Bocklage@mentor.com>
-rw-r--r--HomeScreen/src/homescreencontrolinterface.cpp5
-rw-r--r--HomeScreen/src/homescreencontrolinterface.h3
-rw-r--r--HomeScreen/src/layouthandler.cpp60
-rw-r--r--HomeScreen/src/layouthandler.h1
-rw-r--r--HomeScreen/src/mainwindow.cpp1
-rw-r--r--HomeScreenSimulator/resources/mainwindow.ui20
-rw-r--r--HomeScreenSimulator/src/mainwindow.cpp14
-rw-r--r--HomeScreenSimulator/src/mainwindow.h4
-rw-r--r--WindowManager/src/windowmanager.cpp25
-rw-r--r--WindowManager/src/windowmanager.hpp6
-rw-r--r--interfaces/homescreen.xml3
-rw-r--r--interfaces/windowmanager.xml12
12 files changed, 138 insertions, 16 deletions
diff --git a/HomeScreen/src/homescreencontrolinterface.cpp b/HomeScreen/src/homescreencontrolinterface.cpp
index 45c3cbd..057e742 100644
--- a/HomeScreen/src/homescreencontrolinterface.cpp
+++ b/HomeScreen/src/homescreencontrolinterface.cpp
@@ -42,7 +42,8 @@ void HomeScreenControlInterface::hardKeyPressed(int key)
}
}
-void HomeScreenControlInterface::setToFullscreen(int pid)
+void HomeScreenControlInterface::toggleFullScreen()
{
- qDebug("setToFullscreen %d", pid);
+ qDebug("toggleFullScreen");
+ newRequestsToggleFullscreen();
}
diff --git a/HomeScreen/src/homescreencontrolinterface.h b/HomeScreen/src/homescreencontrolinterface.h
index e406686..e341758 100644
--- a/HomeScreen/src/homescreencontrolinterface.h
+++ b/HomeScreen/src/homescreencontrolinterface.h
@@ -18,11 +18,12 @@ signals:
signals:
void newRequestsToBeVisibleApp(int pid);
+ void newRequestsToggleFullscreen();
//from homescreen_adapter.h
public Q_SLOTS: // METHODS
void hardKeyPressed(int key);
- void setToFullscreen(int pid);
+ void toggleFullScreen();
private:
HomescreenAdaptor *mp_homeScreenAdaptor;
diff --git a/HomeScreen/src/layouthandler.cpp b/HomeScreen/src/layouthandler.cpp
index cb21018..81bc106 100644
--- a/HomeScreen/src/layouthandler.cpp
+++ b/HomeScreen/src/layouthandler.cpp
@@ -36,6 +36,8 @@ void LayoutHandler::setUpLayouts()
qDebug("setUpLayouts");
QList<SimpleRect> surfaceAreas;
SimpleRect surfaceArea;
+ bool isFullScreen;
+ int associatedFullScreenLayout;
const int SCREEN_WIDTH = 1080;
const int SCREEN_HEIGHT = 1920;
@@ -59,7 +61,10 @@ void LayoutHandler::setUpLayouts()
surfaceAreas.append(surfaceArea);
- mp_dBusWindowManagerProxy->addLayout(1, "one app", surfaceAreas);
+ isFullScreen = false;
+ associatedFullScreenLayout = 4;
+
+ mp_dBusWindowManagerProxy->addLayout(1, "one app", isFullScreen, associatedFullScreenLayout, surfaceAreas);
surfaceAreas.clear();
@@ -83,7 +88,10 @@ void LayoutHandler::setUpLayouts()
surfaceAreas.append(surfaceArea);
- mp_dBusWindowManagerProxy->addLayout(2, "top on bottom", surfaceAreas);
+ isFullScreen = false;
+ associatedFullScreenLayout = -1;
+
+ mp_dBusWindowManagerProxy->addLayout(2, "top on bottom", isFullScreen, associatedFullScreenLayout, surfaceAreas);
surfaceAreas.clear();
@@ -107,7 +115,30 @@ void LayoutHandler::setUpLayouts()
surfaceAreas.append(surfaceArea);
- mp_dBusWindowManagerProxy->addLayout(3, "side by side", surfaceAreas);
+ isFullScreen = false;
+ associatedFullScreenLayout = -1;
+
+ mp_dBusWindowManagerProxy->addLayout(3, "side by side", isFullScreen, associatedFullScreenLayout, surfaceAreas);
+
+
+ surfaceAreas.clear();
+
+ // layout 4:
+ // one app surface full screen, no statusbar, no control bar
+ surfaceArea.x = 0;
+ surfaceArea.y = 0;
+ surfaceArea.width = SCREEN_WIDTH;
+ surfaceArea.height = SCREEN_HEIGHT;
+
+ surfaceAreas.append(surfaceArea);
+
+ isFullScreen = true;
+ associatedFullScreenLayout = 1;
+
+ mp_dBusWindowManagerProxy->addLayout(4, "one app full screen", isFullScreen, associatedFullScreenLayout, surfaceAreas);
+
+
+ surfaceAreas.clear();
}
@@ -136,7 +167,7 @@ void LayoutHandler::makeMeVisible(int pid)
for (int i = 0; i < m_visibleApps.size(); ++i)
{
- mp_dBusWindowManagerProxy->setPidToLayoutArea(i, i);
+ mp_dBusWindowManagerProxy->setPidToLayoutArea(m_visibleApps.at(i), i);
}
}
if (1 == availableLayouts.size())
@@ -149,7 +180,7 @@ void LayoutHandler::makeMeVisible(int pid)
mp_dBusWindowManagerProxy->setLayoutById(availableLayouts.at(0));
for (int i = 0; i < m_visibleApps.size(); ++i)
{
- mp_dBusWindowManagerProxy->setPidToLayoutArea(i, i);
+ mp_dBusWindowManagerProxy->setPidToLayoutArea(m_visibleApps.at(i), i);
}
}
if (1 < availableLayouts.size())
@@ -168,6 +199,25 @@ void LayoutHandler::makeMeVisible(int pid)
}
}
+void LayoutHandler::toggleFullscreen()
+{
+ qDebug("toggleFullscreen");
+ int currentLayout = mp_dBusWindowManagerProxy->getLayout();
+ int associatedFullScreenLayout = mp_dBusWindowManagerProxy->getAssociatedFullScreenLayout(currentLayout);
+ if (-1 != associatedFullScreenLayout)
+ {
+ mp_dBusWindowManagerProxy->setLayoutById(associatedFullScreenLayout);
+ for (int i = 0; i < m_visibleApps.size(); ++i)
+ {
+ mp_dBusWindowManagerProxy->setPidToLayoutArea(m_visibleApps.at(i), i);
+ }
+ }
+ else
+ {
+ qDebug("no associatedFullScreenLayout. Cannot switch to full screen.");
+ }
+}
+
void LayoutHandler::setLayoutByName(QString layoutName)
{
// switch to new layout
diff --git a/HomeScreen/src/layouthandler.h b/HomeScreen/src/layouthandler.h
index cc5b59b..c9ca1bf 100644
--- a/HomeScreen/src/layouthandler.h
+++ b/HomeScreen/src/layouthandler.h
@@ -18,6 +18,7 @@ signals:
public slots:
void makeMeVisible(int pid);
+ void toggleFullscreen();
void setLayoutByName(QString layoutName);
private:
diff --git a/HomeScreen/src/mainwindow.cpp b/HomeScreen/src/mainwindow.cpp
index 31ba8d0..c15cca5 100644
--- a/HomeScreen/src/mainwindow.cpp
+++ b/HomeScreen/src/mainwindow.cpp
@@ -100,6 +100,7 @@ MainWindow::MainWindow(QWidget *parent) :
mp_homeScreenControlInterface = new HomeScreenControlInterface(this);
QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestsToBeVisibleApp(int)), mp_layoutHandler, SLOT(makeMeVisible(int)));
+ QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestsToggleFullscreen()), mp_layoutHandler, SLOT(toggleFullscreen()));
QObject::connect(mp_popupWidget, SIGNAL(comboBoxResult(QString)), mp_layoutHandler, SLOT(setLayoutByName(QString)));
}
diff --git a/HomeScreenSimulator/resources/mainwindow.ui b/HomeScreenSimulator/resources/mainwindow.ui
index 6c6e7d0..dcdf2e7 100644
--- a/HomeScreenSimulator/resources/mainwindow.ui
+++ b/HomeScreenSimulator/resources/mainwindow.ui
@@ -39,7 +39,7 @@
<widget class="QPushButton" name="pushButton_Update">
<property name="geometry">
<rect>
- <x>20</x>
+ <x>30</x>
<y>380</y>
<width>211</width>
<height>27</height>
@@ -214,6 +214,24 @@
</property>
</widget>
</widget>
+ <widget class="QWidget" name="tab_FullScreen">
+ <attribute name="title">
+ <string>FullScreen</string>
+ </attribute>
+ <widget class="QPushButton" name="pushButton_ToggleFullScreen">
+ <property name="geometry">
+ <rect>
+ <x>80</x>
+ <y>50</y>
+ <width>161</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Toggle full screen</string>
+ </property>
+ </widget>
+ </widget>
<widget class="QWidget" name="tab_FutureFeatures">
<attribute name="title">
<string>Future features</string>
diff --git a/HomeScreenSimulator/src/mainwindow.cpp b/HomeScreenSimulator/src/mainwindow.cpp
index 743c854..272adfc 100644
--- a/HomeScreenSimulator/src/mainwindow.cpp
+++ b/HomeScreenSimulator/src/mainwindow.cpp
@@ -23,7 +23,8 @@ MainWindow::MainWindow(QWidget *parent) :
mp_dBusDayNightModeAdapter(0),
mp_dBusStatusBarProxy(0),
mp_dBusPopupProxy(0),
- mp_dBusProximityProxy(0)
+ mp_dBusProximityProxy(0),
+ mp_dBusHomeScreenProxy(0)
{
mp_ui->setupUi(this);
@@ -48,6 +49,11 @@ MainWindow::MainWindow(QWidget *parent) :
"/Proximity",
QDBusConnection::sessionBus(),
0);
+ mp_dBusHomeScreenProxy = new org::agl::homescreen("org.agl.homescreen",
+ "/HomeScreen",
+ QDBusConnection::sessionBus(),
+ 0);
+
QSettings settings;
this->move(settings.value("homescreensimulator/pos").toPoint());
mp_ui->radioButton_DayMode->setChecked(settings.value("homescreensimulator/daymode", true).toBool()); // if nothing is stored, use "true"
@@ -61,6 +67,7 @@ MainWindow::~MainWindow()
settings.setValue("homescreensimulator/daymode", mp_ui->radioButton_DayMode->isChecked());
settings.setValue("homescreensimulator/nightmode", mp_ui->radioButton_NightMode->isChecked());
+ delete mp_dBusHomeScreenProxy;
delete mp_dBusProximityProxy;
delete mp_dBusPopupProxy;
delete mp_dBusStatusBarProxy;
@@ -170,3 +177,8 @@ void MainWindow::on_checkBox_ObjectDetected_clicked()
{
mp_dBusProximityProxy->setObjectDetected(Qt::Checked == mp_ui->checkBox_ObjectDetected->checkState());
}
+
+void MainWindow::on_pushButton_ToggleFullScreen_clicked()
+{
+ mp_dBusHomeScreenProxy->toggleFullScreen();
+}
diff --git a/HomeScreenSimulator/src/mainwindow.h b/HomeScreenSimulator/src/mainwindow.h
index 702a338..ca368f0 100644
--- a/HomeScreenSimulator/src/mainwindow.h
+++ b/HomeScreenSimulator/src/mainwindow.h
@@ -24,6 +24,7 @@
#include "statusbar_proxy.h"
#include "popup_proxy.h"
#include "proximity_proxy.h"
+#include "homescreen_proxy.h"
namespace Ui {
class MainWindow;
@@ -62,12 +63,15 @@ private slots:
void on_checkBox_ObjectDetected_clicked();
+ void on_pushButton_ToggleFullScreen_clicked();
+
private:
Ui::MainWindow *mp_ui;
DaynightmodeAdaptor *mp_dBusDayNightModeAdapter;
org::agl::statusbar *mp_dBusStatusBarProxy;
org::agl::popup *mp_dBusPopupProxy;
org::agl::proximity *mp_dBusProximityProxy;
+ org::agl::homescreen *mp_dBusHomeScreenProxy;
};
#endif // MAINWINDOW_H
diff --git a/WindowManager/src/windowmanager.cpp b/WindowManager/src/windowmanager.cpp
index dea17a1..ce59fa0 100644
--- a/WindowManager/src/windowmanager.cpp
+++ b/WindowManager/src/windowmanager.cpp
@@ -29,6 +29,8 @@ WindowManager::WindowManager(QObject *parent) :
QObject(parent),
m_layouts(),
m_layoutNames(),
+ m_layoutFullScreen(),
+ m_layoutFullScreenAssociated(),
m_currentLayout(-1),
m_homeScreenPid(-1),
#ifdef __arm__
@@ -369,18 +371,31 @@ void WindowManager::surfaceCallbackFunction_static(t_ilm_surface surface,
}
#endif
-int WindowManager::addLayout(int layoutId, const QString &layoutName, const QList<SimpleRect> &surfaceAreas)
+int WindowManager::addLayout(int layoutId, const QString &layoutName, bool isFullScreen, int associatedFullScreenLayout, const QList<SimpleRect> &surfaceAreas)
{
qDebug("-=[addLayout]=-");
m_layouts.insert(layoutId, surfaceAreas);
m_layoutNames.insert(layoutId, layoutName);
- qDebug("addLayout %d %s, size %d", layoutId, layoutName.toStdString().c_str(), surfaceAreas.size());
+ m_layoutFullScreen.insert(layoutId, isFullScreen);
+ m_layoutFullScreenAssociated.insert(layoutId, associatedFullScreenLayout);
+ qDebug("addLayout %d %s %s, %d, size %d",
+ layoutId,
+ layoutName.toStdString().c_str(),
+ isFullScreen ? "true" : "false",
+ associatedFullScreenLayout,
+ surfaceAreas.size());
dumpScene();
return true;
}
+int WindowManager::getAssociatedFullScreenLayout(int layoutId)
+{
+ qDebug("-=[getAssociatedFullScreenLayout]=-");
+ return m_layoutFullScreenAssociated.find(layoutId).value();
+}
+
QList<int> WindowManager::getAvailableLayouts(int numberOfAppSurfaces)
{
qDebug("-=[getAvailableLayouts]=-");
@@ -431,6 +446,12 @@ QString WindowManager::getLayoutName(int layoutId)
return m_layoutNames.find(layoutId).value();
}
+bool WindowManager::isLayoutFullScreen(int layoutId)
+{
+ qDebug("-=[isLayoutFullScreen]=-");
+ return m_layoutFullScreen.find(layoutId).value();
+}
+
void WindowManager::setLayoutById(int layoutId)
{
qDebug("-=[setLayoutById]=-");
diff --git a/WindowManager/src/windowmanager.hpp b/WindowManager/src/windowmanager.hpp
index 2a76a32..ef19f4e 100644
--- a/WindowManager/src/windowmanager.hpp
+++ b/WindowManager/src/windowmanager.hpp
@@ -49,6 +49,8 @@ private:
WindowmanagerAdaptor *mp_windowManagerAdaptor;
QMap<int, QList<SimpleRect> > m_layouts;
QMap<int, QString> m_layoutNames;
+ QMap<int, bool> m_layoutFullScreen;
+ QMap<int, int> m_layoutFullScreenAssociated;
int m_currentLayout;
void dumpScene();
int m_homeScreenPid;
@@ -95,11 +97,13 @@ public slots:
// from windowmanager_adapter.h
public Q_SLOTS: // METHODS
- int addLayout(int layoutId, const QString &layoutName, const QList<SimpleRect> &surfaceAreas);
+ int addLayout(int layoutId, const QString &layoutName, bool isFullScreen, int associatedFullScreenLayout, const QList<SimpleRect> &surfaceAreas);
+ int getAssociatedFullScreenLayout(int layoutId);
QList<int> getAvailableLayouts(int numberOfAppSurfaces);
QList<SimplePoint> getAvailableSurfaces();
int getLayout();
QString getLayoutName(int layoutId);
+ bool isLayoutFullScreen(int layoutId);
void setLayoutById(int layoutId);
void setLayoutByName(const QString &layoutName);
void setPidToLayoutArea(int pid, int layoutAreaId);
diff --git a/interfaces/homescreen.xml b/interfaces/homescreen.xml
index 3eb66d0..1a9d7f9 100644
--- a/interfaces/homescreen.xml
+++ b/interfaces/homescreen.xml
@@ -17,8 +17,7 @@
<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 name="toggleFullScreen">
</method>
</interface>
</node>
diff --git a/interfaces/windowmanager.xml b/interfaces/windowmanager.xml
index c86c8e7..5aac541 100644
--- a/interfaces/windowmanager.xml
+++ b/interfaces/windowmanager.xml
@@ -17,8 +17,10 @@
<method name="addLayout">
<arg name="layoutId" type="i" direction="in"/>
<arg name="layoutName" type="s" direction="in"/>
+ <arg name="isFullScreen" type="b" direction="in"/>
+ <arg name="associatedFullScreenLayout" type="i" direction="in"/>
<arg name="surfaceAreas" type="a(iiii)" direction="in"/>
- <annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QList&lt;SimpleRect&gt;"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In4" value="QList&lt;SimpleRect&gt;"/>
<arg name="error" type="i" direction="out"/>
</method>
<method name="getAvailableLayouts">
@@ -26,6 +28,14 @@
<arg name="layoutIds" type="ai" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;int&gt;"/>
</method>
+ <method name="isLayoutFullScreen">
+ <arg name="layoutId" type="i" direction="in"/>
+ <arg name="fullScreen" type="b" direction="out"/>
+ </method>
+ <method name="getAssociatedFullScreenLayout">
+ <arg name="layoutId" type="i" direction="in"/>
+ <arg name="associatedFullScreenLayout" type="i" direction="out"/>
+ </method>
<method name="setLayoutById">
<arg name="layoutId" type="i" direction="in"/>
</method>