diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-17 08:20:48 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-17 08:20:48 +0000 |
commit | aa0726b20f398264f0a2abc60215be044b106f9c (patch) | |
tree | 070fdbc19a1106cfdd7f651a8ce76bb1b89a513d /src/crashhandler.cpp | |
parent | d3cf5b3e75aadc3b02d0b56f030d4c3f8c2c749d (diff) | |
download | basket-aa0726b20f398264f0a2abc60215be044b106f9c.tar.gz basket-aa0726b20f398264f0a2abc60215be044b106f9c.zip |
TQt4 port basket
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/basket@1232416 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/crashhandler.cpp')
-rw-r--r-- | src/crashhandler.cpp | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/src/crashhandler.cpp b/src/crashhandler.cpp index 64e745b..56ddec8 100644 --- a/src/crashhandler.cpp +++ b/src/crashhandler.cpp @@ -22,9 +22,9 @@ #include <klocale.h> #include <ktempfile.h> -#include <qfile.h> -#include <qregexp.h> -#include <qtextstream.h> +#include <tqfile.h> +#include <tqregexp.h> +#include <tqtextstream.h> #include <cstdio> //popen, fread #include <iostream> @@ -48,8 +48,8 @@ }; #endif - static QString - runCommand( const QCString &command ) + static TQString + runCommand( const TQCString &command ) { static const uint SIZE = 40960; //40 KiB static char stdoutBuf[ SIZE ]; @@ -60,7 +60,7 @@ stdoutBuf[ std::fread( static_cast<void*>( stdoutBuf ), sizeof(char), SIZE-1, process ) ] = '\0'; ::pclose( process ); - return QString::fromLocal8Bit( stdoutBuf ); + return TQString::fromLocal8Bit( stdoutBuf ); } void @@ -75,14 +75,14 @@ // we are the child process (the result of the fork) // debug() << "amaroK is crashing...\n"; - QString subject = "[basket-crash] " VERSION " "; - QString body = i18n( + TQString subject = "[basket-crash] " VERSION " "; + TQString body = i18n( "%1 has crashed! We're sorry about this.\n" "\n" "But, all is not lost! You could potentially help us fix the crash. " "Information describing the crash is below, so just click send, " "or if you have time, write a brief description of how the crash happened first.\n\n" - "Many thanks." ).arg(kapp->aboutData()->programName()) + "\n\n"; + "Many thanks." ).tqarg(kapp->aboutData()->programName()) + "\n\n"; body += "\n\n\n\n\n\n" + i18n( "The information below is to help the developers identify the problem, " "please do not modify it." ) + "\n\n\n\n"; @@ -96,9 +96,9 @@ ;// "TagLib: %2.%3.%4\n"; /* body = body - .arg( TAGLIB_MAJOR_VERSION ) - .arg( TAGLIB_MINOR_VERSION ) - .arg( TAGLIB_PATCH_VERSION );*/ + .tqarg( TAGLIB_MAJOR_VERSION ) + .tqarg( TAGLIB_MINOR_VERSION ) + .tqarg( TAGLIB_PATCH_VERSION );*/ #ifdef NDEBUG body += "NDEBUG: true"; @@ -112,13 +112,13 @@ const int handle = temp.handle(); -// QCString gdb_command_string = +// TQCString gdb_command_string = // "file amarokapp\n" -// "attach " + QCString().setNum( ::getppid() ) + "\n" +// "attach " + TQCString().setNum( ::getppid() ) + "\n" // "bt\n" "echo \\n\n" // "thread apply all bt\n"; - const QCString gdb_batch = + const TQCString gdb_batch = "bt\n" "echo \\n\\n\n" "bt full\n" @@ -133,48 +133,48 @@ ::dup2( fileno( stdout ), fileno( stderr ) ); - QCString gdb; + TQCString gdb; gdb = "gdb --nw -n --batch -x "; gdb += temp.name().latin1(); gdb += " basket "; - gdb += QCString().setNum( ::getppid() ); + gdb += TQCString().setNum( ::getppid() ); - QString bt = runCommand( gdb ); + TQString bt = runCommand( gdb ); /// clean up bt.remove( "(no debugging symbols found)..." ); bt.remove( "(no debugging symbols found)\n" ); - bt.replace( QRegExp("\n{2,}"), "\n" ); //clean up multiple \n characters + bt.tqreplace( TQRegExp("\n{2,}"), "\n" ); //clean up multiple \n characters bt.stripWhiteSpace(); /// analyze usefulness bool useful = true; - const QString fileCommandOutput = runCommand( "file `which basket`" ); + const TQString fileCommandOutput = runCommand( "file `which basket`" ); - if( fileCommandOutput.find( "not stripped", false ) == -1 ) + if( fileCommandOutput.tqfind( "not stripped", false ) == -1 ) subject += "[___stripped]"; //same length as below else subject += "[NOTstripped]"; if( !bt.isEmpty() ) { - const int invalidFrames = bt.contains( QRegExp("\n#[0-9]+\\s+0x[0-9A-Fa-f]+ in \\?\\?") ); - const int validFrames = bt.contains( QRegExp("\n#[0-9]+\\s+0x[0-9A-Fa-f]+ in [^?]") ); + const int invalidFrames = bt.tqcontains( TQRegExp("\n#[0-9]+\\s+0x[0-9A-Fa-f]+ in \\?\\?") ); + const int validFrames = bt.tqcontains( TQRegExp("\n#[0-9]+\\s+0x[0-9A-Fa-f]+ in [^?]") ); const int totalFrames = invalidFrames + validFrames; if( totalFrames > 0 ) { const double validity = double(validFrames) / totalFrames; - subject += QString("[validity: %1]").arg( validity, 0, 'f', 2 ); + subject += TQString("[validity: %1]").tqarg( validity, 0, 'f', 2 ); if( validity <= 0.5 ) useful = false; } - subject += QString("[frames: %1]").arg( totalFrames, 3 /*padding*/ ); + subject += TQString("[frames: %1]").tqarg( totalFrames, 3 /*padding*/ ); - if( bt.find( QRegExp(" at \\w*\\.cpp:\\d+\n") ) >= 0 ) + if( bt.tqfind( TQRegExp(" at \\w*\\.cpp:\\d+\n") ) >= 0 ) subject += "[line numbers]"; } else useful = false; -// subject += QString("[%1]").arg( AmarokConfig::soundSystem().remove( QRegExp("-?engine") ) ); +// subject += TQString("[%1]").tqarg( AmarokConfig::soundSystem().remove( TQRegExp("-?engine") ) ); // debug() << subject << endl; @@ -194,19 +194,19 @@ //TODO startup notification kapp->invokeMailer( /*to*/ "kelvie@ieee.org", - /*cc*/ QString(), - /*bcc*/ QString(), + /*cc*/ TQString(), + /*bcc*/ TQString(), /*subject*/ subject, /*body*/ body, - /*messageFile*/ QString(), - /*attachURLs*/ QStringList(), + /*messageFile*/ TQString(), + /*attachURLs*/ TQStringList(), /*startup_id*/ "" ); } else { - std::cout << "\n" + i18n( "%1 has crashed! We're sorry about this.\n\n" + std::cout << ("\n" + i18n( "%1 has crashed! We're sorry about this.\n\n" "But, all is not lost! Perhaps an upgrade is already available " "which fixes the problem. Please check your distribution's software repository." ) - .arg(kapp->aboutData()->programName()).local8Bit() << std::endl; + .tqarg(kapp->aboutData()->programName())).local8Bit().data() << std::endl; } //_exit() exits immediately, otherwise this |