use the application pointer directly without the need of the define

This commit is contained in:
Volker Fischer 2019-04-12 18:12:22 +02:00
parent 05a0ac60a6
commit feaea570f2

View file

@ -442,15 +442,14 @@ int main ( int argc, char** argv )
// Application/GUI setup --------------------------------------------------- // Application/GUI setup ---------------------------------------------------
// Application object // Application object
if (!bUseGUI && !strHistoryFileName.isEmpty()) if ( !bUseGUI && !strHistoryFileName.isEmpty() )
{ {
tsConsole << "Qt5 requires a windowing system to paint a JPEG image; disabling history graph" << endl; tsConsole << "Qt5 requires a windowing system to paint a JPEG image; disabling history graph" << endl;
strHistoryFileName = ""; strHistoryFileName = "";
} }
QCoreApplication* _app = bUseGUI QCoreApplication* pApp = bUseGUI
? new QApplication ( argc, argv ) ? new QApplication ( argc, argv )
: new QCoreApplication ( argc, argv ); : new QCoreApplication ( argc, argv );
#define app (*_app)
#ifdef _WIN32 #ifdef _WIN32
// set application priority class -> high priority // set application priority class -> high priority
@ -460,7 +459,7 @@ int main ( int argc, char** argv )
// be located in the install directory of the software by the installer. // be located in the install directory of the software by the installer.
// Here, we set the path to our application path. // Here, we set the path to our application path.
QDir ApplDir ( QApplication::applicationDirPath() ); QDir ApplDir ( QApplication::applicationDirPath() );
app.addLibraryPath ( QString ( ApplDir.absolutePath() ) ); pApp->addLibraryPath ( QString ( ApplDir.absolutePath() ) );
#endif #endif
// init resources // init resources
@ -498,14 +497,14 @@ int main ( int argc, char** argv )
// show dialog // show dialog
ClientDlg.show(); ClientDlg.show();
app.exec(); pApp->exec();
} }
else else
{ {
// only start application without using the GUI // only start application without using the GUI
tsConsole << CAboutDlg::GetVersionAndNameStr ( false ) << endl; tsConsole << CAboutDlg::GetVersionAndNameStr ( false ) << endl;
app.exec(); pApp->exec();
} }
} }
else else
@ -553,7 +552,7 @@ int main ( int argc, char** argv )
ServerDlg.show(); ServerDlg.show();
} }
app.exec(); pApp->exec();
} }
else else
{ {
@ -563,7 +562,7 @@ int main ( int argc, char** argv )
// only start application without using the GUI // only start application without using the GUI
tsConsole << CAboutDlg::GetVersionAndNameStr ( false ) << endl; tsConsole << CAboutDlg::GetVersionAndNameStr ( false ) << endl;
app.exec(); pApp->exec();
} }
} }
} }