diff options
Diffstat (limited to 'HomeScreen/src')
-rw-r--r-- | HomeScreen/src/applauncher.cpp | 88 | ||||
-rw-r--r-- | HomeScreen/src/applauncher.h | 48 | ||||
-rw-r--r-- | HomeScreen/src/controlbarwidget.cpp | 90 | ||||
-rw-r--r-- | HomeScreen/src/controlbarwidget.h | 54 | ||||
-rw-r--r-- | HomeScreen/src/main.cpp | 12 | ||||
-rw-r--r-- | HomeScreen/src/statusbarwidget.cpp | 151 | ||||
-rw-r--r-- | HomeScreen/src/statusbarwidget.h | 53 |
7 files changed, 5 insertions, 491 deletions
diff --git a/HomeScreen/src/applauncher.cpp b/HomeScreen/src/applauncher.cpp deleted file mode 100644 index fd1ec94..0000000 --- a/HomeScreen/src/applauncher.cpp +++ /dev/null @@ -1,88 +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 "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/applauncher.h b/HomeScreen/src/applauncher.h deleted file mode 100644 index a67c804..0000000 --- a/HomeScreen/src/applauncher.h +++ /dev/null @@ -1,48 +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. - */ - -#ifndef APPLAUNCHER_H -#define APPLAUNCHER_H - -#include <include/appframework.hpp> -#include <appframework_proxy.h> - -class AppLauncher : public QObject -{ - Q_OBJECT - -public: - explicit AppLauncher(QObject *parent); - ~AppLauncher(); - - void populateAppList(); - -public slots: - void updateColorScheme(); - -private slots: - void on_tableView_clicked(int row, int col); - -signals: - void newRequestsToBeVisibleApp(int pid); - void showAppLayer(); - -private: - QList<AppInfo> m_appList; - org::agl::appframework *mp_dBusAppFrameworkProxy; -}; - -#endif // APPLAUNCHER_H diff --git a/HomeScreen/src/controlbarwidget.cpp b/HomeScreen/src/controlbarwidget.cpp deleted file mode 100644 index 0f4aca7..0000000 --- a/HomeScreen/src/controlbarwidget.cpp +++ /dev/null @@ -1,90 +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 "controlbarwidget.h" -#include "ui_controlbarwidget.h" -#include <include/daynightmode.hpp> -#include <include/inputevent.hpp> -#include <QSettings> - -ControlBarWidget::ControlBarWidget(QWidget *parent) : - QWidget(parent), - mp_ui(new Ui::ControlBarWidget), - mp_dBusInputEventProxy() -{ - mp_ui->setupUi(this); - - qDebug("D-Bus: connect to org.agl.homescreenappframeworkbindertizen /AppFramework"); - mp_dBusInputEventProxy = new org::agl::inputevent("org.agl.inputeventmanager", - "/InputEvent", - QDBusConnection::sessionBus(), - 0); -} - -ControlBarWidget::~ControlBarWidget() -{ - delete mp_dBusInputEventProxy; - delete mp_ui; -} - -void ControlBarWidget::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); - - QIcon icon; - mp_ui->widget_background->setStyleSheet(settings_cs.value(QString("ControlBarWidget/widget_background_css")).toString()); - - icon.addFile(settings_cs.value(QString("ControlBarWidget/pushButton_homeIcon_icon")).toString(), QSize(), QIcon::Normal, QIcon::Off); - mp_ui->pushButton_home->setIcon(icon); - mp_ui->pushButton_home->setStyleSheet(settings_cs.value(QString("ControlBarWidget/pushButton_homeIcon_css")).toString()); - icon.addFile(settings_cs.value(QString("ControlBarWidget/pushButton_settingsIcon_icon")).toString(), QSize(), QIcon::Normal, QIcon::Off); - mp_ui->pushButton_settings->setIcon(icon); - mp_ui->pushButton_settings->setStyleSheet(settings_cs.value(QString("ControlBarWidget/pushButton_settingsIcon_css")).toString()); - icon.addFile(settings_cs.value(QString("ControlBarWidget/pushButton_navIcon_icon")).toString(), QSize(), QIcon::Normal, QIcon::Off); - mp_ui->pushButton_nav->setIcon(icon); - mp_ui->pushButton_nav->setStyleSheet(settings_cs.value(QString("ControlBarWidget/pushButton_navIcon_css")).toString()); -} - -void ControlBarWidget::on_pushButton_home_clicked() -{ - emit hideAppLayer(); - emit homeButtonPressed(); -} - -void ControlBarWidget::on_pushButton_settings_clicked() -{ - emit hideAppLayer(); - emit settingsButtonPressed(); -} - -void ControlBarWidget::on_pushButton_nav_clicked() -{ - mp_dBusInputEventProxy->hardKeyPressed(InputEvent::HARDKEY_NAV); -} - -void ControlBarWidget::on_pushButton_media_clicked() -{ - mp_dBusInputEventProxy->hardKeyPressed(InputEvent::HARDKEY_MEDIA); -} diff --git a/HomeScreen/src/controlbarwidget.h b/HomeScreen/src/controlbarwidget.h deleted file mode 100644 index 74067f8..0000000 --- a/HomeScreen/src/controlbarwidget.h +++ /dev/null @@ -1,54 +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. - */ - -#ifndef CONTROLBARWIDGET_H -#define CONTROLBARWIDGET_H - -#include <QWidget> -#include "inputevent_proxy.h" - -namespace Ui { -class ControlBarWidget; -} - -class ControlBarWidget : public QWidget -{ - Q_OBJECT - -public: - explicit ControlBarWidget(QWidget *parent = 0); - ~ControlBarWidget(); -public slots: - void updateColorScheme(); -signals: - void hideAppLayer(); - - void settingsButtonPressed(); - void homeButtonPressed(); - -private slots: - void on_pushButton_home_clicked(); - void on_pushButton_settings_clicked(); - void on_pushButton_nav_clicked(); - - void on_pushButton_media_clicked(); - -private: - Ui::ControlBarWidget *mp_ui; - org::agl::inputevent *mp_dBusInputEventProxy; -}; - -#endif // CONTROLBARWIDGET_H diff --git a/HomeScreen/src/main.cpp b/HomeScreen/src/main.cpp index c1f951e..dcad4c6 100644 --- a/HomeScreen/src/main.cpp +++ b/HomeScreen/src/main.cpp @@ -14,28 +14,27 @@ * limitations under the License. */ -#include "mainwindow.h" -#include <QApplication> +#include <QGuiApplication> #include <QtGui/QGuiApplication> #include <QtQml/QQmlApplicationEngine> #include <QtQml/QQmlContext> #include <QtQml/qqml.h> +#include "layouthandler.h" +#include "homescreencontrolinterface.h" #include "../src2/applicationlauncher.h" #include "../src2/statusbarmodel.h" -#include "layouthandler.h" #include "../src2/applicationmodel.h" -#include "homescreencontrolinterface.h" int main(int argc, char *argv[]) { - QApplication a(argc, argv); + QGuiApplication a(argc, argv); // used for application settings (QSettings) QCoreApplication::setOrganizationDomain("LinuxFoundation"); QCoreApplication::setOrganizationName("AutomotiveGradeLinux"); QCoreApplication::setApplicationName("HomeScreen"); - QCoreApplication::setApplicationVersion("0.6.0"); + QCoreApplication::setApplicationVersion("0.7.0"); qDebug("%s, v%s", QCoreApplication::applicationName().toStdString().c_str(), QCoreApplication::applicationVersion().toStdString().c_str()); @@ -51,7 +50,6 @@ int main(int argc, char *argv[]) LayoutHandler* layoutHandler = new LayoutHandler(); HomeScreenControlInterface* hsci = new HomeScreenControlInterface(); - // QObject::connect(hsci, SIGNAL(newRequestGetAllSurfacesOfProcess(int)), layoutHandler, SLOT(requestGetAllSurfacesOfProcess(int))); QObject::connect(hsci, SIGNAL(newRequestGetSurfaceStatus(int)), layoutHandler, SLOT(requestGetSurfaceStatus(int))); QObject::connect(hsci, SIGNAL(newRequestsToBeVisibleApp(int)), layoutHandler, SLOT(makeMeVisible(int))); QObject::connect(hsci, SIGNAL(newRequestRenderSurfaceToArea(int, int)), layoutHandler, SLOT(requestRenderSurfaceToArea(int,int))); diff --git a/HomeScreen/src/statusbarwidget.cpp b/HomeScreen/src/statusbarwidget.cpp deleted file mode 100644 index 6097f8d..0000000 --- a/HomeScreen/src/statusbarwidget.cpp +++ /dev/null @@ -1,151 +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 "statusbarwidget.h" -#include "ui_statusbarwidget.h" -#include <include/daynightmode.hpp> - -StatusBarWidget::StatusBarWidget(QWidget *parent) : - QWidget(parent), - mp_ui(new Ui::StatusBarWidget), - mp_statusbarAdaptor(0), - mp_statusbarIconURIs(new QMap<int, QString>) -{ - // publish statusbar interface - mp_statusbarAdaptor = new StatusbarAdaptor((QObject*)this); - - QDBusConnection dbus = QDBusConnection::sessionBus(); - dbus.registerObject("/StatusBar", this); - dbus.registerService("org.agl.homescreen"); - - mp_ui->setupUi(this); -} - -StatusBarWidget::~StatusBarWidget() -{ - delete mp_statusbarAdaptor; - delete mp_ui; -} - -void StatusBarWidget::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(QString("StatusBarWidget/widget_background_css")).toString()); - mp_ui->label_1->setStyleSheet(settings_cs.value(QString("StatusBarWidget/label_1_css")).toString()); - mp_ui->label_2->setStyleSheet(settings_cs.value(QString("StatusBarWidget/label_2_css")).toString()); - mp_ui->label_3->setStyleSheet(settings_cs.value(QString("StatusBarWidget/label_3_css")).toString()); - mp_ui->label_4->setStyleSheet(settings_cs.value(QString("StatusBarWidget/label_4_css")).toString()); - mp_ui->label_5->setStyleSheet(settings_cs.value(QString("StatusBarWidget/label_5_css")).toString()); - - mp_ui->label_1_icon->setStyleSheet(settings_cs.value(QString("StatusBarWidget/label_1_icon_css")).toString() - + QString(" border-image: url(") + mp_statusbarIconURIs->value(1) + QString(") 0 0 0 0 stretch stretch;")); - mp_ui->label_2_icon->setStyleSheet(settings_cs.value(QString("StatusBarWidget/label_2_icon_css")).toString() - + QString(" border-image: url(") + mp_statusbarIconURIs->value(2) + QString(") 0 0 0 0 stretch stretch;")); - mp_ui->label_3_icon->setStyleSheet(settings_cs.value(QString("StatusBarWidget/label_3_icon_css")).toString() - + QString(" border-image: url(") + mp_statusbarIconURIs->value(3) + QString(") 0 0 0 0 stretch stretch;")); - mp_ui->label_4_icon->setStyleSheet(settings_cs.value(QString("StatusBarWidget/label_4_icon_css")).toString() - + QString(" border-image: url(") + mp_statusbarIconURIs->value(4) + QString(") 0 0 0 0 stretch stretch;")); - mp_ui->label_5_icon->setStyleSheet(settings_cs.value(QString("StatusBarWidget/label_5_icon_css")).toString() - + QString(" border-image: url(") + mp_statusbarIconURIs->value(5) + QString(") 0 0 0 0 stretch stretch;")); -} - -QList<int> StatusBarWidget::getAvailablePlaceholders() -{ - QList<int> result; - - // for now, all are available - result.append(1); - result.append(2); - result.append(3); - result.append(4); - result.append(5); - - return result; -} - -QString StatusBarWidget::getStatusIcon(int placeholderIndex) -{ - return mp_statusbarIconURIs->value(placeholderIndex); -} - -QString StatusBarWidget::getStatusText(int placeholderIndex) -{ - QString result = ""; - - switch (placeholderIndex) - { - case 1: - result = mp_ui->label_1->text(); - break; - case 2: - result = mp_ui->label_2->text(); - break; - case 3: - result = mp_ui->label_3->text(); - break; - case 4: - result = mp_ui->label_4->text(); - break; - case 5: - result = mp_ui->label_5->text(); - break; - default: - break; - } - - return result; -} - -void StatusBarWidget::setStatusIcon(int placeholderIndex, const QString &iconURI) -{ - mp_statusbarIconURIs->insert(placeholderIndex, iconURI); - - updateColorScheme(); -} - -void StatusBarWidget::setStatusText(int placeholderIndex, const QString &text) -{ - switch (placeholderIndex) - { - case 1: - mp_ui->label_1->setText(text); - break; - case 2: - mp_ui->label_2->setText(text); - break; - case 3: - mp_ui->label_3->setText(text); - break; - case 4: - mp_ui->label_4->setText(text); - break; - case 5: - mp_ui->label_5->setText(text); - break; - default: - break; - } -} diff --git a/HomeScreen/src/statusbarwidget.h b/HomeScreen/src/statusbarwidget.h deleted file mode 100644 index cac856d..0000000 --- a/HomeScreen/src/statusbarwidget.h +++ /dev/null @@ -1,53 +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. - */ - -#ifndef STATUSBARWIDGET_H -#define STATUSBARWIDGET_H - -#include <QWidget> -#include "statusbar_adaptor.h" - -namespace Ui { -class StatusBarWidget; -} - -class StatusBarWidget : public QWidget -{ - Q_OBJECT - -public: - explicit StatusBarWidget(QWidget *parent = 0); - ~StatusBarWidget(); -public slots: - void updateColorScheme(); - -// from statusbar_adaptor.h -public Q_SLOTS: // METHODS - QList<int> getAvailablePlaceholders(); - QString getStatusIcon(int placeholderIndex); - QString getStatusText(int placeholderIndex); - void setStatusIcon(int placeholderIndex, const QString &iconURI); - void setStatusText(int placeholderIndex, const QString &text); - -private: - Ui::StatusBarWidget *mp_ui; - - StatusbarAdaptor *mp_statusbarAdaptor; - - QMap<int, QString> *mp_statusbarIconURIs; -}; - -#endif // STATUSBARWIDGET_H |