dee0207d1bb36edf47261cf3908566bfe484280d
[staging/HomeScreen.git] / HomeScreen / src / controlbarwidget.cpp
1 /*
2  * Copyright (C) 2016 Mentor Graphics Development (Deutschland) GmbH
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #include "controlbarwidget.h"
18 #include "ui_controlbarwidget.h"
19 #include "../interfaces/daynightmode.h"
20 #include <QSettings>
21
22 ControlBarWidget::ControlBarWidget(QWidget *parent) :
23     QWidget(parent),
24     mp_ui(new Ui::ControlBarWidget)
25 {
26     mp_ui->setupUi(this);
27 }
28
29 ControlBarWidget::~ControlBarWidget()
30 {
31     delete mp_ui;
32 }
33
34 void ControlBarWidget::updateColorScheme()
35 {
36     QSettings settings;
37     QSettings settings_cs(QApplication::applicationDirPath() +
38                           "/colorschemes/" +
39                           settings.value("systemsettings/colorscheme", "default").toString() +
40                           "/" +
41                           QString::number(settings.value("systemsettings/daynightmode", SystemDayNight::DAYNIGHTMODE_DAY).toInt()) +
42                           ".ini",
43                           QSettings::IniFormat);
44
45     QIcon icon;
46     mp_ui->widget_Background->setStyleSheet(settings_cs.value(QString("ControlBarWidget/widget_Background")).toString());
47
48     icon.addFile(settings_cs.value(QString("ControlBarWidget/pushButton_Home")).toString(), QSize(), QIcon::Normal, QIcon::Off);
49     mp_ui->pushButton_Home->setIcon(icon);
50     icon.addFile(settings_cs.value(QString("ControlBarWidget/pushButton_Settings")).toString(), QSize(), QIcon::Normal, QIcon::Off);
51     mp_ui->pushButton_Settings->setIcon(icon);
52 }
53
54 void ControlBarWidget::on_pushButton_Settings_clicked()
55 {
56     emit settingsButtonPressed();
57 }
58
59 void ControlBarWidget::on_pushButton_Home_clicked()
60 {
61     emit homeButtonPressed();
62 }