Added mouse gestures.
This commit is contained in:
parent
d1c2b9aa84
commit
fcb257022b
8 changed files with 155 additions and 48 deletions
|
@ -21,6 +21,7 @@
|
||||||
#define APP_CFG_GEN "main"
|
#define APP_CFG_GEN "main"
|
||||||
#define APP_CFG_PROXY "proxy"
|
#define APP_CFG_PROXY "proxy"
|
||||||
#define APP_CFG_CUTS "keyboard"
|
#define APP_CFG_CUTS "keyboard"
|
||||||
|
#define APP_CFG_BROWSER "browser"
|
||||||
|
|
||||||
#define APP_DB_PATH "data/storage/database.db"
|
#define APP_DB_PATH "data/storage/database.db"
|
||||||
#define APP_PREFIX "@CMAKE_INSTALL_PREFIX@"
|
#define APP_PREFIX "@CMAKE_INSTALL_PREFIX@"
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include <QWebFrame>
|
#include <QWebFrame>
|
||||||
#include <QContextMenuEvent>
|
#include <QContextMenuEvent>
|
||||||
|
|
||||||
|
#include "core/defs.h"
|
||||||
|
#include "core/settings.h"
|
||||||
#include "core/basewebpage.h"
|
#include "core/basewebpage.h"
|
||||||
#include "gui/basewebview.h"
|
#include "gui/basewebview.h"
|
||||||
#include "gui/themefactory.h"
|
#include "gui/themefactory.h"
|
||||||
|
@ -12,6 +14,7 @@
|
||||||
BaseWebView::BaseWebView(QWidget *parent)
|
BaseWebView::BaseWebView(QWidget *parent)
|
||||||
: QWebView(parent), m_page(new BaseWebPage(this)) {
|
: QWebView(parent), m_page(new BaseWebPage(this)) {
|
||||||
setPage(m_page);
|
setPage(m_page);
|
||||||
|
setContextMenuPolicy(Qt::NoContextMenu);
|
||||||
initializeActions();
|
initializeActions();
|
||||||
createConnections();
|
createConnections();
|
||||||
}
|
}
|
||||||
|
@ -28,7 +31,10 @@ void BaseWebView::onLoadFinished(bool ok) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseWebView::createConnections() {
|
void BaseWebView::createConnections() {
|
||||||
connect(this, &BaseWebView::loadFinished, this, &BaseWebView::onLoadFinished);
|
connect(this, &BaseWebView::loadFinished,
|
||||||
|
this, &BaseWebView::onLoadFinished);
|
||||||
|
connect(this, &BaseWebView::customContextMenuRequested,
|
||||||
|
this, &BaseWebView::popupContextMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseWebView::setupIcons() {
|
void BaseWebView::setupIcons() {
|
||||||
|
@ -68,10 +74,10 @@ void BaseWebView::displayErrorPage() {
|
||||||
setHtml("error", url());
|
setHtml("error", url());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseWebView::contextMenuEvent(QContextMenuEvent *event) {
|
void BaseWebView::popupContextMenu(const QPoint &pos) {
|
||||||
QMenu context_menu(tr("Web browser"), this);
|
QMenu context_menu(tr("Web browser"), this);
|
||||||
QMenu image_submenu(tr("Image"), &context_menu);
|
QMenu image_submenu(tr("Image"), &context_menu);
|
||||||
QWebHitTestResult hit_result = page()->mainFrame()->hitTestContent(event->pos());
|
QWebHitTestResult hit_result = page()->mainFrame()->hitTestContent(pos);
|
||||||
|
|
||||||
image_submenu.setIcon(ThemeFactory::fromTheme("image-x-generic"));
|
image_submenu.setIcon(ThemeFactory::fromTheme("image-x-generic"));
|
||||||
|
|
||||||
|
@ -94,11 +100,11 @@ void BaseWebView::contextMenuEvent(QContextMenuEvent *event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display the menu.
|
// Display the menu.
|
||||||
context_menu.exec(mapToGlobal(event->pos()));
|
context_menu.exec(mapToGlobal(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseWebView::mousePressEvent(QMouseEvent *event) {
|
void BaseWebView::mousePressEvent(QMouseEvent *event) {
|
||||||
if (event->buttons() & Qt::MiddleButton) {
|
if (event->button() & Qt::MiddleButton) {
|
||||||
QWebHitTestResult hit_result = page()->mainFrame()->hitTestContent(event->pos());
|
QWebHitTestResult hit_result = page()->mainFrame()->hitTestContent(event->pos());
|
||||||
|
|
||||||
// Check if user clicked with middle mouse button on some
|
// Check if user clicked with middle mouse button on some
|
||||||
|
@ -110,15 +116,51 @@ void BaseWebView::mousePressEvent(QMouseEvent *event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (event->button() & Qt::RightButton) {
|
||||||
|
m_gestureOrigin = event->pos();
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Add mouse gestures (from quite-rss).
|
// TODO: Add mouse gestures (from quite-rss).
|
||||||
QWebView::mousePressEvent(event);
|
QWebView::mousePressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseWebView::mouseReleaseEvent(QMouseEvent *event) {
|
void BaseWebView::mouseReleaseEvent(QMouseEvent *event) {
|
||||||
QWebView::mousePressEvent(event);
|
QWebView::mouseReleaseEvent(event);
|
||||||
|
|
||||||
|
if (event->button() & Qt::RightButton) {
|
||||||
|
bool are_gestures_enabled = Settings::getInstance()->value(APP_CFG_BROWSER,
|
||||||
|
"gestures_enabled",
|
||||||
|
true).toBool();
|
||||||
|
if (are_gestures_enabled) {
|
||||||
|
QPoint release_point = event->pos();
|
||||||
|
int left_move = m_gestureOrigin.x() - release_point.x();
|
||||||
|
int right_move = release_point.x() - m_gestureOrigin.x();
|
||||||
|
int top_move = m_gestureOrigin.y() - release_point.y();
|
||||||
|
int bottom_move = release_point.y() - m_gestureOrigin.y();
|
||||||
|
int total_max = qMax(qMax(qMax(left_move, right_move),
|
||||||
|
qMax(top_move, bottom_move)),
|
||||||
|
40);
|
||||||
|
|
||||||
|
if (total_max == left_move && are_gestures_enabled) {
|
||||||
|
back();
|
||||||
|
}
|
||||||
|
else if (total_max == right_move && are_gestures_enabled) {
|
||||||
|
forward();
|
||||||
|
}
|
||||||
|
else if (total_max == top_move && are_gestures_enabled) {
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
else if (total_max == bottom_move && are_gestures_enabled) {
|
||||||
|
emit newTabRequested();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
emit customContextMenuRequested(event->pos());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
emit customContextMenuRequested(event->pos());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseWebView::paintEvent(QPaintEvent *event) {
|
void BaseWebView::paintEvent(QPaintEvent *event) {
|
||||||
|
|
|
@ -23,10 +23,16 @@ class BaseWebView : public QWebView {
|
||||||
// web browser tab.
|
// web browser tab.
|
||||||
void linkMiddleClicked(const QUrl &link_url);
|
void linkMiddleClicked(const QUrl &link_url);
|
||||||
|
|
||||||
|
// User wants to open new empty web browser tab.
|
||||||
|
void newTabRequested();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
// Executes if loading of any page is done.
|
// Executes if loading of any page is done.
|
||||||
void onLoadFinished(bool ok);
|
void onLoadFinished(bool ok);
|
||||||
|
|
||||||
|
// Provides custom context menu.
|
||||||
|
void popupContextMenu(const QPoint &pos);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initializeActions();
|
void initializeActions();
|
||||||
|
|
||||||
|
@ -39,9 +45,6 @@ class BaseWebView : public QWebView {
|
||||||
// Does additional painting.
|
// Does additional painting.
|
||||||
void paintEvent(QPaintEvent *event);
|
void paintEvent(QPaintEvent *event);
|
||||||
|
|
||||||
// Provides custom context menu.
|
|
||||||
void contextMenuEvent(QContextMenuEvent *event);
|
|
||||||
|
|
||||||
// Provides custom mouse actions.
|
// Provides custom mouse actions.
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
void mouseReleaseEvent(QMouseEvent *event);
|
void mouseReleaseEvent(QMouseEvent *event);
|
||||||
|
@ -53,6 +56,8 @@ class BaseWebView : public QWebView {
|
||||||
QAction *m_actionCopyLink;
|
QAction *m_actionCopyLink;
|
||||||
QAction *m_actionCopyImage;
|
QAction *m_actionCopyImage;
|
||||||
QAction *m_actionCopyImageUrl;
|
QAction *m_actionCopyImageUrl;
|
||||||
|
|
||||||
|
QPoint m_gestureOrigin;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BASEWEBVIEW_H
|
#endif // BASEWEBVIEW_H
|
||||||
|
|
|
@ -107,7 +107,7 @@
|
||||||
<locale language="English" country="UnitedStates"/>
|
<locale language="English" country="UnitedStates"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="m_tabInfo">
|
<widget class="QWidget" name="m_tabInfo">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
@ -135,8 +135,8 @@
|
||||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"><br /></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="acceptRichText">
|
<property name="acceptRichText">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -162,15 +162,15 @@ p, li { white-space: pre-wrap; }
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolBox" name="toolBox">
|
<widget class="QToolBox" name="toolBox">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page_GNU_GPL">
|
<widget class="QWidget" name="page_GNU_GPL">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>687</width>
|
<width>685</width>
|
||||||
<height>180</height>
|
<height>184</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoFillBackground">
|
<property name="autoFillBackground">
|
||||||
|
@ -227,12 +227,15 @@ p, li { white-space: pre-wrap; }
|
||||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'DejaVu Sans Mono'; font-size:9pt; font-weight:400; font-style:normal;">
|
</style></head><body style=" font-family:'DejaVu Sans Mono'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif';"><br /></p></body></html></string>
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"><br /></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="textInteractionFlags">
|
<property name="textInteractionFlags">
|
||||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -242,8 +245,8 @@ p, li { white-space: pre-wrap; }
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>687</width>
|
<width>685</width>
|
||||||
<height>180</height>
|
<height>184</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="label">
|
<attribute name="label">
|
||||||
|
@ -294,12 +297,15 @@ p, li { white-space: pre-wrap; }
|
||||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'DejaVu Sans Mono'; font-size:9pt; font-weight:400; font-style:normal;">
|
</style></head><body style=" font-family:'DejaVu Sans Mono'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif';"><br /></p></body></html></string>
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"><br /></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="textInteractionFlags">
|
<property name="textInteractionFlags">
|
||||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -332,8 +338,8 @@ p, li { white-space: pre-wrap; }
|
||||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;"><br /></span></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="tabStopWidth">
|
<property name="tabStopWidth">
|
||||||
<number>30</number>
|
<number>30</number>
|
||||||
|
@ -344,6 +350,9 @@ p, li { white-space: pre-wrap; }
|
||||||
<property name="textInteractionFlags">
|
<property name="textInteractionFlags">
|
||||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -365,8 +374,8 @@ p, li { white-space: pre-wrap; }
|
||||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"><br /></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="acceptRichText">
|
<property name="acceptRichText">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -374,6 +383,9 @@ p, li { white-space: pre-wrap; }
|
||||||
<property name="textInteractionFlags">
|
<property name="textInteractionFlags">
|
||||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -51,6 +51,7 @@ FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::Form
|
||||||
loadShortcuts();
|
loadShortcuts();
|
||||||
loadInterface();
|
loadInterface();
|
||||||
loadProxy();
|
loadProxy();
|
||||||
|
loadBrowser();
|
||||||
loadLanguage();
|
loadLanguage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,6 +83,7 @@ void FormSettings::saveSettings() {
|
||||||
saveShortcuts();
|
saveShortcuts();
|
||||||
saveInterface();
|
saveInterface();
|
||||||
saveProxy();
|
saveProxy();
|
||||||
|
saveBrowser();
|
||||||
saveLanguage();
|
saveLanguage();
|
||||||
|
|
||||||
Settings::getInstance()->checkSettings();
|
Settings::getInstance()->checkSettings();
|
||||||
|
@ -103,6 +105,32 @@ void FormSettings::onProxyTypeChanged(int index) {
|
||||||
m_ui->m_lblProxyUsername->setEnabled(is_proxy_selected);
|
m_ui->m_lblProxyUsername->setEnabled(is_proxy_selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FormSettings::loadBrowser() {
|
||||||
|
// Load settings of web browser GUI.
|
||||||
|
m_initialSettings.m_webBrowserProgress = Settings::getInstance()->value(APP_CFG_BROWSER,
|
||||||
|
"browser_progress_color",
|
||||||
|
QColor(0, 255, 0, 100)).value<QColor>();
|
||||||
|
m_ui->m_checkBrowserProgressColor->setChecked(Settings::getInstance()->value(APP_CFG_BROWSER,
|
||||||
|
"browser_colored_progress_enabled",
|
||||||
|
true).toBool());
|
||||||
|
m_ui->m_checkMouseGestures->setChecked(Settings::getInstance()->value(APP_CFG_BROWSER,
|
||||||
|
"gestures_enabled",
|
||||||
|
true).toBool());
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormSettings::saveBrowser() {
|
||||||
|
// Save settings of GUI of web browser.
|
||||||
|
Settings::getInstance()->setValue(APP_CFG_BROWSER,
|
||||||
|
"browser_progress_color",
|
||||||
|
m_initialSettings.m_webBrowserProgress);
|
||||||
|
Settings::getInstance()->setValue(APP_CFG_BROWSER,
|
||||||
|
"browser_colored_progress_enabled",
|
||||||
|
m_ui->m_checkBrowserProgressColor->isChecked());
|
||||||
|
Settings::getInstance()->setValue(APP_CFG_BROWSER,
|
||||||
|
"gestures_enabled",
|
||||||
|
m_ui->m_checkMouseGestures->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
void FormSettings::loadProxy() {
|
void FormSettings::loadProxy() {
|
||||||
m_ui->m_cmbProxyType->addItem(tr("No proxy"), QNetworkProxy::NoProxy);
|
m_ui->m_cmbProxyType->addItem(tr("No proxy"), QNetworkProxy::NoProxy);
|
||||||
m_ui->m_cmbProxyType->addItem(tr("Socks5"), QNetworkProxy::Socks5Proxy);
|
m_ui->m_cmbProxyType->addItem(tr("Socks5"), QNetworkProxy::Socks5Proxy);
|
||||||
|
@ -260,14 +288,6 @@ void FormSettings::loadInterface() {
|
||||||
m_ui->m_grpTray->setDisabled(true);
|
m_ui->m_grpTray->setDisabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load settings of web browser GUI.
|
|
||||||
m_initialSettings.m_webBrowserProgress = Settings::getInstance()->value(APP_CFG_GUI,
|
|
||||||
"browser_progress_color",
|
|
||||||
QColor(0, 255, 0, 100)).value<QColor>();
|
|
||||||
m_ui->m_checkBrowserProgressColor->setChecked(Settings::getInstance()->value(APP_CFG_GUI,
|
|
||||||
"browser_colored_progress_enabled",
|
|
||||||
true).toBool());
|
|
||||||
|
|
||||||
// Load settings of icon theme.
|
// Load settings of icon theme.
|
||||||
QString current_theme = ThemeFactory::getCurrentIconTheme();
|
QString current_theme = ThemeFactory::getCurrentIconTheme();
|
||||||
|
|
||||||
|
@ -315,14 +335,6 @@ void FormSettings::saveInterface() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save settings of GUI of web browser.
|
|
||||||
Settings::getInstance()->setValue(APP_CFG_GUI,
|
|
||||||
"browser_progress_color",
|
|
||||||
m_initialSettings.m_webBrowserProgress);
|
|
||||||
Settings::getInstance()->setValue(APP_CFG_GUI,
|
|
||||||
"browser_colored_progress_enabled",
|
|
||||||
m_ui->m_checkBrowserProgressColor->isChecked());
|
|
||||||
|
|
||||||
// Save selected icon theme.
|
// Save selected icon theme.
|
||||||
ThemeFactory::setCurrentIconTheme(m_ui->m_cmbIconTheme->itemData(m_ui->m_cmbIconTheme->currentIndex()).toString());
|
ThemeFactory::setCurrentIconTheme(m_ui->m_cmbIconTheme->itemData(m_ui->m_cmbIconTheme->currentIndex()).toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,9 @@ class FormSettings : public QDialog {
|
||||||
void loadShortcuts();
|
void loadShortcuts();
|
||||||
void saveShortcuts();
|
void saveShortcuts();
|
||||||
|
|
||||||
|
void loadBrowser();
|
||||||
|
void saveBrowser();
|
||||||
|
|
||||||
void loadProxy();
|
void loadProxy();
|
||||||
void saveProxy();
|
void saveProxy();
|
||||||
void displayProxyPassword(int state);
|
void displayProxyPassword(int state);
|
||||||
|
|
|
@ -69,8 +69,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>506</width>
|
<width>100</width>
|
||||||
<height>367</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
@ -314,7 +314,7 @@
|
||||||
<item row="3" column="0" colspan="2">
|
<item row="3" column="0" colspan="2">
|
||||||
<widget class="QLabel" name="m_lblMouseGestures">
|
<widget class="QLabel" name="m_lblMouseGestures">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Mouse gestures work with left mouse button. Possible gestures are:
|
<string>Mouse gestures work with right mouse button. Possible gestures are:
|
||||||
<ul>
|
<ul>
|
||||||
<li>previous web page (drag mouse left)</li>
|
<li>previous web page (drag mouse left)</li>
|
||||||
<li>next web page (drag mouse right)</li>
|
<li>next web page (drag mouse right)</li>
|
||||||
|
@ -624,5 +624,37 @@
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_checkBrowserProgressColor</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>m_lblBrowserProgressColor</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>300</x>
|
||||||
|
<y>48</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>275</x>
|
||||||
|
<y>73</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_checkBrowserProgressColor</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>m_btnBrowserProgressColor</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>300</x>
|
||||||
|
<y>48</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>544</x>
|
||||||
|
<y>74</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -50,11 +50,11 @@ void LocationLineEdit::mousePressEvent(QMouseEvent *event) {
|
||||||
|
|
||||||
void LocationLineEdit::paintEvent(QPaintEvent *event) {
|
void LocationLineEdit::paintEvent(QPaintEvent *event) {
|
||||||
// Draw "progress bar" if needed.
|
// Draw "progress bar" if needed.
|
||||||
if (m_progress > 0 && Settings::getInstance()->value(APP_CFG_GUI,
|
if (m_progress > 0 && Settings::getInstance()->value(APP_CFG_BROWSER,
|
||||||
"browser_colored_progress_enabled",
|
"browser_colored_progress_enabled",
|
||||||
true).toBool()) {
|
true).toBool()) {
|
||||||
QPalette current_palette = palette();
|
QPalette current_palette = palette();
|
||||||
QColor loadingColor = Settings::getInstance()->value(APP_CFG_GUI,
|
QColor loadingColor = Settings::getInstance()->value(APP_CFG_BROWSER,
|
||||||
"browser_progress_color",
|
"browser_progress_color",
|
||||||
QColor(0, 255, 0, 100)).value<QColor>();
|
QColor(0, 255, 0, 100)).value<QColor>();
|
||||||
QLinearGradient gradient(0, 0, width(), 0);
|
QLinearGradient gradient(0, 0, width(), 0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue