diff -urb panini-0.62/src/GLwindow.cpp panini-0.62-x11-lock-recursion/src/GLwindow.cpp --- panini-0.62/src/GLwindow.cpp 2009-01-31 22:29:52.000000000 +0100 +++ panini-0.62-x11-lock-recursion/src/GLwindow.cpp 2009-05-11 22:25:31.000000000 +0200 @@ -30,6 +30,8 @@ */ #include +#include +#include #include "GLwindow.h" #include "pvQtView.h" #include "pvQt_QTVR.h" @@ -152,7 +154,8 @@ connect( glview, SIGNAL(reportFov(QSizeF)), this, SIGNAL(showFov(QSizeF)) ); if(!ok) { - qFatal("GLwindow setup failed"); + QMessageBox::critical( 0, "pvQt", "GLwindow setup failed" ); + std::exit( 3 ); } // enable image file dropping setAcceptDrops( true ); @@ -291,7 +294,7 @@ bool ok = false, loaded = false; if( !strcmp( tnm, "proj" )){ - qCritical("%s -- to be implemented", tnm ); + QMessageBox::critical( 0, "pvQt", QString("%1 -- to be implemented").arg(tnm) ); } else if( !strcmp( tnm, "qtvr" )){ if( c > 0 ){ ok = loaded = QTVR_file( fnm[0] ); @@ -357,7 +360,7 @@ QTVRDecoder dec; bool ok = dec.parseHeaders( name.toUtf8().data() ); if( !ok ){ - qCritical("QTVR parse: %s", dec.getError() ); + QMessageBox::critical( 0, "pvQt", QString("QTVR parse: %1").arg(dec.getError()) ); return false; } if( dec.getType() == PANO_CUBIC ){ @@ -409,7 +412,7 @@ // fail if not a readable image file QImageReader ir( files[0] ); if( !ir.canRead() ){ - qCritical("Can't read image: %s", (const char *)files[0].toUtf8()); + QMessageBox::critical( 0, "pvQt", QString("Can't read image: %1").arg(files[0]) ); return 0; } // get and show image size @@ -509,7 +512,7 @@ bool GLwindow::commandLine( int argc, char ** argv ){ if( !glview->OpenGLOK() ){ - qCritical("Your video driver does not support Panini"); + QMessageBox::critical( 0, "pvQt", "Your video driver does not support Panini" ); // qCritical("OpenGL version: %s", (const char *)glGetString(GL_VERSION)); return false; } @@ -568,7 +571,7 @@ if( ext == "mov" ) return loadTypedFiles( "qtvr", names ); if( ext == "pts" || ext == "pto" || ext == "pro" ){ - qCritical("PTscript -- to be implemented"); + QMessageBox::critical( 0, "pvQt", "PTscript -- to be implemented" ); return false; // project_file( name ); } // if more thatn one file, assume cube faces @@ -580,7 +583,7 @@ // fail if not a readable image file QImageReader ir( names[0] ); if( !ir.canRead() ){ - qCritical("Can't read image: %s", (const char *)names[0].toUtf8()); + QMessageBox::critical( 0, "pvQt", QString("Can't read image: %1").arg(names[0]) ); return 0; } // If 2:1 aspect ratio assume eqr @@ -684,7 +687,7 @@ savedir = QFileInfo( fnm ).absolutePath(); // save file if( !glview->saveView( fnm, fac )){ - qCritical("saveView() failed"); + QMessageBox::critical( 0, "pvQt", "saveView() failed" ); } } } diff -urb panini-0.62/src/MainWindow.cpp panini-0.62-x11-lock-recursion/src/MainWindow.cpp --- panini-0.62/src/MainWindow.cpp 2009-02-02 10:23:22.000000000 +0100 +++ panini-0.62-x11-lock-recursion/src/MainWindow.cpp 2009-05-11 22:22:29.000000000 +0200 @@ -18,40 +18,13 @@ */ #include +#include #include "MainWindow.h" #include "GLwindow.h" -/* modal error message display - Note QErrorMessage::qtHandler installs a non-modal handler, so - you don't get to see the message before the program bombs -*/ -static void errMsgHandler( QtMsgType type, const char * msg ){ - QString s; - bool die = false; - switch( type ){ - case QtDebugMsg: - s = "Debug: "; - case QtWarningMsg: - s += msg; - QMessageBox::warning( 0, "pvQt", s ); - break; - case QtFatalMsg: - die = true; - s = "Fatal: "; - case QtCriticalMsg: - s += msg; - QMessageBox::critical( 0, "pvQt", s ); - break; - } - if( die ) exit( 3 ); -} - MainWindow::MainWindow( QWidget * parent) { -// install modal error message handler - qInstallMsgHandler( errMsgHandler ); - // create actions that aren't in menus // toggle panosurface type QAction * ats = new QAction(this); @@ -137,7 +110,10 @@ setCentralWidget( glwindow ); } - if( !ok ) qFatal("MainWindow setup failed"); + if( !ok ) { + QMessageBox::critical( 0, "pvQt", "MainWindow setup failed" ); + std::exit( 3 ); + } // enable panosurface switch actionPanosphere->setEnabled(true); diff -urb panini-0.62/src/pvQt.cpp panini-0.62-x11-lock-recursion/src/pvQt.cpp --- panini-0.62/src/pvQt.cpp 2009-01-06 13:22:22.000000000 +0100 +++ panini-0.62-x11-lock-recursion/src/pvQt.cpp 2009-05-11 22:16:05.000000000 +0200 @@ -1,4 +1,5 @@ #include +#include #include "pvQt.h" @@ -366,7 +367,7 @@ QSize siz = imgreader.size(); validDims.append( siz ); } else { // drop.. - qWarning("%s is not a valid image file", fn.toUtf8().data() ); + QMessageBox::warning( 0, "pvQt", QString("%1 is not a valid image file").arg(fn) ); filespecs.removeAt(i); --i; --nValidFiles; } diff -urb panini-0.62/src/pvQt_QTVR.cpp panini-0.62-x11-lock-recursion/src/pvQt_QTVR.cpp --- panini-0.62/src/pvQt_QTVR.cpp 2009-01-06 13:22:22.000000000 +0100 +++ panini-0.62-x11-lock-recursion/src/pvQt_QTVR.cpp 2009-05-11 22:23:30.000000000 +0200 @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include "pvQt_QTVR.h" @@ -250,7 +252,8 @@ ret = inflate(&strm, Z_NO_FLUSH); ///assert(ret != Z_STREAM_ERROR); /* state not clobbered */ if(ret == Z_STREAM_ERROR){ - qFatal("pvQt_QTVR::Z_STREAM_ERROR"); + QMessageBox::critical( 0, "pvQt", "pvQt_QTVR::Z_STREAM_ERROR" ); + std::exit( 3 ); } switch (ret) { case Z_NEED_DICT: diff -urb panini-0.62/src/pvQtView.cpp panini-0.62-x11-lock-recursion/src/pvQtView.cpp --- panini-0.62/src/pvQtView.cpp 2009-02-02 11:53:32.000000000 +0100 +++ panini-0.62-x11-lock-recursion/src/pvQtView.cpp 2009-05-11 22:24:18.000000000 +0200 @@ -29,8 +29,10 @@ #include #endif #include +#include #include +#include #define max( a, b ) (a > b ? a : b ) #define min( a, b ) (a > b ? b : a ) @@ -626,11 +628,13 @@ // check for panosurface setup errors const char * erm = pqs->errMsg(); if( erm != 0 ){ - qFatal("panosphere: %s", erm ); + QMessageBox::critical( 0, "pvQt", QString("panosphere: %1").arg(erm) ); + std::exit( 3 ); } erm = ppc->errMsg(); if( erm != 0 ){ - qFatal("panocylinder: %s", erm ); + QMessageBox::critical( 0, "pvQt", QString("panocylinder: %1").arg(erm) ); + std::exit( 3 ); } // abort if the OpenGL version is insufficient