diff --git a/soft/thermostat/inc/settings.h b/soft/thermostat/inc/settings.h index c329bc0..cfc6c29 100644 --- a/soft/thermostat/inc/settings.h +++ b/soft/thermostat/inc/settings.h @@ -10,10 +10,11 @@ #define SETTINGS_H #include +#include -class Settings +class Settings : public QSettings { - + Q_OBJECT public: static Settings *getInstance(void); diff --git a/soft/thermostat/src/mainwindow.cpp b/soft/thermostat/src/mainwindow.cpp index 87d0336..4647286 100644 --- a/soft/thermostat/src/mainwindow.cpp +++ b/soft/thermostat/src/mainwindow.cpp @@ -12,22 +12,24 @@ #include #include "zoneitem.h" +#include "settings.h" #include "mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { + Settings *s = Settings::getInstance(); /* * Sensors-related layout */ QGridLayout *mainLayout = new QGridLayout; - mainLayout->addWidget(new ZoneItem(tr("Living room"), this), 0, 0); - mainLayout->addWidget(new ZoneItem(tr("Workspace"), this), 0, 1); + mainLayout->addWidget(new ZoneItem(s->m_rooms_names[0], this), 0, 0); + mainLayout->addWidget(new ZoneItem(s->m_rooms_names[1], this), 0, 1); mainLayout->addWidget(new QPushButton(tr("Menu")), 0, 2); - mainLayout->addWidget(new ZoneItem(tr("Bathroom"), this), 1, 0); - mainLayout->addWidget(new ZoneItem(tr("Bedroom"), this), 1, 1); + mainLayout->addWidget(new ZoneItem(s->m_rooms_names[2], this), 1, 0); + mainLayout->addWidget(new ZoneItem(s->m_rooms_names[3], this), 1, 1); mainLayout->addWidget(new QPushButton(tr("Auto")), 1, 2); QWidget *mainWidget = new QWidget; diff --git a/soft/thermostat/src/settings.cpp b/soft/thermostat/src/settings.cpp index 88a5e57..8a5205e 100644 --- a/soft/thermostat/src/settings.cpp +++ b/soft/thermostat/src/settings.cpp @@ -6,6 +6,7 @@ * */ +#include #include #include @@ -15,10 +16,10 @@ Settings *Settings::_singleton = NULL; Settings::Settings() { - m_rooms_names << QString("Chambe So"); - m_rooms_names << QString("Chambe Rico"); - m_rooms_names << QString("Salon"); - m_rooms_names << QString("Salle de bain"); + m_rooms_names << QString(tr("Bedroom")); + m_rooms_names << QString(tr("Workspace")); + m_rooms_names << QString(tr("Living room")); + m_rooms_names << QString(tr("Bathroom")); m_sensor_topics << QString::fromUtf8("sensors/chambre_so/xiaomi"); m_sensor_topics << QString::fromUtf8("sensors/chambre_rico/xiaomi"); m_sensor_topics << QString::fromUtf8("sensors/salon/xiaomi");