fix for error messages
This commit is contained in:
parent
660f4d5705
commit
2ce29103c6
1 changed files with 62 additions and 45 deletions
107
src/main.cpp
107
src/main.cpp
|
@ -23,6 +23,7 @@
|
||||||
\******************************************************************************/
|
\******************************************************************************/
|
||||||
|
|
||||||
#include <qapplication.h>
|
#include <qapplication.h>
|
||||||
|
#include <qmessagebox.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "llconclientdlg.h"
|
#include "llconclientdlg.h"
|
||||||
|
@ -112,61 +113,77 @@ cerr << "logging ";
|
||||||
extern int qInitResources();
|
extern int qInitResources();
|
||||||
qInitResources();
|
qInitResources();
|
||||||
|
|
||||||
if ( bIsClient )
|
try
|
||||||
{
|
{
|
||||||
// client
|
if ( bIsClient )
|
||||||
// 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 )
|
|
||||||
{
|
{
|
||||||
// GUI object for the server
|
// client
|
||||||
CLlconServerDlg ServerDlg ( &Server, 0 );
|
// 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
|
// set main window
|
||||||
pMainWindow = &ServerDlg;
|
pMainWindow = &ClientDlg;
|
||||||
pApp = &app; // needed for post-event routine
|
pApp = &app; // Needed for post-event routine
|
||||||
|
|
||||||
// show dialog
|
// show dialog
|
||||||
ServerDlg.show();
|
ClientDlg.show();
|
||||||
app.exec();
|
app.exec();
|
||||||
|
|
||||||
|
// save settings to init-file
|
||||||
|
|
||||||
|
// TODO use QString
|
||||||
|
|
||||||
|
Settings.Save ( strIniFileName.c_str() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// only start application without using the GUI
|
// server
|
||||||
qDebug() << CAboutDlg::GetVersionAndNameStr ( false );
|
// actual server object
|
||||||
app.exec();
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue