35 #include <QModelIndex> 36 #include <QtXml/QDomElement> 56 return QString::fromUtf8 (str.c_str ());
118 const QString& locale,
119 const QString& prefix =
"leechcraft",
120 const QString& appname =
"leechcraft");
141 const QString& prefix =
"leechcraft",
142 const QString& appname =
"leechcraft");
189 UTIL_API QPixmap
DrawOverlayText (QPixmap px,
const QString& text, QFont font,
const QPen& pen,
const QBrush& brush);
223 template<
typename TagGetter,
typename TagSetter>
226 QDomDocument& document,
227 const QString& elementName,
233 qWarning () << Q_FUNC_INFO
236 return node.toElement ();
239 QDomNodeList elements = node.childNodes ();
240 for (
int i = 0; i < elements.size (); ++i)
242 QDomElement elem = elements.at (i).toElement ();
243 if (tagGetter (elem) == tags.at (0))
245 if (tags.size () > 1)
247 QStringList childTags = tags;
248 childTags.removeAt (0);
250 document, elementName,
251 tagGetter, tagSetter);
258 QDomElement result = document.createElement (elementName);
259 tagSetter (result, tags.at (0));
260 node.appendChild (result);
261 if (tags.size () > 1)
263 QStringList childTags = tags;
264 childTags.removeAt (0);
266 document, elementName,
267 tagGetter, tagSetter);
UTIL_API QString MakePrettySize(qint64 sourceSize)
Makes a formatted size from number.
UTIL_API QTranslator * LoadTranslator(const QString &base, const QString &locale, const QString &prefix="leechcraft", const QString &appname="leechcraft")
UTIL_API QString MakePrettySizeShort(qint64 size)
Converts a bytes count to a string representation with appropriately chosen units.
UTIL_API QString GetLocaleName()
Returns the current locale name, like en_US.
UTIL_API QString MakeTimeFromLong(ulong time)
Makes a formatted time from number.
UTIL_API QString GetLanguage()
Returns the current language name.
UTIL_API QString GetInternetLocaleName(const QLocale &)
UTIL_API QTranslator * InstallTranslator(const QString &base, const QString &prefix="leechcraft", const QString &appname="leechcraft")
Loads and installs a translator.
UTIL_API QAction * CreateSeparator(QObject *parent)
Returns the action that is set to act as a separator.
UTIL_API QString GetUserText(const Entity &entity)
Return the user-readable representation of the entity.
UTIL_API QPixmap DrawOverlayText(QPixmap px, const QString &text, QFont font, const QPen &pen, const QBrush &brush)
UTIL_API QString GetAsBase64Src(const QImage &image)
Returns the given image in a Base64-encoded form.
UTIL_API QModelIndexList GetSummarySelectedRows(QObject *sender)
A message used for inter-plugin communication.
QDomElement GetElementForTags(const QStringList &tags, QDomNode &node, QDomDocument &document, const QString &elementName, TagGetter tagGetter, TagSetter tagSetter)
Returns an element for a given tags list.
QString FromStdString(const std::string &str)
An utility function that creates a QString from UTF8-encoded std::string.