mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 15:45:46 +08:00
refs #404, and discussion https://dev.vatsim-germany.org/issues/404#note-8 * Changed CSimulatorSetup to use CNameVariantPairList as data. The old version was an hack and had to go, CNameVariantPairList would allow complex types in the future and can be already shown in the GUI. * CNameVariantPairList was improved slightly in the same step * Functions to get CSimulatorSetup from driver / context * Removed CSimulatorSetup data from CSimulatorPluginInfo
93 lines
2.9 KiB
C++
93 lines
2.9 KiB
C++
/* Copyright (C) 2013
|
|
* swift project Community / Contributors
|
|
*
|
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
|
* contained in the LICENSE file.
|
|
*/
|
|
|
|
#include "simulatorsetup.h"
|
|
|
|
namespace BlackMisc
|
|
{
|
|
namespace Simulation
|
|
{
|
|
void CSimulatorSetup::setValue(const QString &name, const QString &value)
|
|
{
|
|
this->m_data.addOrReplaceValue(name, value);
|
|
}
|
|
|
|
QString CSimulatorSetup::getStringValue(const QString &name) const
|
|
{
|
|
return m_data.getValueAsString(name);
|
|
}
|
|
|
|
void CSimulatorSetup::setSimulatorVersion(const QString versionInfo)
|
|
{
|
|
this->setValue("all/versionInfo", versionInfo);
|
|
}
|
|
|
|
void CSimulatorSetup::setSimulatorInstallationDirectory(const QString fullFilePath)
|
|
{
|
|
this->setValue("all/installDir", fullFilePath);
|
|
}
|
|
|
|
QString CSimulatorSetup::getSimulatorVersion() const
|
|
{
|
|
return this->getStringValue("all/versionInfo");
|
|
}
|
|
|
|
QString CSimulatorSetup::getSimulatorInstallationDirectory() const
|
|
{
|
|
return this->getStringValue("all/installDir");
|
|
}
|
|
|
|
void CSimulatorSetup::registerMetadata()
|
|
{
|
|
qRegisterMetaType<BlackMisc::Simulation::CSimulatorSetup>();
|
|
qDBusRegisterMetaType<BlackMisc::Simulation::CSimulatorSetup>();
|
|
registerMetaValueType<BlackMisc::Simulation::CSimulatorSetup>();
|
|
}
|
|
|
|
QString CSimulatorSetup::convertToQString(bool i18n) const
|
|
{
|
|
return m_data.toQString(i18n);
|
|
}
|
|
|
|
CVariant CSimulatorSetup::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
|
{
|
|
if (index.isMyself()) { return this->toCVariant(); }
|
|
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
|
switch (i)
|
|
{
|
|
case IndexData:
|
|
return m_data.toCVariant();
|
|
default:
|
|
return CValueObject::propertyByIndex(index);
|
|
}
|
|
}
|
|
|
|
void CSimulatorSetup::setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index)
|
|
{
|
|
if (index.isMyself())
|
|
{
|
|
this->convertFromCVariant(variant);
|
|
return;
|
|
}
|
|
|
|
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
|
switch (i)
|
|
{
|
|
case IndexData:
|
|
this->m_data.convertFromCVariant(variant.value<QString>());
|
|
break;
|
|
default:
|
|
CValueObject::setPropertyByIndex(variant, index);
|
|
break;
|
|
}
|
|
}
|
|
|
|
} // ns
|
|
} // ns
|