forked from qt-creator/qt-creator
Utils: Add Aspects::volatileToMap
Change-Id: Ic4b77e27570485864cb4a9a412d685c400a9e7d1 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -136,6 +136,11 @@ void BaseAspect::setId(Id id)
|
||||
d->m_id = id;
|
||||
}
|
||||
|
||||
QVariant BaseAspect::volatileVariantValue() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
QVariant BaseAspect::variantValue() const
|
||||
{
|
||||
return {};
|
||||
@@ -601,6 +606,16 @@ void BaseAspect::toMap(Store &map) const
|
||||
saveToMap(map, toSettingsValue(variantValue()), toSettingsValue(defaultVariantValue()), settingsKey());
|
||||
}
|
||||
|
||||
void BaseAspect::volatileToMap(Store &map) const
|
||||
{
|
||||
if (settingsKey().isEmpty())
|
||||
return;
|
||||
saveToMap(map,
|
||||
toSettingsValue(volatileVariantValue()),
|
||||
toSettingsValue(defaultVariantValue()),
|
||||
settingsKey());
|
||||
}
|
||||
|
||||
void BaseAspect::readSettings()
|
||||
{
|
||||
if (settingsKey().isEmpty())
|
||||
@@ -704,6 +719,12 @@ public:
|
||||
m_checked->toMap(map);
|
||||
}
|
||||
|
||||
void volatileToMap(Store &map)
|
||||
{
|
||||
if (m_checked)
|
||||
m_checked->volatileToMap(map);
|
||||
}
|
||||
|
||||
template<class Widget>
|
||||
void updateWidgetFromCheckStatus(BaseAspect *aspect, Widget *w)
|
||||
{
|
||||
@@ -937,6 +958,12 @@ void StringAspect::toMap(Store &map) const
|
||||
d->m_checkerImpl.toMap(map);
|
||||
}
|
||||
|
||||
void StringAspect::volatileToMap(Store &map) const
|
||||
{
|
||||
saveToMap(map, volatileValue(), defaultValue(), settingsKey());
|
||||
d->m_checkerImpl.volatileToMap(map);
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
@@ -1457,6 +1484,12 @@ void FilePathAspect::toMap(Store &map) const
|
||||
d->m_checkerImpl.toMap(map);
|
||||
}
|
||||
|
||||
void FilePathAspect::volatileToMap(Store &map) const
|
||||
{
|
||||
saveToMap(map, volatileValue(), defaultValue(), settingsKey());
|
||||
d->m_checkerImpl.volatileToMap(map);
|
||||
}
|
||||
|
||||
void FilePathAspect::setPromptDialogFilter(const QString &filter)
|
||||
{
|
||||
d->m_prompDialogFilter = filter;
|
||||
@@ -2530,6 +2563,12 @@ void AspectContainer::toMap(Store &map) const
|
||||
aspect->toMap(map);
|
||||
}
|
||||
|
||||
void AspectContainer::volatileToMap(Store &map) const
|
||||
{
|
||||
for (BaseAspect *aspect : std::as_const(d->m_items))
|
||||
aspect->volatileToMap(map);
|
||||
}
|
||||
|
||||
void AspectContainer::readSettings()
|
||||
{
|
||||
const SettingsGroupNester nester(d->m_settingsGroup);
|
||||
|
@@ -56,6 +56,7 @@ public:
|
||||
|
||||
enum Announcement { DoEmit, BeQuiet };
|
||||
|
||||
virtual QVariant volatileVariantValue() const;
|
||||
virtual QVariant variantValue() const;
|
||||
virtual void setVariantValue(const QVariant &value, Announcement = DoEmit);
|
||||
|
||||
@@ -104,6 +105,7 @@ public:
|
||||
virtual void fromMap(const Store &map);
|
||||
virtual void toMap(Store &map) const;
|
||||
virtual void toActiveMap(Store &map) const { toMap(map); }
|
||||
virtual void volatileToMap(Store &map) const;
|
||||
|
||||
virtual void addToLayout(Layouting::LayoutItem &parent);
|
||||
|
||||
@@ -329,6 +331,11 @@ protected:
|
||||
return QVariant::fromValue<ValueType>(m_internal);
|
||||
}
|
||||
|
||||
QVariant volatileVariantValue() const override
|
||||
{
|
||||
return QVariant::fromValue<ValueType>(m_buffer);
|
||||
}
|
||||
|
||||
void setVariantValue(const QVariant &value, Announcement howToAnnounce = DoEmit) override
|
||||
{
|
||||
setValue(value.value<ValueType>(), howToAnnounce);
|
||||
@@ -560,6 +567,7 @@ public:
|
||||
|
||||
void fromMap(const Utils::Store &map) override;
|
||||
void toMap(Utils::Store &map) const override;
|
||||
void volatileToMap(Utils::Store &map) const override;
|
||||
|
||||
signals:
|
||||
void validChanged(bool validState);
|
||||
@@ -629,6 +637,7 @@ public:
|
||||
|
||||
void fromMap(const Utils::Store &map) override;
|
||||
void toMap(Utils::Store &map) const override;
|
||||
void volatileToMap(Utils::Store &map) const override;
|
||||
|
||||
signals:
|
||||
void validChanged(bool validState);
|
||||
@@ -834,6 +843,7 @@ public:
|
||||
|
||||
void fromMap(const Utils::Store &map) override;
|
||||
void toMap(Utils::Store &map) const override;
|
||||
void volatileToMap(Utils::Store &map) const override;
|
||||
|
||||
void readSettings() override;
|
||||
void writeSettings() const override;
|
||||
|
Reference in New Issue
Block a user