#include "nmPebiResultPropertyDisplayText.h" #include "nmPebiResultPropertyCatalog.h" #include #include namespace { /* Qt 4.8 的 lupdate 无法追踪运行时 Catalog 字符串,必须显式登记。 */ static const char* const s_pPropertyTranslationMarkers[] = { QT_TRANSLATE_NOOP("nmPebiResultProperty", "Permeability"), QT_TRANSLATE_NOOP("nmPebiResultProperty", "Porosity"), QT_TRANSLATE_NOOP("nmPebiResultProperty", "Thickness"), QT_TRANSLATE_NOOP("nmPebiResultProperty", "Pressure") }; } QString nmPebiResultPropertyDisplayText::getDisplayName( const QString& sPropertyId) { Q_UNUSED(s_pPropertyTranslationMarkers); nmPebiResultPropertyDescriptor oDescriptor; if(!nmPebiResultPropertyCatalog::findDescriptor( sPropertyId, oDescriptor)) { return QString(); } const QByteArray baSourceText = oDescriptor.m_sDisplayNameSourceText.toLatin1(); return QCoreApplication::translate( "nmPebiResultProperty", baSourceText.constData()); } QString nmPebiResultPropertyDisplayText::getDefaultDisplayUnit( const QString& sPropertyId) { nmPebiResultPropertyDescriptor oDescriptor; return nmPebiResultPropertyCatalog::findDescriptor( sPropertyId, oDescriptor) ? oDescriptor.m_sDefaultDisplayUnit : QString(); }