-
Notifications
You must be signed in to change notification settings - Fork 4
/
cconsole.cpp
62 lines (46 loc) · 1.2 KB
/
cconsole.cpp
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "cconsole.h"
#include "stdarg.h"
CConsole *pcDebug;
///////////////////////////////////
CConsole::CConsole(QWidget *parent) :
///////////////////////////////////
QWidget(parent)
{
setWindowTitle("Skytech X Log Window");
resize(512, 320);
setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint);
QBoxLayout *b = new QBoxLayout(QBoxLayout::LeftToRight, this);
m_edit = new QTextEdit;
m_edit->setStyleSheet("background:black");
m_edit->setReadOnly(true);
b->addWidget(m_edit);
showMinimized();
write("Skytech X Log");
write("");
}
////////////////////////////////////
void CConsole::write(const char *str, ...)
////////////////////////////////////
{
va_list va;
char temp[512];
va_start(va, str);
vsprintf(temp, str, va);
va_end(va);
m_edit->setTextColor(Qt::white);
m_edit->append(temp);
qDebug(temp);
}
/////////////////////////////////////////
void CConsole::writeError(const char *str, ...)
/////////////////////////////////////////
{
va_list va;
char temp[512];
va_start(va, str);
vsprintf(temp, str, va);
va_end(va);
m_edit->setTextColor(Qt::red);
m_edit->append(temp);
qDebug("ERR : %s", temp);
}