From 8655c33a826d0b73e666e859ddea4ac6283ba022 Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Sun, 29 Jul 2007 15:01:22 +0000 Subject: [PATCH] Add a label to describe whether pushing the refresh button will refresh from the selection criterion or from the any changes in the check boxes in the job table. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5264 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/restore/restoretree.cpp | 41 ++++++++++-- bacula/src/qt-console/restore/restoretree.h | 6 ++ bacula/src/qt-console/restore/restoretree.ui | 67 ++++++++++++------- 3 files changed, 84 insertions(+), 30 deletions(-) diff --git a/bacula/src/qt-console/restore/restoretree.cpp b/bacula/src/qt-console/restore/restoretree.cpp index 8d51d087c6..b2e5b7b3f8 100644 --- a/bacula/src/qt-console/restore/restoretree.cpp +++ b/bacula/src/qt-console/restore/restoretree.cpp @@ -99,6 +99,13 @@ void restoreTree::setupPage() connect(refreshButton, SIGNAL(pressed()), this, SLOT(refreshButtonPushed())); connect(restoreButton, SIGNAL(pressed()), this, SLOT(restoreButtonPushed())); connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(jobComboChanged(int))); + connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateRefresh())); + connect(clientCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateRefresh())); + connect(fileSetCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateRefresh())); + connect(limitCheckBox, SIGNAL(stateChanged(int)), this, SLOT(updateRefresh())); + connect(daysCheckBox, SIGNAL(stateChanged(int)), this, SLOT(updateRefresh())); + connect(daysSpinBox, SIGNAL(valueChanged(int)), this, SLOT(updateRefresh())); + connect(limitSpinBox, SIGNAL(valueChanged(int)), this, SLOT(updateRefresh())); connect(directoryTree, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(directoryCurrentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *))); connect(directoryTree, SIGNAL(itemExpanded(QTreeWidgetItem *)), @@ -119,6 +126,26 @@ void restoreTree::setupPage() directoryTree->setContextMenuPolicy(Qt::ActionsContextMenu); } +void restoreTree::updateRefresh() +{ + if (mainWin->m_rtPopDirDebug) Pmsg2(000, "testing prev=\"%s\" current=\"%s\"\n", m_prevJobCombo.toUtf8().data(), jobCombo->currentText().toUtf8().data()); + m_dropdownChanged = (m_prevJobCombo != jobCombo->currentText()) + || (m_prevClientCombo != clientCombo->currentText()) + || (m_prevFileSetCombo != fileSetCombo->currentText() + || (m_prevLimitSpinBox != limitSpinBox->value()) + || (m_prevDaysSpinBox != daysSpinBox->value()) + || (m_prevLimitCheckState != limitCheckBox->checkState()) + || (m_prevDaysCheckState != daysCheckBox->checkState()) + ); + if (m_dropdownChanged) { + if (mainWin->m_rtPopDirDebug) Pmsg0(000, "In restoreTree::updateRefresh Is CHANGED\n"); + refreshLabel->setText("Refresh From Re-Select"); + } else { + if (mainWin->m_rtPopDirDebug) Pmsg0(000, "In restoreTree::updateRefresh Is not Changed\n"); + refreshLabel->setText("Refresh From JobChecks"); + } +} + /* * When refresh button is pushed, perform a query getting the directories and * use parseDirectory and addDirectory to populate the directory tree with items. @@ -142,11 +169,9 @@ void restoreTree::populateDirectoryTree() QString jobComboText = jobCombo->currentText(); QString clientComboText = clientCombo->currentText(); QString fileSetComboText = fileSetCombo->currentText(); - if (mainWin->m_rtPopDirDebug) Pmsg2(000, "testing prev=\"%s\" current=\"%s\"\n", m_prevJobCombo.toUtf8().data(), jobComboText.toUtf8().data()); - bool dropdownChanged = (m_prevJobCombo != jobComboText) || (m_prevClientCombo != clientComboText) || (m_prevFileSetCombo != fileSetComboText); + updateRefresh(); int taskcount = 2, ontask = 1; - if (dropdownChanged) taskcount += 1; -// QString taskCountString = QString("%1").arg(taskcount); + if (m_dropdownChanged) taskcount += 1; /* Set progress bars and repaint */ prBar1->setVisible(true); @@ -160,10 +185,15 @@ void restoreTree::populateDirectoryTree() prLabel2->setVisible(true); repaint(); - if (dropdownChanged) { + if (m_dropdownChanged) { m_prevJobCombo = jobComboText; m_prevClientCombo = clientComboText; m_prevFileSetCombo = fileSetComboText; + m_prevLimitSpinBox = limitSpinBox->value(); + m_prevDaysSpinBox = daysSpinBox->value(); + m_prevLimitCheckState = limitCheckBox->checkState(); + m_prevDaysCheckState = daysCheckBox->checkState(); + updateRefresh(); if (mainWin->m_rtPopDirDebug) Pmsg0(000, "Repopulating the Job Table\n"); QString condition = " Client.Name='" + clientCombo->itemText(clientCombo->currentIndex()) + "'"; @@ -206,6 +236,7 @@ void restoreTree::populateDirectoryTree() populateJobTable(); setJobsCheckedList(); } else { + if (mainWin->m_rtPopDirDebug) Pmsg0(000, "Repopulating from checks in Job Table\n"); setJobsCheckedList(); } diff --git a/bacula/src/qt-console/restore/restoretree.h b/bacula/src/qt-console/restore/restoretree.h index 9311ddeb72..4a9785df49 100644 --- a/bacula/src/qt-console/restore/restoretree.h +++ b/bacula/src/qt-console/restore/restoretree.h @@ -69,6 +69,7 @@ private slots: void directoryItemChanged(QTreeWidgetItem *, int); void fileTableItemChanged(QTableWidgetItem *); void versionTableItemChanged(QTableWidgetItem *); + void updateRefresh(); private: void populateDirectoryTree(); @@ -94,6 +95,7 @@ private: int queryFileIndex(QString &fullPath, int jobID); bool m_populated; + bool m_dropdownChanged; QRegExp m_winRegExpDrive; QRegExp m_winRegExpPath; QRegExp m_slashregex; @@ -104,6 +106,10 @@ private: QString m_prevJobCombo; QString m_prevClientCombo; QString m_prevFileSetCombo; + int m_prevLimitSpinBox; + int m_prevDaysSpinBox; + Qt::CheckState m_prevLimitCheckState; + Qt::CheckState m_prevDaysCheckState; QString m_JobsCheckedList; int m_debugCnt; bool m_debugTrap; diff --git a/bacula/src/qt-console/restore/restoretree.ui b/bacula/src/qt-console/restore/restoretree.ui index 053e31eaa1..9cb45a7706 100644 --- a/bacula/src/qt-console/restore/restoretree.ui +++ b/bacula/src/qt-console/restore/restoretree.ui @@ -154,52 +154,69 @@ - 10 - 57 - 791 + 20 + 23 + 661 79 - 950 - 16777215 + 900 + 79 - 0 + 6 - 6 + 0 - 3 + 0 - 9 + 6 - - - Refresh - - - :/images/view-refresh.svg - - - - - - - Restore + + + 0 - - :/images/restore.png + + 6 - + + + + Refresh + + + :/images/view-refresh.svg + + + + + + + TextLabel + + + + + + + Restore + + + :/images/restore.png + + + + -- 2.39.5