From 705811a401188b8bb363d5966bfe3980d0931aec Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Mon, 5 Aug 2013 21:31:41 +0200 Subject: [PATCH] Work on webbrowser. --- CMakeLists.txt | 4 +-- src/core/basewebpage.cpp | 7 +++- src/core/basewebpage.h | 8 +++++ src/gui/basewebview.cpp | 21 +++++++----- src/gui/basewebview.h | 1 + src/gui/formabout.cpp | 4 +-- src/gui/formmain.cpp | 18 ++++++---- src/gui/formmain.h | 2 ++ src/gui/formsettings.cpp | 16 ++++++--- src/gui/formsettings.ui | 9 ++++- ...{themefactory.cpp => iconthemefactory.cpp} | 24 +++++++------- .../{themefactory.h => iconthemefactory.h} | 10 +++--- src/gui/shortcutcatcher.cpp | 4 +-- src/gui/tabwidget.cpp | 33 +++++++++++-------- src/gui/tabwidget.h | 6 ++-- src/gui/webbrowser.cpp | 16 ++++----- src/main.cpp | 6 ++-- 17 files changed, 116 insertions(+), 73 deletions(-) rename src/gui/{themefactory.cpp => iconthemefactory.cpp} (85%) rename src/gui/{themefactory.h => iconthemefactory.h} (89%) diff --git a/CMakeLists.txt b/CMakeLists.txt index d7a5e9df3..9ab036228 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -160,7 +160,7 @@ set(APP_SOURCES # GUI sources. src/gui/formmain.cpp src/gui/systemtrayicon.cpp - src/gui/themefactory.cpp + src/gui/iconthemefactory.cpp src/gui/formsettings.cpp src/gui/formwelcome.cpp src/gui/formabout.cpp @@ -202,7 +202,7 @@ set(APP_HEADERS # GUI headers. src/gui/formmain.h src/gui/systemtrayicon.h - src/gui/themefactory.h + src/gui/iconthemefactory.h src/gui/formsettings.h src/gui/formwelcome.h src/gui/formabout.h diff --git a/src/core/basewebpage.cpp b/src/core/basewebpage.cpp index 496833369..6f0b83b47 100644 --- a/src/core/basewebpage.cpp +++ b/src/core/basewebpage.cpp @@ -6,7 +6,8 @@ #include "gui/webbrowser.h" -BaseWebPage::BaseWebPage(QObject *parent) : QWebPage(parent) { +BaseWebPage::BaseWebPage(QObject *parent) + : QWebPage(parent), m_openInNewTab(false) { // Setup global network access manager. // NOTE: This makes network settings easy for all web browsers. setNetworkAccessManager(WebBrowser::globalNetworkManager()); @@ -14,3 +15,7 @@ BaseWebPage::BaseWebPage(QObject *parent) : QWebPage(parent) { BaseWebPage::~BaseWebPage() { } + +QWebPage *BaseWebPage::createWindow(WebWindowType type) { + return QWebPage::createWindow(type); +} diff --git a/src/core/basewebpage.h b/src/core/basewebpage.h index 972097c97..f4eefdfb3 100644 --- a/src/core/basewebpage.h +++ b/src/core/basewebpage.h @@ -11,6 +11,14 @@ class BaseWebPage : public QWebPage { // Constructors and destructors. explicit BaseWebPage(QObject *parent = 0); virtual ~BaseWebPage(); + + protected: + QWebPage *createWindow(WebWindowType type); + + private: + friend class BaseWebView; + + bool m_openInNewTab; }; #endif // BASEWEBPAGE_H diff --git a/src/gui/basewebview.cpp b/src/gui/basewebview.cpp index 6d2fbf1af..f045cf212 100644 --- a/src/gui/basewebview.cpp +++ b/src/gui/basewebview.cpp @@ -8,7 +8,7 @@ #include "core/settings.h" #include "core/basewebpage.h" #include "gui/basewebview.h" -#include "gui/themefactory.h" +#include "gui/iconthemefactory.h" BaseWebView::BaseWebView(QWidget *parent) @@ -38,10 +38,10 @@ void BaseWebView::createConnections() { } void BaseWebView::setupIcons() { - m_actionReload->setIcon(ThemeFactory::getInstance()->fromTheme("view-refresh")); - m_actionCopyLink->setIcon(ThemeFactory::getInstance()->fromTheme("edit-copy")); - m_actionCopyImage->setIcon(ThemeFactory::getInstance()->fromTheme("insert-image")); - m_actionCopyImageUrl->setIcon(ThemeFactory::getInstance()->fromTheme("edit-copy")); + m_actionReload->setIcon(IconThemeFactory::getInstance()->fromTheme("view-refresh")); + m_actionCopyLink->setIcon(IconThemeFactory::getInstance()->fromTheme("edit-copy")); + m_actionCopyImage->setIcon(IconThemeFactory::getInstance()->fromTheme("insert-image")); + m_actionCopyImageUrl->setIcon(IconThemeFactory::getInstance()->fromTheme("edit-copy")); } void BaseWebView::initializeActions() { @@ -56,17 +56,22 @@ void BaseWebView::initializeActions() { m_actionCopyLink->setText(tr("Copy link url")); m_actionCopyLink->setToolTip(tr("Copy link url to clipboard")); - m_actionCopyImage = pageAction(QWebPage::CopyImageToClipboard); m_actionCopyImage->setParent(this); m_actionCopyImage->setText(tr("Copy image")); m_actionCopyImage->setToolTip(tr("Copy image to clipboard")); - m_actionCopyImageUrl = pageAction(QWebPage::CopyImageUrlToClipboard); m_actionCopyImageUrl->setParent(this); m_actionCopyImageUrl->setText(tr("Copy image url")); m_actionCopyImageUrl->setToolTip(tr("Copy image url to clipboard")); + + // TODO: Finish implementation of "open link in new tab" + // viz WebPage::createWindow in browser example. + m_actionOpenLinkNewTab = pageAction(QWebPage::OpenLinkInNewWindow); + m_actionOpenLinkNewTab->setParent(this); + m_actionOpenLinkNewTab->setText(tr("Open link in new tab")); + m_actionOpenLinkNewTab->setToolTip(tr("Open this hyperlink in new tab")); } void BaseWebView::displayErrorPage() { @@ -79,7 +84,7 @@ void BaseWebView::popupContextMenu(const QPoint &pos) { QMenu image_submenu(tr("Image"), &context_menu); QWebHitTestResult hit_result = page()->mainFrame()->hitTestContent(pos); - image_submenu.setIcon(ThemeFactory::getInstance()->fromTheme("image-x-generic")); + image_submenu.setIcon(IconThemeFactory::getInstance()->fromTheme("image-x-generic")); // Assemble the menu from actions. context_menu.addAction(m_actionReload); diff --git a/src/gui/basewebview.h b/src/gui/basewebview.h index 74fcdb84c..233ad6fc6 100644 --- a/src/gui/basewebview.h +++ b/src/gui/basewebview.h @@ -56,6 +56,7 @@ class BaseWebView : public QWebView { QAction *m_actionCopyLink; QAction *m_actionCopyImage; QAction *m_actionCopyImageUrl; + QAction *m_actionOpenLinkNewTab; QPoint m_gestureOrigin; }; diff --git a/src/gui/formabout.cpp b/src/gui/formabout.cpp index 041794151..b9c2c062d 100644 --- a/src/gui/formabout.cpp +++ b/src/gui/formabout.cpp @@ -3,7 +3,7 @@ #include "core/datetime.h" #include "gui/formabout.h" -#include "gui/themefactory.h" +#include "gui/iconthemefactory.h" FormAbout::FormAbout(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormAbout) { @@ -11,7 +11,7 @@ FormAbout::FormAbout(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormAbout) // Set flags and attributes. setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog); - setWindowIcon(ThemeFactory::getInstance()->fromTheme("help-about")); + setWindowIcon(IconThemeFactory::getInstance()->fromTheme("help-about")); m_ui->m_lblIcon->setPixmap(QPixmap(APP_ICON_PATH)); // Load information from embedded text files. diff --git a/src/gui/formmain.cpp b/src/gui/formmain.cpp index b9dc81a64..b4021e967 100644 --- a/src/gui/formmain.cpp +++ b/src/gui/formmain.cpp @@ -5,7 +5,7 @@ #include "gui/formabout.h" #include "gui/formsettings.h" #include "gui/webbrowser.h" -#include "gui/themefactory.h" +#include "gui/iconthemefactory.h" #include "gui/systemtrayicon.h" #include "gui/tabbar.h" #include "core/settings.h" @@ -49,6 +49,10 @@ QMenu *FormMain::getTrayMenu() { return m_trayMenu; } +TabWidget *FormMain::getTabWidget() { + return m_ui->m_tabWidget; +} + QList FormMain::getActions() { QList actions; actions << m_ui->m_actionImport << m_ui->m_actionExport << @@ -136,12 +140,12 @@ bool FormMain::event(QEvent *event) { void FormMain::setupIcons() { // Setup icons of this main window. - m_ui->m_actionSettings->setIcon(ThemeFactory::getInstance()->fromTheme("preferences-system")); - m_ui->m_actionQuit->setIcon(ThemeFactory::getInstance()->fromTheme("application-exit")); - m_ui->m_actionAboutGuard->setIcon(ThemeFactory::getInstance()->fromTheme("help-about")); - m_ui->m_actionImport->setIcon(ThemeFactory::getInstance()->fromTheme("document-import")); - m_ui->m_actionExport->setIcon(ThemeFactory::getInstance()->fromTheme("document-export")); - m_ui->m_actionFullscreen->setIcon(ThemeFactory::getInstance()->fromTheme("view-fullscreen")); + m_ui->m_actionSettings->setIcon(IconThemeFactory::getInstance()->fromTheme("preferences-system")); + m_ui->m_actionQuit->setIcon(IconThemeFactory::getInstance()->fromTheme("application-exit")); + m_ui->m_actionAboutGuard->setIcon(IconThemeFactory::getInstance()->fromTheme("help-about")); + m_ui->m_actionImport->setIcon(IconThemeFactory::getInstance()->fromTheme("document-import")); + m_ui->m_actionExport->setIcon(IconThemeFactory::getInstance()->fromTheme("document-export")); + m_ui->m_actionFullscreen->setIcon(IconThemeFactory::getInstance()->fromTheme("view-fullscreen")); // Setup icons for underlying components: opened web browsers... foreach (WebBrowser *browser, WebBrowser::runningWebBrowsers()) { diff --git a/src/gui/formmain.h b/src/gui/formmain.h index 785f9fe39..5665cc58d 100644 --- a/src/gui/formmain.h +++ b/src/gui/formmain.h @@ -18,6 +18,8 @@ class FormMain : public QMainWindow { // Returns menu for the tray icon. QMenu *getTrayMenu(); + TabWidget *getTabWidget(); + // Returns list of all globally available actions. // NOTE: This is used for setting dynamic shortcuts for given actions. QList getActions(); diff --git a/src/gui/formsettings.cpp b/src/gui/formsettings.cpp index fff2165e5..733957a9f 100644 --- a/src/gui/formsettings.cpp +++ b/src/gui/formsettings.cpp @@ -4,7 +4,7 @@ #include #include "gui/formsettings.h" -#include "gui/themefactory.h" +#include "gui/iconthemefactory.h" #include "gui/systemtrayicon.h" #include "gui/formmain.h" #include "gui/webbrowser.h" @@ -21,7 +21,7 @@ FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::Form // Set flags and attributes. setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog); - setWindowIcon(ThemeFactory::getInstance()->fromTheme("preferences-system")); + setWindowIcon(IconThemeFactory::getInstance()->fromTheme("preferences-system")); // Setup behavior. m_ui->m_treeLanguages->setColumnCount(5); @@ -117,6 +117,9 @@ void FormSettings::loadBrowser() { m_ui->m_checkMouseGestures->setChecked(Settings::getInstance()->value(APP_CFG_BROWSER, "gestures_enabled", true).toBool()); + m_ui->m_checkQueueTabs->setChecked(Settings::getInstance()->value(APP_CFG_BROWSER, + "queue_tabs", + true).toBool()); } void FormSettings::saveBrowser() { @@ -130,6 +133,9 @@ void FormSettings::saveBrowser() { Settings::getInstance()->setValue(APP_CFG_BROWSER, "gestures_enabled", m_ui->m_checkMouseGestures->isChecked()); + Settings::getInstance()->setValue(APP_CFG_BROWSER, + "queue_tabs", + m_ui->m_checkQueueTabs->isChecked()); } void FormSettings::loadProxy() { @@ -290,9 +296,9 @@ void FormSettings::loadInterface() { } // Load settings of icon theme. - QString current_theme = ThemeFactory::getInstance()->getCurrentIconTheme(); + QString current_theme = IconThemeFactory::getInstance()->getCurrentIconTheme(); - foreach (QString icon_theme_name, ThemeFactory::getInstance()->getInstalledIconThemes()) { + foreach (QString icon_theme_name, IconThemeFactory::getInstance()->getInstalledIconThemes()) { if (icon_theme_name == APP_THEME_SYSTEM) { #if defined(Q_OS_LINUX) m_ui->m_cmbIconTheme->addItem(tr("system icon theme (default)"), @@ -349,7 +355,7 @@ void FormSettings::saveInterface() { // Save selected icon theme. QString selected_icon_theme = m_ui->m_cmbIconTheme->itemData(m_ui->m_cmbIconTheme->currentIndex()).toString(); - ThemeFactory::getInstance()->setCurrentIconTheme(selected_icon_theme); + IconThemeFactory::getInstance()->setCurrentIconTheme(selected_icon_theme); // Save tab settings. Settings::getInstance()->setValue(APP_CFG_GUI, "tab_close_mid_button", diff --git a/src/gui/formsettings.ui b/src/gui/formsettings.ui index 2b75c150a..3131bf9d3 100644 --- a/src/gui/formsettings.ui +++ b/src/gui/formsettings.ui @@ -327,7 +327,7 @@ - + Enable mouse gestures @@ -353,6 +353,13 @@ + + + + Queue new tabs (with hyperlinks) after the active tab + + + diff --git a/src/gui/themefactory.cpp b/src/gui/iconthemefactory.cpp similarity index 85% rename from src/gui/themefactory.cpp rename to src/gui/iconthemefactory.cpp index d9869630c..71a66f09e 100644 --- a/src/gui/themefactory.cpp +++ b/src/gui/iconthemefactory.cpp @@ -4,13 +4,13 @@ #include #include -#include "gui/themefactory.h" +#include "gui/iconthemefactory.h" #include "qtsingleapplication/qtsingleapplication.h" #include "core/settings.h" #include "core/defs.h" -QPointer ThemeFactory::s_instance; +QPointer IconThemeFactory::s_instance; QEvent::Type ThemeFactoryEvent::m_typeOfEvent = QEvent::None; // @@ -36,45 +36,45 @@ QEvent::Type ThemeFactoryEvent::type() { // ThemeFactory class // -ThemeFactory::ThemeFactory(QObject *parent) +IconThemeFactory::IconThemeFactory(QObject *parent) : QObject(parent), m_currentIconTheme(APP_THEME_SYSTEM) { } -ThemeFactory::~ThemeFactory() { +IconThemeFactory::~IconThemeFactory() { qDebug("Destroying ThemeFactory instance."); } -ThemeFactory *ThemeFactory::getInstance() { +IconThemeFactory *IconThemeFactory::getInstance() { if (s_instance.isNull()) { - s_instance = new ThemeFactory(qApp); + s_instance = new IconThemeFactory(qApp); } return s_instance; } -void ThemeFactory::setupSearchPaths() { +void IconThemeFactory::setupSearchPaths() { // Add custom icon theme path to existing ones. QIcon::setThemeSearchPaths(QIcon::themeSearchPaths() << APP_THEME_PATH); qDebug("Available icon theme paths: %s.", qPrintable(QIcon::themeSearchPaths().join(", "))); } -QString ThemeFactory::getCurrentIconTheme() { +QString IconThemeFactory::getCurrentIconTheme() { return m_currentIconTheme; } -QIcon ThemeFactory::fromTheme(const QString &name, const QIcon &fallback) { +QIcon IconThemeFactory::fromTheme(const QString &name, const QIcon &fallback) { return QIcon::fromTheme(name, fallback); } -void ThemeFactory::setCurrentIconTheme(const QString &theme_name) { +void IconThemeFactory::setCurrentIconTheme(const QString &theme_name) { Settings::getInstance()->setValue(APP_CFG_GUI, "icon_theme", theme_name); loadCurrentIconTheme(true); } -void ThemeFactory::loadCurrentIconTheme(bool notify_widgets) { +void IconThemeFactory::loadCurrentIconTheme(bool notify_widgets) { QStringList installed_themes = getInstalledIconThemes(); QString theme_name_from_settings = Settings::getInstance()->value(APP_CFG_GUI, "icon_theme", @@ -113,7 +113,7 @@ void ThemeFactory::loadCurrentIconTheme(bool notify_widgets) { } } -QStringList ThemeFactory::getInstalledIconThemes() { +QStringList IconThemeFactory::getInstalledIconThemes() { QStringList icon_theme_names; icon_theme_names << APP_THEME_SYSTEM; diff --git a/src/gui/themefactory.h b/src/gui/iconthemefactory.h similarity index 89% rename from src/gui/themefactory.h rename to src/gui/iconthemefactory.h index 3e3dcf2ac..bf15a67ee 100644 --- a/src/gui/themefactory.h +++ b/src/gui/iconthemefactory.h @@ -6,12 +6,12 @@ #include -class ThemeFactory : public QObject { +class IconThemeFactory : public QObject { Q_OBJECT public: // Singleton getter. - static ThemeFactory *getInstance(); + static IconThemeFactory *getInstance(); // Wrapper for QIcon::fromTheme. // TODO: If icon is not found in user-defined icon theme, @@ -41,14 +41,14 @@ class ThemeFactory : public QObject { private: // Constructors and destructors - explicit ThemeFactory(QObject *parent = 0); - virtual ~ThemeFactory(); + explicit IconThemeFactory(QObject *parent = 0); + virtual ~IconThemeFactory(); // Holds name of the current icon theme. QString m_currentIconTheme; // Singleton. - static QPointer s_instance; + static QPointer s_instance; }; class ThemeFactoryEvent : public QEvent { diff --git a/src/gui/shortcutcatcher.cpp b/src/gui/shortcutcatcher.cpp index 09ca92689..ee3342f1d 100644 --- a/src/gui/shortcutcatcher.cpp +++ b/src/gui/shortcutcatcher.cpp @@ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "gui/shortcutcatcher.h" #include "gui/shortcutbutton.h" -#include "gui/themefactory.h" +#include "gui/iconthemefactory.h" ShortcutCatcher::ShortcutCatcher(QWidget *parent) @@ -43,7 +43,7 @@ ShortcutCatcher::ShortcutCatcher(QWidget *parent) // Create clear button. m_clearButton = new QToolButton(this); - m_clearButton->setIcon(ThemeFactory::getInstance()->fromTheme("document-revert")); + m_clearButton->setIcon(IconThemeFactory::getInstance()->fromTheme("document-revert")); m_clearButton->setFocusPolicy(Qt::NoFocus); // Clear main shortcut catching button. diff --git a/src/gui/tabwidget.cpp b/src/gui/tabwidget.cpp index 2c4058596..5e68c7492 100644 --- a/src/gui/tabwidget.cpp +++ b/src/gui/tabwidget.cpp @@ -2,9 +2,10 @@ #include #include "core/defs.h" +#include "core/settings.h" #include "gui/tabwidget.h" #include "gui/tabbar.h" -#include "gui/themefactory.h" +#include "gui/iconthemefactory.h" #include "gui/webbrowser.h" @@ -47,7 +48,7 @@ void TabWidget::setupIcons() { for (int index = 0; index < count(); index++) { // Index 0 usually contains widget which displays feeds & messages. if (tabBar()->tabType(index) == TabBar::FeedReader) { - setTabIcon(index, ThemeFactory::getInstance()->fromTheme("application-rss+xml")); + setTabIcon(index, IconThemeFactory::getInstance()->fromTheme("application-rss+xml")); } // Other indexes probably contain WebBrowsers. else { @@ -55,7 +56,7 @@ void TabWidget::setupIcons() { if (active_browser != nullptr && active_browser->icon().isNull()) { // We found WebBrowser instance of this tab page, which // has no suitable icon, load a new one from the icon theme. - setTabIcon(index, ThemeFactory::getInstance()->fromTheme("text-html")); + setTabIcon(index, IconThemeFactory::getInstance()->fromTheme("text-html")); } } } @@ -101,21 +102,25 @@ int TabWidget::insertTab(int index, QWidget *widget, const QString &label, return tab_index; } -void TabWidget::addEmptyBrowser() { +int TabWidget::addEmptyBrowser() { // TODO: Add reading of move_after_current and make_active // flags from settings. - addBrowser(false, true); + return addBrowser(false, true); } -void TabWidget::addLinkedBrowser(const QUrl &initial_url) { +int TabWidget::addLinkedBrowser(const QUrl &initial_url) { // TODO: Add reading of move_after_current and make_active // flags from settings. - addBrowser(true, false, initial_url); + return addBrowser(Settings::getInstance()->value(APP_CFG_BROWSER, + "queue_tabs", + true).toBool(), + false, + initial_url); } -void TabWidget::addBrowser(bool move_after_current, - bool make_active, - const QUrl &initial_url) { +int TabWidget::addBrowser(bool move_after_current, + bool make_active, + const QUrl &initial_url) { // Create new WebBrowser. WebBrowser *browser = new WebBrowser(this); int final_index; @@ -124,17 +129,16 @@ void TabWidget::addBrowser(bool move_after_current, // Insert web browser after current tab. final_index = insertTab(currentIndex() + 1, browser, - ThemeFactory::getInstance()->fromTheme("text-html"), + IconThemeFactory::getInstance()->fromTheme("text-html"), tr("Web browser"), TabBar::Closable); } else { // Add new browser as the last tab. final_index = addTab(browser, - ThemeFactory::getInstance()->fromTheme("text-html"), + IconThemeFactory::getInstance()->fromTheme("text-html"), tr("Web browser"), TabBar::Closable); - browser->setFocus(Qt::OtherFocusReason); } // Load initial web page if desired. @@ -145,5 +149,8 @@ void TabWidget::addBrowser(bool move_after_current, // Make new web browser active if desired. if (make_active) { setCurrentIndex(final_index); + browser->setFocus(Qt::OtherFocusReason); } + + return final_index; } diff --git a/src/gui/tabwidget.h b/src/gui/tabwidget.h index 237b681f8..c7e7fd0fa 100644 --- a/src/gui/tabwidget.h +++ b/src/gui/tabwidget.h @@ -46,14 +46,14 @@ class TabWidget : public QTabWidget { void closeTab(int index); // Adds new WebBrowser tab to global TabWidget. - void addEmptyBrowser(); + int addEmptyBrowser(); // Adds new WebBrowser with link. This is used when user // selects to "Open link in new tab.". - void addLinkedBrowser(const QUrl &initial_url); + int addLinkedBrowser(const QUrl &initial_url); // General method for adding WebBrowsers. - void addBrowser(bool move_after_current, + int addBrowser(bool move_after_current, bool make_active, const QUrl &initial_url = QUrl()); }; diff --git a/src/gui/webbrowser.cpp b/src/gui/webbrowser.cpp index 520c45192..07bdb3496 100644 --- a/src/gui/webbrowser.cpp +++ b/src/gui/webbrowser.cpp @@ -12,7 +12,7 @@ #include "gui/basewebview.h" #include "gui/webbrowser.h" #include "gui/locationlineedit.h" -#include "gui/themefactory.h" +#include "gui/iconthemefactory.h" #include "gui/tabwidget.h" @@ -80,16 +80,14 @@ void WebBrowser::createConnections() { this, &WebBrowser::updateUrl); // Connect this WebBrowser to global TabWidget. - // TODO: Přemýšlet nad tím, zda toto navázání spojení - // nepředělat například do TabWidget::AddBrowser a ty signály - // z m_webView tedy neforwardovat z WebBrowseru. + // TODO: Think over moving this connections from here to + // e.g. TabWidget::addBrowser. TabWidget *parent_widget = static_cast(parent()); connect(m_webView, &BaseWebView::newTabRequested, parent_widget, &TabWidget::addEmptyBrowser); connect(m_webView, &BaseWebView::linkMiddleClicked, parent_widget, &TabWidget::addLinkedBrowser); - // Change location textbox status according to webpage status. connect(m_webView, &BaseWebView::loadProgress, m_txtLocation, &LocationLineEdit::setProgress); @@ -138,10 +136,10 @@ void WebBrowser::setFocus(Qt::FocusReason reason) { } void WebBrowser::setupIcons() { - m_actionBack->setIcon(ThemeFactory::getInstance()->fromTheme("go-previous")); - m_actionForward->setIcon(ThemeFactory::getInstance()->fromTheme("go-next")); - m_actionReload->setIcon(ThemeFactory::getInstance()->fromTheme("view-refresh")); - m_actionStop->setIcon(ThemeFactory::getInstance()->fromTheme("process-stop")); + m_actionBack->setIcon(IconThemeFactory::getInstance()->fromTheme("go-previous")); + m_actionForward->setIcon(IconThemeFactory::getInstance()->fromTheme("go-next")); + m_actionReload->setIcon(IconThemeFactory::getInstance()->fromTheme("view-refresh")); + m_actionStop->setIcon(IconThemeFactory::getInstance()->fromTheme("process-stop")); m_webView->setupIcons(); } diff --git a/src/main.cpp b/src/main.cpp index b9c03b722..37f8febee 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,7 +10,7 @@ #include "core/localization.h" #include "core/settings.h" #include "core/dynamicshortcuts.h" -#include "gui/themefactory.h" +#include "gui/iconthemefactory.h" #include "gui/formmain.h" #include "gui/formwelcome.h" #include "gui/systemtrayicon.h" @@ -63,8 +63,8 @@ int main(int argc, char *argv[]) { #endif // Add an extra path for non-system icon themes and set current icon theme. - ThemeFactory::getInstance()->setupSearchPaths(); - ThemeFactory::getInstance()->loadCurrentIconTheme(false); + IconThemeFactory::getInstance()->setupSearchPaths(); + IconThemeFactory::getInstance()->loadCurrentIconTheme(false); // Load localization and setup locale before any widget is constructed. LoadLocalization();