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.

66 lines
1.7 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 *exit_btn = new QPushButton(tr("Exit Application"), this);
  24. QPushButton *back_btn = new QPushButton(tr("Back"), this);
  25. mainLayout->addWidget(holiday_btn, 0, 0);
  26. mainLayout->addWidget(exit_btn, 1, 0);
  27. mainLayout->addWidget(back_btn, 1, 1);
  28. connect(holiday_btn, SIGNAL(clicked(void)), this, SIGNAL(show_holiday_dlg(void)));
  29. connect(back_btn, SIGNAL(clicked(void)), this, SIGNAL(closed(void)));
  30. connect(exit_btn, SIGNAL(clicked(void)), this, SLOT(show_confirm_exit_dlg(void)));
  31. holiday_btn->setSizePolicy(*szPolicy);
  32. exit_btn->setSizePolicy(*szPolicy);
  33. back_btn->setSizePolicy(*szPolicy);
  34. QFont font = holiday_btn->font();
  35. font.setPointSize(12);
  36. font.setBold(true);
  37. holiday_btn->setFont(font);
  38. exit_btn->setFont(font);
  39. back_btn->setFont(font);
  40. this->setLayout(mainLayout);
  41. }
  42. void MenuDlg::show_confirm_exit_dlg(void)
  43. {
  44. QMessageBox::StandardButton retval;
  45. retval = QMessageBox::question(this, tr("Exit application"), tr("Are you sure ?"));
  46. if (retval == QMessageBox::Yes)
  47. qApp->quit();
  48. }
  49. MenuDlg::~MenuDlg()
  50. {
  51. }
  52. /* vim: set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab: */