Skip to content

Commit

Permalink
Solution for headless build?
Browse files Browse the repository at this point in the history
define the in headless non existing QDialog as void
and send messages to the appropriate output stream
  • Loading branch information
pgScorpio committed Apr 5, 2022
1 parent a96660a commit 6af7e96
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,33 @@ void CMsgBoxes::ShowInfo ( QString strInfo )
#endif
}

void CMsgBoxes::ShowError ( QString strError )
{
#ifndef HEADLESS
QMessageBox::critical ( pMainForm, strMainFormName + ": " + QObject::tr ( "Error" ), strError, QObject::tr ( "Ok" ), nullptr );
#else
qCritical() << "Error: " << strError.toLocal8Bit().data();
#endif
}

void CMsgBoxes::ShowWarning ( QString strWarning )
{
#ifndef HEADLESS
QMessageBox::warning ( pMainForm, strMainFormName + ": " + QObject::tr ( "Warning" ), strWarning, QObject::tr ( "Ok" ), nullptr );
#else
qWarning() << "Warning: " << strWarning.toLocal8Bit().data();
#endif
}

void CMsgBoxes::ShowInfo ( QString strInfo )
{
#ifndef HEADLESS
QMessageBox::information ( pMainForm, strMainFormName + ": " + QObject::tr ( "Information" ), strInfo, QObject::tr ( "Ok" ), nullptr );
#else
qInfo() << "Info: " << strInfo.toLocal8Bit().data();
#endif
}

/******************************************************************************\
* Command Line Argument Parsing *
\******************************************************************************/
Expand Down

0 comments on commit 6af7e96

Please sign in to comment.