mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 07:51:19 +02:00
CProgressWindow: try to reduce effort inside progress display
Should help to reduce some timing side effects with many data amounts. But there could still be more potential.
This commit is contained in:
@@ -79,7 +79,7 @@ void CProgressWindow::Init( signal<void, size_t, size_t, string> *statusSignal,
|
|||||||
if (globalSignal)
|
if (globalSignal)
|
||||||
*globalSignal->connect(mem_fun(*this, &CProgressWindow::showGlobalStatus));
|
*globalSignal->connect(mem_fun(*this, &CProgressWindow::showGlobalStatus));
|
||||||
|
|
||||||
global_progress = local_progress = 0;
|
global_progress = local_progress = percent_progress = 0;
|
||||||
|
|
||||||
showFooter(false);
|
showFooter(false);
|
||||||
|
|
||||||
@@ -91,6 +91,8 @@ void CProgressWindow::Init( signal<void, size_t, size_t, string> *statusSignal,
|
|||||||
status_txt->doPaintBg(false);
|
status_txt->doPaintBg(false);
|
||||||
addWindowItem(status_txt);
|
addWindowItem(status_txt);
|
||||||
|
|
||||||
|
cur_statusText = string();
|
||||||
|
|
||||||
//create local_bar object
|
//create local_bar object
|
||||||
local_bar = getProgressItem();
|
local_bar = getProgressItem();
|
||||||
|
|
||||||
@@ -128,10 +130,16 @@ CProgressBar* CProgressWindow::getProgressItem()
|
|||||||
void CProgressWindow::initStatus(const unsigned int prog, const unsigned int max, const string &statusText, CProgressBar *pBar)
|
void CProgressWindow::initStatus(const unsigned int prog, const unsigned int max, const string &statusText, CProgressBar *pBar)
|
||||||
{
|
{
|
||||||
pBar->allowPaint(true);
|
pBar->allowPaint(true);
|
||||||
pBar->setValues(prog, (int)max);
|
unsigned int cur_perc = prog*100/(max+1);
|
||||||
if (!statusText.empty())
|
if (percent_progress != cur_perc || prog == 0){
|
||||||
showStatusMessageUTF(statusText);
|
pBar->setValues(prog, (int)max);
|
||||||
pBar->paint(false);
|
if (!statusText.empty() && (cur_statusText != statusText)){
|
||||||
|
showStatusMessageUTF(statusText);
|
||||||
|
cur_statusText = statusText;
|
||||||
|
}
|
||||||
|
pBar->paint(false);
|
||||||
|
percent_progress = cur_perc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CProgressWindow::showStatus(const unsigned int prog, const unsigned int max, const string &statusText)
|
void CProgressWindow::showStatus(const unsigned int prog, const unsigned int max, const string &statusText)
|
||||||
|
@@ -39,6 +39,8 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget
|
|||||||
|
|
||||||
unsigned int global_progress;
|
unsigned int global_progress;
|
||||||
unsigned int local_progress;
|
unsigned int local_progress;
|
||||||
|
unsigned int percent_progress;
|
||||||
|
std::string cur_statusText;
|
||||||
int h_height;
|
int h_height;
|
||||||
void Init( sigc::signal<void, size_t, size_t, std::string> *statusSignal,
|
void Init( sigc::signal<void, size_t, size_t, std::string> *statusSignal,
|
||||||
sigc::signal<void,size_t, size_t, std::string> *localSignal,
|
sigc::signal<void,size_t, size_t, std::string> *localSignal,
|
||||||
|
Reference in New Issue
Block a user