| 1 |
// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-3.0-or-later |
| 4 |
|
| 5 |
#ifndef DTIMEUNITFORMATTER_H |
| 6 |
#define DTIMEUNITFORMATTER_H |
| 7 |
|
| 8 |
#include "dtkcore_global.h" |
| 9 |
#include "dabstractunitformatter.h" |
| 10 |
|
| 11 |
DCORE_BEGIN_NAMESPACE |
| 12 |
|
| 13 |
class LIBDTKCORESHARED_EXPORT DTimeUnitFormatter : public DAbstractUnitFormatter |
| 14 |
{ |
| 15 |
public: |
| 16 |
DTimeUnitFormatter(); |
| 17 |
|
| 18 |
enum TimeUnits |
| 19 |
{ |
| 20 |
Seconds, |
| 21 |
Minute, |
| 22 |
Hour, |
| 23 |
Day, |
| 24 |
}; |
| 25 |
|
| 26 |
QString unitStr(int unitId) const override; |
| 27 |
|
| 28 |
protected: |
| 29 |
int unitMax() const override { return Day; } |
| 30 |
int unitMin() const override { return Seconds; } |
| 31 |
uint unitConvertRate(int unitId) const override; |
| 32 |
}; |
| 33 |
|
| 34 |
DCORE_END_NAMESPACE |
| 35 |
|
| 36 |
#endif // DTIMEUNITFORMATTER_H |