1 | /* |
---|
2 | * This file Copyright (C) 2010 Mnemosyne LLC |
---|
3 | * |
---|
4 | * This file is licensed by the GPL version 2. Works owned by the |
---|
5 | * Transmission project are granted a special exemption to clause 2(b) |
---|
6 | * so that the bulk of its code can remain under the MIT license. |
---|
7 | * This exemption does not extend to derived works not owned by |
---|
8 | * the Transmission project. |
---|
9 | * |
---|
10 | * $Id$ |
---|
11 | */ |
---|
12 | |
---|
13 | #ifndef QTR_UNITS |
---|
14 | #define QTR_UNITS |
---|
15 | |
---|
16 | #include <QString> |
---|
17 | #include <QObject> |
---|
18 | #include <QIcon> |
---|
19 | |
---|
20 | class Speed; |
---|
21 | |
---|
22 | class Formatter: public QObject |
---|
23 | { |
---|
24 | Q_OBJECT |
---|
25 | |
---|
26 | public: |
---|
27 | |
---|
28 | Formatter( ) { } |
---|
29 | virtual ~Formatter( ) { } |
---|
30 | |
---|
31 | public: |
---|
32 | |
---|
33 | static QString memToString( double bytes ); |
---|
34 | static QString sizeToString( double bytes ); |
---|
35 | static QString speedToString( const Speed& speed ); |
---|
36 | static QString percentToString( double x ); |
---|
37 | static QString ratioToString( double ratio ); |
---|
38 | static QString timeToString( int seconds ); |
---|
39 | |
---|
40 | public: |
---|
41 | |
---|
42 | static const int speed_K; |
---|
43 | static const QString speed_K_str; |
---|
44 | static const QString speed_M_str; |
---|
45 | static const QString speed_G_str; |
---|
46 | static const QString speed_T_str; |
---|
47 | |
---|
48 | static const int size_K; |
---|
49 | static const QString size_K_str; |
---|
50 | static const QString size_M_str; |
---|
51 | static const QString size_G_str; |
---|
52 | static const QString size_T_str; |
---|
53 | |
---|
54 | static const int mem_K; |
---|
55 | static const QString mem_K_str; |
---|
56 | static const QString mem_M_str; |
---|
57 | static const QString mem_G_str; |
---|
58 | static const QString mem_T_str; |
---|
59 | }; |
---|
60 | |
---|
61 | #endif |
---|