Thermostat pour piloter jusqu'à 4 radiateurs avec fil pilote
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.2 KiB

  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. /*
  3. * Qt mutizone MQTT thermostat
  4. *
  5. * Copyright (C) 2020 Richard Genoud
  6. *
  7. */
  8. #include <QApplication>
  9. #include <QPushButton>
  10. #include <QMessageBox>
  11. #include <QGridLayout>
  12. #include <QLocale>
  13. #include "settings.h"
  14. #include "menu_dlg.h"
  15. MenuDlg::MenuDlg(QWidget *parent, Qt::WindowFlags f) :
  16. QWidget(parent, f)
  17. {
  18. QSizePolicy *szPolicy = new QSizePolicy(QSizePolicy::Minimum,
  19. QSizePolicy::MinimumExpanding,
  20. QSizePolicy::PushButton);
  21. QGridLayout *mainLayout = new QGridLayout;
  22. QPushButton *holiday_btn = new QPushButton(tr("Holidays"), this);
  23. QPushButton *save_cfg_btn = new QPushButton(tr("Save configuration"), this);
  24. QPushButton *load_cfg_btn = new QPushButton(tr("Load configuration"), this);
  25. QPushButton *exit_btn = new QPushButton(tr("Exit Application"), this);
  26. QPushButton *back_btn = new QPushButton(tr("Back"), this);
  27. mainLayout->addWidget(holiday_btn, 0, 0);
  28. mainLayout->addWidget(save_cfg_btn, 0, 1);
  29. mainLayout->addWidget(load_cfg_btn, 0, 2);
  30. mainLayout->addWidget(exit_btn, 1, 0);
  31. mainLayout->addWidget(back_btn, 1, 2);
  32. connect(holiday_btn, SIGNAL(clicked(void)), this, SIGNAL(show_holiday_dlg(void)));
  33. connect(save_cfg_btn, SIGNAL(clicked(void)), this, SIGNAL(show_save_cfg_dlg(void)));
  34. connect(load_cfg_btn, SIGNAL(clicked(void)), this, SIGNAL(show_load_cfg_dlg(void)));
  35. connect(back_btn, SIGNAL(clicked(void)), this, SIGNAL(closed(void)));
  36. connect(exit_btn, SIGNAL(clicked(void)), this, SLOT(show_confirm_exit_dlg(void)));
  37. holiday_btn->setSizePolicy(*szPolicy);
  38. save_cfg_btn->setSizePolicy(*szPolicy);
  39. load_cfg_btn->setSizePolicy(*szPolicy);
  40. exit_btn->setSizePolicy(*szPolicy);
  41. back_btn->setSizePolicy(*szPolicy);
  42. QFont font = holiday_btn->font();
  43. font.setPointSize(12);
  44. font.setBold(true);
  45. holiday_btn->setFont(font);
  46. save_cfg_btn->setFont(font);
  47. load_cfg_btn->setFont(font);
  48. exit_btn->setFont(font);
  49. back_btn->setFont(font);
  50. this->setLayout(mainLayout);
  51. }
  52. void MenuDlg::show_confirm_exit_dlg(void)
  53. {
  54. QMessageBox::StandardButton retval;
  55. retval = QMessageBox::question(this, tr("Exit application"), tr("Are you sure ?"));
  56. if (retval == QMessageBox::Yes)
  57. qApp->quit();
  58. }
  59. MenuDlg::~MenuDlg()
  60. {
  61. }
  62. /* vim: set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab: */