1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
9 * Copyright (C) 2007 by Dominik Riebeling
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
22 #include "ui_systracefrm.h"
25 QString
SysTrace::debugbuffer
;
27 SysTrace::SysTrace(QWidget
*parent
) : QDialog(parent
)
30 ui
.textTrace
->setReadOnly(true);
33 connect(ui
.buttonClose
, SIGNAL(clicked()), this, SLOT(close()));
34 connect(ui
.buttonSave
, SIGNAL(clicked()), this, SLOT(save()));
35 connect(ui
.buttonRefresh
, SIGNAL(clicked()), this, SLOT(refresh()));
38 void SysTrace::refresh(void)
40 int pos
= ui
.textTrace
->verticalScrollBar()->value();
41 ui
.textTrace
->setHtml("<pre>" + debugbuffer
+ "</pre>");
42 ui
.textTrace
->verticalScrollBar()->setValue(pos
);
45 void SysTrace::save(void)
47 QString fp
= QFileDialog::getSaveFileName(this, tr("Save system trace log"),
48 QDir::homePath(), "*.log");
51 fh
.open(QIODevice::WriteOnly
);
52 fh
.write(debugbuffer
.toUtf8(), debugbuffer
.size());
56 void SysTrace::debug(QtMsgType type
, const char* msg
)
59 debugbuffer
.append(msg
);
60 debugbuffer
.append("\n");
62 fprintf(stderr
, "%s\n", msg
);