//------------------------------------------------------------------------------ bool BibleQuoteModule::createIniFile(MetaInfo info) { /// добавить обработку типа QString text = "////Module for QSopherim" "\nModuleName = " + info.name() + "\nModuleShortName = " + info.shortName() + "\nModuleLanguage = " + info.language + "\nBooksValue = " + m_bookCount + "\nModuleVerseSign = " + m_verseSign + "\nModuleChapterSign = " + m_chapterSign + "\nModuleChapterZero = " + m_chapterZero + "\nStrongNumber = " + m_strongOption + "\nTypeModule = " + m_typeModule; text.append(QString("\nPathToModule = %1/%2/module%3") .arg(m_typeModule.toLower()) .arg(info.shortName()) .arg(GL_FORMAT_MODULE)); text.append("\nBookList = "); for(int i = 0; i < m_bookList.size(); i++) { text.append(m_bookList.at(i) + "[*:*]"); } text.append("\nNumberChapter = "); for(int i = 0; i < m_bookList.size(); i++) { QString str = m_bookList.at(i) + "^" + QString::number(m_bookCountSize[i]) + GL_SYMBOL_SPLIT_CHAPTER ; text.append(str); } // myDebug() << m_bookPath; QString t_pathToIniFile = QString(QString(Config::configuration()->getDataPath() + GL_MODULE_PATH + "%1/" + info.shortName() + "/module" + GL_FORMAT_MODULE).arg(m_typeModule.toLower())); if (QFile::exists(t_pathToIniFile)) { QFile::remove(t_pathToIniFile); } QString r_str = QString(Config::configuration()->getDataPath() + GL_MODULE_PATH + "%1/" + info.shortName() + "/module" + GL_FORMAT_MODULE) .arg(m_typeModule.toLower()); return createEmpty(r_str, text); return false; }
MetaInfo ZefaniaLex::readInfo(const QString &name) { DEBUG_FUNC_NAME QFile file(name); int couldBe = 0;//1 = RMac QString uid = ""; QString type; ZefaniaXmlReader reader(name); MetaInfo info = reader.readMetaInfo(); //open the xml file if(!file.open(QFile::ReadOnly | QFile::Text)) return MetaInfo(); m_xml = new QXmlStreamReader(&file); if(m_xml->readNextStartElement()) { if(cmp(m_xml->name(), "dictionary")) { type = m_xml->attributes().value("type").toString(); if(type != "x-dictionary") { couldBe = -1;// do not scan the keys } while(m_xml->readNextStartElement()) { if(cmp(m_xml->name(), "item")) { const QString key = m_xml->attributes().value("id").toString(); if(couldBe == 0) { if(key.toUpper() == "A-APF" || key.toUpper() == "X-NSN" || key.toUpper() == "V-PAP-DPN") {//todo: speed couldBe = 1; } } else { break; } } else { m_xml->skipCurrentElement(); } } } } if(info.name().isEmpty() && !info.subject.isEmpty()) { info.setName(info.subject); } info.setUID(uid); if(type == "x-strong") { info.setDefaultModule(ModuleTools::DefaultStrongDictModule); info.setContent(ModuleTools::StrongsContent); } else if(type == "x-dictionary") { if(couldBe == 1) { info.setDefaultModule(ModuleTools::DefaultRMACDictModule); info.setContent(ModuleTools::RMACContent); } else { info.setDefaultModule(ModuleTools::DefaultDictModule); info.setContent(ModuleTools::DictionaryContent); } } file.close(); delete m_xml; m_xml = nullptr; return info; }