summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@nokia.com>2012-03-15 11:42:34 +0100
committerKarsten Heimrich <karsten.heimrich@nokia.com>2012-03-16 17:40:27 +0100
commitf60c03d5bb03ba42955ce309a1765795f33e9bc1 (patch)
tree636cce9bdbcbf9b0ce1d928f8fdfd9ebf29f28dd
parent5e0165328aebec9acbc3fc4679ef58857fe856fa (diff)
Fix formating and build with QT_NO_CAST_FROM_ASCII.
Change-Id: I00e4b1ec840d976dbfc7f0138726692a770aadba Reviewed-by: Niels Weber <niels.2.weber@nokia.com> Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
-rw-r--r--examples/testapp/mainwindow.cpp2
-rw-r--r--tests/environmentvariable/environmentvariabletest.cpp4
-rw-r--r--tests/fileengineclient/fileengineclient.cpp33
-rw-r--r--tests/fileengineserver/fileengineserver.cpp4
-rw-r--r--tools/maddehelper/main.cpp108
-rw-r--r--tools/repocompare/main.cpp2
-rw-r--r--tools/repocompare/mainwindow.cpp8
-rw-r--r--tools/repocompare/repositorymanager.cpp40
-rw-r--r--tools/repogenfromonlinerepo/downloadmanager.cpp15
-rw-r--r--tools/repogenfromonlinerepo/main.cpp116
-rw-r--r--tools/repogenfromonlinerepo/repogenfromonlinerepo.pro26
11 files changed, 197 insertions, 161 deletions
diff --git a/examples/testapp/mainwindow.cpp b/examples/testapp/mainwindow.cpp
index 97c534e2d..ab06df665 100644
--- a/examples/testapp/mainwindow.cpp
+++ b/examples/testapp/mainwindow.cpp
@@ -123,7 +123,7 @@ void MainWindow::checkForUpdates()
updatesInstalled();
} catch (const QInstaller::Error &error) {
QMessageBox::critical(this, tr("Check for Updates"), tr("Error while installing updates:\n%1")
- .arg(error.what()));
+ .arg(error.message()));
m_core.rollBackInstallation();
settings.setLastResult(tr("Software Update failed."));
} catch (...) {
diff --git a/tests/environmentvariable/environmentvariabletest.cpp b/tests/environmentvariable/environmentvariabletest.cpp
index b3088cfb2..453559a62 100644
--- a/tests/environmentvariable/environmentvariabletest.cpp
+++ b/tests/environmentvariable/environmentvariabletest.cpp
@@ -66,7 +66,7 @@ void EnvironmentVariableTest::testPersistentNonSystem()
QVERIFY2(ok, qPrintable(op.errorString()));
// Verify now...
- QSettings settings("HKEY_CURRENT_USER\\Environment", QSettings::NativeFormat);
+ QSettings settings(QLatin1String("HKEY_CURRENT_USER\\Environment"), QSettings::NativeFormat);
QVERIFY(value == settings.value(key).toString());
// Remove the setting
@@ -94,7 +94,7 @@ void EnvironmentVariableTest::testNonPersistentNonSystem()
QVERIFY2(ok, qPrintable(op.errorString()));
- QString comp = qgetenv(qPrintable(key));
+ QString comp = QString::fromLocal8Bit(qgetenv(qPrintable(key)));
QCOMPARE(value, comp);
}
diff --git a/tests/fileengineclient/fileengineclient.cpp b/tests/fileengineclient/fileengineclient.cpp
index 33f8fff53..4dfa3e95a 100644
--- a/tests/fileengineclient/fileengineclient.cpp
+++ b/tests/fileengineclient/fileengineclient.cpp
@@ -33,7 +33,7 @@
#include <fsengineclient.h>
#include <QProcess>
-#include <QApplication>
+#include <QCoreApplication>
#include <QThread>
#include <QDebug>
@@ -47,7 +47,7 @@ public:
{
m_process = processWrapper;
QObject::connect(m_process, SIGNAL(readyRead()),
- this, SLOT(readProcessOutput()), Qt::DirectConnection );
+ this, SLOT(readProcessOutput()), Qt::DirectConnection);
}
void clearSavedOutPut() { m_savedOutPut.clear(); }
QByteArray savedOutPut() { return m_savedOutPut; }
@@ -58,10 +58,11 @@ public slots:
Q_ASSERT(m_process);
Q_ASSERT(QThread::currentThread() == m_process->thread());
if (QThread::currentThread() != m_process->thread()) {
- qDebug() << Q_FUNC_INFO << QLatin1String(" can only be called from the same thread as the process is.") ;
+ qDebug() << Q_FUNC_INFO << QLatin1String("can only be called from the same thread as the "
+ "process is.");
}
const QByteArray output = m_process->readAll();
- if( !output.isEmpty() ) {
+ if (!output.isEmpty()) {
m_savedOutPut.append(output);
qDebug() << output;
}
@@ -75,18 +76,19 @@ private:
int main(int argc, char **argv)
{
- QApplication app(argc, argv);
+ QCoreApplication app(argc, argv);
QString fileName(QLatin1String("give_me_some_output.bat"));
QFile file(fileName);
if (file.exists() && !file.remove()) {
- qFatal( qPrintable( QString("something is wrong, can not delete: %1").arg(file.fileName()) ) );
+ qFatal(qPrintable(QString::fromLatin1("something is wrong, can not delete: %1").arg(file.fileName())));
return -1;
}
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
{
- qFatal( qPrintable( QString("something is wrong, can not open for writing to: %1").arg(file.fileName()) ) );
+ qFatal(qPrintable(QString::fromLatin1("something is wrong, can not open for writing to: %1")
+ .arg(file.fileName())));
return -2;
}
@@ -94,7 +96,7 @@ int main(int argc, char **argv)
out << QLatin1String("echo mega test output");
if (!file.flush())
{
- qFatal( qPrintable( QString("something is wrong, can not write to: %1").arg(file.fileName()) ) );
+ qFatal(qPrintable(QString::fromLatin1("something is wrong, can not write to: %1").arg(file.fileName())));
return -3;
}
file.close();
@@ -110,7 +112,7 @@ int main(int argc, char **argv)
qDebug() << "1";
{
const QByteArray output = process.readAll();
- if( !output.isEmpty() ) {
+ if (!output.isEmpty()) {
qDebug() << output;
}
}
@@ -118,7 +120,7 @@ int main(int argc, char **argv)
qDebug() << "2";
{
const QByteArray output = process.readAll();
- if( !output.isEmpty() ) {
+ if (!output.isEmpty()) {
qDebug() << output;
}
}
@@ -126,7 +128,7 @@ int main(int argc, char **argv)
qDebug() << "3";
{
const QByteArray output = process.readAll();
- if( !output.isEmpty() ) {
+ if (!output.isEmpty()) {
qDebug() << output;
}
}
@@ -146,7 +148,7 @@ int main(int argc, char **argv)
qDebug() << "1";
{
const QByteArray output = process.readAll();
- if( !output.isEmpty() ) {
+ if (!output.isEmpty()) {
qDebug() << output;
}
}
@@ -154,7 +156,7 @@ int main(int argc, char **argv)
qDebug() << "2";
{
const QByteArray output = process.readAll();
- if( !output.isEmpty() ) {
+ if (!output.isEmpty()) {
qDebug() << output;
}
}
@@ -162,7 +164,7 @@ int main(int argc, char **argv)
qDebug() << "3";
{
const QByteArray output = process.readAll();
- if( !output.isEmpty() ) {
+ if (!output.isEmpty()) {
qDebug() << output;
}
}
@@ -170,7 +172,8 @@ int main(int argc, char **argv)
}
if (firstOutPut != secondOutPut) {
- qFatal( qPrintable( QString("Test failed: output is different between a normal QProcess and QProcessWrapper").arg(file.fileName()) ) );
+ qFatal(qPrintable(QString::fromLatin1("Test failed: output is different between a normal QProcess "
+ "and QProcessWrapper: %1").arg(file.fileName())));
return -2;
} else {
qDebug() << QLatin1String("Test OK: QProcess works as expected.");
diff --git a/tests/fileengineserver/fileengineserver.cpp b/tests/fileengineserver/fileengineserver.cpp
index a1e2d121c..9b53c8f91 100644
--- a/tests/fileengineserver/fileengineserver.cpp
+++ b/tests/fileengineserver/fileengineserver.cpp
@@ -32,11 +32,11 @@
#include <fsengineserver.h>
-#include <QApplication>
+#include <QCoreApplication>
int main(int argc, char **argv)
{
- QApplication app(argc, argv);
+ QCoreApplication app(argc, argv);
FSEngineServer server(39999);
server.enableTestMode();
return app.exec();
diff --git a/tools/maddehelper/main.cpp b/tools/maddehelper/main.cpp
index 1f4ed555b..28e8c8b3c 100644
--- a/tools/maddehelper/main.cpp
+++ b/tools/maddehelper/main.cpp
@@ -9,38 +9,39 @@
//which I used for testing
bool rebaseDlls(const QString &maddeBinLocation,
const QString &rebaseBinaryLocation,
- const QString &adressValue = "0x50000000",
- const QString &dllFilter = "msys*.dll")
+ const QString &adressValue = QLatin1String("0x50000000"),
+ const QString &dllFilter = QLatin1String("msys*.dll"))
{
QStringList dllStringList = QDir(maddeBinLocation).entryList(QStringList(dllFilter), QDir::Files, QDir::Size | QDir::Reversed);
QString dlls;
QString dllsEnd; //of an unknown issue msys-1.0.dll should be the last on my system
foreach (QString dll, dllStringList) {
- dll.prepend(maddeBinLocation + "/");
- if (dll.contains("msys-1")) {
- dllsEnd.append(dll + " ");
+ dll.prepend(maddeBinLocation + QLatin1String("/"));
+ if (dll.contains(QLatin1String("msys-1"))) {
+ dllsEnd.append(dll + QLatin1String(" "));
} else {
- dlls.append(dll + " ");
+ dlls.append(dll + QLatin1String(" "));
}
}
dlls = dlls.append(dllsEnd);
QProcess process;
- process.setEnvironment(QStringList("EMPTY_ENVIRONMENT=true"));
+ process.setEnvironment(QStringList(QLatin1String("EMPTY_ENVIRONMENT=true")));
QProcess::ProcessError initError(process.error());
process.setProcessChannelMode(QProcess::MergedChannels);
- process.setNativeArguments(QString("-b %1 -o 0x10000 -v %2").arg(adressValue, dlls));
+ process.setNativeArguments(QString::fromLatin1("-b %1 -o 0x10000 -v %2").arg(adressValue, dlls));
process.start(rebaseBinaryLocation);
process.waitForFinished();
if (process.exitCode() != 0 ||
initError != process.error() ||
process.exitStatus() == QProcess::CrashExit)
{
- qWarning() << rebaseBinaryLocation + " " + process.nativeArguments();
- qWarning() << QString("\t Adress rebasing failed! Maybe a process(bash.exe, ssh, ...) is using some of the dlls(%1).").arg(dllStringList.join(", "));
+ qWarning() << rebaseBinaryLocation + QString::fromLatin1(" ") + process.nativeArguments();
+ qWarning() << QString::fromLatin1("\t Adress rebasing failed! Maybe a process(bash.exe, ssh, ...) "
+ "is using some of the dlls(%1).").arg(dllStringList.join(QLatin1String(", ")));
qWarning() << "\t Output: \n" << process.readAll();
if (initError != process.error()) {
- qDebug() << QString("\tError(%1): ").arg(process.error()) << process.errorString();
+ qDebug() << QString::fromLatin1("\tError(%1): ").arg(process.error()) << process.errorString();
}
if (process.exitStatus() == QProcess::CrashExit) {
@@ -48,7 +49,7 @@ bool rebaseDlls(const QString &maddeBinLocation,
}
return false;
}
- qWarning() << rebaseBinaryLocation + " " + process.nativeArguments();
+ qWarning() << rebaseBinaryLocation + QString::fromLatin1(" ") + process.nativeArguments();
//qWarning() << "\t Output: \n" << process.readAll();
return true;
}
@@ -64,23 +65,25 @@ bool checkTools(const QString &maddeBinLocation, const QStringList &binaryCheckL
}
bool testedToolState = true;
QProcess process;
- process.setEnvironment(QStringList("EMPTY_ENVIRONMENT=true"));
+ process.setEnvironment(QStringList(QString::fromLatin1("EMPTY_ENVIRONMENT=true")));
QProcess::ProcessError initError(process.error());
process.setProcessChannelMode(QProcess::MergedChannels);
- process.start(processPath, QStringList("--version"));
+ process.start(processPath, QStringList(QString::fromLatin1("--version")));
process.waitForFinished(1000);
- QString processOutput = process.readAll();
+ QString processOutput = QString::fromLocal8Bit(process.readAll());
//check for the unpossible load dll error
- if (processOutput.contains("VirtualAlloc pointer is null") ||
- processOutput.contains("Couldn't reserve space for") ||
- process.exitStatus() == QProcess::CrashExit)
+ if (processOutput.contains(QString::fromLatin1("VirtualAlloc pointer is null"))
+ || processOutput.contains(QString::fromLatin1("Couldn't reserve space for"))
+ || process.exitStatus() == QProcess::CrashExit)
{
- qWarning() << QString("found dll loading problem with(ExitCode: %1): ").arg(QString::number(process.exitCode())) << processPath;
+ qWarning() << QString::fromLatin1("found dll loading problem with(ExitCode: %1): ")
+ .arg(QString::number(process.exitCode())) << processPath;
qWarning() << processOutput;
testedToolState = false;
if (initError != process.error()) {
- qWarning() << QString("\tError(%1): ").arg(process.error()) << process.errorString();
+ qWarning() << QString::fromLatin1("\tError(%1): ").arg(process.error())
+ << process.errorString();
}
if (process.exitStatus() == QProcess::CrashExit) {
@@ -127,7 +130,7 @@ bool removeDirectory( const QString& path )
}
if ( !QDir().rmdir(path))
- return QDir().rename(path, path + "_" + QDateTime::currentDateTime().toString());
+ return QDir().rename(path, path + QString::fromLatin1("_") + QDateTime::currentDateTime().toString());
return true;
}
@@ -138,12 +141,12 @@ bool cleanUpSubDirectories(const QString &maddeLocation, const QStringList &subD
return false;
}
if (!QFileInfo(maddeLocation).exists()) {
- qWarning() << QString("Ups, location '%1' is not existing.").arg(maddeLocation);
+ qWarning() << QString::fromLatin1("Ups, location '%1' is not existing.").arg(maddeLocation);
return false;
}
foreach (const QString &subDirectory, subDirectoryList) {
- bool removed = removeDirectory(maddeLocation + "/" + subDirectory);
+ bool removed = removeDirectory(maddeLocation + QString::fromLatin1("/") + subDirectory);
if (!removed) {
qWarning() << "Can't remove " << subDirectory <<" for a clean up step";
return false;
@@ -165,7 +168,7 @@ bool cleanUpSubDirectories(const QString &maddeLocation, const QStringList &subD
bool runInstall(const QString &postinstallCommand, const QString &checkFileForAnOkInstallation)
{
QProcess process;
- process.setEnvironment(QStringList("EMPTY_ENVIRONMENT=true"));
+ process.setEnvironment(QStringList(QString::fromLatin1("EMPTY_ENVIRONMENT=true")));
QProcess::ProcessError initError(process.error());
process.setProcessChannelMode(QProcess::ForwardedChannels);
process.setNativeArguments(postinstallCommand);
@@ -176,9 +179,10 @@ bool runInstall(const QString &postinstallCommand, const QString &checkFileForAn
initError != process.error() ||
process.exitStatus() == QProcess::CrashExit)
{
- qWarning() << QString("runInstall(ExitCode: %1) went wrong \n'%2'").arg(QString::number(process.exitCode()), postinstallCommand);
+ qWarning() << QString::fromLatin1("runInstall(ExitCode: %1) went wrong \n'%2'")
+ .arg(QString::number(process.exitCode()), postinstallCommand);
if (initError != process.error()) {
- qDebug() << QString("\tError(%1): ").arg(process.error()) << process.errorString();
+ qDebug() << QString::fromLatin1("\tError(%1): ").arg(process.error()) << process.errorString();
}
if (process.exitStatus() == QProcess::CrashExit) {
@@ -219,11 +223,11 @@ int main(int argc, char *argv[])
for ( int i = 1; i < app.arguments().size(); ++i ) {
if ( app.arguments().at( i ) == QLatin1String( "" ) )
continue;
- if (app.arguments().at(i) == "-r") {
+ if (app.arguments().at(i) == QString::fromLatin1("-r")) {
i++;
rebaseBinaryLocation = app.arguments().at(i);
}
- if (app.arguments().at(i) == "-m") {
+ if (app.arguments().at(i) == QString::fromLatin1("-m")) {
i++;
maddeLocation = app.arguments().at(i);
}
@@ -232,24 +236,25 @@ int main(int argc, char *argv[])
qDebug() << "MADDE location is not existing.";
return 4;
}
- if (!QFileInfo(maddeLocation + "/bin").isDir()) {
+ if (!QFileInfo(maddeLocation + QString::fromLatin1("/bin")).isDir()) {
qDebug() << "It seems that the madde location don't have a 'bin'' directory.";
return 5;
}
- QString maddeBinLocation = maddeLocation + "/bin";
+ QString maddeBinLocation = maddeLocation + QString::fromLatin1("/bin");
//from qs
// var envExecutable = installer.value("TargetDir") + "/" + winMaddeSubPath + "/bin/env.exe";
// var postShell = installer.value("TargetDir") + "/" + winMaddeSubPath + "/postinstall/postinstall.sh";
// component.addOperation("Execute", "{0,1}", envExecutable, "-i" , "/bin/sh", "--login", postShell, "--nosleepontrap", "showStandardError");
- QString postinstallShell = maddeLocation + "/postinstall/postinstall.sh";
+ QString postinstallShell = maddeLocation + QString::fromLatin1("/postinstall/postinstall.sh");
//"--nosleepontrap" is not used in our Madde, but later maybe it is there again
- QString postinstallCommand = maddeBinLocation + QString("/env.exe -i /bin/sh --login %1").arg(postinstallShell + " --nosleepontrap");
- QString successFileCheck = maddeLocation + "/madbin/mad.cmd";
- QString directoriesForCleanUpArgument = "sysroots, toolchains, targets, runtimes, wbin";
- directoriesForCleanUpArgument.remove(" ");
- QStringList directoriesForCleanUp(directoriesForCleanUpArgument.split(","));
+ QString postinstallCommand = maddeBinLocation + QString::fromLatin1("/env.exe -i /bin/sh --login %1")
+ .arg(postinstallShell + QString::fromLatin1(" --nosleepontrap"));
+ QString successFileCheck = maddeLocation + QString::fromLatin1("/madbin/mad.cmd");
+ QString directoriesForCleanUpArgument = QString::fromLatin1("sysroots, toolchains, targets, runtimes, wbin");
+ directoriesForCleanUpArgument.remove(QString::fromLatin1(" "));
+ QStringList directoriesForCleanUp(directoriesForCleanUpArgument.split(QString::fromLatin1(",")));
//this was used for testings
//cleanUpSubDirectories(maddeLocation, directoriesForCleanUp, QStringList(successFileCheck));
@@ -260,23 +265,24 @@ int main(int argc, char *argv[])
return 0;
- QString binaryCheckArgument = ("a2p.exe, basename.exe, bash.exe, bzip2.exe, cat.exe, chmod.exe, cmp.exe, comm.exe, cp.exe, cut.exe, " \
- "date.exe, diff.exe, diff3.exe, dirname.exe, du.exe, env.exe, expr.exe, find.exe, fold.exe, gawk.exe, " \
- "grep.exe, gzip.exe, head.exe, id.exe, install.exe, join.exe, less.exe, ln.exe, ls.exe, lzma.exe, m4.exe, " \
- "make.exe, md5sum.exe, mkdir.exe, mv.exe, od.exe, paste.exe, patch.exe, perl.exe, perl5.6.1.exe, ps.exe, " \
- "rm.exe, rmdir.exe, sed.exe, sh.exe, sleep.exe, sort.exe, split.exe, ssh-agent.exe, ssh-keygen.exe, " \
- "stty.exe, tail.exe, tar.exe, tee.exe, touch.exe, tr.exe, true.exe, uname.exe, uniq.exe, vim.exe, wc.exe, xargs.exe");
- binaryCheckArgument.remove(" ");
- QStringList binaryCheckList(binaryCheckArgument.split(","));
+ QString binaryCheckArgument =
+ QString::fromLatin1("a2p.exe, basename.exe, bash.exe, bzip2.exe, cat.exe, chmod.exe, cmp.exe, comm.exe, cp.exe, cut.exe, " \
+ "date.exe, diff.exe, diff3.exe, dirname.exe, du.exe, env.exe, expr.exe, find.exe, fold.exe, gawk.exe, " \
+ "grep.exe, gzip.exe, head.exe, id.exe, install.exe, join.exe, less.exe, ln.exe, ls.exe, lzma.exe, m4.exe, " \
+ "make.exe, md5sum.exe, mkdir.exe, mv.exe, od.exe, paste.exe, patch.exe, perl.exe, perl5.6.1.exe, ps.exe, " \
+ "rm.exe, rmdir.exe, sed.exe, sh.exe, sleep.exe, sort.exe, split.exe, ssh-agent.exe, ssh-keygen.exe, " \
+ "stty.exe, tail.exe, tar.exe, tee.exe, touch.exe, tr.exe, true.exe, uname.exe, uniq.exe, vim.exe, wc.exe, xargs.exe");
+ binaryCheckArgument.remove(QString::fromLatin1(" "));
+ QStringList binaryCheckList(binaryCheckArgument.split(QString::fromLatin1(",")));
QStringList possibleRebaseAdresses;
- possibleRebaseAdresses << "0x5200000"; //this uses perl
- possibleRebaseAdresses << "0x30000000";
- possibleRebaseAdresses << "0x35000000";
- possibleRebaseAdresses << "0x40000000";
- possibleRebaseAdresses << "0x60000000";
- possibleRebaseAdresses << "0x60800000";
- possibleRebaseAdresses << "0x68000000"; //this uses git
+ possibleRebaseAdresses << QString::fromLatin1("0x5200000"); //this uses perl
+ possibleRebaseAdresses << QString::fromLatin1("0x30000000");
+ possibleRebaseAdresses << QString::fromLatin1("0x35000000");
+ possibleRebaseAdresses << QString::fromLatin1("0x40000000");
+ possibleRebaseAdresses << QString::fromLatin1("0x60000000");
+ possibleRebaseAdresses << QString::fromLatin1("0x60800000");
+ possibleRebaseAdresses << QString::fromLatin1("0x68000000"); //this uses git
foreach (const QString &newAdress, possibleRebaseAdresses) {
bool rebased = rebaseDlls(maddeBinLocation, rebaseBinaryLocation, newAdress);
diff --git a/tools/repocompare/main.cpp b/tools/repocompare/main.cpp
index 00b5cc307..c0535e0e0 100644
--- a/tools/repocompare/main.cpp
+++ b/tools/repocompare/main.cpp
@@ -40,7 +40,7 @@ int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QCoreApplication::setApplicationName(QLatin1String("IFW_repocompare"));
- if (a.arguments().contains("-i")) {
+ if (a.arguments().contains(QLatin1String("-i"))) {
if (a.arguments().count() != 5) {
qWarning() << "Usage: " << a.arguments().at(0) << " -i <production Repo> <update Repo> <outputFile>";
return -1;
diff --git a/tools/repocompare/mainwindow.cpp b/tools/repocompare/mainwindow.cpp
index f14549c31..9df8b9930 100644
--- a/tools/repocompare/mainwindow.cpp
+++ b/tools/repocompare/mainwindow.cpp
@@ -126,15 +126,15 @@ void MainWindow::displayRepositories()
item->setText(0, it.key());
item->setText(indexIncrement + 3, it.value().version);
- item->setText(indexIncrement + 4, it.value().releaseDate.toString("yyyy-MM-dd"));
+ item->setText(indexIncrement + 4, it.value().releaseDate.toString(QLatin1String("yyyy-MM-dd")));
item->setText(indexIncrement + 5, it.value().checksum);
item->setText(indexIncrement + 6, it.value().updateText);
if (i != 0) {
QString errorText;
if (manager.updateRequired(it.key(), &errorText))
- item->setText(1, "Yes");
+ item->setText(1, QLatin1String("Yes"));
else
- item->setText(1, "No");
+ item->setText(1, QLatin1String("No"));
item->setText(2, errorText);
}
}
@@ -143,7 +143,7 @@ void MainWindow::displayRepositories()
void MainWindow::createExportFile()
{
- QString fileName = QFileDialog::getSaveFileName(this, "Export File");
+ QString fileName = QFileDialog::getSaveFileName(this, QLatin1String("Export File"));
if (fileName.isEmpty())
return;
manager.writeUpdateFile(fileName);
diff --git a/tools/repocompare/repositorymanager.cpp b/tools/repocompare/repositorymanager.cpp
index 846fa26c3..a225cd66e 100644
--- a/tools/repocompare/repositorymanager.cpp
+++ b/tools/repocompare/repositorymanager.cpp
@@ -75,7 +75,7 @@ void RepositoryManager::setProductionRepository(const QString &repo)
{
QUrl url(repo);
if (!url.isValid()) {
- QMessageBox::critical(0, "Error", "Specified URL is not valid");
+ QMessageBox::critical(0, QLatin1String("Error"), QLatin1String("Specified URL is not valid"));
return;
}
@@ -87,7 +87,7 @@ void RepositoryManager::setUpdateRepository(const QString &repo)
{
QUrl url(repo);
if (!url.isValid()) {
- QMessageBox::critical(0, "Error", "Specified URL is not valid");
+ QMessageBox::critical(0, QLatin1String("Error"), QLatin1String("Specified URL is not valid"));
return;
}
@@ -117,7 +117,7 @@ void RepositoryManager::createRepositoryMap(const QByteArray &data, QMap<QString
while (!reader.atEnd()) {
QXmlStreamReader::TokenType type = reader.readNext();
if (type == QXmlStreamReader::StartElement) {
- if (reader.name() == "PackageUpdate") {
+ if (reader.name() == QLatin1String("PackageUpdate")) {
// new package
if (!currentItem.isEmpty())
map.insert(currentItem, currentDescription);
@@ -125,15 +125,16 @@ void RepositoryManager::createRepositoryMap(const QByteArray &data, QMap<QString
currentDescription.version.clear();
currentDescription.checksum.clear();
}
- if (reader.name() == "SHA1")
+ if (reader.name() == QLatin1String("SHA1"))
currentDescription.checksum = reader.readElementText();
- else if (reader.name() == "Version")
+ else if (reader.name() == QLatin1String("Version"))
currentDescription.version = reader.readElementText();
- else if (reader.name() == "ReleaseDate")
- currentDescription.releaseDate = QDate::fromString(reader.readElementText(), "yyyy-MM-dd");
- else if (reader.name() == "UpdateText")
+ else if (reader.name() == QLatin1String("ReleaseDate")) {
+ currentDescription.releaseDate = QDate::fromString(reader.readElementText(),
+ QLatin1String("yyyy-MM-dd"));
+ } else if (reader.name() == QLatin1String("UpdateText"))
currentDescription.updateText = reader.readElementText();
- else if (reader.name() == "Name")
+ else if (reader.name() == QLatin1String("Name"))
currentItem = reader.readElementText();
}
}
@@ -163,12 +164,16 @@ bool RepositoryManager::updateRequired(const QString &componentName, QString *me
const ComponentDescription &updateDescription = updateMap.value(componentName);
if (createVersionNumber(productionDescription.version) < createVersionNumber(updateDescription.version)) {
if (productionDescription.releaseDate > updateDescription.releaseDate) {
- if (message)
- *message = QString::fromLatin1("Error: Component %1 has wrong release date %2").arg(componentName).arg(updateDescription.releaseDate.toString());
+ if (message) {
+ *message = QString::fromLatin1("Error: Component %1 has wrong release date %2")
+ .arg(componentName).arg(updateDescription.releaseDate.toString());
+ }
return false;
} else if (productionDescription.updateText == updateDescription.updateText)
- if (message)
- *message = QString::fromLatin1("Warning: Component %1 has no new update text: %2").arg(componentName).arg(updateDescription.updateText);
+ if (message) {
+ *message = QString::fromLatin1("Warning: Component %1 has no new update text: %2")
+ .arg(componentName).arg(updateDescription.updateText);
+ }
if (message && message->isEmpty())
*message = QLatin1String("Ok");
return true;
@@ -180,14 +185,15 @@ void RepositoryManager::writeUpdateFile(const QString &fileName)
{
QFile file(fileName);
if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate)) {
- QMessageBox::critical(0, "Error", "Could not open File for saving");
+ QMessageBox::critical(0, QLatin1String("Error"), QLatin1String("Could not open File for saving"));
return;
}
QStringList items;
- for (QMap<QString, ComponentDescription>::const_iterator it = updateMap.begin(); it != updateMap.end(); ++it) {
- if (it.value().update)
- items.append(it.key());
+ for (QMap<QString, ComponentDescription>::const_iterator it = updateMap.begin(); it != updateMap.end();
+ ++it) {
+ if (it.value().update)
+ items.append(it.key());
}
file.write(items.join(QLatin1String(",")).toLatin1());
diff --git a/tools/repogenfromonlinerepo/downloadmanager.cpp b/tools/repogenfromonlinerepo/downloadmanager.cpp
index 61bf7ea88..b5dc0a0ac 100644
--- a/tools/repogenfromonlinerepo/downloadmanager.cpp
+++ b/tools/repogenfromonlinerepo/downloadmanager.cpp
@@ -77,15 +77,15 @@ QString DownloadManager::saveFileName(const QUrl &url)
QString basename = QFileInfo(path).fileName();
if (basename.isEmpty())
- basename = "download";
+ basename = QLatin1String("download");
if (QFile::exists(basename)) {
// already exists, rename the old one
int i = 0;
- while (QFile::exists(basename + ".old_" + QString::number(i)))
+ while (QFile::exists(basename + QLatin1String(".old_") + QString::number(i)))
++i;
- QFile::rename(basename, basename + ".old_" + QString::number(i));
+ QFile::rename(basename, basename + QLatin1String(".old_") + QString::number(i));
//basename += QString::number(i);
}
@@ -135,17 +135,16 @@ void DownloadManager::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
double speed = bytesReceived * 1000.0 / downloadTime.elapsed();
QString unit;
if (speed < 1024) {
- unit = "bytes/sec";
+ unit = QLatin1String("bytes/sec");
} else if (speed < 1024*1024) {
speed /= 1024;
- unit = "kB/s";
+ unit = QLatin1String("kB/s");
} else {
speed /= 1024*1024;
- unit = "MB/s";
+ unit = QLatin1String("MB/s");
}
- progressBar.setMessage(QString::fromLatin1("%1 %2")
- .arg(speed, 3, 'f', 1).arg(unit));
+ progressBar.setMessage(QString::fromLatin1("%1 %2").arg(speed, 3, 'f', 1).arg(unit));
progressBar.update();
}
diff --git a/tools/repogenfromonlinerepo/main.cpp b/tools/repogenfromonlinerepo/main.cpp
index 20b459ab9..9bda1a674 100644
--- a/tools/repogenfromonlinerepo/main.cpp
+++ b/tools/repogenfromonlinerepo/main.cpp
@@ -58,7 +58,8 @@ int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
- QString repoUrl = "http://www.forum.nokia.com/nokiaqtsdkrepository/oppdatering/windows/online_ndk_repo";
+ QString repoUrl = QLatin1String("http://www.forum.nokia.com/nokiaqtsdkrepository/oppdatering/windows/"
+ "online_ndk_repo");
QStringList args = app.arguments();
for( QStringList::const_iterator it = args.constBegin(); it != args.constEnd(); ++it )
@@ -85,12 +86,12 @@ int main(int argc, char *argv[])
DownloadManager downloadManager;
// get Updates.xml to get to know what we can download
- downloadManager.append(QUrl(repoUrl + "/Updates.xml"));
+ downloadManager.append(QUrl(repoUrl + QLatin1String("/Updates.xml")));
QObject::connect( &downloadManager, SIGNAL( finished() ), &downloadEventLoop, SLOT( quit() ) );
downloadEventLoop.exec();
// END - get Updates.xml to get to know what we can download
- QFile batchFile("download.bat");
+ QFile batchFile(QLatin1String("download.bat"));
if (!batchFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
qDebug() << "can not open " << QFileInfo(batchFile).absoluteFilePath();
return app.exec();
@@ -98,14 +99,15 @@ int main(int argc, char *argv[])
QTextStream batchFileOut(&batchFile);
- const QString updatesXmlPath = "Updates.xml";
+ const QString updatesXmlPath = QLatin1String("Updates.xml");
Q_ASSERT( !updatesXmlPath.isEmpty() );
Q_ASSERT( QFile::exists( updatesXmlPath ) );
QFile updatesFile( updatesXmlPath );
if ( !updatesFile.open( QIODevice::ReadOnly ) ) {
- //qDebug() << QString( "Could not open Updates.xml for reading: %1").arg( updatesFile.errorString() ) ;
+ //qDebug() << QString::fromLatin1("Could not open Updates.xml for reading: %1").arg( updatesFile
+ // .errorString() ) ;
return app.exec();
}
@@ -114,7 +116,8 @@ int main(int argc, char *argv[])
int line = 0;
int col = 0;
if ( !doc.setContent( &updatesFile, &err, &line, &col ) ) {
- //qDebug() << QString( "Could not parse component index: %1:%2: %3").arg( QString::number( line ), QString::number( col ), err );
+ //qDebug() << QString::fromLatin1("Could not parse component index: %1:%2: %3")
+ // .arg(QString::number(line), QString::number( col ), err );
return app.exec();
}
@@ -139,36 +142,38 @@ int main(int argc, char *argv[])
const QDomElement el = children.at( i ).toElement();
if ( el.isNull() )
continue;
- if ( el.tagName() == QString("PackageUpdate") ) {
+ if ( el.tagName() == QLatin1String("PackageUpdate") ) {
const QDomNodeList c2 = el.childNodes();
for ( int j = 0; j < c2.count(); ++j ) {
- if ( c2.at( j ).toElement().tagName() == QString("Name") )
+ if ( c2.at( j ).toElement().tagName() == QLatin1String("Name") )
packageName = c2.at( j ).toElement().text();
- else if ( c2.at( j ).toElement().tagName() == QString("DisplayName") )
+ else if ( c2.at( j ).toElement().tagName() == QLatin1String("DisplayName") )
packageDisplayName = c2.at( j ).toElement().text();
- else if ( c2.at( j ).toElement().tagName() == QString("Description") )
+ else if ( c2.at( j ).toElement().tagName() == QLatin1String("Description") )
packageDescription = c2.at( j ).toElement().text();
- else if ( c2.at( j ).toElement().tagName() == QString("UpdateText") )
+ else if ( c2.at( j ).toElement().tagName() == QLatin1String("UpdateText") )
packageUpdateText = c2.at( j ).toElement().text();
- else if ( c2.at( j ).toElement().tagName() == QString("Version") )
+ else if ( c2.at( j ).toElement().tagName() == QLatin1String("Version") )
packageVersion = c2.at( j ).toElement().text();
- else if ( c2.at( j ).toElement().tagName() == QString("ReleaseDate") )
+ else if ( c2.at( j ).toElement().tagName() == QLatin1String("ReleaseDate") )
packageReleaseDate = c2.at( j ).toElement().text();
- else if ( c2.at( j ).toElement().tagName() == QString("SHA1") )
+ else if ( c2.at( j ).toElement().tagName() == QLatin1String("SHA1") )
packageHash = c2.at( j ).toElement().text();
- else if ( c2.at( j ).toElement().tagName() == QString("UserInterfaces") )
+ else if ( c2.at( j ).toElement().tagName() == QLatin1String("UserInterfaces") )
packageUserinterfacesAsString = c2.at( j ).toElement().text();
- else if ( c2.at( j ).toElement().tagName() == QString("Script") )
+ else if ( c2.at( j ).toElement().tagName() == QLatin1String("Script") )
packageScript = c2.at( j ).toElement().text();
- else if ( c2.at( j ).toElement().tagName() == QString("Dependencies") )
+ else if ( c2.at( j ).toElement().tagName() == QLatin1String("Dependencies") )
packageDependencies = c2.at( j ).toElement().text();
- else if ( c2.at( j ).toElement().tagName() == QString("ForcedInstallation") )
+ else if ( c2.at( j ).toElement().tagName() == QLatin1String("ForcedInstallation") )
packageForcedInstallation = c2.at( j ).toElement().text();
- else if ( c2.at( j ).toElement().tagName() == QString("InstallPriority") )
+ else if ( c2.at( j ).toElement().tagName() == QLatin1String("InstallPriority") )
packageInstallPriority = c2.at( j ).toElement().text();
- else if ( c2.at( j ).toElement().tagName() == QString("Virtual") && c2.at( j ).toElement().text() == "true")
- packageIsVirtual = true;
+ else if ( c2.at( j ).toElement().tagName() == QLatin1String("Virtual") && c2.at( j )
+ .toElement().text() == QLatin1String("true")) {
+ packageIsVirtual = true;
+ }
}
}
if (packageName.isEmpty()) {
@@ -177,7 +182,8 @@ int main(int argc, char *argv[])
if ( !packageScript.isEmpty() ) {
// get Updates.xml to get to know what we can download
- downloadManager.append(QUrl(repoUrl + "/" + packageName + "/" + packageScript));
+ downloadManager.append(QUrl(repoUrl + QLatin1String("/") + packageName + QLatin1String("/")
+ + packageScript));
QObject::connect( &downloadManager, SIGNAL( finished() ), &downloadEventLoop, SLOT( quit() ) );
downloadEventLoop.exec();
// END - get Updates.xml to get to know what we can download
@@ -194,11 +200,11 @@ int main(int argc, char *argv[])
QTextStream in(&file);
while (!in.atEnd()) {
QString line = in.readLine();
- if(line.contains(".7z")) {
- int firstPosition = line.indexOf("\"");
+ if (line.contains(QLatin1String(".7z"))) {
+ int firstPosition = line.indexOf(QLatin1String("\""));
QString subString = line.right(line.count() - firstPosition - 1); //-1 means "
//qDebug() << subString;
- int secondPosition = subString.indexOf("\"");
+ int secondPosition = subString.indexOf(QLatin1String("\""));
sevenZString = subString.left(secondPosition);
//qDebug() << sevenZString;
break;
@@ -206,9 +212,9 @@ int main(int argc, char *argv[])
}
file.remove();
}
- QStringList packageUserinterfaces = packageUserinterfacesAsString.split(",");
+ QStringList packageUserinterfaces = packageUserinterfacesAsString.split(QLatin1String(","));
packageUserinterfaces.removeAll(QString());
- packageUserinterfaces.removeAll("");
+ packageUserinterfaces.removeAll(QLatin1String(""));
QStringList fileList;
@@ -225,55 +231,67 @@ int main(int argc, char *argv[])
fileList << packageScript;
}
- QFile packagesXml( QString( QCoreApplication::applicationDirPath() + "/" + packageName + ".xml" ));
+ QFile packagesXml( QString( QCoreApplication::applicationDirPath() + QLatin1String("/")
+ + packageName + QLatin1String(".xml")));
packagesXml.open( QIODevice::WriteOnly );
QTextStream packageAsXmlStream( &packagesXml );
- packageAsXmlStream << QString( "<?xml version=\"1.0\"?>" ) << endl;
- packageAsXmlStream << QString( "<Package>" ) << endl;
- packageAsXmlStream << QString( " <DisplayName>%1</DisplayName>" ).arg(packageDisplayName) << endl;
+ packageAsXmlStream << QLatin1String("<?xml version=\"1.0\"?>" ) << endl;
+ packageAsXmlStream << QLatin1String("<Package>" ) << endl;
+ packageAsXmlStream << QString::fromLatin1(" <DisplayName>%1</DisplayName>").arg(packageDisplayName)
+ << endl;
if (!packageDescription.isEmpty()) {
- packageAsXmlStream << QString( " <Description>%1</Description>" ).arg(packageDescription) << endl;
+ packageAsXmlStream << QString::fromLatin1(" <Description>%1</Description>" )
+ .arg(packageDescription) << endl;
}
if (!packageUpdateText.isEmpty()) {
- packageAsXmlStream << QString( " <UpdateText>%1</UpdateText>" ).arg(packageUpdateText) << endl;
+ packageAsXmlStream << QString::fromLatin1(" <UpdateText>%1</UpdateText>" )
+ .arg(packageUpdateText) << endl;
}
if (!packageVersion.isEmpty()) {
- packageAsXmlStream << QString( " <Version>%1</Version>" ).arg(packageVersion) << endl;
+ packageAsXmlStream << QString::fromLatin1(" <Version>%1</Version>" )
+ .arg(packageVersion) << endl;
}
if (!packageReleaseDate.isEmpty()) {
- packageAsXmlStream << QString( " <ReleaseDate>%1</ReleaseDate>" ).arg(packageReleaseDate) << endl;
+ packageAsXmlStream << QString::fromLatin1(" <ReleaseDate>%1</ReleaseDate>" )
+ .arg(packageReleaseDate) << endl;
}
- packageAsXmlStream << QString( " <Name>%1</Name>" ).arg(packageName) << endl;
+ packageAsXmlStream << QString::fromLatin1(" <Name>%1</Name>" ).arg(packageName) << endl;
if (!packageScript.isEmpty()) {
- packageAsXmlStream << QString( " <Script>%1</Script>" ).arg(packageScript) << endl;
+ packageAsXmlStream << QString::fromLatin1(" <Script>%1</Script>" ).arg(packageScript) << endl;
}
if (packageIsVirtual) {
- packageAsXmlStream << QString( " <Virtual>true</Virtual>" ) << endl;
+ packageAsXmlStream << QString::fromLatin1(" <Virtual>true</Virtual>" ) << endl;
}
- if (!packageInstallPriority.isEmpty())
- packageAsXmlStream << QString( " <InstallPriority>%1</InstallPriority>" ).arg(packageInstallPriority) << endl;
-
- if (!packageDependencies.isEmpty())
- packageAsXmlStream << QString( " <Dependencies>%1</Dependencies>" ).arg(packageDependencies) << endl;
+ if (!packageInstallPriority.isEmpty()) {
+ packageAsXmlStream << QString::fromLatin1(" <InstallPriority>%1</InstallPriority>" )
+ .arg(packageInstallPriority) << endl;
+ }
+ if (!packageDependencies.isEmpty()) {
+ packageAsXmlStream << QString::fromLatin1(" <Dependencies>%1</Dependencies>" )
+ .arg(packageDependencies) << endl;
+ }
- if (!packageForcedInstallation.isEmpty())
- packageAsXmlStream << QString( " <ForcedInstallation>%1</ForcedInstallation>" ).arg(packageForcedInstallation) << endl;
+ if (!packageForcedInstallation.isEmpty()) {
+ packageAsXmlStream << QString::fromLatin1(" <ForcedInstallation>%1</ForcedInstallation>" )
+ .arg(packageForcedInstallation) << endl;
+ }
if (!packageUserinterfaces.isEmpty()) {
- packageAsXmlStream << QString( " <UserInterfaces>" ) << endl;
+ packageAsXmlStream << QString::fromLatin1(" <UserInterfaces>" ) << endl;
foreach(const QString userInterfaceFile, packageUserinterfaces) {
- packageAsXmlStream << QString( " <UserInterface>%1</UserInterface>" ).arg(userInterfaceFile) << endl;
+ packageAsXmlStream << QString::fromLatin1(" <UserInterface>%1</UserInterface>" )
+ .arg(userInterfaceFile) << endl;
}
- packageAsXmlStream << QString( " </UserInterfaces>" ) << endl;
+ packageAsXmlStream << QString::fromLatin1(" </UserInterfaces>" ) << endl;
}
- packageAsXmlStream << QString( "</Package>" ) << endl;
+ packageAsXmlStream << QString::fromLatin1("</Package>" ) << endl;
batchFileOut << "rem download line BEGIN =============================================\n";
diff --git a/tools/repogenfromonlinerepo/repogenfromonlinerepo.pro b/tools/repogenfromonlinerepo/repogenfromonlinerepo.pro
index 63bb503a4..f34c58f08 100644
--- a/tools/repogenfromonlinerepo/repogenfromonlinerepo.pro
+++ b/tools/repogenfromonlinerepo/repogenfromonlinerepo.pro
@@ -1,16 +1,20 @@
-QT += core network xml
+TEMPLATE = app
+DEPENDPATH += . ..
+INCLUDEPATH += . ..
+TARGET = repogenfromonlinerepo
-QT -= gui
+include(../../installerfw.pri)
-TARGET = repogenfromonlinerepo
-CONFIG += console
-CONFIG -= app_bundle
+QT -= gui
+QT += xml network
-TEMPLATE = app
+CONFIG += console
+CONFIG -= app_bundle
+DESTDIR = $$IFW_APP_PATH
+SOURCES += main.cpp \
+ downloadmanager.cpp \
+ textprogressbar.cpp
-SOURCES += main.cpp
-HEADERS += downloadmanager.h
-SOURCES += downloadmanager.cpp
-HEADERS += textprogressbar.h
-SOURCES += textprogressbar.cpp
+HEADERS += downloadmanager.h \
+ textprogressbar.h