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 "systemsettingssimulator.h"
18 #include "ui_systemsettingssimulator.h"
19 #include "include/daynightmode.h"
22 SystemSettingsSimulator::SystemSettingsSimulator(QWidget *parent) :
24 mp_ui(new Ui::SystemSettingsSimulator),
25 mp_dBusDayNightMode(0)
29 // connect to the dBus interface provided by the main window
30 mp_dBusDayNightMode = new org::agl::daynightmode("org.agl.mainwindow",
32 QDBusConnection::sessionBus(),
36 this->restoreGeometry(settings.value("systemsettingssimulator/geometry").toByteArray());
37 mp_ui->radioButton_DayMode->setChecked(settings.value("systemsettingssimulator/daymode", true).toBool()); // if nothing is stored, use "true"
38 mp_ui->radioButton_NightMode->setChecked(settings.value("systemsettingssimulator/nightmode", false).toBool()); // if nothing is stored, use "false"
41 SystemSettingsSimulator::~SystemSettingsSimulator()
44 settings.setValue("systemsettingssimulator/geometry", saveGeometry());
45 settings.setValue("systemsettingssimulator/daymode", mp_ui->radioButton_DayMode->isChecked());
46 settings.setValue("systemsettingssimulator/nightmode", mp_ui->radioButton_NightMode->isChecked());
48 if (0 == mp_dBusDayNightMode)
50 delete mp_dBusDayNightMode;
55 void SystemSettingsSimulator::on_pushButton_Exit_clicked()
60 void SystemSettingsSimulator::on_radioButton_DayMode_toggled(bool checked)
64 mp_dBusDayNightMode->setDayNightMode(SystemDayNight::DAYNIGHTMODE_DAY);
68 void SystemSettingsSimulator::on_radioButton_NightMode_toggled(bool checked)
72 mp_dBusDayNightMode->setDayNightMode(SystemDayNight::DAYNIGHTMODE_NIGHT);