1 #ifndef _FMTWIDGETITEM_H_
2 #define _FMTWIDGETITEM_H_
4 Bacula® - The Network Backup Solution
6 Copyright (C) 2007-2007 Free Software Foundation Europe e.V.
8 The main author of Bacula is Kern Sibbald, with contributions from
9 many others, a complete list can be found in the file AUTHORS.
10 This program is Free Software; you can redistribute it and/or
11 modify it under the terms of version two of the GNU General Public
12 License as published by the Free Software Foundation and included
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 Bacula® is a registered trademark of John Walker.
26 The licensor of Bacula is the Free Software Foundation Europe
27 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
28 Switzerland, email:ftf@fsfeurope.org.
33 * TreeView formatting helpers - Riccardo Ghetta, May 2008
36 class QTreeWidgetItem;
40 * This class can be used instead of QTreeWidgetItem (it allocates one internally,
41 * to format data fields.
42 * All setXXXFld routines receive a column index and the unformatted string value.
48 ItemFormatter(QTreeWidgetItem &parent, int indent_level);
50 /* Prints Yes if fld is != 0, No otherwise. Centers field if center true*/
51 void setBoolFld(int index, const QString &fld, bool center = true);
52 void setBoolFld(int index, int fld, bool center = true);
54 /* Normal text field. Centers field if center true*/
55 void setTextFld(int index, const QString &fld, bool center = false);
57 /* Right-aligned text field.*/
58 void setNumericFld(int index, const QString &fld);
60 /* fld value interpreted as bytes and formatted with size suffixes */
61 void setBytesFld(int index, const QString &fld);
63 /* fld value interpreted as seconds and formatted with y,m,w,h suffixes */
64 void setDurationFld(int index, const QString &fld);
66 /* fld value interpreted as volume status. Colored accordingly */
67 void setVolStatusFld(int index, const QString &fld, bool center = true);
69 /* access internal widget */
70 QTreeWidgetItem *widget() { return wdg; }
71 const QTreeWidgetItem *widget() const { return wdg; }
78 #endif /* _FMTWIDGETITEM_H_ */
79 #ifndef _FMTWIDGETITEM_H_
80 #define _FMTWIDGETITEM_H_
82 Bacula® - The Network Backup Solution
84 Copyright (C) 2007-2007 Free Software Foundation Europe e.V.
86 The main author of Bacula is Kern Sibbald, with contributions from
87 many others, a complete list can be found in the file AUTHORS.
88 This program is Free Software; you can redistribute it and/or
89 modify it under the terms of version two of the GNU General Public
90 License as published by the Free Software Foundation and included
93 This program is distributed in the hope that it will be useful, but
94 WITHOUT ANY WARRANTY; without even the implied warranty of
95 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
96 General Public License for more details.
98 You should have received a copy of the GNU General Public License
99 along with this program; if not, write to the Free Software
100 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
103 Bacula® is a registered trademark of John Walker.
104 The licensor of Bacula is the Free Software Foundation Europe
105 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
106 Switzerland, email:ftf@fsfeurope.org.
111 * TreeView formatting helpers - Riccardo Ghetta, May 2008
114 class QTreeWidgetItem;
118 * This class can be used instead of QTreeWidgetItem (it allocates one internally,
119 * to format data fields.
120 * All setXXXFld routines receive a column index and the unformatted string value.
126 ItemFormatter(QTreeWidgetItem &parent, int indent_level);
128 /* Prints Yes if fld is != 0, No otherwise. Centers field if center true*/
129 void setBoolFld(int index, const QString &fld, bool center = true);
131 /* Normal text field. Centers field if center true*/
132 void setTextFld(int index, const QString &fld, bool center = false);
134 /* Right-aligned text field.*/
135 void setNumericFld(int index, const QString &fld);
137 /* fld value interpreted as bytes and formatted with size suffixes */
138 void setBytesFld(int index, const QString &fld);
140 /* fld value interpreted as seconds and formatted with y,m,w,h suffixes */
141 void setDurationFld(int index, const QString &fld);
143 /* fld value interpreted as volume status. Colored accordingly */
144 void setVolStatusFld(int index, const QString &fld, bool center = true);
146 /* access internal widget */
147 QTreeWidgetItem *widget() { return wdg; }
148 const QTreeWidgetItem *widget() const { return wdg; }
151 QTreeWidgetItem *wdg;
155 #endif /* _FMTWIDGETITEM_H_ */