bool MUtils::Translation::insert(const QString &langId, const QString &qmFile, const QString &langName, const quint32 &systemId, const quint32 &country) { QWriteLocker writeLockTranslations(&g_translation_lock); const QString key = langId.simplified().toLower(); if(key.isEmpty() || qmFile.isEmpty() || langName.isEmpty() || (systemId < 1)) { return false; } if(g_translation_data.isNull()) { g_translation_data.reset(new translation_store_t()); } if(g_translation_data->contains(key)) { qWarning("Translation store already contains entry for '%s', going to replace!", MUTILS_UTF8(key)); } g_translation_data->insert(key, MAKE_ENTRY(langName, qmFile, systemId, country)); return true; }
/* * Register tool */ void lamexp_tools_register(const QString &toolName, LockedFile *const file, const quint32 &version, const QString &tag) { QWriteLocker writeLock(&g_lamexp_tools_lock); if(!file) { MUTILS_THROW("lamexp_register_tool: Tool file must not be NULL!"); } if(g_lamexp_tools_data.isNull()) { g_lamexp_tools_data.reset(new tool_hash_t()); atexit(lamexp_tools_clean_up); } const QString key = toolName.simplified().toLower(); if(g_lamexp_tools_data->contains(key)) { MUTILS_THROW("lamexp_register_tool: Tool is already registered!"); } g_lamexp_tools_data->insert(key, MAKE_ENTRY(file, version, tag)); }