X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=HomeScreen%2Fsrc%2Fcontrolbarwidget.cpp;fp=src%2Fcontrolbarwidget.cpp;h=e01fe265f4047a1222b2f66e6ca6618697d79ca0;hb=ca3605ea664834acdf712e691be8f0358b1c6b6f;hp=4627a7bb83321770003ad9eb942468199fb52ec1;hpb=ff25a2a06428ffb0d6d8aeddb5faaa301b4201fe;p=staging%2FHomeScreen.git diff --git a/src/controlbarwidget.cpp b/HomeScreen/src/controlbarwidget.cpp similarity index 68% rename from src/controlbarwidget.cpp rename to HomeScreen/src/controlbarwidget.cpp index 4627a7b..e01fe26 100644 --- a/src/controlbarwidget.cpp +++ b/HomeScreen/src/controlbarwidget.cpp @@ -21,34 +21,30 @@ 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) + mp_dayNightModeProxy(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"); + // this has to be adopted to the system setup + mp_dayNightModeProxy = new org::agl::daynightmode("org.agl.homescreen.simulator", //"org.agl.systeminfoprovider" + "/", + QDBusConnection::sessionBus(), + 0); + QObject::connect(mp_dayNightModeProxy, SIGNAL(dayNightMode(int)), this, SLOT(dayNightModeSlot(int))); mp_ui->setupUi(this); } ControlBarWidget::~ControlBarWidget() { - delete mp_daynightmodeAdaptor; + delete mp_dayNightModeProxy; if (0 != mp_settingsWidget) { delete mp_settingsWidget; } - if (0 == mp_dBusDayNightMode_SettingsWidget) - { - delete mp_dBusDayNightMode_SettingsWidget; - } delete mp_ui; } -void ControlBarWidget::setDayNightMode(int mode) +void ControlBarWidget::dayNightModeSlot(int mode) { QIcon icon; switch (mode) @@ -74,12 +70,6 @@ void ControlBarWidget::setDayNightMode(int mode) 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() @@ -91,16 +81,6 @@ void ControlBarWidget::on_pushButton_Settings_clicked() 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()