Unfortunately on Windows argc and argv parameters are unreliable inside a Qt application, so I had to hardcode the report file name. :(

--HG--
branch : feature-crashreport
This commit is contained in:
dfighter1985 2015-02-20 02:35:11 +01:00
parent 9518a80c99
commit f0869aa659
3 changed files with 6 additions and 26 deletions

View file

@ -25,25 +25,8 @@ int main( int argc, char **argv )
{ {
QApplication app( argc, argv ); QApplication app( argc, argv );
#if 0
if( argc < 2 )
{
QMessageBox::information( NULL,
QObject::tr( "Error" ),
QObject::tr( "Need to specify a path to the error report." ) );
return 1;
}
#endif
RCErrorWidget w; RCErrorWidget w;
w.setFileName( "rcerrorlog.txt" );
#if 0
w.setFileName( argv[ 1 ] );
#else
w.setFileName( "log.log" );
#endif
w.show(); w.show();
return app.exec(); return app.exec();

View file

@ -52,7 +52,10 @@ void RCErrorWidget::onLoad()
bool b = f.open( QFile::ReadOnly | QFile::Text ); bool b = f.open( QFile::ReadOnly | QFile::Text );
if( !b ) if( !b )
{ {
return; QMessageBox::information( this,
tr( "No log file found" ),
tr( "There was no log file found, therefore nothing to report. Exiting..." ) );
close();
} }
QTextStream ss( &f ); QTextStream ss( &f );

View file

@ -64,10 +64,7 @@ void report ()
TReportResult report (const std::string &title, const std::string &header, const std::string &subject, const std::string &body, bool enableCheckIgnore, uint debugButton, bool ignoreButton, sint quitButton, bool sendReportButton, bool &ignoreNextTime, const string &attachedFile) TReportResult report (const std::string &title, const std::string &header, const std::string &subject, const std::string &body, bool enableCheckIgnore, uint debugButton, bool ignoreButton, sint quitButton, bool sendReportButton, bool &ignoreNextTime, const string &attachedFile)
{ {
std::string fname; std::string fname = "rcerrorlog.txt";
time_t s = time( NULL );
fname = std::string( "log_" ) + toString( s ) + ".txt";
std::ofstream f; std::ofstream f;
f.open( fname.c_str() ); f.open( fname.c_str() );
@ -83,9 +80,6 @@ TReportResult report (const std::string &title, const std::string &header, const
#endif #endif
} }
NLMISC::CFile::deleteFile( fname );
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
#ifndef NL_COMP_MINGW #ifndef NL_COMP_MINGW
// disable the Windows popup telling that the application aborted and disable the dr watson report. // disable the Windows popup telling that the application aborted and disable the dr watson report.