//------------------------------------------------------------------------------ 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; }
//------------------------------------------------------------------------------ void BibleQuoteModule::parseModule(QString pathToModule) { // myDebug() << "Parse module: " << pathToModule; MetaInfo parseInfo = readInfo(pathToModule); loadBibleData(1, pathToModule); // myDebug() << readInfo(pathToModule).name() << readInfo(pathToModule).shortName(); QDir d; d = QDir(QString(Config::configuration()->getDataPath() + GL_MODULE_PATH + "%1/" + parseInfo.shortName()).arg(m_typeModule.toLower())); if (!d.exists()) { // emit SIGNAL_CreateFolderForModule(parseInfo.shortName()); QDir dir; dir.mkpath(QString(Config::configuration()->getDataPath() + GL_MODULE_PATH + "%1/" + parseInfo.shortName()).arg(m_typeModule.toLower())); if (createIniFile(parseInfo)) { createBookFiles(pathToModule); if (!m_bibleType) { addToListBookModule(parseInfo.shortName()); } else { addToListBibleModule(parseInfo.shortName()); } } else { myWarning() << "this module is created"; } } else { // myDebug() << "This module is exist"; } }