mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
refs #618, own component for GUI own model handling
* moved to own component * ajdjusted last selections * some renaming such as getView() -> view()
This commit is contained in:
@@ -17,13 +17,13 @@ namespace BlackGui
|
||||
{
|
||||
namespace Data
|
||||
{
|
||||
QString CDbMappingComponent::convertToQString(bool i18n) const
|
||||
QString CDbOwnModelsComponent::convertToQString(bool i18n) const
|
||||
{
|
||||
QString s(this->m_simulator.toQString(i18n));
|
||||
return s;
|
||||
}
|
||||
|
||||
CVariant CDbMappingComponent::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
CVariant CDbOwnModelsComponent::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
@@ -36,9 +36,9 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CDbMappingComponent::setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index)
|
||||
void CDbOwnModelsComponent::setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CDbMappingComponent>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.to<CDbOwnModelsComponent>(); return; }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
@@ -51,7 +51,7 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
int CDbMappingComponent::comparePropertyByIndex(const CDbMappingComponent &compareValue, const CPropertyIndex &index) const
|
||||
int CDbOwnModelsComponent::comparePropertyByIndex(const CDbOwnModelsComponent &compareValue, const CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toQString().compare(compareValue.toQString()); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace BlackGui
|
||||
/*!
|
||||
* Store last selections/interactions with this component
|
||||
*/
|
||||
class BLACKGUI_EXPORT CDbMappingComponent : public BlackMisc::CValueObject<CDbMappingComponent>
|
||||
class BLACKGUI_EXPORT CDbOwnModelsComponent : public BlackMisc::CValueObject<CDbOwnModelsComponent>
|
||||
{
|
||||
public:
|
||||
//! Properties by index
|
||||
@@ -51,32 +51,32 @@ namespace BlackGui
|
||||
void setPropertyByIndex(const BlackMisc::CVariant &variant, const BlackMisc::CPropertyIndex &index);
|
||||
|
||||
//! Compare by index
|
||||
int comparePropertyByIndex(const CDbMappingComponent &compareValue, const BlackMisc::CPropertyIndex &index) const;
|
||||
int comparePropertyByIndex(const CDbOwnModelsComponent &compareValue, const BlackMisc::CPropertyIndex &index) const;
|
||||
|
||||
private:
|
||||
BLACK_ENABLE_TUPLE_CONVERSION(CDbMappingComponent)
|
||||
BLACK_ENABLE_TUPLE_CONVERSION(CDbOwnModelsComponent)
|
||||
BlackMisc::Simulation::CSimulatorInfo m_simulator; //!< Last simulator selection
|
||||
};
|
||||
|
||||
//! Trait for model cache
|
||||
struct DbMappingComponent : public BlackMisc::CDataTrait<CDbMappingComponent>
|
||||
struct DbOwnModelsComponent : public BlackMisc::CDataTrait<CDbOwnModelsComponent>
|
||||
{
|
||||
//! Default value
|
||||
static const CDbMappingComponent &defaultValue()
|
||||
static const CDbOwnModelsComponent &defaultValue()
|
||||
{
|
||||
static const CDbMappingComponent ls;
|
||||
static const CDbOwnModelsComponent ls;
|
||||
return ls;
|
||||
}
|
||||
|
||||
//! Key in data cache
|
||||
static const char *key() { return "dbmappingcomponent"; }
|
||||
static const char *key() { return "dbownmodelscomponent"; }
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
Q_DECLARE_METATYPE(BlackGui::Components::Data::CDbMappingComponent)
|
||||
BLACK_DECLARE_TUPLE_CONVERSION(BlackGui::Components::Data::CDbMappingComponent, (
|
||||
Q_DECLARE_METATYPE(BlackGui::Components::Data::CDbOwnModelsComponent)
|
||||
BLACK_DECLARE_TUPLE_CONVERSION(BlackGui::Components::Data::CDbOwnModelsComponent, (
|
||||
attr(o.m_simulator)
|
||||
))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user