/** * @brief Commentary::readStart shows the "Welcome" screen * @param moduleID if moduleID == ModuleIDNotSet then it loads the current module start screen * @return Response */ Response* Commentary::readStart(int moduleID) { if(!loaded()) { if(moduleID == ModuleIDNotSet) moduleID = m_moduleID; loadModuleData(moduleID); } if(!loaded()) { myWarning() << "failed reading because module not loaded"; return nullptr; } return m_commentaryModule->readStart(); }
Response* Commentary::readRanges(const Ranges &ranges, bool ignoreModuleID) { Range r = ranges.getList().first(); if(!loaded() || (m_moduleID != r.moduleID() && !ignoreModuleID)) {//nothing loaded here yet loadModuleData(r.moduleID()); } if(!loaded()) { myWarning() << "failed reading because module not laoded"; return nullptr; } CompiledRange range = this->toCompiledRange(r); if(r.endVerse() == RangeEnum::NoneVerse || r.startVerse() == RangeEnum::NoneVerse) { return m_commentaryModule->readChapter(range.bookID, range.chapterID); } else if(r.chapter() == RangeEnum::NoneChapter) { return m_commentaryModule->readBook(range.bookID); } else { return m_commentaryModule->readVerseRange(range.bookID, range.chapterID, range.startVerse, range.endVerse); } }
/** * Init the ModuleDockWidget. Init proxyModel and selectionModel. */ void ModuleDockWidget::init() { ui->treeView_module->clearSelection(); if(m_proxyModel != NULL) { m_proxyModel->deleteLater(); m_proxyModel = NULL; } if(m_selectionModel != NULL) { m_selectionModel->deleteLater(); m_selectionModel = NULL; } m_moduleID = -1; ModuleModel model(this); model.setShowAll(true); model.setSettings(m_settings); model.generate(); m_proxyModel = new RecursivProxyModel(this); m_proxyModel->setSourceModel(model.itemModel()); m_proxyModel->setHeaderData(0, Qt::Horizontal, tr("Module")); m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); m_selectionModel = new QItemSelectionModel(m_proxyModel); connect(ui->lineEdit_filter, SIGNAL(textChanged(QString)), this, SLOT(filter(QString))); connect(ui->treeView_module, SIGNAL(activated(QModelIndex)), this, SLOT(loadModuleData(QModelIndex))); connect(ui->treeView_module, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint))); ui->treeView_module->setSortingEnabled(true); ui->treeView_module->setModel(m_proxyModel); ui->treeView_module->setSelectionModel(m_selectionModel); m_proxyModel->sort(0); connect(m_actions, SIGNAL(_setCurrentModule(int)), this, SLOT(loadedModule(int))); connect(m_actions, SIGNAL(_moduleChanged(int)), this, SLOT(moduleChanged(int))); }
void ModuleDockWidget::openInNewTab() { loadModuleData(ui->treeView_module->indexAt(m_point), Actions::OpenInNewWindow); }
void ModuleDockWidget::open() { loadModuleData(ui->treeView_module->indexAt(m_point)); }