Apps: Use the Probability app in the launcher

Change-Id: I07cc48db08eb3682e3173399e99d059423b527a6
This commit is contained in:
Romain Goyet
2016-08-19 16:56:44 +02:00
parent 4dea239ab8
commit 223ac2607c
2 changed files with 20 additions and 10 deletions

View File

@@ -1,19 +1,18 @@
#include "apps_container.h"
AppsContainer::AppsContainer() :
Container()
Container(),
m_activeAppIndex(0)
{
}
bool AppsContainer::handleEvent(ion_event_t event) {
if (event == F1) {
#if USE_PIC_VIEW_APP
if (activeApp() == &m_picViewApp) {
Container::switchTo(&m_graphApp);
} else {
Container::switchTo(&m_picViewApp);
m_activeAppIndex++;
if (m_activeAppIndex >= (int)(AppId::Count)) {
m_activeAppIndex = 0;
}
#endif
switchTo((AppId)m_activeAppIndex);
return true;
}
return false;
@@ -25,9 +24,10 @@ void AppsContainer::switchTo(AppId appId) {
App * AppsContainer::appWithId(AppId appId) {
App * apps[] = {
&m_graphApp
&m_graphApp,
&m_probabilityApp,
#if USE_PIC_VIEW_APP
, &m_picViewApp
&m_picViewApp,
#endif
};
return apps[(int)appId];

View File

@@ -2,6 +2,8 @@
#define APPS_CONTAINER_H
#include "graph/graph_app.h"
#include "probability/app.h"
#define USE_PIC_VIEW_APP 0
#if USE_PIC_VIEW_APP
#include "picview/picview_app.h"
@@ -12,13 +14,21 @@ public:
AppsContainer();
enum class AppId {
Graph = 0,
PicView = 1
Probability = 1,
#if USE_PIC_VIEW_APP
PicView = 2,
Count = 3
#else
Count = 2
#endif
};
void switchTo(AppId appId);
bool handleEvent(ion_event_t event) override;
private:
App * appWithId(AppId appId);
int m_activeAppIndex;
GraphApp m_graphApp;
Probability::App m_probabilityApp;
#if USE_PIC_VIEW_APP
PicViewApp m_picViewApp;
#endif