From 2861f4dae4b6dd68e60efe9b668e78acad5c10b3 Mon Sep 17 00:00:00 2001 From: "S. Razi Alavizadeh" Date: Thu, 30 Aug 2012 13:16:58 +0430 Subject: [PATCH 1/2] Fixed conflict between blur background and Adobe PDF plugins on Windows. --- src/lib/3rdparty/qtwin.cpp | 2 +- src/lib/app/qupzilla.cpp | 139 ++++++++++++++++++++++++++++++++++++- src/lib/app/qupzilla.h | 7 ++ 3 files changed, 145 insertions(+), 3 deletions(-) diff --git a/src/lib/3rdparty/qtwin.cpp b/src/lib/3rdparty/qtwin.cpp index 3e650176b..4b6b4aa85 100644 --- a/src/lib/3rdparty/qtwin.cpp +++ b/src/lib/3rdparty/qtwin.cpp @@ -204,7 +204,7 @@ bool QtWin::extendFrameIntoClientArea(QWidget* widget, int left, int top, int ri if (resolveLibs()) { QLibrary dwmLib(QString::fromAscii("dwmapi")); HRESULT hr = S_OK; - MARGINS m = {left, top, right, bottom}; + MARGINS m = {left, right, top, bottom}; hr = pDwmExtendFrameIntoClientArea(widget->winId(), &m); if (SUCCEEDED(hr)) { result = true; diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp index 3e7a48eab..e5286a610 100644 --- a/src/lib/app/qupzilla.cpp +++ b/src/lib/app/qupzilla.cpp @@ -260,6 +260,7 @@ void QupZilla::setupUi() m_navigationBar = new NavigationBar(this); m_navigationBar->setSplitterSizes(locationBarWidth, websearchBarWidth); m_bookmarksToolbar = new BookmarksToolbar(this); + m_mainSplitter->addWidget(m_tabWidget); m_mainLayout->addWidget(m_navigationBar); m_mainLayout->addWidget(m_bookmarksToolbar); @@ -595,6 +596,7 @@ void QupZilla::loadSettings() #ifdef Q_WS_WIN if (m_usingTransparentBackground && !makeTransparent) { + QtWin::extendFrameIntoClientArea(this, 0, 0, 0, 0); QtWin::enableBlurBehindWindow(this, false); m_usingTransparentBackground = false; } @@ -615,12 +617,21 @@ void QupZilla::loadSettings() ensurePolished(); // workaround Oxygen filling the background setAttribute(Qt::WA_StyledBackground, false); #endif + +#ifdef Q_WS_WIN if (QtWin::isCompositionEnabled()) { - QtWin::extendFrameIntoClientArea(this); setContentsMargins(0, 0, 0, 0); m_usingTransparentBackground = true; + + applyBlurToMainWindow(); + //install event filter + menuBar()->installEventFilter(this); + m_navigationBar->installEventFilter(this); + m_bookmarksToolbar->installEventFilter(this); + statusBar()->installEventFilter(this); } +#endif } void QupZilla::goNext() @@ -1226,6 +1237,13 @@ SideBar* QupZilla::addSideBar() m_mainSplitter->setSizes(QList() << m_sideBarWidth << m_webViewWidth); +#ifdef Q_WS_WIN + if (QtWin::isCompositionEnabled()) { + applyBlurToMainWindow(); + m_sideBar.data()->installEventFilter(this); + } +#endif + return m_sideBar.data(); } @@ -1290,6 +1308,13 @@ void QupZilla::showWebInspector(bool toggle) m_webInspectorDock = new WebInspectorDockWidget(this); connect(m_tabWidget, SIGNAL(currentChanged(int)), m_webInspectorDock.data(), SLOT(tabChanged())); addDockWidget(Qt::BottomDockWidgetArea, m_webInspectorDock.data()); + +#ifdef Q_WS_WIN + if (QtWin::isCompositionEnabled()) { + applyBlurToMainWindow(); + m_webInspectorDock.data()->installEventFilter(this); + } +#endif } void QupZilla::showBookmarkImport() @@ -1389,6 +1414,13 @@ void QupZilla::searchOnPage() SearchToolBar* search = new SearchToolBar(this); m_mainLayout->insertWidget(3, search); search->focusSearchLine(); + +#ifdef Q_WS_WIN + if (QtWin::isCompositionEnabled()) { + applyBlurToMainWindow(); + search->installEventFilter(this); + } +#endif } void QupZilla::openFile() @@ -1449,6 +1481,7 @@ void QupZilla::fullScreen(bool make) m_tabWidget->getTabBar()->hide(); #ifdef Q_WS_WIN if (m_usingTransparentBackground) { + QtWin::extendFrameIntoClientArea(this, 0, 0, 0 ,0); QtWin::enableBlurBehindWindow(this, false); } #endif @@ -1463,7 +1496,7 @@ void QupZilla::fullScreen(bool make) m_tabWidget->showTabBar(); #ifdef Q_WS_WIN if (m_usingTransparentBackground) { - QtWin::enableBlurBehindWindow(this); + applyBlurToMainWindow(true); } #endif } @@ -1794,6 +1827,108 @@ bool QupZilla::quitApp() return true; } +#ifdef Q_WS_WIN +bool QupZilla::winEvent(MSG *message, long *result) +{ + if (message && message->message == WM_DWMCOMPOSITIONCHANGED) { + Settings settings; + settings.beginGroup("Browser-View-Settings"); + m_usingTransparentBackground = settings.value("useTransparentBackground", false).toBool(); + settings.endGroup(); + if (m_usingTransparentBackground && QtWin::isCompositionEnabled()) { + setUpdatesEnabled(false); + + QtWin::extendFrameIntoClientArea(this, 0, 0, 0, 0); + QTimer::singleShot(0, this, SLOT(applyBlurToMainWindow())); + + //install event filter + menuBar()->installEventFilter(this); + m_navigationBar->installEventFilter(this); + m_bookmarksToolbar->installEventFilter(this); + statusBar()->installEventFilter(this); + + if (m_sideBar) { + m_sideBar.data()->installEventFilter(this); + } + + if (m_mainLayout->count() == 4) { + SearchToolBar* search = qobject_cast(m_mainLayout->itemAt(3)->widget()); + if (search) { + search->installEventFilter(this); + } + } + + if (m_webInspectorDock) { + m_webInspectorDock.data()->installEventFilter(this); + } + + if (isVisible()) + { + hide(); + show(); + } + setUpdatesEnabled(true); + } + } + return QMainWindow::winEvent(message, result); +} + +void QupZilla::applyBlurToMainWindow(bool force) +{ + if (!force && (m_actionShowFullScreen->isChecked() || !m_usingTransparentBackground)) return; + int topMargin = 0; + int bottomMargin = 1; + int rightMargin = 1; + int leftMargin = 1; + + if (m_sideBar) { + if (isRightToLeft()) + rightMargin += m_sideBar.data()->width() + m_mainSplitter->handleWidth(); + else + leftMargin += m_sideBar.data()->width() + m_mainSplitter->handleWidth(); + } + + topMargin += menuBar()->isVisible() ? menuBar()->height() : 0; + topMargin += m_navigationBar->isVisible() ? m_navigationBar->height() : 0; + topMargin += m_bookmarksToolbar->isVisible() ? m_bookmarksToolbar->height() : 0; + topMargin += m_tabWidget->getTabBar()->height(); + + if (m_mainLayout->count() == 4) { + SearchToolBar* search = qobject_cast(m_mainLayout->itemAt(3)->widget()); + if (search) { + bottomMargin += search->height(); + } + } + + bottomMargin += statusBar()->isVisible() ? statusBar()->height() : 0; + + if (m_webInspectorDock) { + bottomMargin += m_webInspectorDock.data()->isVisible() + ? m_webInspectorDock.data()->height() + + m_webInspectorDock.data()->style()->pixelMetric( QStyle::PM_DockWidgetSeparatorExtent) + : 0; + } + + QtWin::extendFrameIntoClientArea(this, leftMargin, topMargin, rightMargin, bottomMargin); +} + +bool QupZilla::eventFilter(QObject *object, QEvent *event) +{ + switch (event->type()) { + case QEvent::DeferredDelete: + case QEvent::Show: + case QEvent::Hide: + case QEvent::Resize: + applyBlurToMainWindow(); + break; + default: + break; + } + + return QMainWindow::eventFilter(object, event); +} +#endif + QupZilla::~QupZilla() { } diff --git a/src/lib/app/qupzilla.h b/src/lib/app/qupzilla.h index 087eb9619..8a93efd9b 100644 --- a/src/lib/app/qupzilla.h +++ b/src/lib/app/qupzilla.h @@ -187,6 +187,9 @@ private slots: void closeWindow(); bool quitApp(); +#ifdef Q_WS_WIN + void applyBlurToMainWindow(bool force = false); +#endif private: void resizeEvent(QResizeEvent* event); @@ -198,6 +201,10 @@ private slots: void setupMenu(); void disconnectObjects(); +#ifdef Q_WS_WIN + bool winEvent(MSG* message, long* result); + bool eventFilter(QObject *object, QEvent *event); +#endif bool m_historyMenuChanged; bool m_bookmarksMenuChanged; From bbe74f9abafd107ea5bbe68f5ef110cf90b11187 Mon Sep 17 00:00:00 2001 From: Mikino89 Date: Thu, 30 Aug 2012 14:44:35 +0200 Subject: [PATCH 2/2] Update Slovak translation --- translations/sk_SK.ts | 117 +++++++++++++++++++++--------------------- 1 file changed, 59 insertions(+), 58 deletions(-) diff --git a/translations/sk_SK.ts b/translations/sk_SK.ts index ac001a798..8b7f96e67 100644 --- a/translations/sk_SK.ts +++ b/translations/sk_SK.ts @@ -191,11 +191,11 @@ Disable on %1 - + Vypnúť na %1 Disable only on this page - + Vypnúť len na tejto stránke @@ -499,7 +499,7 @@ The file doesn't contain any bookmark. - + Tento súbor neobsahuje žiadne záložky. @@ -758,7 +758,7 @@ Organize Bookmarks - + Organizovať záložky @@ -1171,7 +1171,7 @@ Remove - + Odstrániť @@ -1261,7 +1261,7 @@ Download with External Manager - + Stiahnuť pomocou externého manažéra @@ -1295,35 +1295,35 @@ FileSchemeReply No Error - Žiadna chyba + Žiadna chyba Up to higher level directory - + O adresár vyššie Show hidden files - + Zobraziť skryté súbory Name - Meno + Meno Size - + Veľkosť Last modified - + Zmenené Index for %1 - + Index pre %1 Folder is empty. - + Priečinok je prázdny. @@ -1687,19 +1687,19 @@ PluginsManager Add site to whitelist - Pridať stránku do zoznamu výnimiek + Pridať stránku do zoznamu výnimiek Server without http:// (ex. youtube.com) - Server bez http:// (napr. youtube.com) + Server bez http:// (napr. youtube.com) Error! - Chyba! + Chyba! Cannot load extension! - Nemožno načítať rozšírenie! + Nemožno načítať rozšírenie! @@ -2362,55 +2362,55 @@ Show web search bar - + Zobraziť vyhľadávací riadok Suggest when typing into address bar: - + Odporúčanie pri písaní v adresnom riadku: History and Bookmarks - + História a záložky History - História + História Bookmarks - Záložky + Záložky Nothing - + Nič Leave blank if unsure - + Pokiaľ ste si není istý, nevyplňujte <b>Change browser identification</b> - + <b>Zmeniť identifikáciu prehliadača</b> User Agent Manager - + User Agent Správca Tabs behavior - + Chovanie panelov Address Bar behavior - + Chovanie adresného riadku Show loading progress in address bar - + Zobraziť priebeh načítavania v adresnom riadku Show close button on tabs - + Zobraziť zavieracie tlačidlo na paneloch @@ -2429,11 +2429,11 @@ Save file as... - Uložiť súbor ako... + Uložiť súbor ako... Unknown size - Veľkosť neznáma + Neznáma veľkosť @@ -3112,31 +3112,31 @@ Skutočne chcete skončiť? Are you sure to remove this speed dial? - + Ste si istý, že chcete zmazať túto stránku? Center speed dials - + Vycentrovať náhľady stránok Restore Session - + Obnoviť reláciu Oops, QupZilla crashed. - + Oops, QupZilla spadla. We apologize for this. Would you like to restore the last saved state? - + Ospravedlňujeme sa. Chcete obnoviť poslednú uloženú reláciu? Try removing one or more tabs that you think cause troubles - + Skúste odobrať jeden alebo viac panelov, o ktorých si myslíte, že môžu spôsobovať problémy Or you can start completely new session - + Alebo môžete začať úplne novú reláciu @@ -3306,15 +3306,15 @@ Prosím pridajte nejaké kliknutím na RSS ikonku v navigačnom paneli na strán RecoveryWidget Restore - + Obnoviť Start New Session - + Začať novú reláciu Window %1 - + Okno %1 @@ -3981,51 +3981,51 @@ Po pridaní či odobratí ciest k certifikátom je nutné reštartovať prehliad UserAgentDialog User Agent Manager - + User Agent Správca Change global User Agent - + Zmeniť globálny User Agent Use different User Agents for specified sites - + Používať rôzne User Agenty pre zvolené stránky Site - + Stránka User Agent - + User Agent Add - Pridať + Pridať Remove - + Odstrániť Edit - + Upraviť Add new site - + Pridať novú stránku Edit site - + Upraviť stránku Site domain: - + Doména stránky: User Agent: - + User Agent: @@ -4166,11 +4166,12 @@ Po pridaní či odobratí ciest k certifikátom je nutné reštartovať prehliad To show this page, QupZilla must resend request which do it again (like searching on making an shopping, which has been already done.) - + Pre zobrazenie tejto stránky musí QupZilla znovu odoslať požiadavku na server +(ako napr. hľadanie pri nakupovaní, ktoré už prebehlo) QupZilla can't load page. - + QupZilla nemôže načítať stránku. @@ -4193,7 +4194,7 @@ Po pridaní či odobratí ciest k certifikátom je nutné reštartovať prehliad Show suggestions - + Zobraziť našepkávač