1 | /* |
2 | This file is part of the KDE Frameworks |
3 | |
4 | SPDX-FileCopyrightText: 2013 Alex Merry <alex.merry@kdemail.net> |
5 | SPDX-FileCopyrightText: 2013 John Layt <jlayt@kde.org> |
6 | SPDX-FileCopyrightText: 2010 Michael Leupold <lemma@confuego.org> |
7 | SPDX-FileCopyrightText: 2009 Michael Pyne <mpyne@kde.org> |
8 | SPDX-FileCopyrightText: 2008 Albert Astals Cid <aacid@kde.org> |
9 | |
10 | SPDX-License-Identifier: LGPL-2.0-or-later |
11 | */ |
12 | |
13 | #ifndef KFORMATPRIVATE_P_H |
14 | #define KFORMATPRIVATE_P_H |
15 | |
16 | #include "kformat.h" |
17 | |
18 | #include <QCoreApplication> // for Q_DECLARE_TR_FUNCTIONS |
19 | |
20 | class KFormatPrivate : public QSharedData |
21 | { |
22 | Q_DECLARE_TR_FUNCTIONS(KFormat) |
23 | |
24 | public: |
25 | explicit KFormatPrivate(const QLocale &locale); |
26 | virtual ~KFormatPrivate(); |
27 | |
28 | QString formatByteSize(double size, int precision, KFormat::BinaryUnitDialect dialect, KFormat::BinarySizeUnits units) const; |
29 | |
30 | QString |
31 | formatValue(double value, KFormat::Unit unit, QString unitString, int precision, KFormat::UnitPrefix prefix, KFormat::BinaryUnitDialect dialect) const; |
32 | |
33 | QString formatDuration(quint64 msecs, KFormat::DurationFormatOptions options) const; |
34 | |
35 | QString formatDecimalDuration(quint64 msecs, int decimalPlaces) const; |
36 | |
37 | QString formatSpelloutDuration(quint64 msecs) const; |
38 | |
39 | QString formatRelativeDate(const QDate &date, QLocale::FormatType format) const; |
40 | |
41 | QString formatRelativeDateTime(const QDateTime &dateTime, QLocale::FormatType format) const; |
42 | |
43 | private: |
44 | QLocale m_locale; |
45 | }; |
46 | |
47 | #endif // KFORMATPRIVATE_P_H |
48 | |