diff --git a/rbutil/rbutilqt/main.cpp b/rbutil/rbutilqt/main.cpp index 0b720d6..086dc65 100644 --- a/rbutil/rbutilqt/main.cpp +++ b/rbutil/rbutilqt/main.cpp @@ -20,13 +20,17 @@ #include #include "rbutilqt.h" +#include "systrace.h" #ifdef STATIC #include Q_IMPORT_PLUGIN(qtaccessiblewidgets) #endif + + int main( int argc, char ** argv ) { + qInstallMsgHandler(SysTrace::debug); QApplication app( argc, argv ); #if defined(Q_OS_MAC) QDir dir(QApplication::applicationDirPath()); diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index c8513b1..c192ae8 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp @@ -33,6 +33,7 @@ #include "utils.h" #include "rbzip.h" #include "sysinfo.h" +#include "systrace.h" #include "detect.h" #include "rbsettings.h" @@ -122,6 +123,7 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) connect(ui.actionRemove_bootloader, SIGNAL(triggered()), this, SLOT(uninstallBootloader())); connect(ui.actionUninstall_Rockbox, SIGNAL(triggered()), this, SLOT(uninstall())); connect(ui.action_System_Info, SIGNAL(triggered()), this, SLOT(sysinfo())); + connect(ui.action_Trace, SIGNAL(triggered()), this, SLOT(trace())); #if !defined(STATIC) ui.actionInstall_Rockbox_Utility_on_player->setEnabled(false); @@ -132,6 +134,13 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) } +void RbUtilQt::trace(void) +{ + SysTrace *t = new SysTrace(this); + t->show(); +} + + void RbUtilQt::sysinfo(void) { Sysinfo *info = new Sysinfo(this); diff --git a/rbutil/rbutilqt/rbutilqt.h b/rbutil/rbutilqt/rbutilqt.h index 10bef6e..b5368c9 100644 --- a/rbutil/rbutilqt/rbutilqt.h +++ b/rbutil/rbutilqt/rbutilqt.h @@ -41,7 +41,7 @@ class RbUtilQt : public QMainWindow private: Ui::RbUtilQtFrm ui; - + void initDeviceNames(void); QString deviceName(QString); QString platform; @@ -67,6 +67,7 @@ class RbUtilQt : public QMainWindow void about(void); void help(void); void sysinfo(void); + void trace(void); void configDialog(void); void updateDevice(void); void updateSettings(void); diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro index 3edcbdc..dcfbccf 100644 --- a/rbutil/rbutilqt/rbutilqt.pro +++ b/rbutil/rbutilqt/rbutilqt.pro @@ -76,6 +76,7 @@ SOURCES += rbutilqt.cpp \ base/rbzip.cpp \ base/detect.cpp \ sysinfo.cpp \ + systrace.cpp \ base/bootloaderinstallbase.cpp \ base/bootloaderinstallmi4.cpp \ base/bootloaderinstallhex.cpp \ @@ -127,6 +128,7 @@ HEADERS += rbutilqt.h \ base/rbunzip.h \ base/rbzip.h \ sysinfo.h \ + systrace.h \ base/detect.h \ base/bootloaderinstallbase.h \ base/bootloaderinstallmi4.h \ @@ -151,7 +153,8 @@ dbg { } !dbg { CONFIG += release thread qt - DEFINES += QT_NO_DEBUG_OUTPUT + DEFINES -= QT_NO_DEBUG_OUTPUT + DEFINES += NODEBUG message("release") } @@ -168,7 +171,8 @@ FORMS += rbutilqtfrm.ui \ uninstallfrm.ui \ previewfrm.ui \ createvoicefrm.ui \ - sysinfofrm.ui + sysinfofrm.ui \ + systracefrm.ui RESOURCES += rbutilqt.qrc win32 { diff --git a/rbutil/rbutilqt/rbutilqtfrm.ui b/rbutil/rbutilqt/rbutilqtfrm.ui index ba94259..013da62 100644 --- a/rbutil/rbutilqt/rbutilqtfrm.ui +++ b/rbutil/rbutilqt/rbutilqtfrm.ui @@ -13,7 +13,8 @@ Rockbox Utility - :/icons/rockbox-1.png + + :/icons/rockbox-1.png:/icons/rockbox-1.png @@ -22,16 +23,7 @@ 6 - - 0 - - - 0 - - - 0 - - + 0 @@ -39,7 +31,7 @@ Qt::Horizontal - + 40 20 @@ -62,7 +54,7 @@ Qt::Horizontal - + 40 20 @@ -103,7 +95,7 @@ Qt::Horizontal - + 40 20 @@ -117,7 +109,8 @@ &Change - :/icons/edit-find.png + + :/icons/edit-find.png:/icons/edit-find.png @@ -143,7 +136,8 @@ Complete Installation - :/icons/bootloader_btn.png + + :/icons/bootloader_btn.png:/icons/bootloader_btn.png @@ -172,7 +166,8 @@ Minimal Installation - :/icons/rbinstall_btn.png + + :/icons/rbinstall_btn.png:/icons/rbinstall_btn.png @@ -200,7 +195,7 @@ Qt::Vertical - + 20 91 @@ -213,7 +208,7 @@ Qt::Vertical - + 20 81 @@ -237,7 +232,8 @@ Install Bootloader - :/icons/bootloader_btn.png + + :/icons/bootloader_btn.png:/icons/bootloader_btn.png @@ -266,7 +262,8 @@ Install Rockbox - :/icons/rbinstall_btn.png + + :/icons/rbinstall_btn.png:/icons/rbinstall_btn.png @@ -297,7 +294,7 @@ Qt::Vertical - + 20 91 @@ -310,7 +307,7 @@ Qt::Vertical - + 20 81 @@ -334,7 +331,8 @@ Install Fonts package - :/icons/font_btn.png + + :/icons/font_btn.png:/icons/font_btn.png @@ -360,7 +358,8 @@ Install themes - :/icons/themes_btn.png + + :/icons/themes_btn.png:/icons/themes_btn.png @@ -386,7 +385,8 @@ Install game files - :/icons/doom_btn.png + + :/icons/doom_btn.png:/icons/doom_btn.png @@ -411,7 +411,7 @@ Qt::Vertical - + 20 40 @@ -424,7 +424,7 @@ Qt::Vertical - + 20 40 @@ -448,7 +448,8 @@ Install Voice files - :/icons/talkfile_btn.png + + :/icons/talkfile_btn.png:/icons/talkfile_btn.png @@ -474,7 +475,8 @@ Install Talk files - :/icons/talkfile_btn.png + + :/icons/talkfile_btn.png:/icons/talkfile_btn.png @@ -496,7 +498,7 @@ Qt::Vertical - + 20 51 @@ -509,7 +511,7 @@ Qt::Vertical - + 20 51 @@ -523,7 +525,8 @@ Create Voice files - :/icons/talkfile_btn.png + + :/icons/talkfile_btn.png:/icons/talkfile_btn.png @@ -560,7 +563,8 @@ Uninstall Bootloader - :/icons/rembootloader_btn.png + + :/icons/rembootloader_btn.png:/icons/rembootloader_btn.png @@ -586,7 +590,8 @@ Uninstall Rockbox - :/icons/remrb_btn.png + + :/icons/remrb_btn.png:/icons/remrb_btn.png @@ -617,7 +622,7 @@ Qt::Vertical - + 20 40 @@ -630,7 +635,7 @@ Qt::Vertical - + 20 40 @@ -663,7 +668,7 @@ true - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::NoTextInteraction + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse @@ -676,7 +681,7 @@ true - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::NoTextInteraction + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse @@ -712,7 +717,7 @@ Qt::Horizontal - + 40 20 @@ -735,7 +740,7 @@ Qt::Vertical - + 20 40 @@ -784,7 +789,7 @@ 0 0 650 - 28 + 31 @@ -800,10 +805,17 @@ Abou&t + + + &Troubleshoot + + + + - + @@ -903,7 +915,8 @@ - :/icons/bootloader_btn.png + + :/icons/bootloader_btn.png:/icons/bootloader_btn.png &Complete Installation @@ -911,7 +924,8 @@ - :/icons/rbinstall_btn.png + + :/icons/rbinstall_btn.png:/icons/rbinstall_btn.png &Minimal Installation @@ -919,7 +933,8 @@ - :/icons/bootloader_btn.png + + :/icons/bootloader_btn.png:/icons/bootloader_btn.png Install &Bootloader @@ -927,7 +942,8 @@ - :/icons/rbinstall_btn.png + + :/icons/rbinstall_btn.png:/icons/rbinstall_btn.png Install &Rockbox @@ -935,7 +951,8 @@ - :/icons/font_btn.png + + :/icons/font_btn.png:/icons/font_btn.png Install &Fonts Package @@ -943,7 +960,8 @@ - :/icons/themes_btn.png + + :/icons/themes_btn.png:/icons/themes_btn.png Install &Themes @@ -951,7 +969,8 @@ - :/icons/doom_btn.png + + :/icons/doom_btn.png:/icons/doom_btn.png Install &Game Files @@ -959,7 +978,8 @@ - :/icons/talkfile_btn.png + + :/icons/talkfile_btn.png:/icons/talkfile_btn.png &Install Voice File @@ -967,7 +987,8 @@ - :/icons/talkfile_btn.png + + :/icons/talkfile_btn.png:/icons/talkfile_btn.png Create &Talk Files @@ -975,7 +996,8 @@ - :/icons/rembootloader_btn.png + + :/icons/rembootloader_btn.png:/icons/rembootloader_btn.png Remove &bootloader @@ -983,7 +1005,8 @@ - :/icons/remrb_btn.png + + :/icons/remrb_btn.png:/icons/remrb_btn.png Uninstall &Rockbox @@ -1011,7 +1034,8 @@ - :/icons/talkfile_btn.png + + :/icons/talkfile_btn.png:/icons/talkfile_btn.png Create &Voice File @@ -1025,6 +1049,11 @@ &System Info + + + System &Trace + + tabWidget diff --git a/rbutil/rbutilqt/systrace.cpp b/rbutil/rbutilqt/systrace.cpp new file mode 100644 index 0000000..898a510 --- /dev/null +++ b/rbutil/rbutilqt/systrace.cpp @@ -0,0 +1,86 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2007 by Dominik Riebeling + * $Id$ + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include +#include "systrace.h" +#include "ui_systracefrm.h" + + +static QString debugbuffer; + +SysTrace::SysTrace(QWidget *parent) : QDialog(parent) +{ + ui.setupUi(this); + this->setModal(false); + this->setAttribute(Qt::WA_DeleteOnClose, true); + ui.textTrace->setReadOnly(true); + refresh(); + + connect(ui.buttonClose, SIGNAL(clicked()), this, SLOT(close())); + connect(ui.buttonSave, SIGNAL(clicked()), this, SLOT(save())); + connect(ui.buttonRefresh, SIGNAL(clicked()), this, SLOT(refresh())); +} + + +void SysTrace::refresh(void) +{ + int pos = ui.textTrace->verticalScrollBar()->value(); + ui.textTrace->setHtml("
" + debugbuffer + "
"); + ui.textTrace->verticalScrollBar()->setValue(pos); +} + + +void SysTrace::save(void) +{ + QString fp = QFileDialog::getSaveFileName(this, tr("Save system trace log"), + QDir::homePath(), "*.log"); + + QFile fh(fp); + fh.open(QIODevice::WriteOnly); + fh.write(debugbuffer.toUtf8(), debugbuffer.size()); + fh.close(); +} + + +void SysTrace::debug(QtMsgType type, const char* msg) +{ + switch(type) { + case QtDebugMsg: + debugbuffer.append(msg); + break; + + case QtWarningMsg: + debugbuffer.append(msg); + break; + + case QtCriticalMsg: + debugbuffer.append(msg); + break; + + case QtFatalMsg: + debugbuffer.append(msg); + break; + } + debugbuffer.append("\n"); +#if !defined(NODEBUG) + fprintf(stderr, "%s\n", msg); +#endif + +} + diff --git a/rbutil/rbutilqt/systrace.h b/rbutil/rbutilqt/systrace.h new file mode 100644 index 0000000..e756821 --- /dev/null +++ b/rbutil/rbutilqt/systrace.h @@ -0,0 +1,46 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2007 by Dominik Riebeling + * $Id$ + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef SYSTRACE_H +#define SYSTRACE_H + +#include +#include "ui_systracefrm.h" + +class SysTrace : public QDialog +{ + Q_OBJECT + + public: + SysTrace(QWidget *parent = 0); + static void debug(QtMsgType type, const char* msg); + + private: + Ui::SysTraceFrm ui; + + private slots: + void save(void); + void refresh(void); + +}; + +#endif + diff --git a/rbutil/rbutilqt/systracefrm.ui b/rbutil/rbutilqt/systracefrm.ui new file mode 100644 index 0000000..450ab99 --- /dev/null +++ b/rbutil/rbutilqt/systracefrm.ui @@ -0,0 +1,77 @@ + + SysTraceFrm + + + + 0 + 0 + 600 + 550 + + + + System Trace + + + + + + System State trace + + + true + + + + + + + + + + Qt::Horizontal + + + + 487 + 26 + + + + + + + + &Close + + + + :/icons/process-stop.png:/icons/process-stop.png + + + + + + + &Save + + + + + + + &Refresh + + + + :/icons/view-refresh.png:/icons/view-refresh.png + + + + + + + + + +