LeechCraft  0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
util.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include "utilconfig.h"
12 #include <QString>
13 
14 class QTranslator;
15 class QLocale;
16 class QAction;
17 class QImage;
18 class QObject;
19 
20 template<typename T>
21 class QList;
22 
23 class QModelIndex;
24 
25 namespace LC::Util
26 {
29  Q_DECL_IMPORT extern const QString LCLowercase;
30 
40  UTIL_API QString GetAsBase64Src (const QImage& image);
41 
52  UTIL_API QString MakePrettySize (qint64 sourceSize);
53 
68  UTIL_API QString MakePrettySizeShort (qint64 size);
69 
79  UTIL_API QString MakeTimeFromLong (ulong time);
80 
81  UTIL_API QTranslator* LoadTranslator (const QString& base,
82  const QString& locale,
83  const QString& prefix = LCLowercase,
84  const QString& appname = LCLowercase);
85 
104  UTIL_API QTranslator* InstallTranslator (const QString& base,
105  const QString& prefix = LCLowercase,
106  const QString& appname = LCLowercase);
107 
126  UTIL_API QString GetLocaleName ();
127 
128  UTIL_API QString GetInternetLocaleName (const QLocale&);
129 
139  UTIL_API QString GetLanguage ();
140 
142 
150  UTIL_API QAction* CreateSeparator (QObject *parent);
151 }
QString GetAsBase64Src(const QImage &pix)
Returns the given image in a Base64-encoded form.
Definition: util.cpp:30
QAction * CreateSeparator(QObject *parent)
Returns the action that is set to act as a separator.
Definition: util.cpp:214
QString GetLanguage()
Returns the current language name.
Definition: util.cpp:192
QString MakePrettySize(qint64 sourcesize)
Makes a formatted size from number.
Definition: util.cpp:53
#define UTIL_API
Definition: utilconfig.h:16
QString GetLocaleName()
Returns the current locale name, like en_US.
Definition: util.cpp:151
QString MakeTimeFromLong(ulong time)
Makes a formatted time from number.
Definition: util.cpp:79
QString MakePrettySizeShort(qint64 sourcesize)
Converts a bytes count to a string representation with appropriately chosen units.
Definition: util.cpp:66
QTranslator * InstallTranslator(const QString &baseName, const QString &prefix, const QString &appName)
Loads and installs a translator.
Definition: util.cpp:131
QModelIndexList GetSummarySelectedRows(QObject *sender)
Definition: util.cpp:197
const QString LCLowercase
The "leechcraft" literal, with no run-time overhead.
Definition: util.cpp:28
QTranslator * LoadTranslator(const QString &baseName, const QString &localeName, const QString &prefix, const QString &appName)
Definition: util.cpp:91
QString GetInternetLocaleName(const QLocale &locale)
Definition: util.cpp:182