summaryrefslogtreecommitdiffstats
path: root/installerbuilder/libinstaller
diff options
context:
space:
mode:
authorhjk <qthjk@ovi.com>2011-11-18 23:09:46 +0100
committerTim Jenssen <tim.jenssen@nokia.com>2011-11-21 12:13:05 +0100
commit30e148a16d464a0589278845c50cb64731c40d97 (patch)
tree784af6f0e5831919d34b5c2b95bc39813cc640cf /installerbuilder/libinstaller
parent7f811ba7b07fb9f0f1ef8564bf59a309b42f4d5b (diff)
Replace KDByteSize with plain quint64.
Change-Id: Ieef5b0bbf3d5d4cd81bea2ad73144890379dd33b Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
Diffstat (limited to 'installerbuilder/libinstaller')
-rw-r--r--installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/KDByteSize1
-rw-r--r--installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/KDToolsCore.pri2
-rw-r--r--installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdbytesize.cpp90
-rw-r--r--installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdbytesize.h54
-rw-r--r--installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo.cpp14
-rw-r--r--installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo.h12
-rw-r--r--installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo_mac.cpp10
-rw-r--r--installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo_win.cpp16
-rw-r--r--installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo_x11.cpp16
-rw-r--r--installerbuilder/libinstaller/packagemanagergui.cpp22
10 files changed, 41 insertions, 196 deletions
diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/KDByteSize b/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/KDByteSize
deleted file mode 100644
index e0ee65f30..000000000
--- a/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/KDByteSize
+++ /dev/null
@@ -1 +0,0 @@
-#include "kdbytesize.h"
diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/KDToolsCore.pri b/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/KDToolsCore.pri
index f3f5e7dea..2dea65a66 100644
--- a/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/KDToolsCore.pri
+++ b/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/KDToolsCore.pri
@@ -7,7 +7,6 @@ CONFIG( shared, static|shared) {
HEADERS += $$PWD/pimpl_ptr.h \
$$PWD/kdtoolsglobal.h \
- $$PWD/kdbytesize.h \
$$PWD/kdjob.h \
$$PWD/kdgenericfactory.h \
$$PWD/kdselfrestarter.h \
@@ -17,7 +16,6 @@ HEADERS += $$PWD/pimpl_ptr.h \
$$PWD/kdsysinfo.h
SOURCES += $$PWD/pimpl_ptr.cpp \
- $$PWD/kdbytesize.cpp \
$$PWD/kdjob.cpp \
$$PWD/kdgenericfactory.cpp \
$$PWD/kdselfrestarter.cpp \
diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdbytesize.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdbytesize.cpp
deleted file mode 100644
index 0cf06f233..000000000
--- a/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdbytesize.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-** Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. All rights reserved.
-**
-** This file is part of the KD Tools library.
-**
-** Licensees holding valid commercial KD Tools licenses may use this file in
-** accordance with the KD Tools Commercial License Agreement provided with
-** the Software.
-**
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU Lesser General Public License version 2 and version 3 as published by the
-** Free Software Foundation and appearing in the file LICENSE.LGPL included.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** Contact info@kdab.com if any conditions of this licensing are not
-** clear to you.
-**
-**********************************************************************/
-#include "kdbytesize.h"
-
-#include <QStringList>
-#include <QTextStream>
-
-KDByteSize::KDByteSize( quint64 size )
- : m_size( size )
-{
-}
-
-KDByteSize::~KDByteSize()
-{
-}
-
-KDByteSize::operator quint64() const
-{
- return m_size;
-}
-
-quint64 KDByteSize::size() const
-{
- return m_size;
-}
-
-QString KDByteSize::toString() const
-{
- static const QStringList units = QStringList() << QObject::tr( "B" )
- << QObject::tr( "kB" )
- << QObject::tr( "MB" )
- << QObject::tr( "GB" )
- << QObject::tr( "TB" );
-
- double s = m_size;
- quint64 factor = 1;
- int unit = 0;
- while( s >= 1024.0 && unit + 1 < units.count() )
- {
- ++unit;
- factor *= 1024;
- s = 1.0 * m_size / factor;
- }
-
- // only one digit after the decimal point is wanted
- s = qRound( s * 10 ) / 10.0;
-
- return QString::fromLatin1( "%L1 %2" ).arg( s, 0, 'g', 4 ).arg( units[ unit ] );
-}
-
-bool operator==( const KDByteSize& lhs, const KDByteSize& rhs )
-{
- return lhs.size() == rhs.size();
-}
-
-bool operator<( const KDByteSize& lhs, const KDByteSize& rhs )
-{
- return lhs.size() < rhs.size();
-}
-
-KDByteSize operator*( const KDByteSize& lhs, int rhs )
-{
- return KDByteSize( lhs.size() * rhs );
-}
-
-#include <QDebug>
-
-QDebug operator<<( QDebug dbg, const KDByteSize& size )
-{
- return dbg << "KDByteSize(" << size.size() << ")";
-}
diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdbytesize.h b/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdbytesize.h
deleted file mode 100644
index d5735632c..000000000
--- a/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdbytesize.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-** Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. All rights reserved.
-**
-** This file is part of the KD Tools library.
-**
-** Licensees holding valid commercial KD Tools licenses may use this file in
-** accordance with the KD Tools Commercial License Agreement provided with
-** the Software.
-**
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU Lesser General Public License version 2 and version 3 as published by the
-** Free Software Foundation and appearing in the file LICENSE.LGPL included.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** Contact info@kdab.com if any conditions of this licensing are not
-** clear to you.
-**
-**********************************************************************/
-#ifndef KDBYTESIZE_H
-#define KDBYTESIZE_H
-
-#include <KDToolsCore/kdtoolsglobal.h>
-
-class KDTOOLSCORE_EXPORT KDByteSize
-{
-public:
- explicit KDByteSize( quint64 size = 0 );
- virtual ~KDByteSize();
-
- operator quint64() const;
- quint64 size() const;
-
- QString toString() const;
-
-private:
- quint64 m_size;
-};
-
-KDTOOLSCORE_EXPORT bool operator==( const KDByteSize& lhs, const KDByteSize& rhs );
-KDTOOLSCORE_EXPORT bool operator<( const KDByteSize& lhs, const KDByteSize& rhs );
-KDTOOLSCORE_EXPORT KDByteSize operator*( const KDByteSize& lhs, int rhs );
-
-KDTOOLS_MAKE_RELATION_OPERATORS( KDByteSize, static inline )
-
-QT_BEGIN_NAMESPACE
-class QDebug;
-QT_END_NAMESPACE
-
-KDTOOLSCORE_EXPORT QDebug operator<<( QDebug dbg, const KDByteSize& size );
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo.cpp
index f405e61c0..55b0519db 100644
--- a/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo.cpp
+++ b/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo.cpp
@@ -40,7 +40,7 @@ QDebug operator<<( QDebug dbg, KDSysInfo::Volume volume )
return dbg << "KDSysInfo::Volume(" << volume.path() << ")";
}
-QPair< KDByteSize, KDByteSize > volumeSpace( const QString& volume );
+QPair< quint64, quint64 > volumeSpace( const QString& volume );
QString volumeName( const QString& volume );
class KDSysInfo::Volume::Private : public QSharedData
@@ -48,9 +48,9 @@ class KDSysInfo::Volume::Private : public QSharedData
public:
QString p;
QString name;
- KDByteSize size;
+ quint64 size;
QString fileSystemType;
- KDByteSize availableSpace;
+ quint64 availableSpace;
};
@@ -105,12 +105,12 @@ QString KDSysInfo::Volume::path() const
return d->p;
}
-KDByteSize KDSysInfo::Volume::size() const
+quint64 KDSysInfo::Volume::size() const
{
return d->size;
}
-void KDSysInfo::Volume::setSize( const KDByteSize& size )
+void KDSysInfo::Volume::setSize( const quint64& size )
{
d->size = size;
}
@@ -125,12 +125,12 @@ void KDSysInfo::Volume::setFileSystemType(const QString &type)
d->fileSystemType = type;
}
-KDByteSize KDSysInfo::Volume::availableSpace() const
+quint64 KDSysInfo::Volume::availableSpace() const
{
return d->availableSpace;
}
-void KDSysInfo::Volume::setAvailableSpace( const KDByteSize& available )
+void KDSysInfo::Volume::setAvailableSpace( const quint64& available )
{
d->availableSpace = available;
}
diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo.h b/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo.h
index c863ddd02..8cb6868a9 100644
--- a/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo.h
+++ b/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo.h
@@ -29,8 +29,6 @@
#include <QtCore/QSysInfo>
#include <QtCore/QSharedDataPointer>
-#include "kdbytesize.h"
-
class KDTOOLSCORE_EXPORT KDSysInfo : public QSysInfo
{
private:
@@ -51,9 +49,9 @@ public:
QString name() const;
QString path() const;
- KDByteSize size() const;
+ quint64 size() const;
QString fileSystemType() const;
- KDByteSize availableSpace() const;
+ quint64 availableSpace() const;
void swap( Volume& other );
Volume& operator=( const Volume& other );
@@ -62,9 +60,9 @@ public:
private:
void setPath( const QString& path );
void setName( const QString& name );
- void setSize( const KDByteSize& size );
+ void setSize( const quint64& size );
void setFileSystemType(const QString &type);
- void setAvailableSpace( const KDByteSize& available );
+ void setAvailableSpace( const quint64& available );
private:
class Private;
@@ -77,7 +75,7 @@ public:
QString name;
};
- static KDByteSize installedMemory();
+ static quint64 installedMemory();
static QList< Volume > mountedVolumes();
static QList< ProcessInfo > runningProcesses();
};
diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo_mac.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo_mac.cpp
index 7024160ea..a8d62425c 100644
--- a/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo_mac.cpp
+++ b/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo_mac.cpp
@@ -22,8 +22,6 @@
#include "kdsysinfo.h"
-#include "kdbytesize.h"
-
#include <Carbon/Carbon.h>
#include <sys/mount.h>
@@ -34,11 +32,11 @@ static QString qt_mac_hfsunistr_to_qstring( const HFSUniStr255* hfs )
return QString( charPointer, hfs->length );
}
-KDByteSize KDSysInfo::installedMemory()
+quint64 KDSysInfo::installedMemory()
{
SInt32 mb = 0;
Gestalt( gestaltPhysicalRAMSizeInMegabytes, &mb );
- return KDByteSize( static_cast< quint64 >( mb ) * 1024LL * 1024LL );
+ return quint64( static_cast< quint64 >( mb ) * 1024LL * 1024LL );
}
QList< KDSysInfo::Volume > KDSysInfo::mountedVolumes()
@@ -58,8 +56,8 @@ QList< KDSysInfo::Volume > KDSysInfo::mountedVolumes()
v.setPath(QString::fromLocal8Bit(reinterpret_cast< char* >(path)));
FSGetVolumeInfo(volume, 0, 0, kFSVolInfoSizes, &info, 0, 0);
- v.setSize(KDByteSize(info.totalBytes));
- v.setAvailableSpace(KDByteSize(info.freeBytes));
+ v.setSize(quint64(info.totalBytes));
+ v.setAvailableSpace(quint64(info.freeBytes));
struct statfs data;
if (statfs(qPrintable(v.path()), &data) == 0)
diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo_win.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo_win.cpp
index cf0eaf502..86d152431 100644
--- a/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo_win.cpp
+++ b/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo_win.cpp
@@ -22,8 +22,6 @@
#include "kdsysinfo.h"
-#include "kdbytesize.h"
-
#include <windows.h>
#include <Tlhelp32.h>
#include <Psapi.h>
@@ -35,23 +33,23 @@
#define KDSYSINFO_PROCESS_QUERY_LIMITED_INFORMATION (0x1000)
-KDByteSize KDSysInfo::installedMemory()
+quint64 KDSysInfo::installedMemory()
{
MEMORYSTATUSEX status;
status.dwLength = sizeof( status );
GlobalMemoryStatusEx( &status );
- return KDByteSize( status.ullTotalPhys );
+ return quint64( status.ullTotalPhys );
}
-QPair< KDByteSize, KDByteSize > volumeSpace( const QString& volume )
+QPair< quint64, quint64 > volumeSpace( const QString& volume )
{
- QPair< KDByteSize, KDByteSize > result;
+ QPair< quint64, quint64 > result;
ULARGE_INTEGER bytes;
ULARGE_INTEGER freebytes;
if( GetDiskFreeSpaceExA( qPrintable( volume ), 0, &bytes, &freebytes ) != 0 )
{
- result.first = KDByteSize( bytes.QuadPart );
- result.second = KDByteSize( freebytes.QuadPart );
+ result.first = quint64( bytes.QuadPart );
+ result.second = quint64( freebytes.QuadPart );
}
return result;
}
@@ -107,7 +105,7 @@ QList< KDSysInfo::Volume > KDSysInfo::mountedVolumes()
volume.setPath( path );
volume.setName( volumeName( path ) );
volume.setFileSystemType(fileSystemType(path));
- const QPair< KDByteSize, KDByteSize > sizes = volumeSpace( path );
+ const QPair< quint64, quint64 > sizes = volumeSpace( path );
volume.setSize( sizes.first );
volume.setAvailableSpace( sizes.second );
result.push_back( volume );
diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo_x11.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo_x11.cpp
index 1e676a71b..f54f63c8e 100644
--- a/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo_x11.cpp
+++ b/installerbuilder/libinstaller/3rdparty/kdtools/KDToolsCore/kdsysinfo_x11.cpp
@@ -22,8 +22,6 @@
#include "kdsysinfo.h"
-#include "kdbytesize.h"
-
#include <sys/utsname.h>
#include <sys/statvfs.h>
@@ -32,7 +30,7 @@
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
-KDByteSize KDSysInfo::installedMemory()
+quint64 KDSysInfo::installedMemory()
{
#ifdef Q_OS_LINUX
QFile f( QLatin1String( "/proc/meminfo" ) );
@@ -44,19 +42,19 @@ KDByteSize KDSysInfo::installedMemory()
if( !s.startsWith( QLatin1String( "MemTotal:" ) ) )
continue;
else if( s.isEmpty() )
- return KDByteSize();
+ return quint64();
const QStringList parts = s.split( QLatin1Char( ' ' ), QString::SkipEmptyParts );
- return KDByteSize( parts.at(1).toInt() * 1024LL );
+ return quint64( parts.at(1).toInt() * 1024LL );
}
#else
quint64 physmem;
size_t len = sizeof physmem;
static int mib[2] = { CTL_HW, HW_MEMSIZE };
sysctl( mib, 2, &physmem, &len, 0, 0 );
- return KDByteSize( physmem );
+ return quint64( physmem );
#endif
- return KDByteSize();
+ return 0;
}
QList< KDSysInfo::Volume > KDSysInfo::mountedVolumes()
@@ -88,8 +86,8 @@ QList< KDSysInfo::Volume > KDSysInfo::mountedVolumes()
struct statvfs data;
if( statvfs( qPrintable( v.name() ), &data ) == 0 )
{
- v.setSize( KDByteSize( static_cast< quint64 >( data.f_blocks ) * data.f_bsize ) );
- v.setAvailableSpace( KDByteSize( static_cast< quint64> ( data.f_bavail ) * data.f_bsize ) );
+ v.setSize( quint64( static_cast< quint64 >( data.f_blocks ) * data.f_bsize ) );
+ v.setAvailableSpace( quint64( static_cast< quint64> ( data.f_bavail ) * data.f_bsize ) );
}
result.push_back( v );
diff --git a/installerbuilder/libinstaller/packagemanagergui.cpp b/installerbuilder/libinstaller/packagemanagergui.cpp
index 2ec4faf44..d4a3afd8b 100644
--- a/installerbuilder/libinstaller/packagemanagergui.cpp
+++ b/installerbuilder/libinstaller/packagemanagergui.cpp
@@ -30,6 +30,7 @@
** (qt-info@nokia.com).
**
**************************************************************************/
+
#include "packagemanagergui.h"
#include "component.h"
@@ -45,7 +46,6 @@
#include "common/utils.h"
#include "common/fileutils.h"
-#include <KDToolsCore/KDByteSize>
#include <KDToolsCore/KDSysInfo>
#include <QtCore/QDir>
@@ -1528,25 +1528,25 @@ void ReadyForInstallationPage::entering()
const bool tempOnSameVolume = vol == tempVolume;
// there is no better way atm to check this
- if (vol.size().size() == 0 && vol.availableSpace().size() == 0) {
+ if (vol.size() == 0 && vol.availableSpace() == 0) {
verbose() << "Could not determine available space on device " << target << ". Continue silently."
<< std::endl;
return;
}
- const KDByteSize required(packageManagerCore()->requiredDiskSpace());
- const KDByteSize tempRequired(packageManagerCore()->requiredTemporaryDiskSpace());
+ const quint64 required(packageManagerCore()->requiredDiskSpace());
+ const quint64 tempRequired(packageManagerCore()->requiredTemporaryDiskSpace());
- const KDByteSize available = vol.availableSpace();
- const KDByteSize tempAvailable = tempVolume.availableSpace();
- const KDByteSize realRequiredTempSpace = KDByteSize(0.1 * tempRequired + tempRequired);
- const KDByteSize realRequiredSpace = KDByteSize(2 * required);
+ const quint64 available = vol.availableSpace();
+ const quint64 tempAvailable = tempVolume.availableSpace();
+ const quint64 realRequiredTempSpace = quint64(0.1 * tempRequired + tempRequired);
+ const quint64 realRequiredSpace = quint64(2 * required);
const bool tempInstFailure = tempOnSameVolume && available < realRequiredSpace
+ realRequiredTempSpace;
- verbose() << "Disk space check on " << target << ": required: " << required.size()
- << ", available: " << available.size() << ", size: " << vol.size().size() << std::endl;
+ verbose() << "Disk space check on " << target << ": required: " << required
+ << ", available: " << available << ", size: " << vol.size() << std::endl;
QString tempString;
if (tempAvailable < realRequiredTempSpace || tempInstFailure) {
@@ -1555,7 +1555,7 @@ void ReadyForInstallationPage::entering()
"at least %1 are required").arg(unitSizeText(realRequiredTempSpace + realRequiredSpace));
} else {
tempString = tr("Not enough disk space to store temporary files, at least %1 are required")
- .arg(unitSizeText(realRequiredTempSpace.size()));
+ .arg(unitSizeText(realRequiredTempSpace));
}
}