feggclockwidget.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. Copyright (C) 2010 Martin Zuber, zuber@centrum.cz
  3. This application is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU Lesser General Public License as
  5. published by the Free Software Foundation; either version 2.1 of the
  6. License, or (at your option) any later version.
  7. This application is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with This application; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  14. */
  15. #ifndef FEGGCLOCKWIDGET_H
  16. #define FEGGCLOCKWIDGET_H
  17. #include <QWidget>
  18. #include <QTimer>
  19. #include <QTime>
  20. namespace Ui {
  21. class FEggClockWidget;
  22. }
  23. class FEggClockWidget : public QWidget
  24. {
  25. Q_OBJECT
  26. QTimer *m_timer; // local timer for decrementing by second
  27. QTimer *m_alertTimer; // for alert CSS effects
  28. bool m_isRunning; // flag - is the egg clock running
  29. bool m_isAlert; // flag - the clock is in alert mode
  30. QTime m_lastTime; // last set time before the START was pressed
  31. bool m_alertStyleSwitch; // switching alert CSS flag
  32. public:
  33. explicit FEggClockWidget(QWidget *parent = 0);
  34. ~FEggClockWidget();
  35. /**
  36. stops and resets the counter
  37. */
  38. void stopAlertAndReset();
  39. private:
  40. Ui::FEggClockWidget *ui;
  41. void loadPresets();
  42. private slots:
  43. /**
  44. When the reset button is clicked, the clock counter is set to previous value
  45. */
  46. void on_cbPreset_currentIndexChanged(int index);
  47. void on_pbReset_clicked();
  48. /**
  49. Sets clock counter to 00:00:00
  50. */
  51. void on_pbClear_clicked();
  52. /**
  53. Button START/STOP/SNOOZE was pressed
  54. */
  55. void on_pbStart_clicked();
  56. /**
  57. Slot for decrementing by second
  58. */
  59. void onTimerTimeOut();
  60. /**
  61. Slot for alert effects
  62. */
  63. void onAlertTimerTimeOut();
  64. };
  65. #endif // FEGGCLOCKWIDGET_H