forked from qt-creator/qt-creator
Utils: Make aspect settings access implicit
Generally, aspects should use fromMap/toMap, but some older pages
use {from,to}Settings with always the same ICore::settings().
To make that less intrusive on the user code side, make that globally
implicit.
Task-number: QTCREATORBUG-29167
Change-Id: I29a8e23a31eb8061bb143e93931a07c6741eb7f9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -486,9 +486,10 @@ const char sourcePathMappingArrayNameC[] = "SourcePathMappings";
|
||||
const char sourcePathMappingSourceKeyC[] = "Source";
|
||||
const char sourcePathMappingTargetKeyC[] = "Target";
|
||||
|
||||
void SourcePathMapAspect::writeSettings(QSettings *s) const
|
||||
void SourcePathMapAspect::writeSettings() const
|
||||
{
|
||||
const SourcePathMap sourcePathMap = value();
|
||||
QSettings *s = settings();
|
||||
s->beginWriteArray(sourcePathMappingArrayNameC);
|
||||
if (!sourcePathMap.isEmpty()) {
|
||||
const QString sourcePathMappingSourceKey(sourcePathMappingSourceKeyC);
|
||||
@@ -505,10 +506,9 @@ void SourcePathMapAspect::writeSettings(QSettings *s) const
|
||||
s->endArray();
|
||||
}
|
||||
|
||||
void SourcePathMapAspect::readSettings(const QSettings *settings)
|
||||
void SourcePathMapAspect::readSettings()
|
||||
{
|
||||
// Eeks. But legitimate, this operates on ICore::settings();
|
||||
QSettings *s = const_cast<QSettings *>(settings);
|
||||
QSettings *s = settings();
|
||||
SourcePathMap sourcePathMap;
|
||||
if (const int count = s->beginReadArray(sourcePathMappingArrayNameC)) {
|
||||
const QString sourcePathMappingSourceKey(sourcePathMappingSourceKeyC);
|
||||
|
||||
Reference in New Issue
Block a user