DefaultMainWindow.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * NICE-Core - efficient algebra and computer vision methods
  3. * - libimagedisplay - An imagedisplay/template for new NICE libraries
  4. * See file License for license information.
  5. */
  6. #include "core/imagedisplay/DefaultMainWindow.h"
  7. #include <qapplication.h>
  8. #include <qpushbutton.h>
  9. #include <core/imagedisplay/ImageDisplayManager.h>
  10. #include <core/imagedisplay/ImageDisplayManagerWidget.h>
  11. namespace NICE {
  12. DefaultMainWindow::DefaultMainWindow(const char* title) : QWidget(NULL, NULL) {
  13. setWindowTitle(title);
  14. // create a timer waking us regularly
  15. timer.reset(new QTimer(this));
  16. timer->connect(timer.get(), SIGNAL(timeout()),
  17. this, SLOT(timerSlot()));
  18. timerIntervalMS = 0;
  19. timer->start(timerIntervalMS);
  20. //ImageDisplayManagerWidget* manager =
  21. //new ImageDisplayManagerWidget(this, "image manager");
  22. }
  23. DefaultMainWindow::~DefaultMainWindow() {
  24. timer->stop();
  25. }
  26. //void DefaultMainWindow::closeEvent(QCloseEvent* e) {
  27. // e->accept();
  28. // qApp->quit();
  29. //}
  30. void DefaultMainWindow::timerSlot() {
  31. int nextSleepMS = timerIntervalMS;
  32. loop(nextSleepMS);
  33. if (nextSleepMS < 0) {
  34. timer->stop();
  35. } else if (nextSleepMS != timerIntervalMS) {
  36. timerIntervalMS = nextSleepMS;
  37. timer->start(timerIntervalMS);
  38. }
  39. }
  40. void DefaultMainWindow::loop(int& nextSleepMS) {
  41. nextSleepMS = -1;
  42. }
  43. } // namespace