From: Dirk H Bartley Date: Wed, 1 Aug 2007 01:31:17 +0000 (+0000) Subject: Add toggle columns to toggle all above and toggle all below to the job Table. X-Git-Tag: Release-7.0.0~5914 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=86c68f4f15793dbca225bdd7d697b9c4b964922e;p=bacula%2Fbacula Add toggle columns to toggle all above and toggle all below to the job Table. Also fix a little issue which would cause multiple c:/ treeWdigetItems. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5272 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/images/go-down.png b/bacula/src/qt-console/images/go-down.png new file mode 100644 index 0000000000..3dd7fccdf0 Binary files /dev/null and b/bacula/src/qt-console/images/go-down.png differ diff --git a/bacula/src/qt-console/images/go-down.svg b/bacula/src/qt-console/images/go-down.svg new file mode 100644 index 0000000000..18dadc498e --- /dev/null +++ b/bacula/src/qt-console/images/go-down.svg @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Jakub Steiner + + + http://jimmac.musichall.cz + + Go Down + + + go + lower + down + arrow + pointer + > + + + + + Andreas Nilsson + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/qt-console/images/go-up.png b/bacula/src/qt-console/images/go-up.png new file mode 100644 index 0000000000..fa9a7d71b5 Binary files /dev/null and b/bacula/src/qt-console/images/go-up.png differ diff --git a/bacula/src/qt-console/images/go-up.svg b/bacula/src/qt-console/images/go-up.svg new file mode 100644 index 0000000000..0e3d01d172 --- /dev/null +++ b/bacula/src/qt-console/images/go-up.svg @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Jakub Steiner + + + http://jimmac.musichall.cz + + Go Up + + + go + higher + up + arrow + pointer + > + + + + + Andreas Nilsson + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/qt-console/main.qrc b/bacula/src/qt-console/main.qrc index 31646d0785..3e3324ab09 100644 --- a/bacula/src/qt-console/main.qrc +++ b/bacula/src/qt-console/main.qrc @@ -17,10 +17,11 @@ images/emblem-system.png images/estimate-job.png images/folder.png - images/folder.png + images/folderbothchecked.png images/folderchecked.png images/folderunchecked.png - images/folderbothchecked.png + images/go-down.png + images/go-up.png images/graph1.png images/help-browser.png images/home.png diff --git a/bacula/src/qt-console/restore/restoretree.cpp b/bacula/src/qt-console/restore/restoretree.cpp index 7f46f67c4d..7be6e77cd7 100644 --- a/bacula/src/qt-console/restore/restoretree.cpp +++ b/bacula/src/qt-console/restore/restoretree.cpp @@ -114,6 +114,8 @@ void restoreTree::setupPage() this, SLOT(directoryItemChanged(QTreeWidgetItem *, int))); connect(fileTable, SIGNAL(currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)), this, SLOT(fileCurrentItemChanged(QTableWidgetItem *, QTableWidgetItem *))); + connect(jobTable, SIGNAL(cellClicked(int, int)), + this, SLOT(jobTableCellClicked(int, int))); QStringList titles = QStringList() << "Directories"; directoryTree->setHeaderLabels(titles); @@ -209,6 +211,7 @@ void restoreTree::populateDirectoryTree() QString since = stamp.toString(Qt::ISODate); condition.append(" AND Job.Starttime>'" + since + "'"); } + /* INNER JOIN FileSet eliminates all restore jobs */ m_jobQueryPart = " INNER JOIN Client ON (Job.ClientId=Client.ClientId)" " INNER JOIN FileSet ON (Job.FileSetId=FileSet.FileSetId)" @@ -379,16 +382,18 @@ bool restoreTree::addDirectory(QString &m_cwd, QString &newdirr) } /* no need to check for windows drive if unix */ if (m_winRegExpDrive.indexIn(m_cwd, 0) == 0) { - /* this is a windows drive add the base widget */ - QTreeWidgetItem *item = new QTreeWidgetItem(directoryTree); - item->setText(0, m_cwd); - item->setData(0, Qt::UserRole, QVariant(fullPath)); - item->setData(1, Qt::UserRole, QVariant(Qt::Unchecked)); - item->setIcon(0, QIcon(QString::fromUtf8(":images/folder.png"))); - if ((mainWin->m_miscDebug) && (m_debugTrap)) { - Pmsg0(000, "Added Base \"letter\":/\n"); + if (!m_dirPaths.contains(m_cwd)) { + /* this is a windows drive add the base widget */ + QTreeWidgetItem *item = new QTreeWidgetItem(directoryTree); + item->setText(0, m_cwd); + item->setData(0, Qt::UserRole, QVariant(fullPath)); + item->setData(1, Qt::UserRole, QVariant(Qt::Unchecked)); + item->setIcon(0, QIcon(QString::fromUtf8(":images/folder.png"))); + if ((mainWin->m_miscDebug) && (m_debugTrap)) { + Pmsg0(000, "Added Base \"letter\":/\n"); + } + m_dirPaths.insert(m_cwd, item); } - m_dirPaths.insert(m_cwd, item); } } @@ -671,12 +676,12 @@ void restoreTree::directoryItemExpanded(QTreeWidgetItem *item) void restoreTree::populateJobTable() { QBrush blackBrush(Qt::black); - QStringList headerlist = (QStringList() << "Job Id" << "End Time" << "Type"); + QStringList headerlist = (QStringList() << "Job Id" << "End Time" << "Level" << "Name" << "TU" << "TD"); jobTable->clear(); jobTable->setColumnCount(headerlist.size()); jobTable->setHorizontalHeaderLabels(headerlist); QString jobQuery = - "SELECT Job.Jobid AS Id, Job.EndTime AS EndTime, Job.Level AS Level" + "SELECT Job.Jobid AS Id, Job.EndTime AS EndTime, Job.Level AS Level, Job.Name AS JobName" " FROM Job" + m_jobQueryPart + " ORDER BY Job.EndTime DESC"; /* If Limit check box for limit records returned is checked */ @@ -706,18 +711,29 @@ void restoreTree::populateJobTable() /* Iterate through fields in the record */ foreach (field, fieldlist) { field = field.trimmed(); /* strip leading & trailing spaces */ - tableItem = new QTableWidgetItem(field, 1); - tableItem->setFlags(0); - tableItem->setForeground(blackBrush); - jobTable->setItem(row, column, tableItem); - if (column == 0) { - Qt::ItemFlags flag = Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsTristate; - tableItem->setFlags(flag); - tableItem->setCheckState(Qt::Checked); - tableItem->setBackground(Qt::green); + if (field != "") { + tableItem = new QTableWidgetItem(field, 1); + tableItem->setFlags(0); + tableItem->setForeground(blackBrush); + jobTable->setItem(row, column, tableItem); + if (column == 0) { + Qt::ItemFlags flag = Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsTristate; + tableItem->setFlags(flag); + tableItem->setCheckState(Qt::Checked); + tableItem->setBackground(Qt::green); + } + column++; } - column++; } + tableItem = new QTableWidgetItem(QIcon(QString::fromUtf8(":images/go-up.png")), "", 1); + tableItem->setFlags(0); + tableItem->setForeground(blackBrush); + jobTable->setItem(row, column, tableItem); + column++; + tableItem = new QTableWidgetItem(QIcon(QString::fromUtf8(":images/go-down.png")), "", 1); + tableItem->setFlags(0); + tableItem->setForeground(blackBrush); + jobTable->setItem(row, column, tableItem); row++; } } @@ -727,6 +743,32 @@ void restoreTree::populateJobTable() jobTable->verticalHeader()->hide(); } +void restoreTree::jobTableCellClicked(int row, int column) +{ + if (column == 4){ + int cnt; + for (cnt=0; cntitem(cnt, 0); + Qt::CheckState state = item->checkState(); + if (state == Qt::Checked) + item->setCheckState(Qt::Unchecked); + else if (state == Qt::Unchecked) + item->setCheckState(Qt::Checked); + } + } + if (column == 5){ + int cnt, max = jobTable->rowCount(); + for (cnt=row; cntitem(cnt, 0); + Qt::CheckState state = item->checkState(); + if (state == Qt::Checked) + item->setCheckState(Qt::Unchecked); + else if (state == Qt::Unchecked) + item->setCheckState(Qt::Checked); + } + } +} + /* * When a directory item is "changed" check the state of the checkable item * to see if it is different than what it was which is stored in Qt::UserRole diff --git a/bacula/src/qt-console/restore/restoretree.h b/bacula/src/qt-console/restore/restoretree.h index bf7d13d227..50a7b31e92 100644 --- a/bacula/src/qt-console/restore/restoretree.h +++ b/bacula/src/qt-console/restore/restoretree.h @@ -70,6 +70,7 @@ private slots: void fileTableItemChanged(QTableWidgetItem *); void versionTableItemChanged(QTableWidgetItem *); void updateRefresh(); + void jobTableCellClicked(int, int); private: void populateDirectoryTree();