From 755c99df3ccd14db12a550f5e38e429f48909935 Mon Sep 17 00:00:00 2001
From: pvdk
The OpenMW Wizard successfully installed Morrowind on your computer.
\Click Finish to close the Wizard.
")); diff --git a/apps/wizard/existinginstallationpage.cpp b/apps/wizard/existinginstallationpage.cpp index 34e771e3d7..f0f5c8573e 100644 --- a/apps/wizard/existinginstallationpage.cpp +++ b/apps/wizard/existinginstallationpage.cpp @@ -82,7 +82,7 @@ bool Wizard::ExistingInstallationPage::validatePage() // It can be missing entirely // Or failed to be detected due to the target being a symlink - QString path(field("installation.path").toString()); + QString path(field(QLatin1String("installation.path")).toString()); QFile file(mWizard->mInstallations[path]->iniPath); if (!file.exists()) { @@ -131,7 +131,7 @@ bool Wizard::ExistingInstallationPage::isComplete() const int Wizard::ExistingInstallationPage::nextId() const { - QString path(field("installation.path").toString()); + QString path(field(QLatin1String("installation.path")).toString()); if (path.isEmpty()) return MainWizard::Page_LanguageSelection; diff --git a/apps/wizard/inisettings.cpp b/apps/wizard/inisettings.cpp index f34699742b..a2c2556844 100644 --- a/apps/wizard/inisettings.cpp +++ b/apps/wizard/inisettings.cpp @@ -131,30 +131,20 @@ bool Wizard::IniSettings::writeFile(const QString &path, QTextStream &stream) int index = buffer.lastIndexOf(section); if (index != -1) { - // Append the new keys to the bottom of the section + // Look for the next section index = buffer.indexOf(QLatin1Char('['), index + 1); - if (index == -1 ) - { - // Beginning of next section not found, we are at the last section - if (buffer.lastIndexOf(QLatin1String("\n")) > (buffer.lastIndexOf(section) + section.length())) { - // There is a newline after the section - index = buffer.lastIndexOf(QLatin1String("\n")) - 1; - buffer.insert(index - 2, QString("\n%1=%2").arg(key, i.value().toString())); - mSettings.remove(i.key()); - continue; - } else { - // No newline found, or the last newline is before the last section - // Append the key to the bottom of the file - buffer.append(QString("\n%1=%2").arg(key, i.value().toString())); - mSettings.remove(i.key()); - continue; - } + if (index == -1 ) { + // We are at the last section, append it to the bottom of the file + buffer.append(QString("\n%1=%2").arg(key, i.value().toString())); + mSettings.remove(i.key()); + continue; + } else { + // Not at last section, add the key at the index + buffer.insert(index - 1, QString("\n%1=%2").arg(key, i.value().toString())); + mSettings.remove(i.key()); } - // Add the key at the index - buffer.insert(index - 1, QString("\n%1=%2").arg(key, i.value().toString())); - mSettings.remove(i.key()); } else { // Add the section to the end of the file, because it's not found buffer.append(QString("\n%1\n").arg(section)); diff --git a/apps/wizard/installationpage.cpp b/apps/wizard/installationpage.cpp index 05d1b4af84..774e02f3c5 100644 --- a/apps/wizard/installationpage.cpp +++ b/apps/wizard/installationpage.cpp @@ -20,8 +20,8 @@ Wizard::InstallationPage::InstallationPage(MainWizard *wizard) : void Wizard::InstallationPage::initializePage() { - QString path(field("installation.path").toString()); - QStringList components(field("installation.components").toStringList()); + QString path(field(QLatin1String("installation.path")).toString()); + QStringList components(field(QLatin1String("installation.components")).toStringList()); logTextEdit->appendPlainText(QString("Installing to %1").arg(path)); logTextEdit->appendPlainText(QString("Installing %1.").arg(components.join(", "))); @@ -32,7 +32,7 @@ void Wizard::InstallationPage::initializePage() // That way installing all three components would yield 300% // When one component is done the bar will be filled by 33% - if (field("installation.new").toBool() == true) { + if (field(QLatin1String("installation.new")).toBool() == true) { installProgressBar->setMaximum((components.count() * 100)); } else { if (components.contains(QLatin1String("Tribunal")) @@ -49,8 +49,8 @@ void Wizard::InstallationPage::initializePage() void Wizard::InstallationPage::startInstallation() { - QStringList components(field("installation.components").toStringList()); - QString path(field("installation.path").toString()); + QStringList components(field(QLatin1String("installation.components")).toStringList()); + QString path(field(QLatin1String("installation.path")).toString()); QThread *thread = new QThread(); mUnshield = new UnshieldWorker(); @@ -86,7 +86,7 @@ void Wizard::InstallationPage::startInstallation() connect(mUnshield, SIGNAL(requestFileDialog(Wizard::Component)), this, SLOT(showFileDialog(Wizard::Component)), Qt::QueuedConnection); - if (field("installation.new").toBool() == true) + if (field(QLatin1String("installation.new")).toBool() == true) { // Always install Morrowind mUnshield->setInstallComponent(Wizard::Component_Morrowind, true); @@ -117,7 +117,7 @@ void Wizard::InstallationPage::startInstallation() mUnshield->setPath(path); // Set the right codec to use for Morrowind.ini - QString language(field("installation.language").toString()); + QString language(field(QLatin1String("installation.language")).toString()); if (language == QLatin1String("Polish")) { mUnshield->setIniCodec(QTextCodec::codecForName("windows-1250")); diff --git a/apps/wizard/installationtargetpage.cpp b/apps/wizard/installationtargetpage.cpp index daf2c08467..521dc2ceaa 100644 --- a/apps/wizard/installationtargetpage.cpp +++ b/apps/wizard/installationtargetpage.cpp @@ -27,7 +27,7 @@ void Wizard::InstallationTargetPage::initializePage() bool Wizard::InstallationTargetPage::validatePage() { - QString path(field("installation.path").toString()); + QString path(field(QLatin1String("installation.path")).toString()); qDebug() << "Validating path: " << path; diff --git a/apps/wizard/methodselectionpage.cpp b/apps/wizard/methodselectionpage.cpp index 6db0779a6a..b1483ac3a5 100644 --- a/apps/wizard/methodselectionpage.cpp +++ b/apps/wizard/methodselectionpage.cpp @@ -8,12 +8,12 @@ Wizard::MethodSelectionPage::MethodSelectionPage(MainWizard *wizard) : { setupUi(this); - registerField("installation.new", newLocationRadioButton); + registerField(QLatin1String("installation.new"), newLocationRadioButton); } int Wizard::MethodSelectionPage::nextId() const { - if (field("installation.new").toBool() == true) { + if (field(QLatin1String("installation.new")).toBool() == true) { return MainWizard::Page_InstallationTarget; } else { return MainWizard::Page_ExistingInstallation;