X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Futil.h;h=bb90355e76e3a3f69f8e273009233d819bad8217;hp=36ef8139694005a1574dd2a933146d9c22463866;hb=800b9cc3f9730953c74156f31aeff4d59ec7bade;hpb=665faa937a52fc6175741292737c4a52875b4f75 diff --git a/src/common/util.h b/src/common/util.h index 36ef8139..bb90355e 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005/06 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -15,25 +15,28 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef UTIL_H #define UTIL_H #include -#include #include #include #include - // TODO Use versions from Network instead QString nickFromMask(QString mask); QString userFromMask(QString mask); QString hostFromMask(QString mask); bool isChannelName(QString str); +//! Strip mIRC format codes +QString stripFormatCodes(QString); + +//! Remove accelerator markers (&) from the string +QString stripAcceleratorMarkers(const QString &); QString secondsToString(int timeInSeconds); @@ -48,10 +51,28 @@ QString decodeString(const QByteArray &input, QTextCodec *codec = 0); uint editingDistance(const QString &s1, const QString &s2); -QByteArray methodName(const QMetaMethod &method); +template +QVariantList toVariantList(const QList &list) +{ + QVariantList variants; + for (int i = 0; i < list.count(); i++) { + variants << QVariant::fromValue(list[i]); + } + return variants; +} + + +template +QList fromVariantList(const QVariantList &variants) +{ + QList list; + for (int i = 0; i < variants.count(); i++) { + list << variants[i].value(); + } + return list; +} -QDir quasselDir(); -void loadTranslation(const QLocale &locale); +QByteArray prettyDigest(const QByteArray &digest); #endif