summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/controlbarwidget.cpp112
-rw-r--r--src/controlbarwidget.h60
-rw-r--r--src/inputdevicesimulator.cpp56
-rw-r--r--src/inputdevicesimulator.h44
-rw-r--r--src/inputeventdistributor.cpp50
-rw-r--r--src/inputeventdistributor.h41
-rw-r--r--src/main.cpp70
-rw-r--r--src/mainwindow.cpp149
-rw-r--r--src/mainwindow.h79
-rw-r--r--src/popupwidget.cpp49
-rw-r--r--src/popupwidget.h49
-rw-r--r--src/settingswidget.cpp127
-rw-r--r--src/settingswidget.h61
-rw-r--r--src/statusbarwidget.cpp118
-rw-r--r--src/statusbarwidget.h62
-rw-r--r--src/systemsettingssimulator.cpp74
-rw-r--r--src/systemsettingssimulator.h47
17 files changed, 0 insertions, 1248 deletions
diff --git a/src/controlbarwidget.cpp b/src/controlbarwidget.cpp
deleted file mode 100644
index 4627a7b..0000000
--- a/src/controlbarwidget.cpp
+++ /dev/null
@@ -1,112 +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"
-
-ControlBarWidget::ControlBarWidget(QWidget *parent) :
- QWidget(parent),
- mp_ui(new Ui::ControlBarWidget),
- mp_settingsWidget(0),
- mp_dBusDayNightMode_SettingsWidget(0),
- m_dayNightMode(SystemDayNight::DAYNIGHTMODE_DAY), // TODO: read from system
- mp_daynightmodeAdaptor(0)
-{
- // publish dbus day night mode interface
- mp_daynightmodeAdaptor = new DaynightmodeAdaptor((QObject*)this);
- QDBusConnection dbus = QDBusConnection::sessionBus();
- dbus.registerObject("/ControlBarWidget", this);
- dbus.registerService("org.agl.mainwindow");
-
- mp_ui->setupUi(this);
-}
-
-ControlBarWidget::~ControlBarWidget()
-{
- delete mp_daynightmodeAdaptor;
- if (0 != mp_settingsWidget)
- {
- delete mp_settingsWidget;
- }
- if (0 == mp_dBusDayNightMode_SettingsWidget)
- {
- delete mp_dBusDayNightMode_SettingsWidget;
- }
- delete mp_ui;
-}
-
-void ControlBarWidget::setDayNightMode(int mode)
-{
- QIcon icon;
- switch (mode)
- {
- case SystemDayNight::DAYNIGHTMODE_DAY:
- m_dayNightMode = SystemDayNight::DAYNIGHTMODE_DAY;
- mp_ui->widget_Background->setStyleSheet(QString("background-image: url(:/images/backgrounds/bg_green_day.png)"));
-
- icon.addFile(QStringLiteral(":/icons/home_day.png"), QSize(), QIcon::Normal, QIcon::Off);
- mp_ui->pushButton_Home->setIcon(icon);
- icon.addFile(QStringLiteral(":/icons/settings_day.png"), QSize(), QIcon::Normal, QIcon::Off);
- mp_ui->pushButton_Settings->setIcon(icon);
- break;
- case SystemDayNight::DAYNIGHTMODE_NIGHT:
- m_dayNightMode = SystemDayNight::DAYNIGHTMODE_NIGHT;
- mp_ui->widget_Background->setStyleSheet(QString("background-image: url(:/images/backgrounds/bg_green_night.png)"));
-
- icon.addFile(QStringLiteral(":/icons/home_night.png"), QSize(), QIcon::Normal, QIcon::Off);
- mp_ui->pushButton_Home->setIcon(icon);
- icon.addFile(QStringLiteral(":/icons/settings_night.png"), QSize(), QIcon::Normal, QIcon::Off);
- mp_ui->pushButton_Settings->setIcon(icon);
- break;
- default:
- m_dayNightMode = SystemDayNight::DAYNIGHTMODE_UNDEFINED;
- }
-
- // settings widget if present
- if (0 != mp_dBusDayNightMode_SettingsWidget)
- {
- mp_dBusDayNightMode_SettingsWidget->setDayNightMode(m_dayNightMode);
- }
-}
-
-void ControlBarWidget::on_pushButton_Settings_clicked()
-{
- if (0 == mp_settingsWidget)
- {
- mp_settingsWidget = new SettingsWidget((QWidget*)parent());
- }
-
- mp_settingsWidget->move(0, 60);
- mp_settingsWidget->show();
-
- if (0 == mp_dBusDayNightMode_SettingsWidget)
- {
- // connect to the dBus interface provided by the settings widget
- mp_dBusDayNightMode_SettingsWidget = new org::agl::daynightmode("org.agl.mainwindow",
- "/SettingsWidget",
- QDBusConnection::sessionBus(),
- 0);
- mp_dBusDayNightMode_SettingsWidget->setDayNightMode(m_dayNightMode);
- }
-}
-
-void ControlBarWidget::on_pushButton_Home_clicked()
-{
- if (0 != mp_settingsWidget)
- {
- mp_settingsWidget->hide();
- }
-}
diff --git a/src/controlbarwidget.h b/src/controlbarwidget.h
deleted file mode 100644
index 9d4fa7f..0000000
--- a/src/controlbarwidget.h
+++ /dev/null
@@ -1,60 +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 "include/daynightmode.h"
-#include "daynightmode_adapter.h"
-#include "daynightmode_proxy.h"
-#include "settingswidget.h"
-
-namespace Ui {
-class ControlBarWidget;
-}
-
-class ControlBarWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit ControlBarWidget(QWidget *parent = 0);
- ~ControlBarWidget();
-
-// from daynightmode_adapter.h
-public Q_SLOTS:
- void setDayNightMode(int mode);
- inline int getDayNightMode()
- {
- return (int)m_dayNightMode;
- }
-
-private slots:
- void on_pushButton_Settings_clicked();
-
- void on_pushButton_Home_clicked();
-
-private:
- Ui::ControlBarWidget *mp_ui;
- SettingsWidget *mp_settingsWidget;
- org::agl::daynightmode *mp_dBusDayNightMode_SettingsWidget;
-
- SystemDayNight::eDayNightMode m_dayNightMode;
- DaynightmodeAdaptor *mp_daynightmodeAdaptor;
-};
-
-#endif // CONTROLBARWIDGET_H
diff --git a/src/inputdevicesimulator.cpp b/src/inputdevicesimulator.cpp
deleted file mode 100644
index fcadbc6..0000000
--- a/src/inputdevicesimulator.cpp
+++ /dev/null
@@ -1,56 +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 "inputdevicesimulator.h"
-#include "ui_inputdevicesimulator.h"
-#include <QSettings>
-
-
-InputDeviceSimulator::InputDeviceSimulator(QWidget *parent) :
- QDialog(parent),
- mp_ui(new Ui::InputDeviceSimulator),
- mp_dBusInputevent(0)
-{
- mp_ui->setupUi(this);
-
- // connect to the dBus interface provided by the input device distributor
- mp_dBusInputevent = new org::agl::inputevent("org.agl.main",
- "/InputEventDistributor",
- QDBusConnection::sessionBus(),
- 0);
-
- QSettings settings;
- this->restoreGeometry(settings.value("inputdevicesimulator/geometry").toByteArray());
-}
-
-InputDeviceSimulator::~InputDeviceSimulator()
-{
- QSettings settings;
- settings.setValue("inputdevicesimulator/geometry", saveGeometry());
-
- if (0 == mp_dBusInputevent)
- {
- delete mp_dBusInputevent;
- }
-
- delete mp_ui;
-}
-
-void InputDeviceSimulator::on_pushButtonRight_clicked()
-{
- qDebug("right");
- mp_dBusInputevent->keyEvent(SystemInputEvent::INPUTEVENTTYPE_KEY_PRESSED, SystemInputEvent::INPUTEVENTZONE_1, Qt::Key_Right);
-}
diff --git a/src/inputdevicesimulator.h b/src/inputdevicesimulator.h
deleted file mode 100644
index e22beee..0000000
--- a/src/inputdevicesimulator.h
+++ /dev/null
@@ -1,44 +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 INPUTDEVICESIMULATOR_H
-#define INPUTDEVICESIMULATOR_H
-
-#include <QDialog>
-#include "include/inputevent.h"
-#include "inputevent_proxy.h"
-
-namespace Ui {
-class InputDeviceSimulator;
-}
-
-class InputDeviceSimulator : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit InputDeviceSimulator(QWidget *parent = 0);
- ~InputDeviceSimulator();
-
-private slots:
- void on_pushButtonRight_clicked();
-
-private:
- Ui::InputDeviceSimulator *mp_ui;
- org::agl::inputevent *mp_dBusInputevent;
-};
-
-#endif // INPUTDEVICESIMULATOR_H
diff --git a/src/inputeventdistributor.cpp b/src/inputeventdistributor.cpp
deleted file mode 100644
index 911b90f..0000000
--- a/src/inputeventdistributor.cpp
+++ /dev/null
@@ -1,50 +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 "inputeventdistributor.h"
-#include <QEvent>
-
-InputEventDistributor::InputEventDistributor(QObject *parent) :
- QObject(parent),
- mp_inputEventAdaptor(0)
-{
- // publish dbus popup interface
- mp_inputEventAdaptor = new InputeventAdaptor((QObject*)this);
- QDBusConnection dbus = QDBusConnection::sessionBus();
- dbus.registerObject("/InputEventDistributor", this);
- dbus.registerService("org.agl.main");
-}
-
-InputEventDistributor::~InputEventDistributor()
-{
- delete mp_inputEventAdaptor;
-}
-
-void InputEventDistributor::keyEvent(int type, int zone, int key)
-{
- qDebug("InputEventDistributor::keyEvent type 0x%x, key 0x%x", type, key);
-
- //QEvent *event;
- switch (type)
- {
- case SystemInputEvent::INPUTEVENTTYPE_KEY_PRESSED:
-
- break;
- default:
- qDebug("InputEventDistributor::keyEvent: Type 0x%x undefined", type);
- }
-
-}
diff --git a/src/inputeventdistributor.h b/src/inputeventdistributor.h
deleted file mode 100644
index fe8ed89..0000000
--- a/src/inputeventdistributor.h
+++ /dev/null
@@ -1,41 +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 INPUTEVENTDISTRIBUTOR_H
-#define INPUTEVENTDISTRIBUTOR_H
-
-#include <QObject>
-#include "include/inputevent.h"
-#include "inputevent_adapter.h"
-
-
-class InputEventDistributor : public QObject
-{
- Q_OBJECT
-public:
- explicit InputEventDistributor(QObject *parent = 0);
- ~InputEventDistributor();
-
-signals:
-
-public slots:
-public Q_SLOTS: // METHODS
- void keyEvent(int type, int zone, int key);
-private:
- InputeventAdaptor *mp_inputEventAdaptor;
-};
-
-#endif // INPUTEVENTDISTRIBUTOR_H
diff --git a/src/main.cpp b/src/main.cpp
deleted file mode 100644
index fac6e2f..0000000
--- a/src/main.cpp
+++ /dev/null
@@ -1,70 +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 "mainwindow.h"
-#include "include/daynightmode.h"
-#include <QApplication>
-#include <QSysInfo>
-#include <QSharedMemory>
-#include "inputeventdistributor.h"
-
-#ifdef __i386__
-#include "inputdevicesimulator.h"
-#include "systemsettingssimulator.h"
-#endif
-
-
-int main(int argc, char *argv[])
-{
- // allow only one instance of this application
- QSharedMemory appInstance;
- appInstance.setKey("AGLHomeScreenApp");
- 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)
- QCoreApplication::setOrganizationDomain("LinuxFoundation");
- QCoreApplication::setOrganizationName("AutomotiveGradeLinux");
- QCoreApplication::setApplicationName("HomeScreen");
- QCoreApplication::setApplicationVersion("0.0.1");
-
- MainWindow w;
- w.move(0, 0);
- w.show();
-
- InputEventDistributor *mp_inputEventDistributor;
- mp_inputEventDistributor = new InputEventDistributor();
-
-
- // start input and system settings simulator on developer PCs
-#ifdef __arm__
- qDebug("Running on ARM architecture");
-#endif
-#ifdef __i386__
- InputDeviceSimulator inputdevicesimulator(&w);
- inputdevicesimulator.show();
- SystemSettingsSimulator systemsettingssimulator;
- systemsettingssimulator.show();
- qDebug("Running on x86 architecture");
-#endif
-
- return a.exec();
-}
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
deleted file mode 100644
index 40189b3..0000000
--- a/src/mainwindow.cpp
+++ /dev/null
@@ -1,149 +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 "mainwindow.h"
-#include "ui_mainwindow.h"
-
-MainWindow::MainWindow(QWidget *parent) :
- QMainWindow(parent),
- mp_ui(new Ui::MainWindow),
- mp_statusBarWidget(0),
- mp_dBusDayNightMode_StatusBarWidget(0),
- mp_controlBarWidget(0),
- mp_dBusDayNightMode_ControlBarWidget(0),
- m_dayNightMode(SystemDayNight::DAYNIGHTMODE_DAY), // TODO: read from system
- mp_daynightmodeAdaptor(0),
- mp_popupAdaptor(0),
- mp_dBusPopup(0),
- mp_popupWidget(0)
-{
- // dbus setup
- QDBusConnection dbus = QDBusConnection::sessionBus();
-
- // publish dbus day night mode interface
- mp_daynightmodeAdaptor = new DaynightmodeAdaptor((QObject*)this);
- // publish dbus popup interface
- mp_popupAdaptor = new PopupAdaptor((QObject*)this);
-
- dbus.registerObject("/MainWindow", this);
- dbus.registerService("org.agl.mainwindow");
-
- // no window decoration
- setWindowFlags(Qt::FramelessWindowHint);
- mp_ui->setupUi(this);
-
- mp_statusBarWidget = new StatusBarWidget(this);
- mp_statusBarWidget->raise();
- // apply layout
- mp_statusBarWidget->setGeometry(0, 0, 800, 60);
- // connect to the dBus interface provided by the status bar widget
- mp_dBusDayNightMode_StatusBarWidget = new org::agl::daynightmode("org.agl.mainwindow",
- "/StatusBarWidget",
- QDBusConnection::sessionBus(),
- 0);
-
- mp_controlBarWidget = new ControlBarWidget(this);
- mp_controlBarWidget->raise();
- // apply layout
- mp_controlBarWidget->setGeometry(0, 540, 800, 60);
- // connect to the dBus interface provided by the control bar widget
- mp_dBusDayNightMode_ControlBarWidget = new org::agl::daynightmode("org.agl.mainwindow",
- "/ControlBarWidget",
- QDBusConnection::sessionBus(),
- 0);
-}
-
-MainWindow::~MainWindow()
-{
- delete mp_dBusDayNightMode_ControlBarWidget;
- delete mp_dBusDayNightMode_StatusBarWidget;
-
- if (0 == mp_dBusPopup)
- {
- delete mp_dBusPopup;
- }
- if (0 != mp_popupWidget)
- {
- delete mp_popupWidget;
- }
-
-
-
- delete mp_popupAdaptor;
- delete mp_daynightmodeAdaptor;
- delete mp_statusBarWidget;
- delete mp_ui;
-}
-
-void MainWindow::setDayNightMode(int mode)
-{
- switch (mode)
- {
- case SystemDayNight::DAYNIGHTMODE_DAY:
- m_dayNightMode = SystemDayNight::DAYNIGHTMODE_DAY;
- mp_ui->widget_Background->setStyleSheet(QString("background-image: url(:/images/backgrounds/bg_blue_day.png)"));
- // home icon
- mp_ui->widget_Home_Icon->setStyleSheet(QString("border-image: url(:/icons/home_day.png) 0 0 0 0 stretch stretch;"));
-
- break;
- case SystemDayNight::DAYNIGHTMODE_NIGHT:
- m_dayNightMode = SystemDayNight::DAYNIGHTMODE_NIGHT;
- mp_ui->widget_Background->setStyleSheet(QString("background-image: url(:/images/backgrounds/bg_blue_night.png)"));
- // home icon
- mp_ui->widget_Home_Icon->setStyleSheet(QString("border-image: url(:/icons/home_night.png) 0 0 0 0 stretch stretch;"));
-
- break;
- default:
- m_dayNightMode = SystemDayNight::DAYNIGHTMODE_UNDEFINED;
- }
-
- mp_dBusDayNightMode_StatusBarWidget->setDayNightMode(m_dayNightMode);
- mp_dBusDayNightMode_ControlBarWidget->setDayNightMode(m_dayNightMode);
-}
-
-void MainWindow::showPopup(int type, const QString &text)
-{
- if (0 == mp_popupWidget)
- {
- qDebug("0 == mp_popupWidget");
- mp_popupWidget = new PopupWidget(this);
- }
-
- mp_popupWidget->move(0, 0);
- mp_popupWidget->show();
-
- if (0 == mp_dBusPopup)
- {
- qDebug("0 == mp_dBusPopup");
- // connect to the dBus interface provided by the popup widget
- mp_dBusPopup = new org::agl::popup("org.agl.mainwindow",
- "/PopupWidget",
- QDBusConnection::sessionBus(),
- 0);
- }
- mp_dBusPopup->showPopup(type, text);
-}
-
-void MainWindow::changeEvent(QEvent* event)
-{
- if (QEvent::LanguageChange == event->type())
- {
- mp_ui->retranslateUi(this);
- }
-
- QMainWindow::changeEvent(event);
-}
-
diff --git a/src/mainwindow.h b/src/mainwindow.h
deleted file mode 100644
index a87d88d..0000000
--- a/src/mainwindow.h
+++ /dev/null
@@ -1,79 +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 MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QMainWindow>
-#include "include/daynightmode.h"
-#include "daynightmode_adapter.h"
-#include "daynightmode_proxy.h"
-#include "popupwidget.h"
-#include "include/popup.h"
-#include "popup_adapter.h"
-#include "popup_proxy.h"
-
-#include "statusbarwidget.h"
-#include "controlbarwidget.h"
-
-namespace Ui {
-class MainWindow;
-}
-
-class MainWindow : public QMainWindow
-{
- Q_OBJECT
-
-public:
- explicit MainWindow(QWidget *parent = 0);
- ~MainWindow();
-
-// from daynightmode_adapter.h
-public Q_SLOTS:
- void setDayNightMode(int mode);
- inline int getDayNightMode()
- {
- return (int)m_dayNightMode;
- }
-
-// from popup_adapter.h
-public Q_SLOTS: // METHODS
- void showPopup(int type, const QString &text);
-
-protected:
- // called when the translator loaded a new language set
- void changeEvent(QEvent* event);
-
-private:
- Ui::MainWindow *mp_ui;
-
- StatusBarWidget *mp_statusBarWidget;
- org::agl::daynightmode *mp_dBusDayNightMode_StatusBarWidget;
- ControlBarWidget *mp_controlBarWidget;
- org::agl::daynightmode *mp_dBusDayNightMode_ControlBarWidget;
-
- // dbus daynightmode
- SystemDayNight::eDayNightMode m_dayNightMode;
- DaynightmodeAdaptor *mp_daynightmodeAdaptor;
-
- // dbus popup
- PopupAdaptor *mp_popupAdaptor;
- org::agl::popup *mp_dBusPopup;
-
- PopupWidget *mp_popupWidget;
-};
-
-#endif // MAINWINDOW_H
diff --git a/src/popupwidget.cpp b/src/popupwidget.cpp
deleted file mode 100644
index 54573ad..0000000
--- a/src/popupwidget.cpp
+++ /dev/null
@@ -1,49 +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 "popupwidget.h"
-#include "ui_popupwidget.h"
-
-PopupWidget::PopupWidget(QWidget *parent) :
- QWidget(parent),
- mp_ui(new Ui::PopupWidget),
- mp_popupAdaptor(0)
-{
- mp_ui->setupUi(this);
-
- // publish dbus popup interface
- mp_popupAdaptor = new PopupAdaptor((QObject*)this);
- QDBusConnection dbus = QDBusConnection::sessionBus();
- dbus.registerObject("/PopupWidget", this);
- dbus.registerService("org.agl.mainwindow");
-}
-
-PopupWidget::~PopupWidget()
-{
- delete mp_popupAdaptor;
- delete mp_ui;
-}
-
-void PopupWidget::showPopup(int type, const QString &text)
-{
- qDebug("PopupWidget::showPopup: type %d, text %s", type, text.toStdString().c_str());
- mp_ui->label_Text->setText(text);
-}
-
-void PopupWidget::on_pushButton_OK_clicked()
-{
- this->close();
-}
diff --git a/src/popupwidget.h b/src/popupwidget.h
deleted file mode 100644
index 201cbc3..0000000
--- a/src/popupwidget.h
+++ /dev/null
@@ -1,49 +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 POPUPWIDGET_H
-#define POPUPWIDGET_H
-
-#include <QWidget>
-#include "include/popup.h"
-#include "popup_adapter.h"
-
-namespace Ui {
-class PopupWidget;
-}
-
-class PopupWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit PopupWidget(QWidget *parent = 0);
- ~PopupWidget();
-
-// from popup_adapter.h
-public Q_SLOTS: // METHODS
- void showPopup(int type, const QString &text);
-
-private slots:
- void on_pushButton_OK_clicked();
-
-private:
- Ui::PopupWidget *mp_ui;
-
- PopupAdaptor *mp_popupAdaptor;
-};
-
-#endif // POPUPWIDGET_H
diff --git a/src/settingswidget.cpp b/src/settingswidget.cpp
deleted file mode 100644
index 24085e8..0000000
--- a/src/settingswidget.cpp
+++ /dev/null
@@ -1,127 +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 "settingswidget.h"
-#include "ui_settingswidget.h"
-#include "include/daynightmode.h"
-#include <QSettings>
-
-SettingsWidget::SettingsWidget(QWidget *parent) :
- QWidget(parent),
- mp_ui(new Ui::SettingsWidget),
- m_dayNightMode(SystemDayNight::DAYNIGHTMODE_DAY), // TODO: read from system
- mp_daynightmodeAdaptor(0),
- mp_translator(0)
-{
- // publish dbus day night mode interface
- mp_daynightmodeAdaptor = new DaynightmodeAdaptor((QObject*)this);
- QDBusConnection dbus = QDBusConnection::sessionBus();
- dbus.registerObject("/SettingsWidget", this);
- dbus.registerService("org.agl.mainwindow");
-
- // multi-language support
- mp_translator = new QTranslator();
- mp_translator->load("homescreen_en_US.qm", ":/translations"); // TODO: read from system
- QApplication::instance()->installTranslator(mp_translator);
-
- mp_ui->setupUi(this);
-
- mp_ui->comboBoxLanguage->addItem(QString("English"), QVariant("homescreen_en_US.qm")); // TODO: make this configurable?
- mp_ui->comboBoxLanguage->addItem(QString("Deutsch"), QVariant("homescreen_de_DE.qm"));
- mp_ui->comboBoxLanguage->addItem(QString("日本語"), QVariant("homescreen_ja_JP.qm"));
-
- QSettings settings;
- mp_ui->comboBoxLanguage->setCurrentIndex(settings.value("systemsettings/language", 0).toInt());
-}
-
-SettingsWidget::~SettingsWidget()
-{
- delete mp_translator;
- delete mp_daynightmodeAdaptor;
-
- QSettings settings;
- settings.setValue("systemsettings/language", mp_ui->comboBoxLanguage->currentIndex());
- delete mp_ui;
-}
-
-void SettingsWidget::setDayNightMode(int mode)
-{
- switch (mode)
- {
- case SystemDayNight::DAYNIGHTMODE_DAY:
- m_dayNightMode = SystemDayNight::DAYNIGHTMODE_DAY;
- mp_ui->widget_Background->setStyleSheet(QString("background-image: url(:/images/backgrounds/bg_blue_day.png);"));
- mp_ui->comboBoxLanguage->setStyleSheet(QString("QComboBox { \
- border: 1px solid #D3D3D3; \
- border-radius: 8px; \
- background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(242, 242, 249, 255), stop:1 rgba(255, 255, 255, 255)); \
- color: #333; \
- padding: 0px; \
- } \
- QComboBox:on { \
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #D5D5D5, stop: 1 #EEEEEE); \
- } \
- QComboBox::drop-down { \
- border: 0px solid; \
- border-radius: 0px; \
- } \
- QComboBox::down-arrow:on { \
- }"));
- // settings icon
- mp_ui->widget_Settings_Icon->setStyleSheet(QString("border-image: url(:/icons/settings_day.png) 0 0 0 0 stretch stretch;"));
- break;
- case SystemDayNight::DAYNIGHTMODE_NIGHT:
- m_dayNightMode = SystemDayNight::DAYNIGHTMODE_NIGHT;
- mp_ui->widget_Background->setStyleSheet(QString("background-image: url(:/images/backgrounds/bg_blue_night.png);"));
- mp_ui->comboBoxLanguage->setStyleSheet(QString("QComboBox { \
- border: 1px solid #D3D3D3; \
- border-radius: 8px; \
- background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(147, 147, 151, 255), stop:1 rgba(255, 255, 255, 255)); \
- color: #333; \
- padding: 0px; \
- } \
- QComboBox:on { \
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #D5D5D5, stop: 1 #EEEEEE); \
- } \
- QComboBox::drop-down { \
- border: 0px solid; \
- border-radius: 0px; \
- } \
- QComboBox::down-arrow:on { \
- }"));
- // settings icon
- mp_ui->widget_Settings_Icon->setStyleSheet(QString("border-image: url(:/icons/settings_night.png) 0 0 0 0 stretch stretch;"));
- break;
- default:
- m_dayNightMode = SystemDayNight::DAYNIGHTMODE_UNDEFINED;
- }
-}
-
-void SettingsWidget::changeEvent(QEvent* event)
-{
- if (QEvent::LanguageChange == event->type())
- {
- mp_ui->retranslateUi(this);
- }
-
- QWidget::changeEvent(event);
-}
-
-void SettingsWidget::on_comboBoxLanguage_currentIndexChanged(const QString &)
-{
- if (0 != mp_translator)
- mp_translator->load(mp_ui->comboBoxLanguage->currentData().toString(), ":/translations");
-}
diff --git a/src/settingswidget.h b/src/settingswidget.h
deleted file mode 100644
index f49da8d..0000000
--- a/src/settingswidget.h
+++ /dev/null
@@ -1,61 +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 SETTINGSWIDGET_H
-#define SETTINGSWIDGET_H
-
-#include <QWidget>
-#include <QTranslator>
-#include "include/daynightmode.h"
-#include "daynightmode_adapter.h"
-
-namespace Ui {
-class SettingsWidget;
-}
-
-class SettingsWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit SettingsWidget(QWidget *parent = 0);
- ~SettingsWidget();
-
-// from daynightmode_adapter.h
-public Q_SLOTS:
- void setDayNightMode(int mode);
- inline int getDayNightMode()
- {
- return (int)m_dayNightMode;
- }
-
-protected:
- // called when the translator loaded a new language set
- void changeEvent(QEvent* event);
-
-private slots:
- void on_comboBoxLanguage_currentIndexChanged(const QString &);
-
-private:
- Ui::SettingsWidget *mp_ui;
-
- SystemDayNight::eDayNightMode m_dayNightMode;
- DaynightmodeAdaptor *mp_daynightmodeAdaptor;
-
- QTranslator *mp_translator;
-};
-
-#endif // SETTINGSWIDGET_H
diff --git a/src/statusbarwidget.cpp b/src/statusbarwidget.cpp
deleted file mode 100644
index 775a9ec..0000000
--- a/src/statusbarwidget.cpp
+++ /dev/null
@@ -1,118 +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"
-
-StatusBarWidget::StatusBarWidget(QWidget *parent) :
- QWidget(parent),
- mp_ui(new Ui::StatusBarWidget),
- m_dayNightMode(SystemDayNight::DAYNIGHTMODE_DAY), // TODO: read from system
- mp_daynightmodeAdaptor(0),
- mp_statusbarAdaptor(0),
- m_secondsTimerId(-1)
-{
- // publish dbus day night mode interface
- mp_daynightmodeAdaptor = new DaynightmodeAdaptor((QObject*)this);
- // publish statusbar interface
- mp_statusbarAdaptor = new StatusbarAdaptor((QObject*)this);
-
- QDBusConnection dbus = QDBusConnection::sessionBus();
- dbus.registerObject("/StatusBarWidget", this);
- dbus.registerService("org.agl.mainwindow");
-
- mp_ui->setupUi(this);
-
- // callback every second
- m_secondsTimerId = startTimer(1000);
-}
-
-StatusBarWidget::~StatusBarWidget()
-{
- delete mp_statusbarAdaptor;
- delete mp_daynightmodeAdaptor;
- delete mp_ui;
-}
-
-void StatusBarWidget::setDayNightMode(int mode)
-{
- switch (mode)
- {
- case SystemDayNight::DAYNIGHTMODE_DAY:
- m_dayNightMode = SystemDayNight::DAYNIGHTMODE_DAY;
- mp_ui->widget->setStyleSheet(QString("background-image: url(:/images/backgrounds/bg_stripes_day.png)"));
- mp_ui->label_1->setStyleSheet(QString("color: rgb(238, 238, 238); background-image: url(:/images/transparency.png);"));
- mp_ui->label_2->setStyleSheet(QString("color: rgb(238, 238, 238); background-image: url(:/images/transparency.png);"));
- mp_ui->label_3->setStyleSheet(QString("color: rgb(238, 238, 238); background-image: url(:/images/transparency.png);"));
- mp_ui->label_4_Time->setStyleSheet(QString("color: rgb(238, 238, 238); background-image: url(:/images/transparency.png);"));
- mp_ui->label_5->setStyleSheet(QString("color: rgb(238, 238, 238); background-image: url(:/images/transparency.png);"));
- mp_ui->label_6->setStyleSheet(QString("color: rgb(238, 238, 238); background-image: url(:/images/transparency.png);"));
- mp_ui->label_7->setStyleSheet(QString("color: rgb(238, 238, 238); background-image: url(:/images/transparency.png);"));
- break;
- case SystemDayNight::DAYNIGHTMODE_NIGHT:
- m_dayNightMode = SystemDayNight::DAYNIGHTMODE_NIGHT;
- mp_ui->widget->setStyleSheet(QString("background-image: url(:/images/backgrounds/bg_stripes_night.png)"));
- mp_ui->label_1->setStyleSheet(QString("color: rgb(177, 177, 177); background-image: url(:/images/transparency.png);"));
- mp_ui->label_2->setStyleSheet(QString("color: rgb(177, 177, 177); background-image: url(:/images/transparency.png);"));
- mp_ui->label_3->setStyleSheet(QString("color: rgb(177, 177, 177); background-image: url(:/images/transparency.png);"));
- mp_ui->label_4_Time->setStyleSheet(QString("color: rgb(177, 177, 177); background-image: url(:/images/transparency.png);"));
- mp_ui->label_5->setStyleSheet(QString("color: rgb(177, 177, 177); background-image: url(:/images/transparency.png);"));
- mp_ui->label_6->setStyleSheet(QString("color: rgb(177, 177, 177); background-image: url(:/images/transparency.png);"));
- mp_ui->label_7->setStyleSheet(QString("color: rgb(177, 177, 177); background-image: url(:/images/transparency.png);"));
- break;
- default:
- m_dayNightMode = SystemDayNight::DAYNIGHTMODE_UNDEFINED;
- }
-}
-
-void StatusBarWidget::setStatus(int index, const QString &text)
-{
- switch (index)
- {
- 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:
- qDebug("reserved for the time status");
- break;
- case 5:
- mp_ui->label_5->setText(text);
- break;
- case 6:
- mp_ui->label_6->setText(text);
- break;
- case 7:
- mp_ui->label_7->setText(text);
- break;
- default:
- break;
- }
-}
-
-void StatusBarWidget::timerEvent(QTimerEvent *e)
-{
- if (e->timerId() == m_secondsTimerId)
- {
- mp_ui->label_4_Time->setText(QDateTime::currentDateTime().toString("hh:mm"));
- }
-}
-
diff --git a/src/statusbarwidget.h b/src/statusbarwidget.h
deleted file mode 100644
index 2547d34..0000000
--- a/src/statusbarwidget.h
+++ /dev/null
@@ -1,62 +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 "include/daynightmode.h"
-#include "daynightmode_adapter.h"
-#include "statusbar_adapter.h"
-
-namespace Ui {
-class StatusBarWidget;
-}
-
-class StatusBarWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit StatusBarWidget(QWidget *parent = 0);
- ~StatusBarWidget();
-
-// from daynightmode_adapter.h
-public Q_SLOTS:
- void setDayNightMode(int mode);
- inline int getDayNightMode()
- {
- return (int)m_dayNightMode;
- }
-
-// from statusbar_adapter.h
-public Q_SLOTS: // METHODS
- void setStatus(int index, const QString &text);
-
-protected:
- void timerEvent(QTimerEvent *e);
-
-private:
- Ui::StatusBarWidget *mp_ui;
-
- SystemDayNight::eDayNightMode m_dayNightMode;
- DaynightmodeAdaptor *mp_daynightmodeAdaptor;
- StatusbarAdaptor *mp_statusbarAdaptor;
-
- int m_secondsTimerId;
-};
-
-#endif // STATUSBARWIDGET_H
diff --git a/src/systemsettingssimulator.cpp b/src/systemsettingssimulator.cpp
deleted file mode 100644
index b1ed6b3..0000000
--- a/src/systemsettingssimulator.cpp
+++ /dev/null
@@ -1,74 +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 "systemsettingssimulator.h"
-#include "ui_systemsettingssimulator.h"
-#include "include/daynightmode.h"
-#include <QSettings>
-
-SystemSettingsSimulator::SystemSettingsSimulator(QWidget *parent) :
- QDialog(parent),
- mp_ui(new Ui::SystemSettingsSimulator),
- mp_dBusDayNightMode(0)
-{
- mp_ui->setupUi(this);
-
- // connect to the dBus interface provided by the main window
- mp_dBusDayNightMode = new org::agl::daynightmode("org.agl.mainwindow",
- "/MainWindow",
- QDBusConnection::sessionBus(),
- 0);
-
- QSettings settings;
- this->restoreGeometry(settings.value("systemsettingssimulator/geometry").toByteArray());
- mp_ui->radioButton_DayMode->setChecked(settings.value("systemsettingssimulator/daymode", true).toBool()); // if nothing is stored, use "true"
- mp_ui->radioButton_NightMode->setChecked(settings.value("systemsettingssimulator/nightmode", false).toBool()); // if nothing is stored, use "false"
-}
-
-SystemSettingsSimulator::~SystemSettingsSimulator()
-{
- QSettings settings;
- settings.setValue("systemsettingssimulator/geometry", saveGeometry());
- settings.setValue("systemsettingssimulator/daymode", mp_ui->radioButton_DayMode->isChecked());
- settings.setValue("systemsettingssimulator/nightmode", mp_ui->radioButton_NightMode->isChecked());
-
- if (0 == mp_dBusDayNightMode)
- {
- delete mp_dBusDayNightMode;
- }
- delete mp_ui;
-}
-
-void SystemSettingsSimulator::on_pushButton_Exit_clicked()
-{
- QApplication::exit();
-}
-
-void SystemSettingsSimulator::on_radioButton_DayMode_toggled(bool checked)
-{
- if (checked)
- {
- mp_dBusDayNightMode->setDayNightMode(SystemDayNight::DAYNIGHTMODE_DAY);
- }
-}
-
-void SystemSettingsSimulator::on_radioButton_NightMode_toggled(bool checked)
-{
- if (checked)
- {
- mp_dBusDayNightMode->setDayNightMode(SystemDayNight::DAYNIGHTMODE_NIGHT);
- }
-}
diff --git a/src/systemsettingssimulator.h b/src/systemsettingssimulator.h
deleted file mode 100644
index cba7a14..0000000
--- a/src/systemsettingssimulator.h
+++ /dev/null
@@ -1,47 +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 SYSTEMSETTINGSSIMULATOR_H
-#define SYSTEMSETTINGSSIMULATOR_H
-
-#include <QDialog>
-#include "include/daynightmode.h"
-#include "daynightmode_proxy.h"
-
-namespace Ui {
-class SystemSettingsSimulator;
-}
-
-class SystemSettingsSimulator : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit SystemSettingsSimulator(QWidget *parent = 0);
- ~SystemSettingsSimulator();
-
-private slots:
- void on_pushButton_Exit_clicked();
- void on_radioButton_DayMode_toggled(bool checked);
-
- void on_radioButton_NightMode_toggled(bool checked);
-
-private:
- Ui::SystemSettingsSimulator *mp_ui;
- org::agl::daynightmode *mp_dBusDayNightMode;
-};
-
-#endif // SYSTEMSETTINGSSIMULATOR_H