}
-// Need to use the fmtwidgetitem helper instead
-static QString convertBytesSI(qint64 qfld)
-{
- static const qint64 KB = Q_INT64_C(1000);
- static const qint64 MB = (KB * KB);
- static const qint64 GB = (MB * KB);
- static const qint64 TB = (GB * KB);
- static const qint64 PB = (TB * KB);
- static const qint64 EB = (PB * KB);
-
- /* note: division is integer, so to have some decimals we divide for a
- smaller unit (e.g. GB for a TB number and so on) */
- char suffix;
- if (qfld >= EB) {
- qfld /= PB;
- suffix = 'E';
- }
- else if (qfld >= PB) {
- qfld /= TB;
- suffix = 'P';
- }
- else if (qfld >= TB) {
- qfld /= GB;
- suffix = 'T';
- }
- else if (qfld >= GB) {
- qfld /= MB;
- suffix = 'G';
- }
- else if (qfld >= MB) {
- qfld /= KB;
- suffix = 'M';
- }
- else if (qfld >= KB) {
- suffix = 'k'; /* SI uses lowercase k */
- }
- else {
- /* plain bytes, no need to reformat */
- return QString("%1 B").arg(qfld);
- }
-
- /* having divided for a smaller unit, now we can safely convert to double and
- use the extra room for decimals */
- return QString("%1 %2B").arg(qfld / 1000.0, 0, 'f', 2).arg(suffix);
-}
-
/*
* Populate the text in the window
*/
#include <QTableWidgetItem>
#include <QMessageBox>
#include "mediainfo.h"
+#include "util/fmtwidgetitem.h"
/*
* A constructor
populateForm();
}
-// Need to use the fmtwidgetitem helper instead
-static QString convertBytesSI(qint64 qfld)
-{
- static const qint64 KB = Q_INT64_C(1000);
- static const qint64 MB = (KB * KB);
- static const qint64 GB = (MB * KB);
- static const qint64 TB = (GB * KB);
- static const qint64 PB = (TB * KB);
- static const qint64 EB = (PB * KB);
-
- /* note: division is integer, so to have some decimals we divide for a
- smaller unit (e.g. GB for a TB number and so on) */
- char suffix;
- if (qfld >= EB) {
- qfld /= PB;
- suffix = 'E';
- }
- else if (qfld >= PB) {
- qfld /= TB;
- suffix = 'P';
- }
- else if (qfld >= TB) {
- qfld /= GB;
- suffix = 'T';
- }
- else if (qfld >= GB) {
- qfld /= MB;
- suffix = 'G';
- }
- else if (qfld >= MB) {
- qfld /= KB;
- suffix = 'M';
- }
- else if (qfld >= KB) {
- suffix = 'k'; /* SI uses lowercase k */
- }
- else {
- /* plain bytes, no need to reformat */
- return QString("%1 B").arg(qfld);
- }
-
- /* having divided for a smaller unit, now we can safely convert to double and
- use the extra room for decimals */
- return QString("%1 %2B").arg(qfld / 1000.0, 0, 'f', 2).arg(suffix);
-}
-
/*
* Populate the text in the window
*/
ItemFormatterBase::BYTES_CONVERSION ItemFormatterBase::cnvFlag(BYTES_CONVERSION_IEC);
-QString ItemFormatterBase::convertBytesIEC(qint64 qfld)
+QString convertBytesIEC(qint64 qfld)
{
static const qint64 KB = Q_INT64_C(1024);
static const qint64 MB = (KB * KB);
return QString("%1 %2iB").arg(qfld / 1000.0, 0, 'f', 2).arg(suffix);
}
-QString ItemFormatterBase::convertBytesSI(qint64 qfld)
+QString convertBytesSI(qint64 qfld)
{
static const qint64 KB = Q_INT64_C(1000);
static const qint64 MB = (KB * KB);
*/
QString convertJobStatus(const QString &sts);
+/* bytes formatted as power-of-two with IEC suffixes (KiB, MiB, and so on) */
+QString convertBytesIEC(qint64 fld);
+
+/* bytes formatted as power-of-ten with SI suffixes (kB, MB, and so on) */
+QString convertBytesSI(qint64 fld);
+
/*
* disable widget updating
*/
/* sets the *optional* value used for sorting */
virtual void setSortValue(int index, const QVariant &value) = 0;
-private:
-
- /* bytes formatted as power-of-two with IEC suffixes (KiB, MiB, and so on) */
- static QString convertBytesIEC(qint64 fld);
-
- /* bytes formatted as power-of-ten with SI suffixes (kB, MB, and so on) */
- static QString convertBytesSI(qint64 fld);
-
private:
static BYTES_CONVERSION cnvFlag;
};
04Aug09
ebl bat: Go to the media info panel when double-click on job page or media list
+ebl bat: cleanup job and mediainfo panel
03Aug09
ebl Add new media info panel to bat
02Aug09