Message timeout: try to fix timeout defines

Some parameters were confused.
This commit is contained in:
2016-12-07 11:07:41 +01:00
committed by Jacek Jendrzej
parent bd5e82fdc4
commit 4382daf5e4
4 changed files with 20 additions and 15 deletions

View File

@@ -840,7 +840,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
} }
else if (actionKey == "msgbox_test_yes_no") else if (actionKey == "msgbox_test_yes_no")
{ {
int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NULL, 500, -1); int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NULL, 500);
std::string msg_txt = "Return value of MsgBox test is "; std::string msg_txt = "Return value of MsgBox test is ";
msg_txt += to_string(msgRet); msg_txt += to_string(msgRet);
@@ -863,7 +863,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
return res; return res;
} }
else if (actionKey == "msgbox_test_all"){ else if (actionKey == "msgbox_test_all"){
int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrOk, CMsgBox::mbAll, NULL, 700, -1); int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrOk, CMsgBox::mbAll, NULL, 700);
std::string msg_txt = "Return value of MsgBox test is "; std::string msg_txt = "Return value of MsgBox test is ";
msg_txt += to_string(msgRet); msg_txt += to_string(msgRet);
@@ -871,7 +871,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
return menu_return::RETURN_REPAINT; return menu_return::RETURN_REPAINT;
} }
else if (actionKey == "msgbox_test_yes_no_cancel"){ else if (actionKey == "msgbox_test_yes_no_cancel"){
int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrCancel, CMsgBox::mbYes | CMsgBox::mbNo | CMsgBox::mbCancel, NULL, 500, -1); int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrCancel, CMsgBox::mbYes | CMsgBox::mbNo | CMsgBox::mbCancel, NULL, 500);
std::string msg_txt = "Return value of MsgBox test is "; std::string msg_txt = "Return value of MsgBox test is ";
msg_txt += to_string(msgRet); msg_txt += to_string(msgRet);
@@ -879,7 +879,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
return menu_return::RETURN_REPAINT; return menu_return::RETURN_REPAINT;
} }
else if (actionKey == "msgbox_test_ok_cancel"){ else if (actionKey == "msgbox_test_ok_cancel"){
int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrOk, CMsgBox::mbOk | CMsgBox::mbCancel, NULL, 500, -1); int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrOk, CMsgBox::mbOk | CMsgBox::mbCancel, NULL, 500);
std::string msg_txt = "Return value of MsgBox test is "; std::string msg_txt = "Return value of MsgBox test is ";
msg_txt += to_string(msgRet); msg_txt += to_string(msgRet);
@@ -887,7 +887,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
return menu_return::RETURN_REPAINT; return menu_return::RETURN_REPAINT;
} }
else if (actionKey == "msgbox_test_no_yes"){ else if (actionKey == "msgbox_test_no_yes"){
int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrOk, CMsgBox::mbNoYes, NULL, 500, -1); int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press key! ...", CMsgBox::mbrOk, CMsgBox::mbNoYes, NULL, 500);
std::string msg_txt = "Return value of MsgBox test is "; std::string msg_txt = "Return value of MsgBox test is ";
msg_txt += to_string(msgRet); msg_txt += to_string(msgRet);
@@ -895,7 +895,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
return menu_return::RETURN_REPAINT; return menu_return::RETURN_REPAINT;
} }
else if (actionKey == "msgbox_test_ok"){ else if (actionKey == "msgbox_test_ok"){
int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press ok key! ...", CMsgBox::mbrOk, CMsgBox::mbOk, NULL, 500, -1); int msgRet = ShowMsg("Testmenu: MsgBox test", "Test for MsgBox,\nPlease press ok key! ...", CMsgBox::mbrOk, CMsgBox::mbOk, NULL, 500);
std::string msg_txt = "Return value of MsgBox test is "; std::string msg_txt = "Return value of MsgBox test is ";
msg_txt += to_string(msgRet); msg_txt += to_string(msgRet);

View File

@@ -36,7 +36,8 @@
#define HINTBOX_MIN_HEIGHT 125 #define HINTBOX_MIN_HEIGHT 125
#define HINTBOX_MAX_HEIGHT 520 #define HINTBOX_MAX_HEIGHT 520
#define HINTBOX_DEFAULT_TIMEOUT g_settings.timing[SNeutrinoSettings::TIMING_POPUP_MESSAGES] #define HINTBOX_DEFAULT_TIMEOUT g_settings.timing[SNeutrinoSettings::TIMING_POPUP_MESSAGES]
#define NO_TIMEOUT -1 #define NO_TIMEOUT 0
#define DEFAULT_TIMEOUT -1
//frame around hint container as indent //frame around hint container as indent
#define W_FRAME std::max(HINTBOX_MIN_WIDTH, HINTBOX_MIN_HEIGHT) * 2/100 #define W_FRAME std::max(HINTBOX_MIN_WIDTH, HINTBOX_MIN_HEIGHT) * 2/100
//frame color around hint/message box //frame color around hint/message box
@@ -179,7 +180,9 @@ class CHintBox : public CComponentsWindow
int exec(); int exec();
/** /**
* Defines timeout, timeout is enabled if parameter1 > -1 * Defines timeout for message window.
* Timeout is enabled with parameter1 = DEFAULT_TIMEOUT (-1) or any other value > 0
* To disable timeout use NO_TIMEOUT (0)
* @param[in] Timeout as int as seconds * @param[in] Timeout as int as seconds
*/ */
virtual void setTimeOut(const int& Timeout){timeout = Timeout;} virtual void setTimeOut(const int& Timeout){timeout = Timeout;}

View File

@@ -114,7 +114,7 @@ void CMsgBox::init(const int& Height, const int& ShowButtons, const msg_result_t
void CMsgBox::initTimeOut() void CMsgBox::initTimeOut()
{ {
timeout = -1; timeout = NO_TIMEOUT;
enable_timeout_result = false; enable_timeout_result = false;
} }
@@ -238,7 +238,9 @@ int CMsgBox::exec()
ccw_footer->getSelectedButtonObject()->setButtonAlias(mb_show_button); ccw_footer->getSelectedButtonObject()->setButtonAlias(mb_show_button);
int selected = ccw_footer->getSelectedButton(); int selected = ccw_footer->getSelectedButton();
if (timeout == NO_TIMEOUT) if (timeout == NO_TIMEOUT)
timeout = MSGBOX_DEFAULT_TIMEOUT; timeout = 0;
if (timeout == DEFAULT_TIMEOUT)
timeout = g_settings.timing[SNeutrinoSettings::TIMING_STATIC_MESSAGES];
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout); uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout);
@@ -528,12 +530,12 @@ int ShowMsg( const std::string & Title,
void DisplayErrorMessage(const char * const ErrorMsg, const neutrino_locale_t& caption, const int& Text_mode) void DisplayErrorMessage(const char * const ErrorMsg, const neutrino_locale_t& caption, const int& Text_mode)
{ {
ShowMsg(caption, ErrorMsg, CMsgBox::mbrCancel, CMsgBox::mbBack, NEUTRINO_ICON_ERROR, 500, -1, false, Text_mode, COL_RED); ShowMsg(caption, ErrorMsg, CMsgBox::mbrCancel, CMsgBox::mbBack, NEUTRINO_ICON_ERROR, 500, NO_TIMEOUT, false, Text_mode, COL_RED);
} }
void DisplayErrorMessage(const char * const ErrorMsg, const std::string& caption, const int& Text_mode) void DisplayErrorMessage(const char * const ErrorMsg, const std::string& caption, const int& Text_mode)
{ {
ShowMsg(caption, ErrorMsg, CMsgBox::mbrCancel, CMsgBox::mbBack, NEUTRINO_ICON_ERROR, 500, -1, false, Text_mode, COL_RED); ShowMsg(caption, ErrorMsg, CMsgBox::mbrCancel, CMsgBox::mbBack, NEUTRINO_ICON_ERROR, 500, NO_TIMEOUT, false, Text_mode, COL_RED);
} }
void DisplayErrorMessage(const char * const ErrorMsg, const int& Text_mode) void DisplayErrorMessage(const char * const ErrorMsg, const int& Text_mode)
@@ -543,12 +545,12 @@ void DisplayErrorMessage(const char * const ErrorMsg, const int& Text_mode)
void DisplayInfoMessage(const char * const InfoMsg, const neutrino_locale_t& caption, const int& Text_mode, fb_pixel_t color_frame) void DisplayInfoMessage(const char * const InfoMsg, const neutrino_locale_t& caption, const int& Text_mode, fb_pixel_t color_frame)
{ {
ShowMsg(caption, InfoMsg, CMsgBox::mbrBack, CMsgBox::mbOk, NEUTRINO_ICON_INFO, 500, -1, false, Text_mode, color_frame); ShowMsg(caption, InfoMsg, CMsgBox::mbrBack, CMsgBox::mbOk, NEUTRINO_ICON_INFO, 500, NO_TIMEOUT, false, Text_mode, color_frame);
} }
void DisplayInfoMessage(const char * const InfoMsg, const std::string& caption, const int& Text_mode, fb_pixel_t color_frame) void DisplayInfoMessage(const char * const InfoMsg, const std::string& caption, const int& Text_mode, fb_pixel_t color_frame)
{ {
ShowMsg(caption, InfoMsg, CMsgBox::mbrBack, CMsgBox::mbOk, NEUTRINO_ICON_INFO, 500, -1, false, Text_mode, color_frame); ShowMsg(caption, InfoMsg, CMsgBox::mbrBack, CMsgBox::mbOk, NEUTRINO_ICON_INFO, 500, NO_TIMEOUT, false, Text_mode, color_frame);
} }
void DisplayInfoMessage(const char * const InfoMsg, const int& Text_mode, fb_pixel_t color_frame) void DisplayInfoMessage(const char * const InfoMsg, const int& Text_mode, fb_pixel_t color_frame)

View File

@@ -3350,7 +3350,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
} }
else if (msg == NeutrinoMessages::EVT_POPUP || msg == NeutrinoMessages::EVT_EXTMSG) { else if (msg == NeutrinoMessages::EVT_POPUP || msg == NeutrinoMessages::EVT_EXTMSG) {
if (mode != mode_scart && mode != mode_standby) { if (mode != mode_scart && mode != mode_standby) {
int timeout = NO_TIMEOUT; int timeout = DEFAULT_TIMEOUT;
std::string text = (char*)data; std::string text = (char*)data;
std::string::size_type pos; std::string::size_type pos;