void PersistantConfig::applyValues(const QVariantMap &values) { #undef CONFIG_SETTING_VAL #undef CONFIG_SETTING #define CONFIG_SETTING_VAL(access, variantType, type, name, defaultValue) \ if(values.contains(lit(#name))) \ name = convertFromVariant<type>(values[lit(#name)].value<variantType>()); #define CONFIG_SETTING(access, variantType, type, name) \ if(values.contains(lit(#name))) \ name = convertFromVariant<type>(values[lit(#name)].value<variantType>()); CONFIG_SETTINGS() // backwards compatibility code, to apply old values. #define RENAMED_SETTING(variantType, oldName, newName) \ if(values.contains(lit(#oldName))) \ newName = convertFromVariant<decltype(newName)>(values[lit(#oldName)].value<variantType>()); RENAMED_SETTING(QString, LastLogPath, LastCaptureFilePath); RENAMED_SETTING(QVariantList, RecentLogFiles, RecentCaptureFiles); RENAMED_SETTING(QDateTime, DegradedLog_LastUpdate, DegradedCapture_LastUpdate); }
return ret; } void PersistantConfig::applyValues(const QVariantMap &values) { #undef CONFIG_SETTING_VAL #undef CONFIG_SETTING #define CONFIG_SETTING_VAL(access, variantType, type, name, defaultValue) \ if(values.contains(#name)) \ name = convertFromVariant<type>(values[#name].value<variantType>()); #define CONFIG_SETTING(access, variantType, type, name) \ if(values.contains(#name)) \ name = convertFromVariant<type>(values[#name].value<variantType>()); CONFIG_SETTINGS() } void PersistantConfig::SetupFormatting() { Formatter::setParams(Formatter_MinFigures, Formatter_MaxFigures, Formatter_NegExp, Formatter_PosExp); /* PreferredFont = Font_PreferMonospaced ? new System.Drawing.Font("Consolas", 9.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))) : new System.Drawing.Font("Tahoma", 8.25F); */ } void PersistantConfig::AddRecentFile(QList<QString> &recentList, const QString &file, int maxItems)