Commit 74896187 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

SettingsAccessorPrivate::bestSettings: Use Utils::FileName

also remove the const from that method.

Change-Id: I5df052d39595eac885e1dbdafd50ccec3e850ca8
Reviewed-by: default avatarDaniel Teske <>
parent b9338df4
......@@ -456,7 +456,7 @@ public:
return 0;
Settings bestSettings(const SettingsAccessor *accessor, const QStringList &candidates) const;
Settings bestSettings(const SettingsAccessor *accessor, const QList<Utils::FileName> &pathList);
QList<VersionUpgrader *> m_upgraders;
Utils::PersistentSettingsWriter *m_writer;
......@@ -744,20 +744,20 @@ bool SettingsAccessor::addVersionUpgrader(VersionUpgrader *upgrader)
/* Will always return the default name first */
QStringList SettingsAccessor::findSettingsFiles(const QString &suffix) const
QList<FileName> SettingsAccessor::findSettingsFiles(const QString &suffix) const
const QString defaultName = defaultFileName(suffix);
QDir projectDir = QDir(project()->projectDirectory().toString());
QStringList result;
QList<Utils::FileName> result;
if (QFileInfo(defaultName).exists())
result << defaultName;
result << Utils::FileName::fromString(defaultName);
QFileInfoList fiList = projectDir.entryInfoList(
QStringList(QFileInfo(defaultName).fileName() + QLatin1String("*")), QDir::Files);
foreach (const QFileInfo &fi, fiList) {
const QString path = fi.absoluteFilePath();
const Utils::FileName path = Utils::FileName::fromString(fi.absoluteFilePath());
if (!result.contains(path))
......@@ -813,7 +813,7 @@ void SettingsAccessor::backupUserFile() const
QVariantMap SettingsAccessor::readUserSettings(QWidget *parent) const
SettingsAccessorPrivate::Settings result;
QStringList fileList = findSettingsFiles(m_userSuffix);
QList<Utils::FileName> fileList = findSettingsFiles(m_userSuffix);
if (fileList.isEmpty()) // No settings found at all.
......@@ -908,14 +908,15 @@ QVariantMap SettingsAccessor::readSharedSettings(QWidget *parent) const
SettingsAccessorPrivate::Settings SettingsAccessorPrivate::bestSettings(const SettingsAccessor *accessor, const QStringList &candidates) const
SettingsAccessorPrivate::Settings SettingsAccessorPrivate::bestSettings(const SettingsAccessor *accessor,
const QList<Utils::FileName> &pathList)
Settings newestNonMatching;
Settings newestMatching;
Settings tmp;
foreach (const QString &file, candidates) {
tmp.path = FileName::fromString(file);
foreach (const Utils::FileName &file, pathList) {
tmp.path = file; = accessor->readFile(tmp.path);
if (
......@@ -71,7 +71,7 @@ protected:
virtual QVariantMap prepareSettings(const QVariantMap &data) const;
QStringList findSettingsFiles(const QString &suffix) const;
QList<Utils::FileName> findSettingsFiles(const QString &suffix) const;
static QByteArray creatorId();
QString defaultFileName(const QString &suffix) const;
void backupUserFile() const;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment