diff options
Diffstat (limited to 'src/libs/installer/settings.cpp')
-rw-r--r-- | src/libs/installer/settings.cpp | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/src/libs/installer/settings.cpp b/src/libs/installer/settings.cpp index 7093a88a5..5389573fa 100644 --- a/src/libs/installer/settings.cpp +++ b/src/libs/installer/settings.cpp @@ -61,6 +61,7 @@ static const QLatin1String scRemoteRepositories("RemoteRepositories"); static const QLatin1String scDependsOnLocalInstallerBinary("DependsOnLocalInstallerBinary"); static const QLatin1String scTranslations("Translations"); static const QLatin1String scCreateLocalRepository("CreateLocalRepository"); +static const QLatin1String scInstallActionColumnVisible("InstallActionColumnVisible"); static const QLatin1String scFtpProxy("FtpProxy"); static const QLatin1String scHttpProxy("HttpProxy"); @@ -84,9 +85,10 @@ static void raiseError(QXmlStreamReader &reader, const QString &error, Settings: } else { QFile *xmlFile = qobject_cast<QFile*>(reader.device()); if (xmlFile) { - qWarning() << QString::fromLatin1("Ignoring following settings reader error in %1, line %2, " - "column %3: %4").arg(xmlFile->fileName()).arg(reader.lineNumber()).arg(reader.columnNumber()) - .arg(error); + qWarning().noquote().nospace() + << "Ignoring following settings reader error in " << xmlFile->fileName() + << ", line " << reader.lineNumber() << ", column " << reader.columnNumber() + << ": " << error; } else { qWarning("Ignoring following settings reader error: %s", qPrintable(error)); } @@ -102,7 +104,7 @@ static QStringList readArgumentAttributes(QXmlStreamReader &reader, Settings::Pa switch (token) { case QXmlStreamReader::StartElement: { if (!reader.attributes().isEmpty()) { - raiseError(reader, QString::fromLatin1("Unexpected attribute for element '%1'.") + raiseError(reader, QString::fromLatin1("Unexpected attribute for element \"%1\".") .arg(reader.name().toString()), parseMode); return arguments; } else { @@ -110,7 +112,7 @@ static QStringList readArgumentAttributes(QXmlStreamReader &reader, Settings::Pa (lc) ? arguments.append(reader.readElementText().toLower()) : arguments.append(reader.readElementText()); } else { - raiseError(reader, QString::fromLatin1("Unexpected element '%1'.").arg(reader.name() + raiseError(reader, QString::fromLatin1("Unexpected element \"%1\".").arg(reader.name() .toString()), parseMode); return arguments; } @@ -152,23 +154,23 @@ static QSet<Repository> readRepositories(QXmlStreamReader &reader, bool isDefaul } else if (reader.name() == QLatin1String("Enabled")) { repo.setEnabled(bool(reader.readElementText().toInt())); } else { - raiseError(reader, QString::fromLatin1("Unexpected element '%1'.").arg(reader.name() + raiseError(reader, QString::fromLatin1("Unexpected element \"%1\".").arg(reader.name() .toString()), parseMode); } if (!reader.attributes().isEmpty()) { - raiseError(reader, QString::fromLatin1("Unexpected attribute for element '%1'.") + raiseError(reader, QString::fromLatin1("Unexpected attribute for element \"%1\".") .arg(reader.name().toString()), parseMode); } } set.insert(repo); } else { - raiseError(reader, QString::fromLatin1("Unexpected element '%1'.").arg(reader.name().toString()), + raiseError(reader, QString::fromLatin1("Unexpected element \"%1\".").arg(reader.name().toString()), parseMode); } if (!reader.attributes().isEmpty()) { - raiseError(reader, QString::fromLatin1("Unexpected attribute for element '%1'.").arg(reader + raiseError(reader, QString::fromLatin1("Unexpected attribute for element \"%1\".").arg(reader .name().toString()), parseMode); } } @@ -235,12 +237,12 @@ Settings Settings::fromFileAndPrefix(const QString &path, const QString &prefix, file.setFileName(overrideConfig.fileName()); if (!file.open(QIODevice::ReadOnly)) - throw Error(tr("Could not open settings file %1 for reading: %2").arg(path, file.errorString())); + throw Error(tr("Cannot open settings file %1 for reading: %2").arg(path, file.errorString())); QXmlStreamReader reader(&file); if (reader.readNextStartElement()) { if (reader.name() != QLatin1String("Installer")) { - reader.raiseError(QString::fromLatin1("Unexpected element '%1' as root element.").arg(reader + reader.raiseError(QString::fromLatin1("Unexpected element \"%1\" as root element.").arg(reader .name().toString())); } } @@ -252,26 +254,26 @@ Settings Settings::fromFileAndPrefix(const QString &path, const QString &prefix, << scStartMenuDir << scMaintenanceToolName << scMaintenanceToolIniFile << scRemoveTargetDir << scRunProgram << scRunProgramArguments << scRunProgramDescription << scDependsOnLocalInstallerBinary - << scAllowSpaceInPath << scAllowNonAsciiCharacters << scWizardStyle << scTitleColor + << scAllowSpaceInPath << scAllowNonAsciiCharacters << scWizardStyle << scStyleSheet << scTitleColor << scWizardDefaultWidth << scWizardDefaultHeight << scRepositorySettingsPageVisible << scTargetConfigurationFile - << scRemoteRepositories << scTranslations << QLatin1String(scControlScript) - << scCreateLocalRepository; + << scRemoteRepositories << scTranslations << scUrlQueryString << QLatin1String(scControlScript) + << scCreateLocalRepository << scInstallActionColumnVisible; Settings s; s.d->m_data.insert(scPrefix, prefix); while (reader.readNextStartElement()) { const QString name = reader.name().toString(); if (!elementList.contains(name)) - raiseError(reader, QString::fromLatin1("Unexpected element '%1'.").arg(name), parseMode); + raiseError(reader, QString::fromLatin1("Unexpected element \"%1\".").arg(name), parseMode); if (!reader.attributes().isEmpty()) { - raiseError(reader, QString::fromLatin1("Unexpected attribute for element '%1'.").arg(name), + raiseError(reader, QString::fromLatin1("Unexpected attribute for element \"%1\".").arg(name), parseMode); } if (s.d->m_data.contains(name)) - reader.raiseError(QString::fromLatin1("Element '%1' has been defined before.").arg(name)); + reader.raiseError(QString::fromLatin1("Element \"%1\" has been defined before.").arg(name)); if (name == scTranslations) { s.setTranslations(readArgumentAttributes(reader, parseMode, QLatin1String("Translation"), true)); @@ -323,6 +325,8 @@ Settings Settings::fromFileAndPrefix(const QString &path, const QString &prefix, s.d->m_data.insert(scRepositorySettingsPageVisible, true); if (!s.d->m_data.contains(scCreateLocalRepository)) s.d->m_data.insert(scCreateLocalRepository, false); + if (!s.d->m_data.contains(scInstallActionColumnVisible)) + s.d->m_data.insert(scInstallActionColumnVisible, false); return s; } @@ -377,6 +381,11 @@ QString Settings::wizardStyle() const return d->m_data.value(scWizardStyle).toString(); } +QString Settings::styleSheet() const +{ + return d->absolutePathFromKey(scStyleSheet); +} + QString Settings::titleColor() const { return d->m_data.value(scTitleColor).toString(); @@ -477,6 +486,11 @@ bool Settings::createLocalRepository() const return d->m_data.value(scCreateLocalRepository).toBool(); } +bool Settings::installActionColumnVisible() const +{ + return d->m_data.value(scInstallActionColumnVisible, false).toBool(); +} + bool Settings::allowSpaceInPath() const { return d->m_data.value(scAllowSpaceInPath, true).toBool(); |