From: Eric Bollengier Date: Mon, 10 Aug 2009 10:17:23 +0000 (+0200) Subject: try to insert data on table content X-Git-Tag: Release-5.0.0~333^2~13^2~7 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5aa1568675e4fb77626cc3165f488b98a236a3f3;p=bacula%2Fbacula try to insert data on table content --- 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