/*
- Bacula® - The Network Backup Solution
+ Bacula(R) - The Network Backup Solution
+ Copyright (C) 2000-2015 Kern Sibbald
Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
- The main author of Bacula is Kern Sibbald, with contributions from many
- others, a complete list can be found in the file AUTHORS.
+ The original author of Bacula is Kern Sibbald, with contributions
+ from many others, a complete list can be found in the file AUTHORS.
You may use this file and others of this release according to the
license defined in the LICENSE file, which includes the Affero General
Public License, v3.0 ("AGPLv3") and some additional permissions and
terms pursuant to its AGPLv3 Section 7.
- Bacula® is a registered trademark of Kern Sibbald.
-*/
+ This notice must be preserved when any source code is
+ conveyed and/or propagated.
+ Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+
/*
*
* Helper functions for tree widget formatting
*
* Riccardo Ghetta, May 2008
*
- */
+ */
#include "bat.h"
#include <QTreeWidgetItem>
Freeze::Freeze(QWidget &q):
qw(&q)
{
- qw->setUpdatesEnabled(false);
+ qw->setUpdatesEnabled(false);
}
Freeze::~Freeze()
{
if (qw) {
- qw->setUpdatesEnabled(true);
+ qw->setUpdatesEnabled(true);
qw->update();
}
}
smaller unit (e.g. GB for a TB number and so on) */
char suffix;
if (qfld >= EB) {
- qfld /= PB;
+ qfld /= PB;
suffix = 'E';
}
else if (qfld >= PB) {
- qfld /= TB;
+ qfld /= TB;
suffix = 'P';
}
else if (qfld >= TB) {
- qfld /= GB;
+ qfld /= GB;
suffix = 'T';
}
else if (qfld >= GB) {
}
else {
/* plain bytes, no need to reformat */
- return QString("%1 B").arg(qfld);
+ return QString("%1 B").arg(qfld);
}
/* having divided for a smaller unit, now we can safely convert to double and
smaller unit (e.g. GB for a TB number and so on) */
char suffix;
if (qfld >= EB) {
- qfld /= PB;
+ qfld /= PB;
suffix = 'E';
}
else if (qfld >= PB) {
- qfld /= TB;
+ qfld /= TB;
suffix = 'P';
}
else if (qfld >= TB) {
- qfld /= GB;
+ qfld /= GB;
suffix = 'T';
}
else if (qfld >= GB) {
}
else {
/* plain bytes, no need to reformat */
- return QString("%1 B").arg(qfld);
+ return QString("%1 B").arg(qfld);
}
/* having divided for a smaller unit, now we can safely convert to double and
/* By default, the setPixmap implementation with tooltip don't implement
* the tooltip stuff
*/
-void ItemFormatterBase::setPixmap(int index, const QPixmap &pix,
+void ItemFormatterBase::setPixmap(int index, const QPixmap &pix,
const QString & /* tip */)
{
setPixmap(index, pix);
void ItemFormatterBase::setNumericFld(int index, const QString &fld)
{
setRightFld(index, fld.trimmed());
- setSortValue(index, fld.toDouble());
+ setSortValue(index, fld.toDouble() );
}
void ItemFormatterBase::setNumericFld(int index, const QString &fld, const QVariant &sortval)
{
setRightFld(index, fld.trimmed());
- setSortValue(index, sortval);
+ setSortValue(index, sortval );
}
void ItemFormatterBase::setBytesFld(int index, const QString &fld)
setBackground(index, Qt::green);
} else if (redchars.contains(st, Qt::CaseSensitive)) {
setBackground(index, Qt::red);
- } else if (yellowchars.contains(st, Qt::CaseSensitive)){
+ } else if (yellowchars.contains(st, Qt::CaseSensitive)){
setBackground(index, Qt::yellow);
}
}
setData(SORTDATA_ROLE, d);
}
-bool TableItemFormatter::BatSortingTableItem::operator< ( const QTableWidgetItem & o ) const
+bool TableItemFormatter::BatSortingTableItem::operator< ( const QTableWidgetItem & o ) const
{
QVariant my = data(SORTDATA_ROLE);
QVariant other = o.data(SORTDATA_ROLE);
/* 64bit integers must be handled separately, others can be converted to double */
if (QVariant::ULongLong == my.type()) {
- return my.toULongLong() < other.toULongLong();
+ return my.toULongLong() < other.toULongLong();
} else if (QVariant::LongLong == my.type()) {
- return my.toLongLong() < other.toLongLong();
+ return my.toLongLong() < other.toLongLong();
} else if (my.canConvert(QVariant::Double)) {
- return my.toDouble() < other.toDouble();
+ return my.toDouble() < other.toDouble();
} else {
return QTableWidgetItem::operator< (o); /* invalid combination, revert to default sorting */
}
parent->setCellWidget(row, index, lbl);
}
-void TableItemFormatter::setPixmap(int index, const QPixmap &pix,
+void TableItemFormatter::setPixmap(int index, const QPixmap &pix,
const QString &tips)
{
// Centered, but not sortable !