cleanup of show message code for headless mode
This commit is contained in:
parent
8bbcdfbdb3
commit
957fe2d09b
|
@ -548,7 +548,7 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep, bool fatalExit) {
|
||||||
mainProgram->showMessage(msg.c_str());
|
mainProgram->showMessage(msg.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
message(msg.c_str());
|
message(msg.c_str(),GlobalStaticFlags::getIsNonGraphicalModeEnabled());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -564,7 +564,7 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep, bool fatalExit) {
|
||||||
mainProgram->showMessage(msg.c_str());
|
mainProgram->showMessage(msg.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
message(msg.c_str());
|
message(msg.c_str(),GlobalStaticFlags::getIsNonGraphicalModeEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExceptionHandler::logError(const char *msg, bool confirmToConsole) {
|
void ExceptionHandler::logError(const char *msg, bool confirmToConsole) {
|
||||||
|
@ -733,7 +733,7 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep, bool fatalExit) {
|
||||||
#endif
|
#endif
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
message(err);
|
message(err,GlobalStaticFlags::getIsNonGraphicalModeEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
@ -789,7 +789,7 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep, bool fatalExit) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] msg [%s] exitApp = %d\n",__FILE__,__FUNCTION__,__LINE__,msg,exitApp);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] msg [%s] exitApp = %d\n",__FILE__,__FUNCTION__,__LINE__,msg,exitApp);
|
||||||
message(msg);
|
message(msg,GlobalStaticFlags::getIsNonGraphicalModeEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] msg [%s] exitApp = %d\n",__FILE__,__FUNCTION__,__LINE__,msg,exitApp);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] msg [%s] exitApp = %d\n",__FILE__,__FUNCTION__,__LINE__,msg,exitApp);
|
||||||
|
@ -5434,7 +5434,7 @@ int glestMain(int argc, char** argv) {
|
||||||
if(program != NULL &&
|
if(program != NULL &&
|
||||||
program->getTryingRendererInit() == true &&
|
program->getTryingRendererInit() == true &&
|
||||||
program->getRendererInitOk() == false) {
|
program->getRendererInitOk() == false) {
|
||||||
message(e.what());
|
message(e.what(),GlobalStaticFlags::getIsNonGraphicalModeEnabled());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5586,7 +5586,7 @@ static bool MinidumpCallback(const google_breakpad::MinidumpDescriptor& descript
|
||||||
char szBuf[8096];
|
char szBuf[8096];
|
||||||
snprintf(szBuf,8096,"An unhandled error was detected.\n\nA crash dump file has been created in the folder:\n%s\nCrash dump filename is: %s",descriptor.directory().c_str(),descriptor.path());
|
snprintf(szBuf,8096,"An unhandled error was detected.\n\nA crash dump file has been created in the folder:\n%s\nCrash dump filename is: %s",descriptor.directory().c_str(),descriptor.path());
|
||||||
//MessageBox(NULL, szBuf, "Unhandled error", MB_OK|MB_SYSTEMMODAL);
|
//MessageBox(NULL, szBuf, "Unhandled error", MB_OK|MB_SYSTEMMODAL);
|
||||||
message(szBuf);
|
message(szBuf,GlobalStaticFlags::getIsNonGraphicalModeEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
return succeeded;
|
return succeeded;
|
||||||
|
|
|
@ -59,8 +59,7 @@ public:
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// Misc
|
// Misc
|
||||||
// =====================================================
|
// =====================================================
|
||||||
void message(string message);
|
void message(string message,bool isNonGraphicalModeEnabled);
|
||||||
bool ask(string message);
|
|
||||||
void exceptionMessage(const exception &excp);
|
void exceptionMessage(const exception &excp);
|
||||||
|
|
||||||
string getCommandLine();
|
string getCommandLine();
|
||||||
|
|
|
@ -78,24 +78,17 @@ bool showMessage(const std::string & warning) {
|
||||||
return guiMessage;
|
return guiMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void message(string message) {
|
void message(string message, bool isNonGraphicalModeEnabled) {
|
||||||
showMessage(message);
|
|
||||||
|
|
||||||
std::cerr << "******************************************************\n";
|
std::cerr << "******************************************************\n";
|
||||||
std::cerr << " " << message << "\n";
|
std::cerr << " " << message << "\n";
|
||||||
std::cerr << "******************************************************\n";
|
std::cerr << "******************************************************\n";
|
||||||
}
|
|
||||||
|
|
||||||
bool ask(string message) {
|
if(isNonGraphicalModeEnabled == false) {
|
||||||
std::cerr << "Confirmation: " << message << "\n";
|
showMessage(message);
|
||||||
int res;
|
}
|
||||||
std::cin >> res;
|
|
||||||
return res != 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void exceptionMessage(const exception &excp) {
|
void exceptionMessage(const exception &excp) {
|
||||||
//showMessage(excp.what());
|
|
||||||
|
|
||||||
std::cerr << "Exception: " << excp.what() << std::endl;
|
std::cerr << "Exception: " << excp.what() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -325,21 +325,16 @@ megaglest_runtime_error::megaglest_runtime_error(const string& __arg,bool noStac
|
||||||
// assert(dispChangeErr==DISP_CHANGE_SUCCESSFUL);
|
// assert(dispChangeErr==DISP_CHANGE_SUCCESSFUL);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
void message(string message){
|
void message(string message, bool isNonGraphicalModeEnabled) {
|
||||||
std::cerr << "******************************************************\n";
|
std::cerr << "******************************************************\n";
|
||||||
std::cerr << " " << message << "\n";
|
std::cerr << " " << message << "\n";
|
||||||
std::cerr << "******************************************************\n";
|
std::cerr << "******************************************************\n";
|
||||||
|
|
||||||
LPWSTR wstr = Ansi2WideString(message.c_str());
|
if(isNonGraphicalModeEnabled == false) {
|
||||||
MessageBox(NULL, wstr, L"Message", MB_OK | MB_SYSTEMMODAL);
|
LPWSTR wstr = Ansi2WideString(message.c_str());
|
||||||
if(wstr) delete [] wstr;
|
MessageBox(NULL, wstr, L"Message", MB_OK | MB_SYSTEMMODAL);
|
||||||
}
|
if(wstr) delete [] wstr;
|
||||||
|
}
|
||||||
bool ask(string message){
|
|
||||||
LPWSTR wstr = Ansi2WideString(message.c_str());
|
|
||||||
bool result = MessageBox(NULL, wstr, L"Confirmation", MB_YESNO | MB_SYSTEMMODAL) == IDYES;
|
|
||||||
if(wstr) delete [] wstr;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void exceptionMessage(const exception &excp){
|
void exceptionMessage(const exception &excp){
|
||||||
|
|
Loading…
Reference in New Issue
Block a user