summaryrefslogtreecommitdiffstats
path: root/utils/wpseditor/gui/src/utils.cpp
blob: f18442555b57805338d800942dd12ea5b9ad2cb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "utils.h"
#include <QPointer>
#include <QtGlobal>
#include "qwpseditorwindow.h"

extern QPointer<QWpsEditorWindow> win;

int qlogger(const char* fmt,...) {
    va_list ap;
    va_start(ap, fmt);
    QString s;
    s.vsprintf(fmt,ap);
    va_end(ap);
    s.replace("\n","");
    //qDebug()<<s;
    if (win==0)
        qDebug()<<s;
    if (s.indexOf("ERR")>=0)
        s = "<font color=red>"+s+"</font>";
    if (win!=0)
        win->logMsg(s);
    va_end(ap);
    return s.length();
}

int qlogger(const QString& s) {
    return qlogger(s.toAscii().data());
}