2
* This file is a part of KleanSweep.
4
* Copyright (C) 2005 Pawel Stolowski <pawel.stolowski@wp.pl>
6
* KleanSweep is free software; you can redestribute it and/or modify it
7
* under terms of GNU General Public License by Free Software Foundation.
9
* This program is distributed in the hope that it will be useful, but
10
* WITHOUT ANY WARRANTY. See GPL for more details.
13
#include "summarylabel.h"
18
SummaryLabel::SummaryLabel(QWidget *parent): QHBox(parent), selsize(-1), selitems(-1), totsize(-1), totitems(-1)
22
setFrameStyle(QFrame::Panel | QFrame::Sunken);
24
new QLabel(i18n("Found") + ":", this);
25
l_totitems = new QLabel(this);
26
l_totitems->setAlignment(Qt::AlignRight);
27
l_totsize = new QLabel(this);
28
l_totsize->setAlignment(Qt::AlignRight);
29
new QLabel(i18n("Selected") + ":", this);
30
l_selitems = new QLabel(this);
31
l_selitems->setAlignment(Qt::AlignRight);
32
l_selsize = new QLabel(this);
33
l_selsize->setAlignment(Qt::AlignRight);
38
SummaryLabel::~SummaryLabel()
42
void SummaryLabel::reset()
50
QString SummaryLabel::formatSize(int n)
52
static const float mb = 1.0f/(1024.0f*1024.0f);
53
static const float kb = 1.0f/1024.0f;
68
return QString("(%1 b)").arg(n);
70
return QString(p).arg(x, 0, 'f', 2);
73
void SummaryLabel::setTotalItems(int n)
78
l_totitems->setText(QString::number(n));
82
void SummaryLabel::setSelectedItems(int n)
87
l_selitems->setText(QString::number(selitems));
91
void SummaryLabel::setSelectedSize(int size)
96
l_selsize->setText(formatSize(selsize));
100
void SummaryLabel::updateSelectedInfo(int d, unsigned int size)
109
l_selsize->setText(formatSize(selsize));
111
l_selitems->setText(QString::number(selitems));
114
void SummaryLabel::setTotalSize(int size)
119
l_totsize->setText(formatSize(totsize));
123
void SummaryLabel::setTotals(int n, unsigned int size)
129
#include "summarylabel.moc"