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

@@ -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;}

View File

@@ -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)