From aa313475fa48ac1537324248e77c25e6d9a0f986 Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Fri, 6 Aug 2004 15:14:36 +0000 Subject: [PATCH] - wxbRestorePanel : now parsing '+' sent by the director when building tree. - wxbRestorePanel : implemented .backups client=xxx (2.1). git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1513 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/wx-console/CHANGELOG | 3 ++ bacula/src/wx-console/TODO | 4 -- bacula/src/wx-console/wxbrestorepanel.cpp | 53 +++++++++-------------- bacula/src/wx-console/wxbtableparser.cpp | 4 +- bacula/src/wx-console/wxbtableparser.h | 2 +- 5 files changed, 26 insertions(+), 40 deletions(-) diff --git a/bacula/src/wx-console/CHANGELOG b/bacula/src/wx-console/CHANGELOG index 97e4845b2e..4b8ce87317 100644 --- a/bacula/src/wx-console/CHANGELOG +++ b/bacula/src/wx-console/CHANGELOG @@ -1,4 +1,7 @@ 06-08-2004 : + - wxbRestorePanel : now parsing '+' sent by the director when building + tree. + - wxbRestorePanel : implemented .backups client=xxx (2.1) - wxbRestorePanel : implemented the director modification showing jobid when a job is started. diff --git a/bacula/src/wx-console/TODO b/bacula/src/wx-console/TODO index 62c076bcf8..726adbf6ec 100644 --- a/bacula/src/wx-console/TODO +++ b/bacula/src/wx-console/TODO @@ -1,6 +1,4 @@ general : Show nice messages boxes when errors occurs. - -wxbRestorePanel : implement .backups client=xxx (2.1a) wxbRestorePanel : list jobs and list jobid=# will probably crash if there is nothing to show (db error or empty table) @@ -74,8 +72,6 @@ wxbRestorePanel : The + only appears when one selects a directory, wxbRestorePanel : Add a timeout when waiting for commands results -bacula-dir : Progress status when building tree. - bacula-dir : correct director to handle correctly + marked status (In fact there is a bug in the director : If you mark a directory (not a file), and then unmark it, its parents keep the "+" status.) diff --git a/bacula/src/wx-console/wxbrestorepanel.cpp b/bacula/src/wx-console/wxbrestorepanel.cpp index 779c6ad5df..440ed3eff8 100644 --- a/bacula/src/wx-console/wxbrestorepanel.cpp +++ b/bacula/src/wx-console/wxbrestorepanel.cpp @@ -587,7 +587,7 @@ void wxbRestorePanel::CmdStart() { SetStatus(choosing); wxbTableParser* tableparser = new wxbTableParser(); - wxbDataTokenizer* dt = new wxbDataTokenizer(true); + wxbDataTokenizer* dt = new wxbDataTokenizer(false); wxbMainFrame::GetInstance()->Send(wxString("restore") << " client=\"" << configPanel->GetRowString("Client") << @@ -670,34 +670,24 @@ void wxbRestorePanel::CmdStart() { if (str.ToLong(&l)) { done += willdo; willdo += l; - var = (willdo-done)/3; + var = (willdo-done)/50; + gauge->SetValue(done); + wxTheApp->Yield(true); } break; } } } + else if ((*dt)[lastindex] == "+") { + gauge->SetValue(gauge->GetValue()+var); + wxTheApp->Yield(true); + } } - if (gauge->GetValue() <= done) { - gauge->SetValue(done); - if (var < 0) - var = -var; - } - else if (gauge->GetValue() >= willdo) { - gauge->SetValue(willdo); - if (var > 0) - var = -var; - } - - gauge->SetValue(gauge->GetValue()+var); - + if (dt->hasFinished()) { break; } - - /*wxbMainFrame::GetInstance()->Print( - wxString("[") << gauge->GetValue() << "/" << done - << "-" << willdo << "]", CS_DEBUG);*/ } wxTheApp->Yield(true); ::wxUsleep(1); @@ -1180,12 +1170,18 @@ void wxbRestorePanel::CmdConfigCancel() { void wxbRestorePanel::CmdListJobs() { if (status == entered) { configPanel->ClearRowChoices("Before"); - wxbUtils::WaitForPrompt("query\n"); - wxbUtils::WaitForPrompt("6\n"); - wxbTableParser* tableparser = new wxbTableParser(); - wxbDataTokenizer* dt = wxbUtils::WaitForEnd(configPanel->GetRowString("Client") + "\n", true); + /*wxbUtils::WaitForPrompt("query\n"); + wxbUtils::WaitForPrompt("6\n");*/ + wxbTableParser* tableparser = new wxbTableParser(false); + wxbDataTokenizer* dt = wxbUtils::WaitForEnd( + wxString(".backups client=") + configPanel->GetRowString("Client") + "\n", true); - if (!tableparser->hasFinished()) { + while (!tableparser->hasFinished()) { + wxTheApp->Yield(true); + ::wxUsleep(100); + } + + if (!tableparser->GetCount() == 0) { for (unsigned int i = 0; i < dt->Count(); i++) { if ((*dt)[i].Find("No results to list.") == 0) { configPanel->AddRowChoice("Before", "No backup found for this client."); @@ -1206,11 +1202,6 @@ void wxbRestorePanel::CmdListJobs() { } } - while (!tableparser->hasFinished()) { - wxTheApp->Yield(true); - ::wxUsleep(100); - } - delete dt; for (int i = tableparser->GetCount()-1; i > -1; i--) { @@ -1219,12 +1210,8 @@ void wxbRestorePanel::CmdListJobs() { const char* chr; if ( ( (chr = datetime.ParseDate(str.GetData()) ) != NULL ) && ( datetime.ParseTime(++chr) != NULL ) ) { datetime += wxTimeSpan::Seconds(1); - //wxbMainFrame::GetInstance()->Print(wxString("-") << datetime.Format("%Y-%m-%d %H:%M:%S"), CS_DEBUG); configPanel->AddRowChoice("Before", datetime.Format("%Y-%m-%d %H:%M:%S")); } - /*else { - jobChoice->Append("Invalid"); - }*/ } delete tableparser; diff --git a/bacula/src/wx-console/wxbtableparser.cpp b/bacula/src/wx-console/wxbtableparser.cpp index 6f60f35ea6..5ce98e2764 100644 --- a/bacula/src/wx-console/wxbtableparser.cpp +++ b/bacula/src/wx-console/wxbtableparser.cpp @@ -54,8 +54,8 @@ wxbArrayString::~wxbArrayString() { /* * wxbTableParser constructor */ -wxbTableParser::wxbTableParser() : wxbTable(), wxbDataParser(true) { - separatorNum = 0; +wxbTableParser::wxbTableParser(bool header) : wxbTable(), wxbDataParser(true) { + separatorNum = header ? 0 : 2; tableHeader = wxbArrayString(); } diff --git a/bacula/src/wx-console/wxbtableparser.h b/bacula/src/wx-console/wxbtableparser.h index dfce4989e4..565630165a 100644 --- a/bacula/src/wx-console/wxbtableparser.h +++ b/bacula/src/wx-console/wxbtableparser.h @@ -71,7 +71,7 @@ WX_DECLARE_OBJARRAY( wxbArrayString, wxbTable ); class wxbTableParser: public wxbTable, public wxbDataParser { public: - wxbTableParser(); + wxbTableParser(bool header = true); virtual ~wxbTableParser(); /* -- 2.39.5