aboutsummaryrefslogtreecommitdiffstats
path: root/HomeScreen/src
diff options
context:
space:
mode:
Diffstat (limited to 'HomeScreen/src')
-rw-r--r--HomeScreen/src/applauncher.cpp88
-rw-r--r--HomeScreen/src/applauncher.h (renamed from HomeScreen/src/applauncherwidget.h)21
-rw-r--r--HomeScreen/src/applauncherwidget.cpp148
-rw-r--r--HomeScreen/src/layouthandler.cpp82
-rw-r--r--HomeScreen/src/layouthandler.h2
-rw-r--r--HomeScreen/src/main.cpp40
-rw-r--r--HomeScreen/src/mainwindow.cpp20
-rw-r--r--HomeScreen/src/mainwindow.h4
8 files changed, 136 insertions, 269 deletions
diff --git a/HomeScreen/src/applauncher.cpp b/HomeScreen/src/applauncher.cpp
new file mode 100644
index 0000000..fd1ec94
--- /dev/null
+++ b/HomeScreen/src/applauncher.cpp
@@ -0,0 +1,88 @@
+/*
+ * 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 "applauncher.h"
+#include <include/daynightmode.hpp>
+#include <QSettings>
+#include <QApplication>
+#ifdef __i386__
+ #include <QProcess>
+#endif
+
+AppLauncher::AppLauncher(QObject *parent) :
+ QObject(parent),
+ m_appList(),
+ mp_dBusAppFrameworkProxy()
+{
+ /*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",
+ "/AppFramework",
+ QDBusConnection::sessionBus(),
+ 0);
+}
+
+AppLauncher::~AppLauncher()
+{
+ delete mp_dBusAppFrameworkProxy;
+}
+
+void AppLauncher::updateColorScheme()
+{
+ QSettings settings;
+ QSettings settings_cs(QApplication::applicationDirPath() +
+ "/colorschemes/" +
+ settings.value("systemsettings/colorscheme", "default").toString() +
+ "/" +
+ QString::number(settings.value("systemsettings/proximityobjectdetected", false).toBool()) +
+ "/" +
+ QString::number(settings.value("systemsettings/daynightmode", SystemDayNight::DAYNIGHTMODE_DAY).toInt()) +
+ ".ini",
+ QSettings::IniFormat);
+
+ //mp_ui->widget_background->setStyleSheet(settings_cs.value("AppLauncherWidget/widget_Background").toString());
+ //mp_ui->widget_homeIcon->setStyleSheet(settings_cs.value("AppLauncherWidget/widget_Home_Icon").toString());
+
+ //setStyleSheet(settings_cs.value("AppLauncherWidget/common_css").toString());
+}
+
+void AppLauncher::populateAppList()
+{
+ int i;
+
+ m_appList = mp_dBusAppFrameworkProxy->getAvailableApps();
+}
+
+void AppLauncher::on_tableView_clicked(int row, int col)
+{
+/* if (m_appList.size() > row * APP_LIST_COLUMN_COUNT + col)
+ {
+ 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
+ emit newRequestsToBeVisibleApp(pid);
+
+ emit showAppLayer();
+ }*/
+}
diff --git a/HomeScreen/src/applauncherwidget.h b/HomeScreen/src/applauncher.h
index d6bc615..a67c804 100644
--- a/HomeScreen/src/applauncherwidget.h
+++ b/HomeScreen/src/applauncher.h
@@ -14,26 +14,19 @@
* limitations under the License.
*/
-#ifndef APPLAUNCHERWIDGET_H
-#define APPLAUNCHERWIDGET_H
+#ifndef APPLAUNCHER_H
+#define APPLAUNCHER_H
-#include <QWidget>
-#include <QList>
-#include <QTableWidget>
#include <include/appframework.hpp>
#include <appframework_proxy.h>
-namespace Ui {
-class AppLauncherWidget;
-}
-
-class AppLauncherWidget : public QWidget
+class AppLauncher : public QObject
{
Q_OBJECT
public:
- explicit AppLauncherWidget(QWidget *parent = 0);
- ~AppLauncherWidget();
+ explicit AppLauncher(QObject *parent);
+ ~AppLauncher();
void populateAppList();
@@ -48,10 +41,8 @@ signals:
void showAppLayer();
private:
- Ui::AppLauncherWidget *mp_ui;
QList<AppInfo> m_appList;
- QTableWidget *mp_appTable;
org::agl::appframework *mp_dBusAppFrameworkProxy;
};
-#endif // APPLAUNCHERWIDGET_H
+#endif // APPLAUNCHER_H
diff --git a/HomeScreen/src/applauncherwidget.cpp b/HomeScreen/src/applauncherwidget.cpp
deleted file mode 100644
index 26b80a0..0000000
--- a/HomeScreen/src/applauncherwidget.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * 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 "applauncherwidget.h"
-#include "ui_applauncherwidget.h"
-#include <include/daynightmode.hpp>
-#include <QSettings>
-#ifdef __i386__
- #include <QProcess>
-#endif
-
-#define APP_LIST_COLUMN_COUNT 5
-
-AppLauncherWidget::AppLauncherWidget(QWidget *parent) :
- QWidget(parent),
- mp_ui(new Ui::AppLauncherWidget),
- m_appList(),
- mp_appTable(0),
- mp_dBusAppFrameworkProxy()
-{
- mp_ui->setupUi(this);
-
- /*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",
- "/AppFramework",
- QDBusConnection::sessionBus(),
- 0);
-}
-
-AppLauncherWidget::~AppLauncherWidget()
-{
- delete mp_dBusAppFrameworkProxy;
- if (0 != mp_appTable)
- {
- delete mp_appTable;
- }
- delete mp_ui;
-}
-
-void AppLauncherWidget::updateColorScheme()
-{
- QSettings settings;
- QSettings settings_cs(QApplication::applicationDirPath() +
- "/colorschemes/" +
- settings.value("systemsettings/colorscheme", "default").toString() +
- "/" +
- QString::number(settings.value("systemsettings/proximityobjectdetected", false).toBool()) +
- "/" +
- QString::number(settings.value("systemsettings/daynightmode", SystemDayNight::DAYNIGHTMODE_DAY).toInt()) +
- ".ini",
- QSettings::IniFormat);
-
- mp_ui->widget_background->setStyleSheet(settings_cs.value("AppLauncherWidget/widget_Background").toString());
- mp_ui->widget_homeIcon->setStyleSheet(settings_cs.value("AppLauncherWidget/widget_Home_Icon").toString());
-
- setStyleSheet(settings_cs.value("AppLauncherWidget/common_css").toString());
-}
-
-void AppLauncherWidget::populateAppList()
-{
- if (0 == mp_appTable)
- {
- mp_appTable = new QTableWidget(this);
- QObject::connect(mp_appTable, SIGNAL(cellClicked(int,int)), this, SLOT(on_tableView_clicked(int,int)));
- }
- else
- {
- mp_appTable->clear();
- }
-
- mp_appTable->setShowGrid(false);
- mp_appTable->setFrameShape(QFrame::NoFrame);
- mp_appTable->move(40, 40);
- mp_appTable->resize(1000, 1920 - 40 - 40 - 60 - 60);
- mp_appTable->horizontalHeader()->setVisible(false);
- mp_appTable->verticalHeader()->setVisible(false);
- mp_appTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- mp_appTable->setRowCount(100);
- mp_appTable->setColumnCount(APP_LIST_COLUMN_COUNT);
-
- int i;
-
- m_appList = mp_dBusAppFrameworkProxy->getAvailableApps();
-
- mp_appTable->setRowCount((m_appList.size() + (APP_LIST_COLUMN_COUNT - 1)) / APP_LIST_COLUMN_COUNT);
-
- if (m_appList.size() >= (9 * APP_LIST_COLUMN_COUNT))
- {
- mp_appTable->resize(1000, 1920 - 40 - 40 - 60 - 60);
- }
- else
- {
- mp_appTable->resize(1000, mp_appTable->rowCount() * 190);
- }
-
-
- /*for (i = 0; i < (mp_appTable->rowCount() * APP_LIST_COLUMN_COUNT); i++)
- {
- mp_appTable->verticalHeader()->resizeSection(i, 190);
- mp_appTable->horizontalHeader()->resizeSection(i, 190);
- }*/
-
- for (i = 0; i < m_appList.size(); i++)
- {
- mp_appTable->setItem(i / APP_LIST_COLUMN_COUNT,
- i % APP_LIST_COLUMN_COUNT,
- 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,
- i % APP_LIST_COLUMN_COUNT)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
- }
-}
-
-void AppLauncherWidget::on_tableView_clicked(int row, int col)
-{
- if (m_appList.size() > row * APP_LIST_COLUMN_COUNT + col)
- {
- 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
- emit newRequestsToBeVisibleApp(pid);
-
- emit showAppLayer();
- }
-}
diff --git a/HomeScreen/src/layouthandler.cpp b/HomeScreen/src/layouthandler.cpp
index 6aad54b..f8804b4 100644
--- a/HomeScreen/src/layouthandler.cpp
+++ b/HomeScreen/src/layouthandler.cpp
@@ -34,92 +34,40 @@ LayoutHandler::LayoutHandler(QObject *parent) :
"surfaceVisibilityChanged",
this,
SIGNAL(surfaceVisibilityChanged(int,bool)));
-}
-LayoutHandler::~LayoutHandler()
-{
- delete mp_dBusPopupProxy;
- delete mp_dBusWindowManagerProxy;
-}
-
-void LayoutHandler::setUpLayouts()
-{
- qDebug("setUpLayouts");
QList<LayoutArea> surfaceAreas;
LayoutArea surfaceArea;
const int SCREEN_WIDTH = 1080;
const int SCREEN_HEIGHT = 1920;
- 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;
+ const int TOPAREA_HEIGHT = 218;
+ const int TOPAREA_WIDTH = SCREEN_WIDTH;
+ const int TOPAREA_X = 0;
+ const int TOPAREA_Y = 0;
+ const int MEDIAAREA_HEIGHT = 215;
+ const int MEDIAAREA_WIDTH = SCREEN_WIDTH;
+ const int MEDIAAREA_X = 0;
+ const int MEDIAAREA_Y = SCREEN_HEIGHT - MEDIAAREA_HEIGHT;
// only one Layout for CES2017 needed
// layout 1:
// one app surface, statusbar, control bar
surfaceArea.x = 0;
- surfaceArea.y = STATUSBAR_HEIGHT;
+ surfaceArea.y = TOPAREA_HEIGHT;
surfaceArea.width = SCREEN_WIDTH;
- surfaceArea.height = SCREEN_HEIGHT - STATUSBAR_HEIGHT - CONTROLBAR_HEIGHT;
+ surfaceArea.height = SCREEN_HEIGHT - TOPAREA_HEIGHT - MEDIAAREA_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 = SCREEN_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);*/
+LayoutHandler::~LayoutHandler()
+{
+ delete mp_dBusPopupProxy;
+ delete mp_dBusWindowManagerProxy;
}
void LayoutHandler::showAppLayer()
diff --git a/HomeScreen/src/layouthandler.h b/HomeScreen/src/layouthandler.h
index 54290ac..9ca0a9f 100644
--- a/HomeScreen/src/layouthandler.h
+++ b/HomeScreen/src/layouthandler.h
@@ -12,8 +12,6 @@ public:
explicit LayoutHandler(QObject *parent = 0);
~LayoutHandler();
- void setUpLayouts();
-
signals:
public slots:
diff --git a/HomeScreen/src/main.cpp b/HomeScreen/src/main.cpp
index a896c2e..99f98c9 100644
--- a/HomeScreen/src/main.cpp
+++ b/HomeScreen/src/main.cpp
@@ -16,20 +16,17 @@
#include "mainwindow.h"
#include <QApplication>
-#include <QSysInfo>
-//#include <QSharedMemory>
+#include <QtGui/QGuiApplication>
+#include <QtQml/QQmlApplicationEngine>
+#include <QtQml/qqml.h>
+
+#include "../src2/applicationlauncher.h"
+#include "../src2/statusbarmodel.h"
+#include "layouthandler.h"
+
int main(int argc, char *argv[])
{
- // allow only one instance of this application
- /*QSharedMemory appInstance;
- appInstance.setKey("HomeScreen");
- if (!appInstance.create(1))
- {
- qDebug("Only one instance of the Home Screen App allowed!");
- exit(-1);
- }*/
-
QApplication a(argc, argv);
// used for application settings (QSettings)
@@ -43,20 +40,13 @@ int main(int argc, char *argv[])
qDBusRegisterMetaType<AppInfo>();
qDBusRegisterMetaType<QList<AppInfo> >();
- MainWindow w;
- w.show();
-#ifdef HAVE_IVI_LAYERMANAGEMENT_API
- // the WindowManager positions the surface correctly
-#else
- w.move(0, 0);
-#endif
-
-#ifdef __arm__
- qDebug("Running on ARM architecture");
-#endif
-#ifdef __i386__
- qDebug("Running on x86 architecture");
-#endif
+ qmlRegisterType<ApplicationLauncher>("HomeScreen", 1, 0, "ApplicationLauncher");
+ qmlRegisterType<StatusBarModel>("HomeScreen", 1, 0, "StatusBarModel");
+ qmlRegisterType<LayoutHandler>("HomeScreen", 1, 0, "LayoutHandler");
+
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return a.exec();
}
diff --git a/HomeScreen/src/mainwindow.cpp b/HomeScreen/src/mainwindow.cpp
index 82336ca..0bf4b5c 100644
--- a/HomeScreen/src/mainwindow.cpp
+++ b/HomeScreen/src/mainwindow.cpp
@@ -24,7 +24,7 @@ MainWindow::MainWindow(QWidget *parent) :
mp_statusBarWidget(0),
mp_controlBarWidget(0),
mp_settingsWidget(0),
- mp_applauncherwidget(0),
+ //mp_applauncherwidget(0),
mp_popupWidget(0),
mp_layoutHandler(new LayoutHandler()),
mp_dBusDayNightModeProxy(0),
@@ -66,10 +66,10 @@ MainWindow::MainWindow(QWidget *parent) :
mp_settingsWidget->move(0, 60);
//mp_settingsWidget->hide();
- mp_applauncherwidget = new AppLauncherWidget(this);
+ /*mp_applauncherwidget = new AppLauncherWidget(this);
mp_applauncherwidget->raise();
// apply layout
- mp_applauncherwidget->move(0, 60);
+ mp_applauncherwidget->move(0, 60);*/
mp_popupWidget = new PopupWidget();
@@ -85,11 +85,11 @@ MainWindow::MainWindow(QWidget *parent) :
QObject::connect(mp_settingsWidget, SIGNAL(colorSchemeChanged()), mp_popupWidget, SLOT(updateColorScheme()));
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(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()));
+ //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
@@ -98,8 +98,8 @@ 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->setUpLayouts();
+ // mp_applauncherwidget->populateAppList();
+ //mp_layoutHandler->setUpLayouts();
mp_homeScreenControlInterface = new HomeScreenControlInterface(this);
QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestGetAllSurfacesOfProcess(int)), mp_layoutHandler, SLOT(requestGetAllSurfacesOfProcess(int)));
@@ -121,7 +121,7 @@ MainWindow::~MainWindow()
delete mp_layoutHandler;
delete mp_popupWidget;
- delete mp_applauncherwidget;
+ //delete mp_applauncherwidget;
delete mp_settingsWidget;
delete mp_controlBarWidget;
delete mp_statusBarWidget;
@@ -170,7 +170,7 @@ void MainWindow::updateColorScheme()
mp_statusBarWidget->updateColorScheme();
mp_controlBarWidget->updateColorScheme();
mp_settingsWidget->updateColorScheme();
- mp_applauncherwidget->updateColorScheme();
+ //mp_applauncherwidget->updateColorScheme();
mp_popupWidget->updateColorScheme();
}
diff --git a/HomeScreen/src/mainwindow.h b/HomeScreen/src/mainwindow.h
index 28471a0..0747e46 100644
--- a/HomeScreen/src/mainwindow.h
+++ b/HomeScreen/src/mainwindow.h
@@ -26,7 +26,7 @@
#include "statusbarwidget.h"
#include "controlbarwidget.h"
#include "settingswidget.h"
-#include "applauncherwidget.h"
+//#include "applauncher.h"
#include "popupwidget.h"
#include "layouthandler.h"
@@ -68,7 +68,7 @@ private:
ControlBarWidget *mp_controlBarWidget;
org::agl::daynightmode *mp_dBusDayNightMode_ControlBarWidget;
SettingsWidget *mp_settingsWidget;
- AppLauncherWidget *mp_applauncherwidget;
+ //AppLauncherWidget *mp_applauncherwidget;
PopupWidget *mp_popupWidget;
LayoutHandler *mp_layoutHandler;