From 2ce29103c60bcff062c6311c9ecba36e9fdcef3d Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sun, 13 Jul 2008 18:43:40 +0000 Subject: [PATCH] fix for error messages --- src/main.cpp | 107 +++++++++++++++++++++++++++++---------------------- 1 file changed, 62 insertions(+), 45 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index a02ebeca..7ed9178e 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,6 +23,7 @@ \******************************************************************************/ #include +#include #include #include "global.h" #include "llconclientdlg.h" @@ -112,61 +113,77 @@ cerr << "logging "; extern int qInitResources(); qInitResources(); - if ( bIsClient ) + try { - // client - // actual client object - CClient Client; - - // load settings from init-file - CSettings Settings ( &Client ); - - -// TODO use QString - - Settings.Load ( strIniFileName.c_str() ); - - // GUI object - CLlconClientDlg ClientDlg ( &Client, 0 ); - - // set main window - pMainWindow = &ClientDlg; - pApp = &app; // Needed for post-event routine - - // show dialog - ClientDlg.show(); - app.exec(); - - // save settings to init-file - -// TODO use QString - - Settings.Save ( strIniFileName.c_str() ); - } - else - { - // server - // actual server object - CServer Server ( bUseServerLogging ); - - if ( bUseGUI ) + if ( bIsClient ) { - // GUI object for the server - CLlconServerDlg ServerDlg ( &Server, 0 ); + // client + // actual client object + CClient Client; + + // load settings from init-file + CSettings Settings ( &Client ); + + +// TODO use QString + + Settings.Load ( strIniFileName.c_str() ); + + // GUI object + CLlconClientDlg ClientDlg ( &Client, 0 ); // set main window - pMainWindow = &ServerDlg; - pApp = &app; // needed for post-event routine + pMainWindow = &ClientDlg; + pApp = &app; // Needed for post-event routine // show dialog - ServerDlg.show(); + ClientDlg.show(); app.exec(); + + // save settings to init-file + +// TODO use QString + + Settings.Save ( strIniFileName.c_str() ); } else { - // only start application without using the GUI - qDebug() << CAboutDlg::GetVersionAndNameStr ( false ); - app.exec(); + // server + // actual server object + CServer Server ( bUseServerLogging ); + + if ( bUseGUI ) + { + // GUI object for the server + CLlconServerDlg ServerDlg ( &Server, 0 ); + + // set main window + pMainWindow = &ServerDlg; + pApp = &app; // needed for post-event routine + + // show dialog + ServerDlg.show(); + app.exec(); + } + else + { + // only start application without using the GUI + qDebug() << CAboutDlg::GetVersionAndNameStr ( false ); + app.exec(); + } + } + } + + catch ( CGenErr generr ) + { + // show generic error + if ( bUseGUI ) + { + QMessageBox::critical ( 0, APP_NAME, generr.strError, "Quit", 0 ); + } + else + { + qDebug() << generr.strError; } }