# HG changeset patch # User unc0rr # Date 1315070600 -14400 # Node ID fbc52bb92cad05f3ed10e6c86ecbb28d7ff63fb7 # Parent 71e69623be39a4d869b233cad73ab011ccb657ef Use QTextBrowser instead of WebKit for downloadable contents page (currently only shows the page itself) diff -r 71e69623be39 -r fbc52bb92cad QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Sat Sep 03 12:35:49 2011 +0200 +++ b/QTfrontend/hwform.cpp Sat Sep 03 21:23:20 2011 +0400 @@ -1322,4 +1322,5 @@ } } while(!fileName.isEmpty() && !ok); } -} \ No newline at end of file +} + diff -r 71e69623be39 -r fbc52bb92cad QTfrontend/pagedata.cpp --- a/QTfrontend/pagedata.cpp Sat Sep 03 12:35:49 2011 +0200 +++ b/QTfrontend/pagedata.cpp Sat Sep 03 21:23:20 2011 +0400 @@ -20,8 +20,11 @@ #include #include #include +#include #include #include +#include + #include "pagedata.h" @@ -34,11 +37,21 @@ BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); - web = new QWebView(this); - connect(web, SIGNAL(linkClicked(const QUrl&)), this, SLOT(install(const QUrl&))); - web->load(QUrl("http://m8y.org/hw/downloads/")); - web->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); + web = new QTextBrowser(this); + connect(web, SIGNAL(anchorClicked(QUrl)), this, SLOT(install(const QUrl&))); + web->setOpenLinks(false); + //web->setSource(); + //web->load(QUrl("http://m8y.org/hw/downloads/")); + //web->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); pageLayout->addWidget(web, 0, 0, 1, 3); + + + QNetworkRequest newRequest(QUrl("http://m8y.org/hw/downloads/index.xhtml")); + //newRequest.setAttribute(QNetworkRequest::User, fileName); + + QNetworkAccessManager *manager = new QNetworkAccessManager(this); + QNetworkReply *reply = manager->get(newRequest); + connect(reply, SIGNAL(finished()), this, SLOT(downloadIssueFinished())); } void PageDataDownload::install(const QUrl &url) @@ -52,5 +65,19 @@ QNetworkAccessManager *manager = new QNetworkAccessManager(this); QNetworkReply *reply = manager->get(newRequest); //connect( reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64, qint64)) ); -//connect( reply, SIGNAL(finished()), this, SLOT(downloadIssueFinished())); } + + +void PageDataDownload::downloadIssueFinished() +{ + QNetworkReply * reply = qobject_cast(sender()); + + if(reply) + { + web->setHtml(QString::fromUtf8(reply->readAll())); + } +} + + + + diff -r 71e69623be39 -r fbc52bb92cad QTfrontend/pagedata.h --- a/QTfrontend/pagedata.h Sat Sep 03 12:35:49 2011 +0200 +++ b/QTfrontend/pagedata.h Sat Sep 03 21:23:20 2011 +0400 @@ -18,10 +18,12 @@ #ifndef PAGE_DATA_H #define PAGE_DATA_H -#include + #include #include "AbstractPage.h" +class QTextBrowser; + class PageDataDownload : public AbstractPage { Q_OBJECT @@ -30,10 +32,12 @@ PageDataDownload(QWidget* parent = 0); QPushButton *BtnBack; - QWebView *web; + QTextBrowser *web; private slots: void install(const QUrl &url); + + void downloadIssueFinished(); }; #endif