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-5.2.1~1066 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=791db099f3737e6033f742d1111252ca49185e19;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; }