diff --git a/src/gui/basewebview.cpp b/src/gui/basewebview.cpp
index 52336fc19..753f67b2e 100644
--- a/src/gui/basewebview.cpp
+++ b/src/gui/basewebview.cpp
@@ -207,6 +207,23 @@ void BaseWebView::mouseReleaseEvent(QMouseEvent *event) {
QWebView::mouseReleaseEvent(event);
}
+void BaseWebView::wheelEvent(QWheelEvent *event) {
+ if (event->modifiers() & Qt::ControlModifier) {
+ if (event->delta() > 0) {
+ increaseWebPageZoom();
+ emit zoomFactorChanged();
+ return;
+ }
+ else if (event->delta() < 0) {
+ decreaseWebPageZoom();
+ emit zoomFactorChanged();
+ return;
+ }
+ }
+
+ QWebView::wheelEvent(event);
+}
+
void BaseWebView::paintEvent(QPaintEvent *event) {
QWebView::paintEvent(event);
diff --git a/src/gui/basewebview.h b/src/gui/basewebview.h
index b2bb1cab1..a258482de 100644
--- a/src/gui/basewebview.h
+++ b/src/gui/basewebview.h
@@ -26,6 +26,9 @@ class BaseWebView : public QWebView {
// User wants to open new empty web browser tab.
void newTabRequested();
+ // Emitted if user changes zoom factor via CTRL + mouse wheel combo.
+ void zoomFactorChanged();
+
public slots:
bool increaseWebPageZoom();
bool decreaseWebPageZoom();
@@ -51,6 +54,9 @@ class BaseWebView : public QWebView {
// Displays custom error page.
void displayErrorPage();
+ // Customize mouse wheeling.
+ void wheelEvent(QWheelEvent *event);
+
// Does additional painting.
void paintEvent(QPaintEvent *event);
diff --git a/src/gui/formmain.cpp b/src/gui/formmain.cpp
index 463a9e3fa..dabe56ea7 100644
--- a/src/gui/formmain.cpp
+++ b/src/gui/formmain.cpp
@@ -179,9 +179,13 @@ void FormMain::createConnections() {
void FormMain::loadWebBrowserMenu(int index) {
WebBrowser *active_browser = m_ui->m_tabWidget->widget(index)->webBrowser();
- m_ui->m_menuWebBrowser->clear();
+ m_ui->m_menuCurrentTab->clear();
if (active_browser != NULL) {
- m_ui->m_menuWebBrowser->addActions(active_browser->globalMenu());
+ m_ui->m_menuCurrentTab->addActions(active_browser->globalMenu());
+
+ if (m_ui->m_menuCurrentTab->actions().size() == 0) {
+ m_ui->m_menuCurrentTab->insertAction(NULL, m_ui->m_actionNoActions);
+ }
}
}
diff --git a/src/gui/formmain.ui b/src/gui/formmain.ui
index c9aebd148..aa8927f96 100644
--- a/src/gui/formmain.ui
+++ b/src/gui/formmain.ui
@@ -82,6 +82,16 @@
Web browser
+
+
+
+
+
+
@@ -141,6 +151,38 @@
Ctrl+Shift+F
+
+
+ &Add tab
+
+
+ Add tab
+
+
+
+
+ Close &all tabs except current one
+
+
+ Close all tabs except current one
+
+
+
+
+ Close current &tab
+
+
+
+
+ false
+
+
+ &No actions possible
+
+
+ No actions are possible at this point of time.
+
+
diff --git a/src/gui/locationlineedit.cpp b/src/gui/locationlineedit.cpp
index 44c050bc0..2f02af84d 100644
--- a/src/gui/locationlineedit.cpp
+++ b/src/gui/locationlineedit.cpp
@@ -13,6 +13,7 @@ LocationLineEdit::LocationLineEdit(QWidget *parent)
m_progress(0),
m_defaultPalette(palette()),
m_mouseSelectsAllText(true) {
+ setPlaceholderText(tr("Website address goes here"));
}
LocationLineEdit::~LocationLineEdit() {
diff --git a/src/gui/webbrowser.cpp b/src/gui/webbrowser.cpp
index a0128f71b..12d7c5349 100644
--- a/src/gui/webbrowser.cpp
+++ b/src/gui/webbrowser.cpp
@@ -133,6 +133,9 @@ void WebBrowser::createConnections() {
// Forward title/icon changes.
connect(m_webView, SIGNAL(titleChanged(QString)), this, SLOT(onTitleChanged(QString)));
connect(m_webView, SIGNAL(iconChanged()), this, SLOT(onIconChanged()));
+
+ // Misc connections.
+ connect(m_webView, SIGNAL(zoomFactorChanged()), this, SLOT(updateZoomGui()));
}
void WebBrowser::onIconChanged() {
@@ -160,23 +163,25 @@ void WebBrowser::navigateToUrl(const QUrl &url) {
}
}
-void WebBrowser::increaseZoom() {
- m_webView->increaseWebPageZoom();
+void WebBrowser::updateZoomGui() {
m_btnResetZoom->setText(QString("%1%").arg(QString::number(m_webView->zoomFactor() * 100,
'f',
0)));
}
+void WebBrowser::increaseZoom() {
+ m_webView->increaseWebPageZoom();
+ updateZoomGui();
+}
+
void WebBrowser::decreaseZoom() {
m_webView->decreaseWebPageZoom();
- m_btnResetZoom->setText(QString("%1%").arg(QString::number(m_webView->zoomFactor() * 100,
- 'f',
- 0)));
+ updateZoomGui();
}
void WebBrowser::resetZoom() {
m_webView->resetWebPageZoom();
- m_btnResetZoom->setText("100%");
+ updateZoomGui();
}
void WebBrowser::navigateToUrl(const QString &textual_url) {
diff --git a/src/gui/webbrowser.h b/src/gui/webbrowser.h
index 25597567e..114ee35c1 100644
--- a/src/gui/webbrowser.h
+++ b/src/gui/webbrowser.h
@@ -65,6 +65,7 @@ class WebBrowser : public TabContent {
void resetZoom();
protected:
+
// Creates necessary connections.
void createConnections();
@@ -72,6 +73,9 @@ class WebBrowser : public TabContent {
void initializeZoomWidget();
protected slots:
+ // Updates zoom-related gui.
+ void updateZoomGui();
+
// Updates url (for example on location text box).
void updateUrl(const QUrl &url);