Tweak to error dialogs and add separate warning dialogs

(Also some error messages tweaked)
This commit is contained in:
2015-08-14 23:30:07 -04:00
parent d2a348cdd6
commit 5762c2bb90
21 changed files with 240 additions and 200 deletions

View File

@@ -522,8 +522,8 @@ void cStrDlog::show(){
dlg.run();
}
void giveError(std::string str1, std::string str2, cDialog* parent){
cStrDlog error(str1,str2,"Error!!!",25,PIC_DLOG,parent);
static void giveError(pic_num_t pic, std::string title, std::string str1, std::string str2, cDialog* parent) {
cStrDlog error(str1,str2,title,pic,PIC_DLOG,parent);
error->getControl("record").setText("Copy");
error.setRecordHandler([](cDialog& me) {
std::string error = me["str1"].getText();
@@ -539,6 +539,26 @@ void giveError(std::string str1, std::string str2, cDialog* parent){
error.show();
}
void giveError(std::string str1, cDialog* parent) {
giveError(str1, "", parent);
void showError(std::string str1, cDialog* parent) {
showError(str1, "", parent);
}
void showError(std::string str1, std::string str2, cDialog* parent) {
giveError(25, "Error", str1, str2, parent);
}
void showWarning(std::string str1, cDialog* parent) {
showWarning(str1, "", parent);
}
void showWarning(std::string str1, std::string str2, cDialog* parent) {
giveError(24, "Warning", str1, str2, parent);
}
void showFatalError(std::string str1, cDialog* parent) {
showFatalError(str1, "", parent);
}
void showFatalError(std::string str1, std::string str2, cDialog* parent) {
giveError(25, "Error!!!", str1, str2, parent);
}

View File

@@ -255,12 +255,32 @@ public:
};
#endif
/// Shows a simple error dialog.
/// Shows a simple error dialog for an unrecoverable condition.
/// @param str1 The first string in the error dialog.
/// @param str2 The second string in the error dialog.
/// @param parent Optionally, a parent dialog.
void giveError(std::string str1, std::string str2, cDialog* parent = NULL);
/// Shows a simple error dialog.
void showFatalError(std::string str1, std::string str2, cDialog* parent = NULL);
/// Shows a simple error dialog for an unrecoverable condition.
/// @param str1 The string in the error dialog.
/// @param parent Optionally, a parent dialog.
void giveError(std::string str1, cDialog* parent = NULL);
void showFatalError(std::string str1, cDialog* parent = NULL);
/// Shows a simple error dialog for a recoverable condition.
/// @param str1 The first string in the error dialog.
/// @param str2 The second string in the error dialog.
/// @param parent Optionally, a parent dialog.
void showError(std::string str1, std::string str2, cDialog* parent = NULL);
/// Shows a simple error dialog for a recoverable condition.
/// @param str1 The string in the error dialog.
/// @param parent Optionally, a parent dialog.
void showError(std::string str1, cDialog* parent = NULL);
/// Shows a simple warning message dialog.
/// @param str1 The first string in the warning dialog.
/// @param str2 The second string in the warning dialog.
/// @param parent Optionally, a parent dialog.
void showWarning(std::string str1, std::string str2, cDialog* parent = NULL);
/// Shows a simple warning message dialog.
/// @param str1 The string in the warning dialog.
/// @param parent Optionally, a parent dialog.
void showWarning(std::string str1, cDialog* parent = NULL);

View File

@@ -47,7 +47,7 @@ bool cTextField::triggerFocusHandler(cDialog& me, std::string id, bool losingFoc
{FLD_UINT, "a positive integer"},
{FLD_REAL, "a number"},
};
giveError("You need to enter " + typeNames.at(field_type) + "!","",parent);
showError("You need to enter " + typeNames.at(field_type) + "!","",parent);
return false;
}
}