35 #include <QModelIndex> 36 #include <QtXml/QDomElement> 107 const QString& locale,
108 const QString& prefix =
"leechcraft",
109 const QString& appname =
"leechcraft");
130 const QString& prefix =
"leechcraft",
131 const QString& appname =
"leechcraft");
178 UTIL_API QPixmap
DrawOverlayText (QPixmap px,
const QString& text, QFont font,
const QPen& pen,
const QBrush& brush);
212 template<
typename TagGetter,
typename TagSetter>
215 QDomDocument& document,
216 const QString& elementName,
222 qWarning () << Q_FUNC_INFO
225 return node.toElement ();
228 QDomNodeList elements = node.childNodes ();
229 for (
int i = 0; i < elements.size (); ++i)
231 QDomElement elem = elements.at (i).toElement ();
232 if (tagGetter (elem) == tags.at (0))
234 if (tags.size () > 1)
236 QStringList childTags = tags;
237 childTags.removeAt (0);
239 document, elementName,
240 tagGetter, tagSetter);
247 QDomElement result = document.createElement (elementName);
248 tagSetter (result, tags.at (0));
249 node.appendChild (result);
250 if (tags.size () > 1)
252 QStringList childTags = tags;
253 childTags.removeAt (0);
255 document, elementName,
256 tagGetter, tagSetter);
UTIL_API QString GetInternetLocaleName(const QLocale &)
UTIL_API QAction * CreateSeparator(QObject *parent)
Returns the action that is set to act as a separator.
UTIL_API QString GetAsBase64Src(const QImage &image)
Returns the given image in a Base64-encoded form.
UTIL_API QString GetLanguage()
Returns the current language name.
UTIL_API QPixmap DrawOverlayText(QPixmap px, const QString &text, QFont font, const QPen &pen, const QBrush &brush)
UTIL_API QString GetLocaleName()
Returns the current locale name, like en_US.
UTIL_API QTranslator * InstallTranslator(const QString &base, const QString &prefix="leechcraft", const QString &appname="leechcraft")
Loads and installs a translator.
QDomElement GetElementForTags(const QStringList &tags, QDomNode &node, QDomDocument &document, const QString &elementName, TagGetter tagGetter, TagSetter tagSetter)
Returns an element for a given tags list.
UTIL_API QString MakePrettySizeShort(qint64 size)
Converts a bytes count to a string representation with appropriately chosen units.
UTIL_API QModelIndexList GetSummarySelectedRows(QObject *sender)
UTIL_API QString MakeTimeFromLong(ulong time)
Makes a formatted time from number.
UTIL_API QString MakePrettySize(qint64 sourceSize)
Makes a formatted size from number.
UTIL_API QString GetUserText(const Entity &entity)
Return the user-readable representation of the entity.
UTIL_API QTranslator * LoadTranslator(const QString &base, const QString &locale, const QString &prefix="leechcraft", const QString &appname="leechcraft")