diff --git a/bin/locale/sk_SK.qm b/bin/locale/sk_SK.qm index ef885ca73..709acd580 100644 Binary files a/bin/locale/sk_SK.qm and b/bin/locale/sk_SK.qm differ diff --git a/src/QupZilla.pro b/src/QupZilla.pro index 5d9cd12e9..c35c61c49 100644 --- a/src/QupZilla.pro +++ b/src/QupZilla.pro @@ -148,7 +148,8 @@ SOURCES += main.cpp\ tools/globalfunctions.cpp \ other/pagescreen.cpp \ downloads/downloadfilehelper.cpp \ - tools/certificateinfowidget.cpp + tools/certificateinfowidget.cpp \ + webview/webinspectordockwidget.cpp HEADERS += \ 3rdparty/qtwin.h \ @@ -245,7 +246,8 @@ HEADERS += \ tools/globalfunctions.h \ other/pagescreen.h \ downloads/downloadfilehelper.h \ - tools/certificateinfowidget.h + tools/certificateinfowidget.h \ + webview/webinspectordockwidget.h FORMS += \ preferences/autofillmanager.ui \ diff --git a/src/app/qupzilla.cpp b/src/app/qupzilla.cpp index f88ae7c29..0cf6de4c3 100644 --- a/src/app/qupzilla.cpp +++ b/src/app/qupzilla.cpp @@ -56,6 +56,7 @@ #include "browsinglibrary.h" #include "navigationbar.h" #include "pagescreen.h" +#include "webinspectordockwidget.h" const QString QupZilla::VERSION = "1.0.0-rc1"; const QString QupZilla::BUILDTIME = __DATE__" "__TIME__; @@ -886,32 +887,17 @@ void QupZilla::showStatusbar() settings.setValue("Browser-View-Settings/showStatusbar", !status); } -void QupZilla::showInspector() +void QupZilla::showWebInspector() { - if (!m_webInspectorDock) { - m_webInspectorDock = new QDockWidget(this); - if (m_webInspector) - delete m_webInspector; - m_webInspector = new QWebInspector(this); - m_webInspector->setPage(weView()->page()); - addDockWidget(Qt::BottomDockWidgetArea, m_webInspectorDock); - m_webInspectorDock->setWindowTitle(tr("Web Inspector")); - m_webInspectorDock->setTitleBarWidget(new DockTitleBarWidget(tr("Web Inspector"), m_webInspectorDock)); - m_webInspectorDock->setObjectName("WebInspector"); - m_webInspectorDock->setWidget(m_webInspector); - m_webInspectorDock->setFeatures(0); - m_webInspectorDock->setContextMenuPolicy(Qt::CustomContextMenu); - } else if (m_webInspectorDock->isVisible()) { //Next tab + if (m_webInspectorDock) { + m_webInspectorDock->setPage(weView()->webPage()); m_webInspectorDock->show(); - m_webInspector->setPage(weView()->page()); - m_webInspectorDock->setWidget(m_webInspector); - } else { //Showing hidden dock - m_webInspectorDock->show(); - if (m_webInspector->page() != weView()->page()) { - m_webInspector->setPage(weView()->page()); - m_webInspectorDock->setWidget(m_webInspector); - } + return; } + + m_webInspectorDock = new WebInspectorDockWidget(this); + connect(m_tabWidget, SIGNAL(currentChanged(int)), m_webInspectorDock, SLOT(tabChanged())); + addDockWidget(Qt::BottomDockWidgetArea, m_webInspectorDock); } void QupZilla::refreshHistory() @@ -1093,8 +1079,6 @@ QupZilla::~QupZilla() delete m_bookmarksToolbar; delete m_progressBar; - if (m_webInspectorDock) { - delete m_webInspector; + if (m_webInspectorDock) delete m_webInspectorDock; - } } diff --git a/src/app/qupzilla.h b/src/app/qupzilla.h index 783dca42d..e77793f2c 100644 --- a/src/app/qupzilla.h +++ b/src/app/qupzilla.h @@ -63,6 +63,7 @@ class ProgressBar; class StatusBarMessage; class NavigationBar; class ClickableLabel; +class WebInspectorDockWidget; class QupZilla : public QMainWindow { Q_OBJECT @@ -85,7 +86,6 @@ public: void addBookmark(const QUrl &url, const QString &title, const QIcon &icon); void installTranslator(); void loadSettings(); - void showInspector(); void showNavigationWithFullscreen(); inline WebView* weView() const { WebTab* webTab = qobject_cast(m_tabWidget->widget(m_tabWidget->currentIndex())); if (!webTab) return 0; return webTab->view(); } @@ -99,7 +99,6 @@ public: inline ProgressBar* progressBar(){ return m_progressBar; } inline QString activeProfil(){ return m_activeProfil; } inline QString activeLanguage(){ return m_activeLanguage; } - inline QDockWidget* inspectorDock(){ return m_webInspectorDock; } inline QLabel* ipLabel(){ return m_ipLabel; } inline QColor menuTextColor() { return m_menuTextColor; } inline QMenu* menuHelp() { return m_menuHelp; } @@ -115,6 +114,7 @@ signals: public slots: void setWindowTitle(const QString &t); + void showWebInspector(); void showBookmarksToolbar(); void loadActionUrl(); void loadActionUrlInNewTab(); @@ -224,8 +224,7 @@ private: QLabel* m_privateBrowsing; ClickableLabel* m_adblockIcon; - QPointer m_webInspector; - QPointer m_webInspectorDock; + QPointer m_webInspectorDock; BookmarksToolbar* m_bookmarksToolbar; TabWidget* m_tabWidget; diff --git a/src/webview/tabwidget.cpp b/src/webview/tabwidget.cpp index 121f85e1a..1575cb495 100644 --- a/src/webview/tabwidget.cpp +++ b/src/webview/tabwidget.cpp @@ -340,8 +340,6 @@ void TabWidget::currentTabChanged(int index) p_QupZilla->ipLabel()->show(); } - if (p_QupZilla->inspectorDock() && p_QupZilla->inspectorDock()->isVisible()) - p_QupZilla->showInspector(); webView->setFocus(); m_tabBar->updateCloseButton(index); diff --git a/src/webview/webinspectordockwidget.cpp b/src/webview/webinspectordockwidget.cpp new file mode 100644 index 000000000..0801e96a5 --- /dev/null +++ b/src/webview/webinspectordockwidget.cpp @@ -0,0 +1,57 @@ +#include "webinspectordockwidget.h" +#include "docktitlebarwidget.h" +#include "webpage.h" +#include "webview.h" +#include "webtab.h" +#include "qupzilla.h" + +WebInspectorDockWidget::WebInspectorDockWidget(QupZilla* mainClass) + : QDockWidget() + , p_QupZilla(mainClass) + , m_inspector(0) +{ + setWindowTitle(tr("Web Inspector")); + setObjectName("WebInspector"); + setFeatures(0); + setTitleBarWidget(new DockTitleBarWidget(tr("Web Inspector"), this)); + + show(); +} + +void WebInspectorDockWidget::close() +{ + delete m_inspector; + p_QupZilla->weView()->webTab()->setInspectorVisible(false); + + hide(); +} + +void WebInspectorDockWidget::show() +{ + if (!m_inspector) { + m_inspector = new QWebInspector(this); + m_inspector->setPage(p_QupZilla->weView()->page()); + setWidget(m_inspector); + } + + if (m_inspector->page() != p_QupZilla->weView()->page()) + m_inspector->setPage(p_QupZilla->weView()->page()); + + p_QupZilla->weView()->webTab()->setInspectorVisible(true); + + QDockWidget::show(); +} + +void WebInspectorDockWidget::tabChanged() +{ + if (p_QupZilla->weView()->webTab()->inspectorVisible()) + show(); + else + close(); +} + +WebInspectorDockWidget::~WebInspectorDockWidget() +{ + if (m_inspector) + delete m_inspector; +} diff --git a/src/webview/webinspectordockwidget.h b/src/webview/webinspectordockwidget.h new file mode 100644 index 000000000..4ca955efc --- /dev/null +++ b/src/webview/webinspectordockwidget.h @@ -0,0 +1,34 @@ +#ifndef WEBINSPECTORDOCKWIDGET_H +#define WEBINSPECTORDOCKWIDGET_H + +#include +#include +#include +#include + +class WebPage; +class QupZilla; +class WebInspectorDockWidget : public QDockWidget +{ + Q_OBJECT +public: + explicit WebInspectorDockWidget(QupZilla* mainClass); + ~WebInspectorDockWidget(); + + void setPage(WebPage* page) { m_page = page; } + +signals: + +public slots: + void tabChanged(); + + void close(); + void show(); + +private: + QupZilla* p_QupZilla; + QPointer m_inspector; + WebPage* m_page; +}; + +#endif // WEBINSPECTORDOCKWIDGET_H diff --git a/src/webview/webpage.h b/src/webview/webpage.h index 91a677abe..a86f6f24d 100644 --- a/src/webview/webpage.h +++ b/src/webview/webpage.h @@ -30,6 +30,7 @@ #include #include #include +#include class QupZilla; class WebView; diff --git a/src/webview/webtab.cpp b/src/webview/webtab.cpp index dbd80f92a..b1d81b6a1 100644 --- a/src/webview/webtab.cpp +++ b/src/webview/webtab.cpp @@ -23,11 +23,12 @@ #include "locationbar.h" WebTab::WebTab(QupZilla* mainClass, LocationBar* locationBar) - :QWidget() - ,p_QupZilla(mainClass) - ,m_view(0) - ,m_locationBar(locationBar) - ,m_pinned(false) + : QWidget() + , p_QupZilla(mainClass) + , m_view(0) + , m_locationBar(locationBar) + , m_pinned(false) + , m_inspectorVisible(false) { m_layout = new QVBoxLayout(this); m_layout->setContentsMargins(0,0,0,0); diff --git a/src/webview/webtab.h b/src/webview/webtab.h index bf9bddd89..d7eb4a142 100644 --- a/src/webview/webtab.h +++ b/src/webview/webtab.h @@ -39,17 +39,22 @@ public: void setLocationBar(LocationBar* bar) { m_locationBar = bar; } LocationBar* locationBar() { return m_locationBar; } + bool inspectorVisible() { return m_inspectorVisible; } + void setInspectorVisible(bool v) { m_inspectorVisible = v; } + private slots: void showNotification(QWidget* notif); private: int tabIndex(); + QupZilla* p_QupZilla; QPointer m_view; QVBoxLayout* m_layout; LocationBar* m_locationBar; bool m_pinned; + bool m_inspectorVisible; }; #endif // WEBTAB_H diff --git a/src/webview/webview.cpp b/src/webview/webview.cpp index 1b3527c91..8971a35d7 100644 --- a/src/webview/webview.cpp +++ b/src/webview/webview.cpp @@ -669,7 +669,7 @@ void WebView::bookmarkLink() void WebView::showInspector() { - p_QupZilla->showInspector(); + p_QupZilla->showWebInspector(); } void WebView::showSiteInfo() diff --git a/translations/sk_SK.ts b/translations/sk_SK.ts index f63597d1a..fc361967b 100644 --- a/translations/sk_SK.ts +++ b/translations/sk_SK.ts @@ -3070,7 +3070,7 @@ Prosím pridajte si nejaký kliknutím na RSS ikonku v navigačnom riadku. After adding or removing certificate paths, it is neccessary to restart browser in order to changes take effect. - + Po pridaní či odstránení ciest k certifikátom je nutné k zobrazeniu zmien reštart počítača. @@ -3095,7 +3095,7 @@ Prosím pridajte si nejaký kliknutím na RSS ikonku v navigačnom riadku. <b>NOTE:</b> Setting this option is big security risk! - + <b>Poznámka:</b> Zaškrtnutím tejto možnosti sa vystavujete veľkému bezpečnostnému riziku!