mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
Issue #77 All classes propertyindex methods use CPropertyIndexRef and QVariant
This commit is contained in:
@@ -24,21 +24,21 @@ namespace BlackGui
|
||||
return s.arg(boolToOnOff(this->showOnlyInRange()), boolToOnOff(this->showOnlyWithValidFrequency()));
|
||||
}
|
||||
|
||||
CVariant CAtcStationsSettings::propertyByIndex(const CPropertyIndex &index) const
|
||||
QVariant CAtcStationsSettings::propertyByIndex(CPropertyIndexRef index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexInRangeOnly: return CVariant::fromValue(m_showOnlyInRange);
|
||||
case IndexValidFrequencyOnly: return CVariant::fromValue(m_onlyWithValidFrequency);
|
||||
case IndexInRangeOnly: return QVariant::fromValue(m_showOnlyInRange);
|
||||
case IndexValidFrequencyOnly: return QVariant::fromValue(m_onlyWithValidFrequency);
|
||||
default: return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void CAtcStationsSettings::setPropertyByIndex(const CPropertyIndex &index, const BlackMisc::CVariant &variant)
|
||||
void CAtcStationsSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CAtcStationsSettings>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CAtcStationsSettings>(); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -49,10 +49,10 @@ namespace BlackGui
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant);
|
||||
void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant);
|
||||
|
||||
private:
|
||||
bool m_showOnlyInRange = true;
|
||||
|
||||
@@ -102,42 +102,42 @@ namespace BlackGui
|
||||
return s;
|
||||
}
|
||||
|
||||
CVariant CDockWidgetSettings::propertyByIndex(const CPropertyIndex &index) const
|
||||
QVariant CDockWidgetSettings::propertyByIndex(CPropertyIndexRef index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexFloatingMargins:
|
||||
return CVariant::fromValue(m_floatingMargins);
|
||||
return QVariant::fromValue(m_floatingMargins);
|
||||
case IndexFloatingFramelessMargins:
|
||||
return CVariant::fromValue(m_floatingFramelessMargins);
|
||||
return QVariant::fromValue(m_floatingFramelessMargins);
|
||||
case IndexDockedMargins:
|
||||
return CVariant::fromValue(m_dockedMargins);
|
||||
return QVariant::fromValue(m_dockedMargins);
|
||||
case IndexFrameless:
|
||||
return CVariant::fromValue(m_floating);
|
||||
return QVariant::fromValue(m_floating);
|
||||
case IndexFloating:
|
||||
return CVariant::fromValue(m_floating);
|
||||
return QVariant::fromValue(m_floating);
|
||||
default:
|
||||
return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void CDockWidgetSettings::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
void CDockWidgetSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CDockWidgetSettings>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CDockWidgetSettings>(); return; }
|
||||
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexFloatingMargins:
|
||||
m_floatingMargins = variant.toQString();
|
||||
m_floatingMargins = variant.toString();
|
||||
break;
|
||||
case IndexFloatingFramelessMargins:
|
||||
m_floatingFramelessMargins = variant.toQString();
|
||||
m_floatingFramelessMargins = variant.toString();
|
||||
break;
|
||||
case IndexDockedMargins:
|
||||
m_dockedMargins = variant.toQString();
|
||||
m_dockedMargins = variant.toString();
|
||||
break;
|
||||
case IndexFloating:
|
||||
m_floating = variant.toBool();
|
||||
|
||||
@@ -92,10 +92,10 @@ namespace BlackGui
|
||||
QString convertToQString(const QString &separator, bool i18n = false) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant);
|
||||
void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant);
|
||||
|
||||
private:
|
||||
QString m_floatingMargins {"0:0:0:0"}; //!< margins: when floating
|
||||
|
||||
@@ -50,29 +50,29 @@ namespace BlackGui
|
||||
return QStringLiteral("Widget style: %1").arg(this->m_widgetStyle);
|
||||
}
|
||||
|
||||
BlackMisc::CVariant CGeneralGuiSettings::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
QVariant CGeneralGuiSettings::propertyByIndex(BlackMisc::CPropertyIndexRef index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexWidgetStyle:
|
||||
return CVariant::fromValue(this->m_widgetStyle);
|
||||
return QVariant::fromValue(this->m_widgetStyle);
|
||||
case IndexPreferredSelection:
|
||||
return CVariant::fromValue(this->m_preferredSelection);
|
||||
return QVariant::fromValue(this->m_preferredSelection);
|
||||
default:
|
||||
return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void CGeneralGuiSettings::setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant)
|
||||
void CGeneralGuiSettings::setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CGeneralGuiSettings>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CGeneralGuiSettings>(); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexWidgetStyle:
|
||||
this->setWidgetStyle(variant.toQString());
|
||||
this->setWidgetStyle(variant.toString());
|
||||
break;
|
||||
case IndexPreferredSelection:
|
||||
this->m_preferredSelection = variant.toInt();
|
||||
|
||||
@@ -56,10 +56,10 @@ namespace BlackGui
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant);
|
||||
void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant);
|
||||
|
||||
private:
|
||||
QString m_widgetStyle { "Fusion" };
|
||||
|
||||
@@ -63,32 +63,32 @@ namespace BlackGui
|
||||
return s;
|
||||
}
|
||||
|
||||
CVariant CNavigatorSettings::propertyByIndex(const CPropertyIndex &index) const
|
||||
QVariant CNavigatorSettings::propertyByIndex(CPropertyIndexRef index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexMargins:
|
||||
return CVariant::fromValue(this->m_margins);
|
||||
return QVariant::fromValue(this->m_margins);
|
||||
case IndexFrameless:
|
||||
return CVariant::fromValue(this->isFramless());
|
||||
return QVariant::fromValue(this->isFramless());
|
||||
case IndexColumns:
|
||||
return CVariant::fromValue(this->m_columns);
|
||||
return QVariant::fromValue(this->m_columns);
|
||||
default:
|
||||
return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void CNavigatorSettings::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
void CNavigatorSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CNavigatorSettings>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CNavigatorSettings>(); return; }
|
||||
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexMargins:
|
||||
this->m_margins = variant.toQString();
|
||||
this->m_margins = variant.toString();
|
||||
break;
|
||||
case IndexColumns:
|
||||
this->m_columns = variant.toInt();
|
||||
|
||||
@@ -77,10 +77,10 @@ namespace BlackGui
|
||||
QString convertToQString(const QString &separator, bool i18n = false) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant);
|
||||
void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant);
|
||||
|
||||
private:
|
||||
QString m_margins {"0:0:0:0"}; //!< margins
|
||||
|
||||
@@ -84,27 +84,27 @@ namespace BlackGui
|
||||
);
|
||||
}
|
||||
|
||||
CVariant CTextMessageSettings::propertyByIndex(const CPropertyIndex &index) const
|
||||
QVariant CTextMessageSettings::propertyByIndex(CPropertyIndexRef index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexPopupAllMessages: return CVariant::fromValue(this->getPopupAllMessages());
|
||||
case IndexPopupFrequencyMessages: return CVariant::fromValue(this->popupFrequencyMessages());
|
||||
case IndexPopupPrivateMessages: return CVariant::fromValue(this->popupPrivateMessages());
|
||||
case IndexPopupSupervisorMessages: return CVariant::fromValue(this->popupSupervisorMessages());
|
||||
case IndexPopupSelcalMessages: return CVariant::fromValue(this->popupSelcalMessages());
|
||||
case IndexStyle: return CVariant::fromValue(this->getStyleSheet());
|
||||
case IndexLatestFirst: return CVariant::fromValue(this->isLatestFirst());
|
||||
case IndexFocus: return CVariant::fromValue(this->focusOverlayWindow());
|
||||
case IndexPopupAllMessages: return QVariant::fromValue(this->getPopupAllMessages());
|
||||
case IndexPopupFrequencyMessages: return QVariant::fromValue(this->popupFrequencyMessages());
|
||||
case IndexPopupPrivateMessages: return QVariant::fromValue(this->popupPrivateMessages());
|
||||
case IndexPopupSupervisorMessages: return QVariant::fromValue(this->popupSupervisorMessages());
|
||||
case IndexPopupSelcalMessages: return QVariant::fromValue(this->popupSelcalMessages());
|
||||
case IndexStyle: return QVariant::fromValue(this->getStyleSheet());
|
||||
case IndexLatestFirst: return QVariant::fromValue(this->isLatestFirst());
|
||||
case IndexFocus: return QVariant::fromValue(this->focusOverlayWindow());
|
||||
default: return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void CTextMessageSettings::setPropertyByIndex(const CPropertyIndex &index, const BlackMisc::CVariant &variant)
|
||||
void CTextMessageSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CTextMessageSettings>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CTextMessageSettings>(); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
@@ -115,7 +115,7 @@ namespace BlackGui
|
||||
case IndexPopupSelcalMessages: this->setPopupSelcalMessages(variant.toBool()); break;
|
||||
case IndexFocus: this->setFocusOverlayWindows(variant.toBool()); break;
|
||||
case IndexLatestFirst: this->setLatestFirst(variant.toBool()); break;
|
||||
case IndexStyle: this->setStyleSheet(variant.toQString()); break;
|
||||
case IndexStyle: this->setStyleSheet(variant.toString()); break;
|
||||
default: CValueObject::setPropertyByIndex(index, variant); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,10 +121,10 @@ namespace BlackGui
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant);
|
||||
void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant);
|
||||
|
||||
private:
|
||||
bool m_popupPrivateMessages = true;
|
||||
|
||||
@@ -49,28 +49,28 @@ namespace BlackGui
|
||||
.arg(m_updateUser.valueRounded(CTimeUnit::s(), 2)).arg(m_updateRendering.valueRounded(CTimeUnit::s(), 2));
|
||||
}
|
||||
|
||||
CVariant CViewUpdateSettings::propertyByIndex(const CPropertyIndex &index) const
|
||||
QVariant CViewUpdateSettings::propertyByIndex(CPropertyIndexRef index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexAircraft:
|
||||
return CVariant::fromValue(this->m_updateAircraft);
|
||||
return QVariant::fromValue(this->m_updateAircraft);
|
||||
case IndexAtc:
|
||||
return CVariant::fromValue(this->m_updateAtc);
|
||||
return QVariant::fromValue(this->m_updateAtc);
|
||||
case IndexRendering:
|
||||
return CVariant::fromValue(this->m_updateRendering);
|
||||
return QVariant::fromValue(this->m_updateRendering);
|
||||
case IndexUser:
|
||||
return CVariant::fromValue(this->m_updateUser);
|
||||
return QVariant::fromValue(this->m_updateUser);
|
||||
default:
|
||||
return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void CViewUpdateSettings::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
void CViewUpdateSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CViewUpdateSettings>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CViewUpdateSettings>(); return; }
|
||||
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
|
||||
@@ -76,10 +76,10 @@ namespace BlackGui
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant);
|
||||
void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant);
|
||||
|
||||
private:
|
||||
BlackMisc::PhysicalQuantities::CTime m_updateAtc {10.0, BlackMisc::PhysicalQuantities::CTimeUnit::s()};
|
||||
|
||||
@@ -323,7 +323,7 @@ namespace BlackGui
|
||||
QString CViewBaseNonTemplate::getRememberedLastJsonDirectory() const
|
||||
{
|
||||
const CDirectories directories = m_dirSettings.get();
|
||||
return directories.propertyByIndex(m_dirSettingsIndex).toQString();
|
||||
return directories.propertyByIndex(m_dirSettingsIndex).toString();
|
||||
}
|
||||
|
||||
Components::CTextEditDialog *CViewBaseNonTemplate::textEditDialog()
|
||||
@@ -590,7 +590,7 @@ namespace BlackGui
|
||||
}
|
||||
|
||||
// Save file path
|
||||
const QString dir = m_dirSettings.get().propertyByIndex(m_dirSettingsIndex).toQString();
|
||||
const QString dir = m_dirSettings.get().propertyByIndex(m_dirSettingsIndex).toString();
|
||||
QString name(m_saveFileName);
|
||||
if (name.isEmpty())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user