From: Eric Bollengier Date: Thu, 22 Oct 2009 14:59:42 +0000 (+0200) Subject: bat: Use green/red bullet for InChanger in mediview X-Git-Tag: Release-5.0.0~282^2~3 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=89b1acdec6c13c812a2f0609f8f3dae0cdf23374;p=bacula%2Fbacula bat: Use green/red bullet for InChanger in mediview --- diff --git a/bacula/src/qt-console/medialist/mediaview.cpp b/bacula/src/qt-console/medialist/mediaview.cpp index 595d7bcdcc..e652de5aaa 100644 --- a/bacula/src/qt-console/medialist/mediaview.cpp +++ b/bacula/src/qt-console/medialist/mediaview.cpp @@ -307,7 +307,7 @@ void MediaView::populateTable() mediaitem.setTextFld(index++, fld.next()); /* Online */ - mediaitem.setTextFld(index++, fld.next()); + mediaitem.setInChanger(index++, fld.next()); fld.next(); // Slot /* Volume bytes */ diff --git a/bacula/src/qt-console/util/fmtwidgetitem.cpp b/bacula/src/qt-console/util/fmtwidgetitem.cpp index 7871e8a9c4..d7b228d747 100644 --- a/bacula/src/qt-console/util/fmtwidgetitem.cpp +++ b/bacula/src/qt-console/util/fmtwidgetitem.cpp @@ -192,6 +192,13 @@ ItemFormatterBase::~ItemFormatterBase() { } +void ItemFormatterBase::setInChanger(int index, const QString &InChanger) +{ + setPixmap(index, + QPixmap(":images/inflag"+InChanger+".png")); + setSortValue(index, InChanger.toInt() ); +} + void ItemFormatterBase::setTextFld(int index, const QString &fld, bool center) { setText(index, fld.trimmed()); @@ -386,6 +393,11 @@ void TreeItemFormatter::setSortValue(int /* index */, const QVariant & /* value { } +void TreeItemFormatter::setPixmap(int index, const QPixmap &pix) +{ + wdg->setIcon(index, QIcon(pix)); +} + /*********************************************** * * Specialized table widget used for sorting @@ -433,6 +445,13 @@ last(NULL) { } +void TableItemFormatter::setPixmap(int index, const QPixmap &pix) +{ + last = new BatSortingTableItem; + parent->setItem(row, index, last); + last->setIcon(pix); +} + void TableItemFormatter::setText(int col, const QString &fld) { last = new BatSortingTableItem; diff --git a/bacula/src/qt-console/util/fmtwidgetitem.h b/bacula/src/qt-console/util/fmtwidgetitem.h index 896a0d32e2..43e9da5346 100644 --- a/bacula/src/qt-console/util/fmtwidgetitem.h +++ b/bacula/src/qt-console/util/fmtwidgetitem.h @@ -115,6 +115,9 @@ public: /* fld value interpreted as job level. */ void setJobLevelFld(int index, const QString &fld, bool center = false); + + /* fld value interpreted as Online/Offline */ + void setInChanger(int index, const QString &InChanger); static void setBytesConversion(BYTES_CONVERSION b) { cnvFlag = b; @@ -130,6 +133,7 @@ protected: virtual void setText(int index, const QString &fld) = 0; virtual void setTextAlignment(int index, int align) = 0; virtual void setBackground(int index, const QBrush &) = 0; + virtual void setPixmap(int index, const QPixmap &pix) = 0; /* sets the *optional* value used for sorting */ virtual void setSortValue(int index, const QVariant &value) = 0; @@ -158,6 +162,7 @@ protected: virtual void setTextAlignment(int index, int align); virtual void setBackground(int index, const QBrush &); virtual void setSortValue(int index, const QVariant &value); + virtual void setPixmap(int index, const QPixmap &pix); private: QTreeWidgetItem *wdg; @@ -201,6 +206,7 @@ protected: virtual void setTextAlignment(int index, int align); virtual void setBackground(int index, const QBrush &); virtual void setSortValue(int index, const QVariant &value); + virtual void setPixmap(int index, const QPixmap &pix); private: QTableWidget *parent;