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);
31 ui
.textTrace
->setLayoutDirection(Qt::LeftToRight
);
34 connect(ui
.buttonClose
, SIGNAL(clicked()), this, SLOT(close()));
35 connect(ui
.buttonSave
, SIGNAL(clicked()), this, SLOT(save()));
36 connect(ui
.buttonRefresh
, SIGNAL(clicked()), this, SLOT(refresh()));
39 void SysTrace::refresh(void)
41 int pos
= ui
.textTrace
->verticalScrollBar()->value();
42 ui
.textTrace
->setHtml("<pre>" + debugbuffer
+ "</pre>");
43 ui
.textTrace
->verticalScrollBar()->setValue(pos
);
46 void SysTrace::save(void)
48 QString fp
= QFileDialog::getSaveFileName(this, tr("Save system trace log"),
49 QDir::homePath(), "*.log");
54 if(!fh
.open(QIODevice::WriteOnly
))
56 fh
.write(debugbuffer
.toUtf8(), debugbuffer
.size());
60 void SysTrace::debug(QtMsgType type
, const char* msg
)
63 debugbuffer
.append(msg
);
64 debugbuffer
.append("\n");
66 fprintf(stderr
, "%s\n", msg
);