| 1 | /*********************************************************************** |
| 2 | * |
| 3 | * Copyright (C) 2010-2017 Innocent De Marchi <[email protected]> |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | * |
| 18 | ***********************************************************************/ |
| 19 | #ifndef RELLOTGE_H |
| 20 | #define RELLOTGE_H |
| 21 | |
| 22 | #include <QtGui> |
| 23 | #include <QLabel> |
| 24 | |
| 25 | |
| 26 | class QTimer; |
| 27 | |
| 28 | class Rellotge : public QLabel |
| 29 | { |
| 30 | Q_OBJECT |
| 31 | |
| 32 | public: |
| 33 | Rellotge(QWidget * parent = 0, Qt::WindowFlags f = 0 ); |
| 34 | |
| 35 | void iniciaRellotge(); |
| 36 | void reIniciaRellotge(); |
| 37 | void aturaRellotge(); |
| 38 | /* |
| 39 | Si tipus=0 retorna el temps amb format |
| 40 | tipus=1 retorna nomès el temps |
| 41 | */ |
| 42 | QString retornaTemps(int tipus=0); |
| 43 | void estableixTemps(QString temps); |
| 44 | |
| 45 | bool rellotgeEnMarxa(); |
| 46 | |
| 47 | int get_minuts() const{ |
| 48 | return minuts; |
| 49 | } |
| 50 | int get_segons() const{ |
| 51 | return segons; |
| 52 | } |
| 53 | // int get_milisegons10() const{ |
| 54 | // return milisegons10; |
| 55 | // } |
| 56 | |
| 57 | int retornarSegonsTotals(); |
| 58 | |
| 59 | private slots: |
| 60 | void actualitzaRellotge(); |
| 61 | |
| 62 | private: |
| 63 | QTimer *rellotgeQTimer; |
| 64 | int hores,minuts,segons,milisegons10; |
| 65 | |
| 66 | bool p_rellotgeEnMarxa; |
| 67 | |
| 68 | |
| 69 | }; |
| 70 | |
| 71 | #endif // RELLOTGE_H |