summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhjk <qthjk@ovi.com>2011-11-20 00:09:54 +0100
committerTim Jenssen <tim.jenssen@nokia.com>2011-11-21 13:16:15 +0100
commita188e46af2359ef43c24d66abbeea89dd70c7821 (patch)
tree1254d567c88aeb9fc08b6a82532cf201531480ed
parent05c6a59c05d8b2b1168e5822da6b10bce79548fc (diff)
Simplifications in PackageInfo and ZipJob.
Change-Id: If92e16fb5f27c262048471eb9ea45e5c247f65b9 Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
-rw-r--r--installerbuilder/common/utils.cpp8
-rw-r--r--installerbuilder/common/zipjob.cpp22
-rw-r--r--installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterapplication.cpp34
-rw-r--r--installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterpackagesinfo.cpp18
4 files changed, 33 insertions, 49 deletions
diff --git a/installerbuilder/common/utils.cpp b/installerbuilder/common/utils.cpp
index 6267c82f6..ee3f89b9d 100644
--- a/installerbuilder/common/utils.cpp
+++ b/installerbuilder/common/utils.cpp
@@ -320,19 +320,19 @@ static QString qt_create_commandline(const QString &program, const QStringList &
args = programName + QLatin1Char(' ');
}
- for (int i=0; i<arguments.size(); ++i) {
+ for (int i = 0; i < arguments.size(); ++i) {
QString tmp = arguments.at(i);
// in the case of \" already being in the string the \ must also be escaped
- tmp.replace( QLatin1String("\\\""), QLatin1String("\\\\\"") );
+ tmp.replace(QLatin1String("\\\""), QLatin1String("\\\\\""));
// escape a single " because the arguments will be parsed
- tmp.replace( QLatin1Char('\"'), QLatin1String("\\\"") );
+ tmp.replace(QLatin1Char('\"'), QLatin1String("\\\""));
if (tmp.isEmpty() || tmp.contains(QLatin1Char(' ')) || tmp.contains(QLatin1Char('\t'))) {
// The argument must not end with a \ since this would be interpreted
// as escaping the quote -- rather put the \ behind the quote: e.g.
// rather use "foo"\ than "foo\"
QString endQuote(QLatin1Char('\"'));
int i = tmp.length();
- while (i>0 && tmp.at(i-1) == QLatin1Char('\\')) {
+ while (i > 0 && tmp.at(i - 1) == QLatin1Char('\\')) {
--i;
endQuote += QLatin1Char('\\');
}
diff --git a/installerbuilder/common/zipjob.cpp b/installerbuilder/common/zipjob.cpp
index 7fffd64ee..4593a8e95 100644
--- a/installerbuilder/common/zipjob.cpp
+++ b/installerbuilder/common/zipjob.cpp
@@ -42,14 +42,8 @@
class ZipJob::Private
{
- ZipJob *const q;
public:
- explicit Private(ZipJob *qq) :
- q(qq),
- outputDevice(0),
- process(0)
- {
- }
+ Private() : outputDevice(0), process(0) {}
QIODevice *outputDevice;
QDir workingDir;
@@ -60,7 +54,7 @@ public:
Q_DECLARE_METATYPE(QProcess::ExitStatus)
ZipJob::ZipJob()
- : d(new Private(this))
+ : d(new Private())
{
qRegisterMetaType<QProcess::ExitStatus>();
}
@@ -137,24 +131,16 @@ void ZipJob::setFilesToArchive(const QStringList &files)
class UnzipJob::Private
{
- UnzipJob *const q;
public:
- explicit Private(UnzipJob *qq)
- : q(qq),
- inputDevice(0)
- {
- }
+ Private() : inputDevice(0) {}
-public:
QIODevice *inputDevice;
QString outputPath;
QStringList filesToExtract;
};
UnzipJob::UnzipJob()
- : QObject(),
- QRunnable(),
- d(new Private(this))
+ : d(new Private())
{
qRegisterMetaType<QProcess::ExitStatus>();
}
diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterapplication.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterapplication.cpp
index 0c771556f..0b9b47213 100644
--- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterapplication.cpp
+++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterapplication.cpp
@@ -62,25 +62,25 @@ ConfigurationInterface::~ConfigurationInterface()
namespace {
- class DefaultConfigImpl : public ConfigurationInterface
+class DefaultConfigImpl : public ConfigurationInterface
+{
+public:
+ QVariant value(const QString &key) const
{
- public:
- QVariant value(const QString &key) const
- {
- QSettings settings;
- settings.beginGroup(QLatin1String("KDUpdater"));
- return settings.value(key);
- }
-
- void setValue(const QString &key, const QVariant &value)
- {
- QSettings settings;
- settings.beginGroup(QLatin1String("KDUpdater"));
- settings.setValue(key, value);
- }
- };
+ QSettings settings;
+ settings.beginGroup(QLatin1String("KDUpdater"));
+ return settings.value(key);
+ }
-}
+ void setValue(const QString &key, const QVariant &value)
+ {
+ QSettings settings;
+ settings.beginGroup(QLatin1String("KDUpdater"));
+ settings.setValue(key, value);
+ }
+};
+
+} // namespace anon
/*!
\class KDUpdater::Application kdupdaterapplication.h KDUpdaterApplication
diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterpackagesinfo.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterpackagesinfo.cpp
index c151998a8..12bc4bd1c 100644
--- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterpackagesinfo.cpp
+++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterpackagesinfo.cpp
@@ -75,14 +75,12 @@ using namespace KDUpdater;
struct PackagesInfo::PackagesInfoData
{
- PackagesInfoData(PackagesInfo *qq) :
- q(qq),
+ PackagesInfoData() :
application(0),
error(PackagesInfo::NotYetReadError),
compatLevel(-1),
modified(false)
{}
- PackagesInfo *q;
Application *application;
QString errorMessage;
PackagesInfo::Error error;
@@ -109,7 +107,7 @@ void PackagesInfo::PackagesInfoData::setInvalidContentError(const QString &detai
*/
PackagesInfo::PackagesInfo(Application *application)
: QObject(application),
- d(new PackagesInfoData(this))
+ d(new PackagesInfoData())
{
d->application = application;
}
@@ -127,7 +125,7 @@ PackagesInfo::~PackagesInfo()
Returns a pointer to the application, whose package information this class provides
access to.
*/
-Application* PackagesInfo::application() const
+Application *PackagesInfo::application() const
{
return d->application;
}
@@ -162,9 +160,9 @@ PackagesInfo::Error PackagesInfo::error() const
\sa KDUpdater::Application::setPackagesXMLFileName()
*/
-void PackagesInfo::setFileName(const QString& fileName)
+void PackagesInfo::setFileName(const QString &fileName)
{
- if( d->fileName == fileName )
+ if (d->fileName == fileName)
return;
d->fileName = fileName;
@@ -201,7 +199,7 @@ QString PackagesInfo::applicationName() const
Sets the application version. By default this is the version specified
in the ApplicationVersion XML element of Packages.xml.
*/
-void PackagesInfo::setApplicationVersion(const QString& version)
+void PackagesInfo::setApplicationVersion(const QString &version)
{
d->applicationVersion = version;
d->modified = true;
@@ -232,7 +230,7 @@ PackageInfo PackagesInfo::packageInfo(int index) const
if (index < 0 || index >= d->packageInfoList.count())
return PackageInfo();
- return d->packageInfoList[index];
+ return d->packageInfoList.at(index);
}
/*!
@@ -247,7 +245,7 @@ int PackagesInfo::compatLevel() const
This function returns the index of the package whose name is \c pkgName. If no such
package was found, this function returns -1.
*/
-int PackagesInfo::findPackageInfo(const QString& pkgName) const
+int PackagesInfo::findPackageInfo(const QString &pkgName) const
{
for (int i = 0; i < d->packageInfoList.count(); i++) {
if (d->packageInfoList[i].name == pkgName)