show the skin buffer size as well as the used amount in the rockbox info screen
[kugel-rb.git] / rbutil / rbutilqt / systrace.cpp
blob42babfe2f889a9a9a809ad630ab02514cb1f2da1
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2007 by Dominik Riebeling
10 * $Id$
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 ****************************************************************************/
20 #include <QtGui>
21 #include "systrace.h"
22 #include "ui_systracefrm.h"
25 QString SysTrace::debugbuffer;
27 SysTrace::SysTrace(QWidget *parent) : QDialog(parent)
29 ui.setupUi(this);
30 ui.textTrace->setReadOnly(true);
31 refresh();
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");
50 QFile fh(fp);
51 fh.open(QIODevice::WriteOnly);
52 fh.write(debugbuffer.toUtf8(), debugbuffer.size());
53 fh.close();
56 void SysTrace::debug(QtMsgType type, const char* msg)
58 (void)type;
59 debugbuffer.append(msg);
60 debugbuffer.append("\n");
61 #if !defined(NODEBUG)
62 fprintf(stderr, "%s\n", msg);
63 #endif