Exemple #1
0
void TitleBar::loadErrorPage()
{
#ifdef USEWEBENGINE
    QWebEngineView* comments = noteView()->commentView();
#else
    noteView()->commentWidget()->hideLocalProgress();
    QWebView* comments = noteView()->commentView();
    comments->setVisible(true);
#endif
    QString strFileName = Utils::PathResolve::resourcesPath() + "files/errorpage/load_fail_comments.html";
    QString strHtml;
    ::WizLoadUnicodeTextFromFile(strFileName, strHtml);
    QUrl url = QUrl::fromLocalFile(strFileName);
    comments->setHtml(strHtml, url);
}
Exemple #2
0
void TitleBar::loadErrorPage()
{
#ifdef USEWEBENGINE
    QWebEngineView* comments = noteView()->commentView();
#else
    QWebView* comments = noteView()->commentView();
#endif
    QString strFileName = Utils::PathResolve::resourcesPath() + "files/errorpage/load_fail_comments.html";
    QString strHtml;
    ::WizLoadUnicodeTextFromFile(strFileName, strHtml);
    strHtml.replace("{error_text1}", tr("Load Error"));
    strHtml.replace("{error_text2}", tr("Network anomalies, check the network, then retry!"));
    strHtml.replace("{error_text3}", tr("Load Error"));
    QUrl url = QUrl::fromLocalFile(strFileName);
    comments->setHtml(strHtml, url);
}
void PublisherPage::show()
{
    QWebEngineView *view = new QWebEngineView;
    QDir dir;
    QString cwd = dir.currentPath();
    QString html = "qrc:///vpub/index.html";
    QString fpath = "/src/qt/res/vpub/index.html";
    QString res = cwd + fpath;
    QFile file(res);
    // QFile file("file:////res/pbt/index.html");
    if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        html = QString("<html><body><p>Cannot read file in ") + res + QString("</p></body></html>");
    } else {
        html = QTextStream(&file).readAll();
    };
    view->setHtml(html, QUrl());
    view->show();
}
void QRestClient::displayHtml(QByteArray html)
{
    QWebEngineView *view = new QWebEngineView();
    view->setAttribute(Qt::WA_DeleteOnClose);
    view->setHtml(html);
    view->show();
}