diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index cd4b5116c..a8cb33d63 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -840,7 +840,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } 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 "; msg_txt += to_string(msgRet); @@ -863,7 +863,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) return res; } 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 "; msg_txt += to_string(msgRet); @@ -871,7 +871,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_REPAINT; } 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 "; msg_txt += to_string(msgRet); @@ -879,7 +879,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_REPAINT; } 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 "; msg_txt += to_string(msgRet); @@ -887,7 +887,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_REPAINT; } 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 "; msg_txt += to_string(msgRet); @@ -895,7 +895,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_REPAINT; } 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 "; msg_txt += to_string(msgRet); diff --git a/src/gui/widget/hintbox.h b/src/gui/widget/hintbox.h index 4afacb82a..c005feb26 100644 --- a/src/gui/widget/hintbox.h +++ b/src/gui/widget/hintbox.h @@ -36,7 +36,8 @@ #define HINTBOX_MIN_HEIGHT 125 #define HINTBOX_MAX_HEIGHT 520 #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 #define W_FRAME std::max(HINTBOX_MIN_WIDTH, HINTBOX_MIN_HEIGHT) * 2/100 //frame color around hint/message box @@ -179,7 +180,9 @@ class CHintBox : public CComponentsWindow 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 */ virtual void setTimeOut(const int& Timeout){timeout = Timeout;} diff --git a/src/gui/widget/msgbox.cpp b/src/gui/widget/msgbox.cpp index 151a0cc73..5f6e375e0 100644 --- a/src/gui/widget/msgbox.cpp +++ b/src/gui/widget/msgbox.cpp @@ -114,7 +114,7 @@ void CMsgBox::init(const int& Height, const int& ShowButtons, const msg_result_t void CMsgBox::initTimeOut() { - timeout = -1; + timeout = NO_TIMEOUT; enable_timeout_result = false; } @@ -238,7 +238,9 @@ int CMsgBox::exec() ccw_footer->getSelectedButtonObject()->setButtonAlias(mb_show_button); int selected = ccw_footer->getSelectedButton(); 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); @@ -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) { - 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) { - 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) @@ -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) { - 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) { - 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) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index a4eae6220..1cef929db 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -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) { if (mode != mode_scart && mode != mode_standby) { - int timeout = NO_TIMEOUT; + int timeout = DEFAULT_TIMEOUT; std::string text = (char*)data; std::string::size_type pos;