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 Mar 28, 2022
1 parent 803159e commit 09e294c
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 @@ -1065,6 +1065,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 09e294c

Please sign in to comment.