2 * Copyright (C) 2016 Mentor Graphics Development (Deutschland) GmbH
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "controlbarwidget.h"
18 #include "ui_controlbarwidget.h"
19 #include <include/daynightmode.hpp>
20 #include <include/inputevent.hpp>
23 ControlBarWidget::ControlBarWidget(QWidget *parent) :
25 mp_ui(new Ui::ControlBarWidget),
26 mp_dBusInputEventProxy()
30 qDebug("D-Bus: connect to org.agl.homescreenappframeworkbindertizen /AppFramework");
31 mp_dBusInputEventProxy = new org::agl::inputevent("org.agl.inputeventmanager",
33 QDBusConnection::sessionBus(),
37 ControlBarWidget::~ControlBarWidget()
39 delete mp_dBusInputEventProxy;
43 void ControlBarWidget::updateColorScheme()
46 QSettings settings_cs(QApplication::applicationDirPath() +
48 settings.value("systemsettings/colorscheme", "default").toString() +
50 QString::number(settings.value("systemsettings/proximityobjectdetected", false).toBool()) +
52 QString::number(settings.value("systemsettings/daynightmode", SystemDayNight::DAYNIGHTMODE_DAY).toInt()) +
54 QSettings::IniFormat);
57 mp_ui->widget_background->setStyleSheet(settings_cs.value(QString("ControlBarWidget/widget_background_css")).toString());
59 icon.addFile(settings_cs.value(QString("ControlBarWidget/pushButton_homeIcon_icon")).toString(), QSize(), QIcon::Normal, QIcon::Off);
60 mp_ui->pushButton_home->setIcon(icon);
61 mp_ui->pushButton_home->setStyleSheet(settings_cs.value(QString("ControlBarWidget/pushButton_homeIcon_css")).toString());
62 icon.addFile(settings_cs.value(QString("ControlBarWidget/pushButton_settingsIcon_icon")).toString(), QSize(), QIcon::Normal, QIcon::Off);
63 mp_ui->pushButton_settings->setIcon(icon);
64 mp_ui->pushButton_settings->setStyleSheet(settings_cs.value(QString("ControlBarWidget/pushButton_settingsIcon_css")).toString());
65 icon.addFile(settings_cs.value(QString("ControlBarWidget/pushButton_navIcon_icon")).toString(), QSize(), QIcon::Normal, QIcon::Off);
66 mp_ui->pushButton_nav->setIcon(icon);
67 mp_ui->pushButton_nav->setStyleSheet(settings_cs.value(QString("ControlBarWidget/pushButton_navIcon_css")).toString());
70 void ControlBarWidget::on_pushButton_home_clicked()
75 void ControlBarWidget::on_pushButton_settings_clicked()
77 settingsButtonPressed();
80 void ControlBarWidget::on_pushButton_nav_clicked()
82 mp_dBusInputEventProxy->hardKeyPressed(InputEvent::HARDKEY_NAV);