StrongsResultList::StrongsResultList(const CSwordModuleInfo *module, const sword::ListKey & result, const QString &strongsNumber) { using namespace Rendering; int count = result.getCount(); if (!count) return; CTextRendering::KeyTreeItem::Settings settings; BtConstModuleList modules; modules.append(module); clear(); // for whatever reason the text "Parsing...translations." does not appear. // this is not critical but the text is necessary to get the dialog box // to be wide enough. QProgressDialog progress(QObject::tr("Parsing Strong's Numbers"), 0, 0, count); //0, "progressDialog", tr("Parsing Strong's Numbers"), tr("Parsing Strong's numbers for translations."), true); //progress->setAllowCancel(false); //progress->setMinimumDuration(0); progress.show(); progress.raise(); qApp->processEvents(QEventLoop::AllEvents, 1); //1 ms only for (int index = 0; index < count; index++) { progress.setValue(index); qApp->processEvents(QEventLoop::AllEvents, 1); //1 ms only QString key = QString::fromUtf8(result.getElement(index)->getText()); QString text = CDisplayRendering().renderSingleKey(key, modules, settings); for (int sIndex = 0;;) { continueloop: QString rText = getStrongsNumberText(text, sIndex, strongsNumber); if (rText.isEmpty()) break; for (iterator it = begin(); it != end(); ++it) { if ((*it).keyText() == rText) { (*it).addKeyName(key); goto continueloop; // break, then continue } } append(StrongsResult(rText, key)); } } }
/** Setups the list with the given module. */ void BtSearchInterface::setupReferenceModel(const CSwordModuleInfo *m, const sword::ListKey & results) { QHash<int, QByteArray> roleNames; roleNames[TextRole] = "text"; roleNames[ValueRole] = "value"; m_referencesModel.setRoleNames(roleNames); m_referencesModel.clear(); if (!m) return; const int count = results.getCount(); if (!count) return; for (int index = 0; index < count; index++) { QString reference = QString::fromUtf8(results.getElement(index)->getText()); QStandardItem* item = new QStandardItem(); item->setData(reference, TextRole); item->setData(reference, ValueRole); m_referencesModel.appendRow(item); } referencesModelChanged(); }