Last change
on this file since 10822 was
10822,
checked in by Longinus00, 12 years ago
|
#3298:Prettier formating of percentages
|
-
Property svn:keywords set to
Date Rev Author Id
|
File size:
1.5 KB
|
Line | |
---|
1 | /* |
---|
2 | * This file Copyright (C) 2009-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: utils.h 10822 2010-06-22 22:30:58Z Longinus00 $ |
---|
11 | */ |
---|
12 | |
---|
13 | #ifndef QTR_UTILS |
---|
14 | #define QTR_UTILS |
---|
15 | |
---|
16 | #include <QString> |
---|
17 | #include <QObject> |
---|
18 | #include <QIcon> |
---|
19 | |
---|
20 | #include "speed.h" |
---|
21 | |
---|
22 | class Utils: public QObject |
---|
23 | { |
---|
24 | Q_OBJECT |
---|
25 | |
---|
26 | public: |
---|
27 | Utils( ) { } |
---|
28 | virtual ~Utils( ) { } |
---|
29 | public: |
---|
30 | static QString remoteFileChooser( QWidget * parent, const QString& title, const QString& myPath, bool dir, bool local ); |
---|
31 | static QString sizeToString( double bytes ); |
---|
32 | static QString speedToString( const Speed& speed ); |
---|
33 | static QString percentToString( double x ); |
---|
34 | static QString ratioToString( double ratio ); |
---|
35 | static QString timeToString( int seconds ); |
---|
36 | static const QIcon& guessMimeIcon( const QString& filename ); |
---|
37 | |
---|
38 | // meh |
---|
39 | static void toStderr( const QString& qstr ); |
---|
40 | |
---|
41 | /// |
---|
42 | /// URLs |
---|
43 | /// |
---|
44 | |
---|
45 | static bool isMagnetLink( const QString& s ) { return s.startsWith( "magnet:?" ); } |
---|
46 | |
---|
47 | static bool isURL( const QString& s ) { return s.startsWith( "http://" ) |
---|
48 | || s.startsWith( "https://" ) |
---|
49 | || s.startsWith( "ftp://" ); } |
---|
50 | |
---|
51 | }; |
---|
52 | |
---|
53 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.