From: Eric Bollengier Date: Fri, 1 Oct 2010 13:10:58 +0000 (+0200) Subject: bat: Implement a Date and FileType helper in ItemFormatter X-Git-Tag: Release-7.0.0~1531 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0b0e266abb93ebf6efc8f507c73c413081c42c0d;p=bacula%2Fbacula bat: Implement a Date and FileType helper in ItemFormatter --- diff --git a/bacula/src/qt-console/util/fmtwidgetitem.cpp b/bacula/src/qt-console/util/fmtwidgetitem.cpp index 348d2b2ef7..5aa520c632 100644 --- a/bacula/src/qt-console/util/fmtwidgetitem.cpp +++ b/bacula/src/qt-console/util/fmtwidgetitem.cpp @@ -232,6 +232,12 @@ void ItemFormatterBase::setInChanger(int index, const QString &InChanger) //setSortValue(index, InChanger.toInt() ); } +void ItemFormatterBase::setFileType(int index, const QString &type) +{ + setPixmap(index, QPixmap(":images/"+type+".png")); + //setSortValue(index, InChanger.toInt() ); +} + void ItemFormatterBase::setTextFld(int index, const QString &fld, bool center) { setText(index, fld.trimmed()); @@ -240,6 +246,16 @@ void ItemFormatterBase::setTextFld(int index, const QString &fld, bool center) } } +void ItemFormatterBase::setDateFld(int index, utime_t fld, bool center) +{ + char buf[200]; + bstrutime(buf, sizeof(buf), fld); + setText(index, QString(buf).trimmed()); + if (center) { + setTextAlignment(index, Qt::AlignCenter); + } +} + void ItemFormatterBase::setRightFld(int index, const QString &fld) { setText(index, fld.trimmed()); diff --git a/bacula/src/qt-console/util/fmtwidgetitem.h b/bacula/src/qt-console/util/fmtwidgetitem.h index 40b4fd3110..364697362d 100644 --- a/bacula/src/qt-console/util/fmtwidgetitem.h +++ b/bacula/src/qt-console/util/fmtwidgetitem.h @@ -92,6 +92,9 @@ public: /* Normal text field. Centers field if center true*/ void setTextFld(int index, const QString &fld, bool center = false); + /* Normal date field. Centers field if center true*/ + void setDateFld(int index, utime_t fld, bool center = false); + /* Right-aligned text field. */ void setRightFld(int index, const QString &fld); @@ -120,6 +123,9 @@ public: /* fld value interpreted as Online/Offline */ void setInChanger(int index, const QString &InChanger); + /* fld value interpreted as file or folder */ + void setFileType(int index, const QString &type); + static void setBytesConversion(BYTES_CONVERSION b) { cnvFlag = b; }