void PhysiomeModelRepositoryWindowWidget::initialize(const PhysiomeModelRepositoryWindowExposures &pExposures, const QString &pErrorMessage, const bool &pInternetConnectionAvailable) { // Initialise / keep track of some properties mExposureNames = QStringList(); mExposureDisplayed = QBoolList(); mExposureUrlId = QMap<QString, int>(); mErrorMessage = pErrorMessage; mInternetConnectionAvailable = pInternetConnectionAvailable; // Initialise our list of exposures QWebElement tbodyElement = page()->mainFrame()->documentElement().findFirst("tbody[id=exposures]"); tbodyElement.removeAllChildren(); for (int i = 0, iMax = pExposures.count(); i < iMax; ++i) { QString exposureUrl = pExposures[i].url(); QString exposureName = pExposures[i].name(); tbodyElement.appendInside("<tr id=\"exposure_"+QString::number(i)+"\">\n" " <td class=\"exposure\">\n" " <table class=\"fullWidth\">\n" " <tbody>\n" " <tr>\n" " <td class=\"fullWidth\">\n" " <ul>\n" " <li class=\"exposure\">\n" " <a href=\""+exposureUrl+"\">"+exposureName+"</a>\n" " </li>\n" " </ul>\n" " </td>\n" " <td class=\"button\">\n" " <a class=\"noHover\" href=\"cloneWorkspace|"+exposureUrl+"|"+exposureName+"\"><img class=\"button clone\"/></a>\n" " </td>\n" " <td class=\"button\">\n" " <a class=\"noHover\" href=\"showExposureFiles|"+exposureUrl+"|"+exposureName+"\"><img id=\"exposure_"+QString::number(i)+"\" class=\"button open\"/></a>\n" " </td>\n" " </tr>\n" " </tbody>\n" " </table>\n" " <ul id=\"exposureFiles_"+QString::number(i)+"\" style=\"display: none;\">\n" " </ul>\n" " </td>\n" "</tr>\n"); mExposureNames << exposureName; mExposureDisplayed << true; mExposureUrlId.insert(exposureUrl, i); } }
void WelcomePageWidget::updateRecentFilesContainer(const QString &id, const QStringList &files, const QString &message) { static const QString divTemplate = "<div id=\"%1\" class=\"recent_items_content\">%2</div>"; static const QString linkTemplate = "<a class=\"recentLink\" href=\"#\" onclick=\"ugene.openFile('%1')\" title=\"%1\">- %2</a>"; QWebElement doc = page()->mainFrame()->documentElement(); QWebElement recentFilesDiv = doc.findFirst("#" + id); SAFE_POINT(!recentFilesDiv.isNull(), "No recent files container", ); recentFilesDiv.removeAllChildren(); QStringList links; foreach (const QString &file, files.mid(0, MAX_RECENT)) { if (file.isEmpty()) { continue; } links << linkTemplate.arg(file).arg(QFileInfo(file).fileName()); } QString result = message; if (!links.isEmpty()) { result = links.join("\n"); } recentFilesDiv.setOuterXml(divTemplate.arg(id).arg(result)); }
void EnmlFormatter::fixLinkNode(QWebElement e) { QString enTag = e.attribute("en-tag", ""); if (enTag.toLower() == "en-media") { resources.append(e.attribute("lid").toInt()); e.removeAttribute("style"); e.removeAttribute("href"); e.removeAttribute("title"); removeInvalidAttributes(e); e.removeAllChildren(); QString newXml = e.toOuterXml(); newXml.replace("<a", "<en-media"); newXml.replace("</a>", "</en-media>"); e.setOuterXml(newXml); } QString latex = e.attribute("href", ""); if (latex.toLower().startsWith("latex://")) { removeInvalidAttributes(e); e.removeAttribute("title"); e.removeAttribute("href"); e.setOuterXml(e.toInnerXml()); } removeInvalidAttributes(e); }