OptionsForm.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * ImageDescriptionForm.cpp
  3. *
  4. * Created on: Oct 11, 2011
  5. * Author: Gapchich Vlad
  6. */
  7. #include "OptionsForm.h"
  8. #include <QCheckBox>
  9. #include <QPushButton>
  10. #include <QBoxLayout>
  11. #include <QMessageBox>
  12. #include <QApplication>
  13. #include <QDesktopWidget>
  14. OptionsForm::OptionsForm(QWidget *aParent)
  15. : QWidget(aParent)
  16. {
  17. setWindowTitle(tr("Options"));
  18. layout_v_ = new QVBoxLayout(this);
  19. layout_h_ = new QHBoxLayout;
  20. auto_color_generation_ = new QCheckBox(this);
  21. auto_color_generation_->setText(tr("Automatic label color generation"));
  22. button_ok_ = new QPushButton(this);
  23. button_ok_->setText(tr("OK"));
  24. button_cancel_ = new QPushButton(this);
  25. button_cancel_->setText(tr("Cancel"));
  26. layout_v_->addWidget(auto_color_generation_);
  27. layout_v_->addLayout(layout_h_);
  28. layout_h_->addWidget(button_ok_);
  29. layout_h_->addWidget(button_cancel_);
  30. connect(
  31. button_ok_,
  32. SIGNAL(clicked()),
  33. this,
  34. SLOT(setOptions())
  35. );
  36. connect(
  37. button_cancel_,
  38. SIGNAL(clicked()),
  39. this,
  40. SLOT(hide())
  41. );
  42. adjustSize();
  43. move(QApplication::desktop()->screen()->rect().center() - rect().center());
  44. }
  45. OptionsForm::~OptionsForm()
  46. {
  47. delete auto_color_generation_;
  48. delete button_ok_;
  49. delete button_cancel_;
  50. delete layout_v_;
  51. }
  52. void
  53. OptionsForm::setOptions()
  54. {
  55. emit optionsSet();
  56. hide();
  57. }
  58. bool
  59. OptionsForm::autoColorGeneration()
  60. {
  61. return auto_color_generation_->isChecked();
  62. }
  63. /*
  64. *
  65. */