File: dtimeunitformatter.h

package info (click to toggle)
dtk6core 6.0.31-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,696 kB
  • sloc: cpp: 20,987; ansic: 183; python: 68; xml: 58; makefile: 26; sh: 15
file content (36 lines) | stat: -rw-r--r-- 758 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later

#ifndef DTIMEUNITFORMATTER_H
#define DTIMEUNITFORMATTER_H

#include "dtkcore_global.h"
#include "dabstractunitformatter.h"

DCORE_BEGIN_NAMESPACE

class LIBDTKCORESHARED_EXPORT DTimeUnitFormatter : public DAbstractUnitFormatter
{
public:
    DTimeUnitFormatter();

    enum TimeUnits
    {
        Seconds,
        Minute,
        Hour,
        Day,
    };

    QString unitStr(int unitId) const override;

protected:
    int unitMax() const override { return Day; }
    int unitMin() const override { return Seconds; }
    uint unitConvertRate(int unitId) const override;
};

DCORE_END_NAMESPACE

#endif // DTIMEUNITFORMATTER_H