summaryrefslogtreecommitdiff
path: root/src/webwindow
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-07-25 17:30:52 +0200
committerAndrea Diamantini <adjam7@gmail.com>2012-12-10 02:48:04 +0100
commit197455a6044b66bdfdd479f07f4ad52649816998 (patch)
treeaac283db573bc86c5a9a1c9e8908741a7cc0c448 /src/webwindow
parentSet window icon & title (diff)
downloadrekonq-197455a6044b66bdfdd479f07f4ad52649816998.tar.xz
Re-add && Re-view tab preview popup
Diffstat (limited to 'src/webwindow')
-rw-r--r--src/webwindow/webwindow.cpp52
-rw-r--r--src/webwindow/webwindow.h9
2 files changed, 33 insertions, 28 deletions
diff --git a/src/webwindow/webwindow.cpp b/src/webwindow/webwindow.cpp
index 6d0d4d72..4b94414a 100644
--- a/src/webwindow/webwindow.cpp
+++ b/src/webwindow/webwindow.cpp
@@ -32,37 +32,14 @@
WebWindow::WebWindow(QWidget *parent)
: QWidget(parent)
+ , _progress(0)
, _view(new QWebView(this))
, _edit(new QLineEdit(this))
{
WebPage *p = new WebPage(_view);
_view->setPage(p);
- // layout
- QVBoxLayout *l = new QVBoxLayout;
- l->addWidget(_edit);
- l->addWidget(_view);
- l->setContentsMargins(0, 0, 0, 0);
- setLayout(l);
-
- setContentsMargins(0, 0, 0, 0);
-
- // line edit signals
- connect(_edit, SIGNAL(returnPressed()), this, SLOT(checkLoadUrl()));
-
- // url signal
- connect(_view, SIGNAL(urlChanged(QUrl)), this, SLOT(setUrlText(QUrl)));
-
- // things changed signals
- connect(_view, SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString)));
-
- // load signals
- connect(_view, SIGNAL(loadStarted()), this, SIGNAL(loadStarted()));
- connect(_view, SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int)));
- connect(_view, SIGNAL(loadFinished(bool)), this, SIGNAL(loadFinished(bool)));
-
- // page signals
- connect(p, SIGNAL(pageCreated(WebPage *)), this, SIGNAL(pageCreated(WebPage *)));
+ init();
}
@@ -74,6 +51,12 @@ WebWindow::WebWindow(WebPage *page, QWidget *parent)
_view->setPage(page);
page->setParent(_view);
+ init();
+}
+
+
+void WebWindow::init()
+{
// layout
QVBoxLayout *l = new QVBoxLayout;
l->addWidget(_edit);
@@ -94,12 +77,12 @@ WebWindow::WebWindow(WebPage *page, QWidget *parent)
// load signals
connect(_view, SIGNAL(loadStarted()), this, SIGNAL(loadStarted()));
- connect(_view, SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int)));
connect(_view, SIGNAL(loadFinished(bool)), this, SIGNAL(loadFinished(bool)));
- // page signals
- connect(page, SIGNAL(pageCreated(WebPage *)), this, SIGNAL(pageCreated(WebPage *)));
+ connect(_view, SIGNAL(loadProgress(int)), this, SLOT(checkLoadProgress(int)));
+ // page signals
+ connect(page(), SIGNAL(pageCreated(WebPage *)), this, SIGNAL(pageCreated(WebPage *)));
}
@@ -133,6 +116,13 @@ void WebWindow::setUrlText(const QUrl &u)
}
+void WebWindow::checkLoadProgress(int p)
+{
+ _progress = p;
+ emit loadProgress(p);
+}
+
+
QUrl WebWindow::url() const
{
return _view->url();
@@ -155,3 +145,9 @@ QPixmap WebWindow::tabPreview(int width, int height)
{
return WebSnap::renderPagePreview(*page(), width, height);
}
+
+
+bool WebWindow::isLoading()
+{
+ return _progress != 0 && _progress != 100;
+}
diff --git a/src/webwindow/webwindow.h b/src/webwindow/webwindow.h
index 189f111f..fdcb0383 100644
--- a/src/webwindow/webwindow.h
+++ b/src/webwindow/webwindow.h
@@ -51,10 +51,17 @@ public:
QPixmap tabPreview(int width, int height);
+ bool isLoading();
+
+private:
+ void init();
+
private Q_SLOTS:
void checkLoadUrl();
void setUrlText(const QUrl &);
+ void checkLoadProgress(int);
+
Q_SIGNALS:
void titleChanged(QString);
@@ -65,6 +72,8 @@ Q_SIGNALS:
void pageCreated(WebPage *);
private:
+ int _progress;
+
QWebView *_view;
QLineEdit *_edit;
};