From 5aa1568675e4fb77626cc3165f488b98a236a3f3 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Mon, 10 Aug 2009 12:17:23 +0200 Subject: [PATCH] try to insert data on table content --- bacula/src/qt-console/storage/content.cpp | 50 +++++++++++++++-------- bacula/src/qt-console/storage/content.ui | 24 +++++++++++ 2 files changed, 58 insertions(+), 16 deletions(-) diff --git a/bacula/src/qt-console/storage/content.cpp b/bacula/src/qt-console/storage/content.cpp index eac3b76ef6..feb54ae933 100644 --- a/bacula/src/qt-console/storage/content.cpp +++ b/bacula/src/qt-console/storage/content.cpp @@ -62,37 +62,52 @@ void Content::populateContent() { m_populated = true; m_firstpopulation = false; - Freeze frz(*tableContent); /* disable updating*/ +// Freeze frz(*tableContent); /* disable updating*/ tableContent->clear(); + int row = 0; - QStringList results; + QStringList results_all; QString cmd("status slots drive=0 storage=\"" + m_currentStorage + "\""); - m_console->dir_cmd(cmd, results); + + m_console->dir_cmd(cmd, results_all); + // skip non list messages + QStringList results = results_all.filter(QRegExp("[0-9]+\\|")); + Pmsg1(0, "count=%i\n", results.size()); + tableContent->setRowCount(results.size()); + foreach (QString resultline, results){ - Pmsg1(0, "s=%s\n", resultline.toUtf8().data()); + int col=0; QStringList fieldlist = resultline.split("|"); QStringListIterator fld(fieldlist); + if (fieldlist.size() < 9) continue; /* some fields missing, ignore row */ + Pmsg1(0, "s=%s\n", resultline.toUtf8().data()); + TableItemFormatter slotitem(*tableContent, row); - int col=0; - slotitem.setNumericFld(col++, fld.next()); - Pmsg1(0, "s=%s\n", fld.next().toUtf8().data()); - slotitem.setTextFld(col++, fld.next()); - slotitem.setNumericFld(col++, fld.next()); - slotitem.setVolStatusFld(col++, fld.next()); - slotitem.setTextFld(col++, fld.next()); - slotitem.setTextFld(col++, fld.next()); - slotitem.setTextFld(col++, fld.next()); - slotitem.setTextFld(col++, fld.next()); + slotitem.setNumericFld(col++, fld.next()); // Slot + Pmsg1(0, "s=%s\n", fld.next().toUtf8().data()); // Real Slot + +// if (fld.next() != "") { // skip "Real Slot" + slotitem.setTextFld(col++, fld.next()); // Volume + slotitem.setNumericFld(col++, fld.next()); // Bytes + slotitem.setVolStatusFld(col++, fld.next()); // Status + slotitem.setTextFld(col++, fld.next()); // MediaType + slotitem.setTextFld(col++, fld.next()); // Pool + slotitem.setTextFld(col++, fld.next()); // LastWritten + slotitem.setTextFld(col++, fld.next()); // Expire +// } row++; } + tableContent->resizeColumnsToContents(); - tableContent->resizeRowsToContents(); tableContent->verticalHeader()->hide(); + tableContent->sortByColumn(0, Qt::AscendingOrder); + tableContent->setSortingEnabled(true); + int rcnt = tableContent->rowCount(); int ccnt = tableContent->columnCount(); for(int r=0; r < rcnt; r++) { @@ -104,6 +119,9 @@ void Content::populateContent() } } + tableContent->update(); + + tableDrive->verticalHeader()->hide(); } /* @@ -112,7 +130,7 @@ void Content::populateContent() void Content::currentStackItem() { if(!m_populated) { - populate(); + populateContent(); } } diff --git a/bacula/src/qt-console/storage/content.ui b/bacula/src/qt-console/storage/content.ui index fde15329bc..bbda55640d 100644 --- a/bacula/src/qt-console/storage/content.ui +++ b/bacula/src/qt-console/storage/content.ui @@ -128,6 +128,9 @@ 192 + + QAbstractItemView::SelectRows + LTO1 @@ -205,6 +208,12 @@ 0 + + QAbstractItemView::SelectRows + + + false + Slot @@ -230,6 +239,21 @@ + + true + + + QAbstractItemView::ExtendedSelection + + + QAbstractItemView::SelectRows + + + true + + + 0 + Slot -- 2.39.5