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.
- This program is Free Software; you can redistribute it and/or
- modify it under the terms of version three of the GNU Affero General Public
- License as published by the Free Software Foundation and included
- in the file LICENSE.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
+ The main 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.
- The licensor of Bacula is the Free Software Foundation Europe
- (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
- Switzerland, email:ftf@fsfeurope.org.
*/
-
+
/*
*
* 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);
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 !