]> git.sur5r.net Git - bacula/bacula/commitdiff
- wxbRestorePanel : Corrected a problem when you double-clicked an a folder in the...
authorNicolas Boichat <nicolas@boichat.ch>
Sat, 1 May 2004 15:39:12 +0000 (15:39 +0000)
committerNicolas Boichat <nicolas@boichat.ch>
Sat, 1 May 2004 15:39:12 +0000 (15:39 +0000)
 - wxbRestorePanel : Improved configuration panels' look
 - wxbRestorePanel : Added titles to configuration panels

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1336 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/wx-console/CHANGELOG
bacula/src/wx-console/TODO
bacula/src/wx-console/wxbconfigpanel.cpp
bacula/src/wx-console/wxbconfigpanel.h
bacula/src/wx-console/wxbmainframe.cpp
bacula/src/wx-console/wxbrestorepanel.cpp

index 6f706d5b45dc4e6f30f92dfa2414ab2052585e1a..85b7e8d4336e884e97c7045283905dab294a6bca 100644 (file)
@@ -1,4 +1,9 @@
 31-04-2004 :
+ - wxbRestorePanel : Corrected a problem when you double-clicked an 
+      a folder in the list, the list was then refreshed two times
+      (instead of one) in the new directory
+ - wxbRestorePanel : Improved configuration panels' look
+ - wxbRestorePanel : Added titles to configuration panels
  - wxbMainFrame : If the connection drops unexpectedly, it should say 
    it lost the connection to the Director and then wait for you to
    either manually exit or (when it becomes possible) reconnect.
index 90ce28fc1bd1231d8477f8ada3435db51a427df8..e71fd5101447524ebb934600e47ab8ca604dc69a 100644 (file)
@@ -1,10 +1,6 @@
 FEATURES
 --------
 
-wxbRestorePanel : Reconsider start button's labels.
-
-wxbRestorePanel : Add titles to configuration panels
-
 wxbRestorePanel : When cancelling, check for commands results
 
 general : Show nice messages boxes when errors occurs.
@@ -16,7 +12,8 @@ wxbRestorePanel : Add a way to cancel restore when building tree
 
 wxbMainFrame : set focus to type control when clicking on console
 
-global : create a general class which keeps clients, jobs, filesets, pools... list.
+global : create a general class which keeps clients, jobs, 
+       filesets, pools... list, and with functions like WaitForEnd.
 
 wxbConfigPanel : Create a dialog for selecting dates and paths.
 
@@ -30,10 +27,6 @@ wxbRestorePanel : Add buttons to mark/unmark directories/files.
 
 wxbRestorePanel : Add a button to force to refresh the whole tree
 
-wxbRestorePanel : Put titles above the Client drop down 
-     box and the Backup date drop down box. It isn't immediately 
-     obvious that the dates correspond to the backup dates.
-
 wxbRestorePanel : There needs to be some way of marking/unmarking a range of 
      files selected with shift-click or multiple files selected 
      with ctl-click. The GTX console uses a button to mark/unmark 
@@ -88,10 +81,3 @@ bacula-dir : correct director to handle correctly + marked status
    (not a file), and then unmark it, its parents keep the "+" status.)
 
 general : make a good documentation with snapshots
-
-BUGS
-----
-
-wxRestorePanel : When you double-click an a folder in the list, 
-      the list is then refreshed two times (instead of one) 
-      in the new directory
index f743b8c79928b4342a09a892f3c1623c4f17478d..2fb98026096c6466bca3d4ff425f493a71d36ca5 100644 (file)
@@ -64,7 +64,7 @@ wxbConfigParam::~wxbConfigParam() {
 }
   
 void wxbConfigParam::AddControl(wxWindow* parent, wxSizer* sizer) {
-   sizer->Add(new wxStaticText(parent, -1, title + ": ", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT), 1, wxEXPAND | wxALIGN_CENTER_HORIZONTAL);
+   sizer->Add(new wxStaticText(parent, -1, title + ": ", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT), 0, wxEXPAND | wxALIGN_CENTER_HORIZONTAL);
    switch (type) {
    case text:
       statictext = new wxStaticText(parent, -1, value, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
@@ -75,7 +75,7 @@ void wxbConfigParam::AddControl(wxWindow* parent, wxSizer* sizer) {
       sizer->Add(textctrl, 1, wxEXPAND | wxADJUST_MINSIZE);
       break;
    case choice:
-      choicectrl = new wxChoice(parent, id, wxDefaultPosition, wxDefaultSize, nvalues, values);
+      choicectrl = new wxChoice(parent, id, wxDefaultPosition, wxSize(150, 20), nvalues, values);
       sizer->Add(choicectrl, 1, wxEXPAND);
       break;
    }
@@ -154,12 +154,17 @@ void wxbConfigParam::Add(wxString value) {
 }
 
 /* Creates a new config panel, config must be allocated with new */
-wxbConfigPanel::wxbConfigPanel(wxWindow* parent, wxbConfig* config,
+wxbConfigPanel::wxbConfigPanel(wxWindow* parent, wxbConfig* config, wxString title,
       wxWindowID ok, wxWindowID cancel, wxWindowID apply): wxPanel(parent) {
 
    this->config = config;
 
    wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
+   
+   mainSizer->Add(
+      new wxStaticText(this, -1, title, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER),
+            0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5);
+
    wxFlexGridSizer* cfgSizer = new wxFlexGridSizer(config->GetCount()+1, 2, 8, 5);
    unsigned int i;
    for (i = 0; i < config->GetCount(); i++) {
index 14c6bbe04b4e013ae8a39940ef3e35e4259a687a..baaead91fdb49030d3bd9beadfce3b83d15de639 100644 (file)
@@ -81,7 +81,7 @@ WX_DECLARE_OBJARRAY(wxbConfigParam, wxbConfig);
 class wxbConfigPanel : public wxPanel {
 public:
    /* Creates a new config panel, config must be allocated with new */
-       wxbConfigPanel(wxWindow* parent, wxbConfig* config, wxWindowID ok, wxWindowID cancel, wxWindowID apply = -1);
+       wxbConfigPanel(wxWindow* parent, wxbConfig* config, wxString title, wxWindowID ok, wxWindowID cancel, wxWindowID apply = -1);
        ~wxbConfigPanel();
    
    void SetRowString(const char* title, wxString value);
index 4399a3a5e929bb68bc66b645134ab61cee151cdd..3e64a2c13811e7cad26560cc6aad1f16b274ecc9 100644 (file)
@@ -171,6 +171,7 @@ wxbMainFrame::~wxbMainFrame()
    if (ct != NULL) { // && (!ct->IsRunning())
       ct->Delete();
    }
+   frame = NULL;
 }
 
 /*
@@ -313,6 +314,7 @@ void wxbMainFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
       ct->Delete();
       ct = NULL;
    }
+   frame = NULL;
    Close(TRUE);
 }
 
@@ -359,6 +361,7 @@ void wxbMainFrame::Print(wxString str, int status)
       int answer = wxMessageBox("Connection to the director lost. Quit program?", "Connection lost",
                         wxYES_NO | wxICON_EXCLAMATION, this);
       if (answer == wxYES) {
+         frame = NULL;
          Close(true);
       }
       return;
@@ -542,8 +545,10 @@ void firePrintEvent(wxString str, int status)
 
    wxbThreadEvent evt(Thread);
    evt.SetEventPrintObject(po);
-
-   wxbMainFrame::GetInstance()->AddPendingEvent(evt);
+   
+   if (wxbMainFrame::GetInstance()) {
+      wxbMainFrame::GetInstance()->AddPendingEvent(evt);
+   }
 }
 
 //wxString csBuffer; /* Temporary buffer for receiving data from console thread */
index 1a4f12a8fea65a06369d7bd1e0d8f314225900f5..4a2d2e6eda7ece00ce2d2a3481badad9723e5f79 100644 (file)
@@ -308,7 +308,7 @@ wxbRestorePanel::wxbRestorePanel(wxWindow* parent): wxbPanel(parent) {
    config->Add(new wxbConfigParam("Storage", ConfigStorage, choice, 0, elist));
    config->Add(new wxbConfigParam("Before", ConfigWhen, choice, 0, elist));
    
-   configPanel = new wxbConfigPanel(this, config, RestoreStart, RestoreCancel, -1);
+   configPanel = new wxbConfigPanel(this, config, "Please configure parameters concerning files to restore :", RestoreStart, RestoreCancel, -1);
    
    configPanel->Show(true);
    configPanel->Enable(false);
@@ -325,7 +325,7 @@ wxbRestorePanel::wxbRestorePanel(wxWindow* parent): wxbPanel(parent) {
    config->Add(new wxbConfigParam("When", ConfigWhen, modifiableText, ""));
    config->Add(new wxbConfigParam("Priority", ConfigPriority, modifiableText, ""));
    
-   restorePanel = new wxbConfigPanel(this, config, ConfigOk, ConfigCancel, ConfigApply);
+   restorePanel = new wxbConfigPanel(this, config, "Please configure parameters concerning files restoration :", ConfigOk, ConfigCancel, ConfigApply);
     
    restorePanel->Show(false);
    
@@ -653,6 +653,7 @@ void wxbRestorePanel::CmdStart() {
 
       WaitForEnd("unmark *\n");
       wxTreeItemId root = tree->AddRoot(configPanel->GetRowString("Client"), -1, -1, new wxbTreeItemData("/", configPanel->GetRowString("Client"), 0));
+      currentTreeItem = root;
       tree->Refresh();
       UpdateTreeItem(root, true);
       wxbMainFrame::GetInstance()->SetStatusText("Right click on a file or on a directory, or double-click on its mark to add it to the restore list.");
@@ -859,7 +860,6 @@ void wxbRestorePanel::CmdCancel() {
    cancelled = 1;
    
    if (status == restoring) {
-      int n = 0;
       if (jobid != "") {
          wxbMainFrame::GetInstance()->Send(wxString("cancel job=") << jobid << "\n");
       }
@@ -1246,12 +1246,10 @@ wxbDataTokenizer* wxbRestorePanel::WaitForEnd(wxString cmd, bool keepresults, bo
 /* Run a dir command, and waits until result is fully received. */
 void wxbRestorePanel::UpdateTreeItem(wxTreeItemId item, bool updatelist) {
 //   this->updatelist = updatelist;
-   currentTreeItem = item;
-
    wxbDataTokenizer* dt;
 
    dt = WaitForEnd(wxString("cd \"") << 
-      static_cast<wxbTreeItemData*>(tree->GetItemData(currentTreeItem))
+      static_cast<wxbTreeItemData*>(tree->GetItemData(item))
          ->GetPath() << "\"\n", false);
 
    /* TODO: check command result */
@@ -1286,7 +1284,7 @@ void wxbRestorePanel::UpdateTreeItem(wxTreeItemId item, bool updatelist) {
          wxString itemStr;
 
          long cookie;
-         treeid = tree->GetFirstChild(currentTreeItem, cookie);
+         treeid = tree->GetFirstChild(item, cookie);
 
          bool updated = false;
 
@@ -1302,12 +1300,12 @@ void wxbRestorePanel::UpdateTreeItem(wxTreeItemId item, bool updatelist) {
                updated = true;
                break;
             }
-            treeid = tree->GetNextChild(currentTreeItem, cookie);
+            treeid = tree->GetNextChild(item, cookie);
          }
 
          if (!updated) {
             int img = wxbTreeItemData::GetMarkedStatus(file[6]);
-            treeid = tree->AppendItem(currentTreeItem, file[8], img, img, new wxbTreeItemData(file[7], file[8], file[6]));
+            treeid = tree->AppendItem(item, file[8], img, img, new wxbTreeItemData(file[7], file[8], file[6]));
          }
       }
 
@@ -1804,9 +1802,13 @@ void wxbRestorePanel::OnTreeChanged(wxTreeEvent& event) {
    if (working) {
       return;
    }
+   if (currentTreeItem == event.GetItem()) {
+      return;
+   }
    SetCursor(*wxHOURGLASS_CURSOR);
    markWhenListingDone = false;
    working = true;
+   currentTreeItem = event.GetItem();
    CmdList(event.GetItem());
    if (markWhenListingDone) {
       CmdMark(event.GetItem(), -1);
@@ -1876,7 +1878,7 @@ void wxbRestorePanel::OnListActivated(wxListEvent& event) {
                SetCursor(*wxSTANDARD_CURSOR);
                tree->Expand(currentTreeItem);
                tree->SelectItem(currentChild);
-               tree->Refresh();
+               //tree->Refresh();
                return;
             }
             currentChild = tree->GetNextChild(currentTreeItem, cookie);