/* 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 "blackmisc/dbus.h" #include "blackmisc/simulation/simulatorinternals.h" #include #include namespace BlackMisc { namespace Simulation { void CSimulatorInternals::setValue(const QString &name, const QString &value) { this->m_data.addOrReplaceValue(name, value); } CVariant CSimulatorInternals::getVariantValue(const QString &name) const { return m_data.getVariantValue(name); } QString CSimulatorInternals::getStringValue(const QString &name) const { return m_data.getValueAsString(name); } QStringList CSimulatorInternals::getSortedNames() const { return m_data.getNames(true); } void CSimulatorInternals::setSimulatorVersion(const QString versionInfo) { this->setValue("all/versionInfo", versionInfo); } void CSimulatorInternals::setSimulatorInstallationDirectory(const QString fullFilePath) { this->setValue("all/installDir", fullFilePath); } QString CSimulatorInternals::getSimulatorName() const { return this->getStringValue("all/simulatorName"); } void CSimulatorInternals::setSimulatorName(const QString &name) { this->setValue("all/simulatorName", name); } QString CSimulatorInternals::getSimulatorVersion() const { return this->getStringValue("all/versionInfo"); } QString CSimulatorInternals::getSimulatorInstallationDirectory() const { return this->getStringValue("all/installDir"); } void CSimulatorInternals::registerMetadata() { qRegisterMetaType(); qDBusRegisterMetaType(); registerMetaValueType(); } QString CSimulatorInternals::convertToQString(bool i18n) const { return m_data.toQString(i18n); } CVariant CSimulatorInternals::propertyByIndex(const BlackMisc::CPropertyIndex &index) const { if (index.isMyself()) { return CVariant::from(*this); } ColumnIndex i = index.frontCasted(); switch (i) { case IndexData: return CVariant::from(m_data); default: return CValueObject::propertyByIndex(index); } } void CSimulatorInternals::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) { if (index.isMyself()) { (*this) = variant.to(); return; } ColumnIndex i = index.frontCasted(); switch (i) { case IndexData: this->m_data = variant.to(); break; default: CValueObject::setPropertyByIndex(index, variant); break; } } } // ns } // ns