Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
util.cpp File Reference
#include "util.h"
#include <QCoreApplication>
#include <QDebug>
#include <QFile>
#include <QTextCodec>
#include "quassel.h"
Include dependency graph for util.cpp:

Go to the source code of this file.

Functions

QString nickFromMask (QString mask)
QString userFromMask (QString mask)
QString hostFromMask (QString mask)
bool isChannelName (QString str)
QString stripFormatCodes (QString str)
 Strip mIRC format codes.
QString stripAcceleratorMarkers (const QString &label_)
 Remove accelerator markers (&) from the string.
QString decodeString (const QByteArray &input, QTextCodec *codec)
 Take a string and decode it using the specified text codec, recognizing utf8.
uint editingDistance (const QString &s1, const QString &s2)
QString secondsToString (int timeInSeconds)
QByteArray prettyDigest (const QByteArray &digest)

Variables

static QList< int > utf8DetectionBlacklist

Function Documentation

QString userFromMask ( QString  mask)
QString hostFromMask ( QString  mask)
QString stripFormatCodes ( QString  str)

Strip mIRC format codes.

Definition at line 64 of file util.cpp.

Referenced by ChannelBufferItem::toolTip().

QString stripAcceleratorMarkers ( const QString &  label_)

Remove accelerator markers (&) from the string.

Definition at line 77 of file util.cpp.

Referenced by ShortcutsModel::data().

QString decodeString ( const QByteArray &  input,
QTextCodec *  codec = 0 
)

Take a string and decode it using the specified text codec, recognizing utf8.

This function takes a string and first checks if it is encoded in utf8, in which case it is decoded appropriately. Otherwise, the specified text codec is used to transform the string.

Parameters
inputThe input string containing encoded data
codecThe text codec we use if the input is not utf8
Returns
The decoded string.

Definition at line 95 of file util.cpp.

References utf8DetectionBlacklist.

uint editingDistance ( const QString &  s1,
const QString &  s2 
)

Definition at line 130 of file util.cpp.

QString secondsToString ( int  timeInSeconds)
QByteArray prettyDigest ( const QByteArray &  digest)

Definition at line 187 of file util.cpp.

References prettyDigest().

Referenced by prettyDigest(), and SslInfoDlg::setCurrentCert().

Variable Documentation

QList<int> utf8DetectionBlacklist
static
Initial value:
QList<int>()
<< 39

Definition at line 33 of file util.cpp.

Referenced by decodeString().