1
0
Fork 0

Move the PUI dialog code to James' new messagebox code and use that one instead for SG_LOG_POPUP to get a native popup window if available and fall back to a PUI one if not

This commit is contained in:
Erik Hofman 2016-07-21 08:56:05 +02:00
parent 5ab2d82c89
commit e2216891be
2 changed files with 10 additions and 7 deletions

View file

@ -8,6 +8,7 @@
#include <Main/globals.hxx>
#include <Viewer/renderer.hxx>
#include <GUI/new_gui.hxx>
#include <osgViewer/Viewer>
@ -127,10 +128,16 @@ MessageBoxResult modalMessageBox(const std::string& caption,
#elif defined(HAVE_QT)
return QtMessageBox(caption, msg, moreText, false);
#else
SG_LOG(SG_GENERAL, SG_ALERT, caption << ":" << msg);
std::string s = caption + ": "+ msg;
if (!moreText.empty()) {
SG_LOG(SG_GENERAL, SG_ALERT, "(" << moreText << ")");
s += "\n( " + moreText + ")";
}
// SG_LOG(SG_GENERAL, SG_ALERT, s);
NewGUI* _gui = (NewGUI *)globals->get_subsystem("gui");
SGPropertyNode_ptr dlg = _gui->getDialogProperties("popup");
dlg->setStringValue("text/label", s );
_gui->showDialog("popup");
return MSG_BOX_OK;
#endif
}

View file

@ -64,7 +64,6 @@ extern bool global_crashRptEnabled;
#include <Time/TimeManager.hxx>
#include <GUI/gui.h>
#include <GUI/MessageBox.hxx>
#include <GUI/new_gui.hxx>
#include <Viewer/splash.hxx>
#include <Viewer/renderer.hxx>
#include <Viewer/WindowSystemAdapter.hxx>
@ -105,11 +104,8 @@ static void fgMainLoop( void )
{
if (sglog().has_popup()) {
NewGUI* _gui = (NewGUI *)globals->get_subsystem("gui");
SGPropertyNode_ptr dlg = _gui->getDialogProperties("popup");
std::string s = sglog().get_popup();
dlg->setStringValue("text/label", s );
_gui->showDialog("popup");
flightgear::modalMessageBox("Alert", s, "");
}
frame_signal->fireValueChanged();