mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
CHintBox: move showTimeOutBar() to protected, add params to enableTimeOutBar()
Explicit call of disableTimeOutBar() after exec() is required to ensure we have no timebar opened objects. I'm not shure, but otherwise crashs could be possible. showTimeOutBar() is required for OnTimer(). It doesn't need any parameter.
This commit is contained in:
@@ -168,17 +168,21 @@ void CHintBox::init(const std::string& Text, const int& Width, const std::string
|
|||||||
|
|
||||||
CHintBox::~CHintBox()
|
CHintBox::~CHintBox()
|
||||||
{
|
{
|
||||||
if(timeout_pb){
|
disableTimeOutBar();
|
||||||
timeout_pb->kill(); //ensure cleanup from screen
|
}
|
||||||
delete timeout_pb; timeout_pb = NULL;
|
|
||||||
}
|
void CHintBox::enableTimeOutBar(bool enable)
|
||||||
|
{
|
||||||
|
if(!enable){
|
||||||
if(timeout_pb_timer){
|
if(timeout_pb_timer){
|
||||||
delete timeout_pb_timer; timeout_pb_timer = NULL;
|
delete timeout_pb_timer; timeout_pb_timer = NULL;
|
||||||
}
|
}
|
||||||
}
|
if(timeout_pb){
|
||||||
|
delete timeout_pb; timeout_pb = NULL;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void CHintBox::showTimeOutBar()
|
|
||||||
{
|
|
||||||
if(timeout_pb){
|
if(timeout_pb){
|
||||||
timeout_pb->paint0();
|
timeout_pb->paint0();
|
||||||
timeout_pb->setValues(timeout_pb->getValue()+1, 100*timeout);
|
timeout_pb->setValues(timeout_pb->getValue()+1, 100*timeout);
|
||||||
@@ -201,7 +205,7 @@ int CHintBox::exec()
|
|||||||
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd( timeout );
|
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd( timeout );
|
||||||
|
|
||||||
if (timeout > 0)
|
if (timeout > 0)
|
||||||
showTimeOutBar();
|
enableTimeOutBar();
|
||||||
|
|
||||||
while ( ! ( res & ( messages_return::cancel_info | messages_return::cancel_all ) ) )
|
while ( ! ( res & ( messages_return::cancel_info | messages_return::cancel_all ) ) )
|
||||||
{
|
{
|
||||||
@@ -244,6 +248,8 @@ int CHintBox::exec()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disableTimeOutBar();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -84,6 +84,7 @@ class CHintBox : public CComponentsWindow
|
|||||||
const int& indent);
|
const int& indent);
|
||||||
|
|
||||||
virtual void ReSize();
|
virtual void ReSize();
|
||||||
|
void showTimeOutBar(){enableTimeOutBar();}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**CHintBox Constructor
|
/**CHintBox Constructor
|
||||||
@@ -186,9 +187,17 @@ class CHintBox : public CComponentsWindow
|
|||||||
virtual void setTimeOut(const int& Timeout){timeout = Timeout;}
|
virtual void setTimeOut(const int& Timeout){timeout = Timeout;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* enable visualized timeout as progressbar under titelbar
|
* enable/disable visualized timeout as progressbar under titlebar
|
||||||
|
* @param[in] enable
|
||||||
|
* @li optional: exepts type bool, default = true
|
||||||
*/
|
*/
|
||||||
void showTimeOutBar();
|
void enableTimeOutBar(bool enable = true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* disable visualized timeout as progressbar
|
||||||
|
* @see enableTimeOutBar
|
||||||
|
*/
|
||||||
|
void disableTimeOutBar(){enableTimeOutBar(false);}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* scroll handler for text objects: NOTE: exec() must be called !
|
* scroll handler for text objects: NOTE: exec() must be called !
|
||||||
|
@@ -223,7 +223,7 @@ int CMsgBox::exec()
|
|||||||
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout);
|
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(timeout);
|
||||||
|
|
||||||
if (timeout > 0)
|
if (timeout > 0)
|
||||||
showTimeOutBar();
|
enableTimeOutBar();
|
||||||
|
|
||||||
bool loop = true;
|
bool loop = true;
|
||||||
while (loop)
|
while (loop)
|
||||||
|
Reference in New Issue
Block a user