Commit 42ca8acf authored by Jan Möbius's avatar Jan Möbius
Browse files

Added function to exit application with an error



git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16193 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b1ac2ff5
...@@ -1089,6 +1089,7 @@ Core::slotRecentOpen(QAction* _action) ...@@ -1089,6 +1089,7 @@ Core::slotRecentOpen(QAction* _action)
} }
//-----------------------------------------------------------------------------
void void
Core::writeOnExit() { Core::writeOnExit() {
...@@ -1132,6 +1133,8 @@ Core::writeOnExit() { ...@@ -1132,6 +1133,8 @@ Core::writeOnExit() {
} }
} }
//-----------------------------------------------------------------------------
void Core::slotExit() { void Core::slotExit() {
// Write all information on application exit // Write all information on application exit
writeOnExit(); writeOnExit();
...@@ -1172,6 +1175,18 @@ void Core::slotExit() { ...@@ -1172,6 +1175,18 @@ void Core::slotExit() {
qApp->quit(); qApp->quit();
} }
//-----------------------------------------------------------------------------
void Core::exitFailure() {
// Kill application with an error
// No need to clean up here anyway
exit(EXIT_FAILURE);
}
//-----------------------------------------------------------------------------
/// log to file /// log to file
void Core::slotLogToFile(Logtype _type, QString _message){ void Core::slotLogToFile(Logtype _type, QString _message){
...@@ -1719,7 +1734,7 @@ bool Core::checkLibraryVersions() { ...@@ -1719,7 +1734,7 @@ bool Core::checkLibraryVersions() {
} }
// Unsafe operation, so quit the application // Unsafe operation, so quit the application
exit(1); exitFailure();
} else if ( warn ) { } else if ( warn ) {
...@@ -1807,7 +1822,7 @@ bool Core::checkOpenGLCapabilities() { ...@@ -1807,7 +1822,7 @@ bool Core::checkOpenGLCapabilities() {
// Unsafe operation, so quit the application // Unsafe operation, so quit the application
if ( button == QMessageBox::Abort ) if ( button == QMessageBox::Abort )
exit(1); exitFailure();
else else
QMessageBox::warning(0,tr( "Insufficient OpenGL Capabilities!"),tr("Ignoring OpenGL capabilities might lead to unstable Operation! Do it at your own risk!")); QMessageBox::warning(0,tr( "Insufficient OpenGL Capabilities!"),tr("Ignoring OpenGL capabilities might lead to unstable Operation! Do it at your own risk!"));
...@@ -1832,4 +1847,6 @@ bool Core::checkOpenGLCapabilities() { ...@@ -1832,4 +1847,6 @@ bool Core::checkOpenGLCapabilities() {
return ok; return ok;
} }
//============================================================================= //=============================================================================
...@@ -645,9 +645,6 @@ public slots: ...@@ -645,9 +645,6 @@ public slots:
/// Called to delete an object /// Called to delete an object
void deleteObject( int _id ); void deleteObject( int _id );
/// exit the current application
void exitApplication();
/// set fullscreen mode /// set fullscreen mode
void fullscreen( bool _state ); void fullscreen( bool _state );
...@@ -1407,7 +1404,26 @@ private slots: ...@@ -1407,7 +1404,26 @@ private slots:
void deletedObject(int _objectId); void deletedObject(int _objectId);
/** @} */ /** @} */
//===========================================================================
/** @name Exit functions
* @{ */
//===========================================================================
public slots:
/// exit the current application
void exitApplication();
/** \brief Aborts the application with an error code
*
* Use this function in unit tests, if you detected a failure. Therefore the
* test functions will recognize that something went wrong.
*/
void exitFailure();
/** @} */
private: private:
/** \brief OpenGL capability check /** \brief OpenGL capability check
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment