From: Dirk H Bartley Date: Sun, 29 Jul 2007 04:42:23 +0000 (+0000) Subject: Put controls in a scroll area for JobList and restore tree. Then put the scroll X-Git-Tag: Release-7.0.0~5925 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=30ee19ec636750974dd652dbd3d7440536f028f2;p=bacula%2Fbacula Put controls in a scroll area for JobList and restore tree. Then put the scroll area in a splitter. Allows for the window to get smaller and the control area will then scroll. Add ability to have the only criterion be the client in restore tree. Add limits to restore tree like with joblist with record limit and/or days limit. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5261 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/joblist/joblist.cpp b/bacula/src/qt-console/joblist/joblist.cpp index 006c06a9f5..159ba120fe 100644 --- a/bacula/src/qt-console/joblist/joblist.cpp +++ b/bacula/src/qt-console/joblist/joblist.cpp @@ -70,6 +70,21 @@ JobList::JobList(const QString &mediaName, const QString &clientName, daysCheckBox->setCheckState(mainWin->m_daysLimitCheck ? Qt::Checked : Qt::Unchecked); daysSpinBox->setValue(mainWin->m_daysLimitVal); dockPage(); + + QGridLayout *m_gridLayout = new QGridLayout(this); + m_gridLayout->setSpacing(6); + m_gridLayout->setMargin(9); + m_gridLayout->setObjectName(QString::fromUtf8("m_gridLayout")); + + QSplitter *splitter_2 = new QSplitter(Qt::Vertical, this); + QScrollArea *area = new QScrollArea(); + area->setObjectName(QString::fromUtf8("area")); + area->setWidget(frame); + area->setWidgetResizable(true); + splitter_2->addWidget(mp_tableWidget); + splitter_2->addWidget(area); + + m_gridLayout->addWidget(splitter_2, 0, 0, 1, 1); } /* diff --git a/bacula/src/qt-console/joblist/joblist.ui b/bacula/src/qt-console/joblist/joblist.ui index 00a0ab9b94..c0ee9eb989 100644 --- a/bacula/src/qt-console/joblist/joblist.ui +++ b/bacula/src/qt-console/joblist/joblist.ui @@ -5,342 +5,361 @@ 0 0 - 545 - 276 + 739 + 512 Form - - - 9 + + + + 60 + 10 + 457 + 131 + - - 6 + + + + + 30 + 170 + 521 + 143 + - - - - 0 - - - 6 - - - - - 0 - - - 6 - - - - - 0 - - - 3 - - - - - - 65 - 20 - - - - Refresh - - - :/images/view-refresh.svg - - - - - - - - 65 - 20 - - - - Graph - - - :/images/graph1.png - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Ignored - - - - 16 - 20 - - - - - - - - - - 0 - - - 6 - - - - - 0 - - - 6 - - - - - Status - - - - - - - - - - - - 0 - - - 6 - - - - - Purged - - - - - - - - - - - - - - 0 - - - 6 - - - - - 0 - - - 6 - - - - - Record Limit - - - - - - - 10000 - - - 1 - - - 25 - - - - - - - - - 0 - - - 6 - - - - - Days Limit - - - - - - - 7 - - - - - - - - - - - 0 - - - 6 - - - - - - 16777215 - 20 - - - - FileSet - - - - - - - - - - - - 0 - - - 6 - - - - - 0 - - - 6 - - - - - Clients - - - - - - - - - - - - 0 - - - 6 - - - - - Volume - - - - - - - - - - - - - - 0 - - - 6 - - - - - 0 - - - 6 - - - - - Job - - - - - - - - - - - - 0 - - - 6 - - - - - Level - - - - - - - - - - - - - - - - + + + 900 + 143 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 9 + + + 6 + + + + + 3 + + + 6 + + + + + 3 + + + 6 + + + + + Job + + + + + + + + + + + + 3 + + + 6 + + + + + Level + + + + + + + + + + + + + + 3 + + + 6 + + + + + 3 + + + 6 + + + + + Clients + + + + + + + + + + + + 3 + + + 6 + + + + + Volume + + + + + + + + + + + + + + 3 + + + 6 + + + + + + 16777215 + 20 + + + + FileSet + + + + + + + + + + + + 3 + + + 6 + + + + + 3 + + + 6 + + + + + Record Limit + + + + + + + 10000 + + + 1 + + + 25 + + + + + + + + + 3 + + + 6 + + + + + Days Limit + + + + + + + 7 + + + + + + + + + + + 3 + + + 6 + + + + + 3 + + + 6 + + + + + Status + + + + + + + + + + + + 3 + + + 6 + + + + + Purged + + + + + + + + + + + + + + 3 + + + 6 + + + + + 3 + + + 3 + + + + + + 65 + 20 + + + + Refresh + + + :/images/view-refresh.svg + + + + + + + + 65 + 20 + + + + Graph + + + :/images/graph1.png + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Ignored + + + + 16 + 20 + + + + + + + + :/images/view-refresh.svg diff --git a/bacula/src/qt-console/restore/restoretree.cpp b/bacula/src/qt-console/restore/restoretree.cpp index 852d8c9ac5..8d51d087c6 100644 --- a/bacula/src/qt-console/restore/restoretree.cpp +++ b/bacula/src/qt-console/restore/restoretree.cpp @@ -57,11 +57,33 @@ restoreTree::restoreTree() m_slashregex.setPattern("/"); m_debugCnt = 0; m_debugTrap = true; + + QGridLayout *m_gridLayout = new QGridLayout(this); + m_gridLayout->setSpacing(6); + m_gridLayout->setMargin(9); + m_gridLayout->setObjectName(QString::fromUtf8("m_gridLayout")); + + QSplitter *splitter_2 = new QSplitter(Qt::Vertical, this); + QScrollArea *area = new QScrollArea(); + area->setObjectName(QString::fromUtf8("area")); + area->setWidget(widget); + area->setWidgetResizable(true); + splitter_2->addWidget(splitter); + splitter_2->addWidget(area); + + m_gridLayout->addWidget(splitter_2, 0, 0, 1, 1); + /* progress widgets */ prBar1->setVisible(false); prBar2->setVisible(false); prLabel1->setVisible(false); prLabel2->setVisible(false); + + /* Set Defaults for check and spin for limits */ + limitCheckBox->setCheckState(mainWin->m_recordLimitCheck ? Qt::Checked : Qt::Unchecked); + limitSpinBox->setValue(mainWin->m_recordLimitVal); + daysCheckBox->setCheckState(mainWin->m_daysLimitCheck ? Qt::Checked : Qt::Unchecked); + daysSpinBox->setValue(mainWin->m_daysLimitVal); } restoreTree::~restoreTree() @@ -91,6 +113,7 @@ void restoreTree::setupPage() clientCombo->addItems(m_console->client_list); fileSetCombo->addItem("Any"); fileSetCombo->addItems(m_console->fileset_list); + jobCombo->addItem("Any"); jobCombo->addItems(m_console->job_list); directoryTree->setContextMenuPolicy(Qt::ActionsContextMenu); @@ -116,11 +139,10 @@ void restoreTree::populateDirectoryTree() m_versionExceptionHash.clear(); m_directoryIconStateHash.clear(); - int clientIndex = clientCombo->currentIndex(); - int fileSetIndex = fileSetCombo->currentIndex(); - QString jobComboText = jobCombo->itemText(jobCombo->currentIndex()); - QString clientComboText = clientCombo->itemText(clientIndex); - QString fileSetComboText = fileSetCombo->itemText(fileSetIndex); + 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); int taskcount = 2, ontask = 1; if (dropdownChanged) taskcount += 1; @@ -144,21 +166,34 @@ void restoreTree::populateDirectoryTree() m_prevFileSetCombo = fileSetComboText; if (mainWin->m_rtPopDirDebug) Pmsg0(000, "Repopulating the Job Table\n"); - m_condition = " Job.name = '" + jobCombo->itemText(jobCombo->currentIndex()) + "'"; - if ((clientIndex >= 0) && (clientCombo->itemText(clientIndex) != "Any")) { - m_condition.append(" AND Client.Name='" + clientCombo->itemText(clientIndex) + "'"); + QString condition = " Client.Name='" + clientCombo->itemText(clientCombo->currentIndex()) + "'"; + if ((jobCombo->currentIndex() >= 0) && (jobComboText != "Any")) { + condition.append(" AND Job.name = '" + jobComboText + "'"); + } + if ((fileSetCombo->currentIndex() >= 0) && (fileSetComboText != "Any")) { + condition.append(" AND FileSet.FileSet='" + fileSetComboText + "'"); } - if ((fileSetIndex >= 0) && (fileSetCombo->itemText(fileSetIndex) != "Any")) { - m_condition.append(" AND FileSet.FileSet='" + fileSetCombo->itemText(fileSetIndex) + "'"); + /* If Limit check box For limit by days is checked */ + if (daysCheckBox->checkState() == Qt::Checked) { + QDateTime stamp = QDateTime::currentDateTime().addDays(-daysSpinBox->value()); + QString since = stamp.toString(Qt::ISODate); + condition.append(" AND Job.Starttime>'" + since + "'"); } m_jobQueryPart = " INNER JOIN Client ON (Job.ClientId=Client.ClientId)" " INNER JOIN FileSet ON (Job.FileSetId=FileSet.FileSetId)" - " WHERE" + m_condition + + " WHERE" + condition + " AND Job.purgedfiles=0"; m_jobQuery = "SELECT Job.Jobid" " From Job" + m_jobQueryPart; + /* If Limit check box for limit records returned is checked */ + if (limitCheckBox->checkState() == Qt::Checked) { + QString limit; + limit.setNum(limitSpinBox->value()); + m_jobQuery += " LIMIT " + limit; + } + if (mainWin->m_sqlDebug) { Pmsg1(000, "Query cmd : %s\n", m_jobQuery.toUtf8().data()); } @@ -392,6 +427,10 @@ void restoreTree::refreshButtonPushed() */ void restoreTree::jobComboChanged(int) { + if (jobCombo->currentText() == "Any") { + fileSetCombo->setCurrentIndex(fileSetCombo->findText("Any", Qt::MatchExactly)); + return; + } job_defaults job_defs; (void)index; @@ -615,6 +654,12 @@ void restoreTree::populateJobTable() "SELECT Job.Jobid AS Id, Job.EndTime AS EndTime, Job.Level AS Level" " FROM Job" + m_jobQueryPart + " ORDER BY Job.EndTime DESC"; + /* If Limit check box for limit records returned is checked */ + if (limitCheckBox->checkState() == Qt::Checked) { + QString limit; + limit.setNum(limitSpinBox->value()); + jobQuery += " LIMIT " + limit; + } if (mainWin->m_sqlDebug) { Pmsg1(000, "Query cmd : %s\n", jobQuery.toUtf8().data()); } diff --git a/bacula/src/qt-console/restore/restoretree.h b/bacula/src/qt-console/restore/restoretree.h index ae3a7e2279..9311ddeb72 100644 --- a/bacula/src/qt-console/restore/restoretree.h +++ b/bacula/src/qt-console/restore/restoretree.h @@ -99,7 +99,6 @@ private: QRegExp m_slashregex; bool m_slashTrap; QHash m_dirPaths; - QString m_condition; QString m_jobQuery; QString m_jobQueryPart; QString m_prevJobCombo; diff --git a/bacula/src/qt-console/restore/restoretree.ui b/bacula/src/qt-console/restore/restoretree.ui index 1447db6c2e..053e31eaa1 100644 --- a/bacula/src/qt-console/restore/restoretree.ui +++ b/bacula/src/qt-console/restore/restoretree.ui @@ -5,236 +5,383 @@ 0 0 - 411 - 295 + 817 + 524 Form - - - 9 + + + + 60 + 160 + 382 + 221 + - - 6 + + Qt::Horizontal - - - - - 7 - 7 - 0 - 0 - + + + + 0 - - Qt::Horizontal + + 6 - - - - 0 + + + + Jobs - - 6 + + Qt::AlignCenter - - - - true - - - 24 - - - Qt::Horizontal - - - - - - - TextLabel - - - Qt::AlignCenter - - - - - - - Jobs - - - Qt::AlignCenter - - - - - - - true - - - 24 - - - Qt::Horizontal - - - - - - - TextLabel - - - Qt::AlignCenter - - - - - - - - - - - - - 0 + + + + + + + + + TextLabel - - 6 + + Qt::AlignCenter - - - - - - - Files - - - Qt::AlignCenter - - - - - - - - - 0 + + + + + + true - - 6 + + 24 - - - - FileName - - - Qt::AlignCenter - - - - - - - Versions of File - - - Qt::AlignCenter - - - - - - - - - - - - + + Qt::Horizontal + + + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + true + + + 24 + + + Qt::Horizontal + + + + + + + + 0 6 - - - - - 5 - 0 - 0 - 0 - + + + + Files + + + Qt::AlignCenter + + + + + + + + + + + 0 + + + 6 + + + - Directory + Versions of File + + + Qt::AlignCenter - - - - 0 + + + + FileName - - 6 + + Qt::AlignCenter - - - - Refresh - - - :/images/view-refresh.svg - - - - - - - - - - - - - - - - Qt::Horizontal - - - - 21 - 26 - - - - - - - - Restore - - - - + + + + - - + + + + + + 10 + 57 + 791 + 79 + + + + + 950 + 16777215 + + + + + 0 + + + 6 + + + + + 3 + + + 9 + + + + + Refresh + + + :/images/view-refresh.svg + + + + + + + Restore + + + :/images/restore.png + + + + + + + 3 + + + 9 + + + + + Job + + + + + + + + 7 + 0 + 0 + 0 + + + + Job List Job Criterion Selector + + + Job List Job Criterion Selector + + + + + + + + + 3 + + + 0 + + + + + Client + + + + + + + + 7 + 0 + 0 + 0 + + + + Job List Client Criterion Selector + + + Job List Client Criterion Selector + + + + + + + + + 3 + + + 0 + + + + + FileSet + + + + + + + + 7 + 0 + 0 + 0 + + + + Job List Fileset Criterion Selector + + + Job List Fileset Criterion Selector + + + + + + + + + 3 + + + 0 + + + + + Record Limit + + + + + + + 10000 + + + 1 + + + 25 + + + + + + + + + 3 + + + 0 + + + + + Days Limit + + + + + + + 7 + + + + + + + + + + + + 5 + 0 + 0 + 0 + + + + 13 + + + Directory + + + + +