1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Merge branch 'master' of github.com:QupZilla/qupzilla

This commit is contained in:
nowrep 2012-08-30 21:34:56 +02:00
commit d1d837616a
4 changed files with 204 additions and 61 deletions

View File

@ -204,7 +204,7 @@ bool QtWin::extendFrameIntoClientArea(QWidget* widget, int left, int top, int ri
if (resolveLibs()) { if (resolveLibs()) {
QLibrary dwmLib(QString::fromAscii("dwmapi")); QLibrary dwmLib(QString::fromAscii("dwmapi"));
HRESULT hr = S_OK; HRESULT hr = S_OK;
MARGINS m = {left, top, right, bottom}; MARGINS m = {left, right, top, bottom};
hr = pDwmExtendFrameIntoClientArea(widget->winId(), &m); hr = pDwmExtendFrameIntoClientArea(widget->winId(), &m);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
result = true; result = true;

View File

@ -260,6 +260,7 @@ void QupZilla::setupUi()
m_navigationBar = new NavigationBar(this); m_navigationBar = new NavigationBar(this);
m_navigationBar->setSplitterSizes(locationBarWidth, websearchBarWidth); m_navigationBar->setSplitterSizes(locationBarWidth, websearchBarWidth);
m_bookmarksToolbar = new BookmarksToolbar(this); m_bookmarksToolbar = new BookmarksToolbar(this);
m_mainSplitter->addWidget(m_tabWidget); m_mainSplitter->addWidget(m_tabWidget);
m_mainLayout->addWidget(m_navigationBar); m_mainLayout->addWidget(m_navigationBar);
m_mainLayout->addWidget(m_bookmarksToolbar); m_mainLayout->addWidget(m_bookmarksToolbar);
@ -595,6 +596,7 @@ void QupZilla::loadSettings()
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
if (m_usingTransparentBackground && !makeTransparent) { if (m_usingTransparentBackground && !makeTransparent) {
QtWin::extendFrameIntoClientArea(this, 0, 0, 0, 0);
QtWin::enableBlurBehindWindow(this, false); QtWin::enableBlurBehindWindow(this, false);
m_usingTransparentBackground = false; m_usingTransparentBackground = false;
} }
@ -615,12 +617,21 @@ void QupZilla::loadSettings()
ensurePolished(); // workaround Oxygen filling the background ensurePolished(); // workaround Oxygen filling the background
setAttribute(Qt::WA_StyledBackground, false); setAttribute(Qt::WA_StyledBackground, false);
#endif #endif
#ifdef Q_WS_WIN
if (QtWin::isCompositionEnabled()) { if (QtWin::isCompositionEnabled()) {
QtWin::extendFrameIntoClientArea(this);
setContentsMargins(0, 0, 0, 0); setContentsMargins(0, 0, 0, 0);
m_usingTransparentBackground = true; 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() void QupZilla::goNext()
@ -1226,6 +1237,13 @@ SideBar* QupZilla::addSideBar()
m_mainSplitter->setSizes(QList<int>() << m_sideBarWidth << m_webViewWidth); m_mainSplitter->setSizes(QList<int>() << m_sideBarWidth << m_webViewWidth);
#ifdef Q_WS_WIN
if (QtWin::isCompositionEnabled()) {
applyBlurToMainWindow();
m_sideBar.data()->installEventFilter(this);
}
#endif
return m_sideBar.data(); return m_sideBar.data();
} }
@ -1290,6 +1308,13 @@ void QupZilla::showWebInspector(bool toggle)
m_webInspectorDock = new WebInspectorDockWidget(this); m_webInspectorDock = new WebInspectorDockWidget(this);
connect(m_tabWidget, SIGNAL(currentChanged(int)), m_webInspectorDock.data(), SLOT(tabChanged())); connect(m_tabWidget, SIGNAL(currentChanged(int)), m_webInspectorDock.data(), SLOT(tabChanged()));
addDockWidget(Qt::BottomDockWidgetArea, m_webInspectorDock.data()); addDockWidget(Qt::BottomDockWidgetArea, m_webInspectorDock.data());
#ifdef Q_WS_WIN
if (QtWin::isCompositionEnabled()) {
applyBlurToMainWindow();
m_webInspectorDock.data()->installEventFilter(this);
}
#endif
} }
void QupZilla::showBookmarkImport() void QupZilla::showBookmarkImport()
@ -1389,6 +1414,13 @@ void QupZilla::searchOnPage()
SearchToolBar* search = new SearchToolBar(this); SearchToolBar* search = new SearchToolBar(this);
m_mainLayout->insertWidget(3, search); m_mainLayout->insertWidget(3, search);
search->focusSearchLine(); search->focusSearchLine();
#ifdef Q_WS_WIN
if (QtWin::isCompositionEnabled()) {
applyBlurToMainWindow();
search->installEventFilter(this);
}
#endif
} }
void QupZilla::openFile() void QupZilla::openFile()
@ -1449,6 +1481,7 @@ void QupZilla::fullScreen(bool make)
m_tabWidget->getTabBar()->hide(); m_tabWidget->getTabBar()->hide();
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
if (m_usingTransparentBackground) { if (m_usingTransparentBackground) {
QtWin::extendFrameIntoClientArea(this, 0, 0, 0 ,0);
QtWin::enableBlurBehindWindow(this, false); QtWin::enableBlurBehindWindow(this, false);
} }
#endif #endif
@ -1463,7 +1496,7 @@ void QupZilla::fullScreen(bool make)
m_tabWidget->showTabBar(); m_tabWidget->showTabBar();
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
if (m_usingTransparentBackground) { if (m_usingTransparentBackground) {
QtWin::enableBlurBehindWindow(this); applyBlurToMainWindow(true);
} }
#endif #endif
} }
@ -1794,6 +1827,108 @@ bool QupZilla::quitApp()
return true; 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<SearchToolBar*>(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<SearchToolBar*>(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() QupZilla::~QupZilla()
{ {
} }

View File

@ -187,6 +187,9 @@ private slots:
void closeWindow(); void closeWindow();
bool quitApp(); bool quitApp();
#ifdef Q_WS_WIN
void applyBlurToMainWindow(bool force = false);
#endif
private: private:
void resizeEvent(QResizeEvent* event); void resizeEvent(QResizeEvent* event);
@ -198,6 +201,10 @@ private:
void setupMenu(); void setupMenu();
void disconnectObjects(); void disconnectObjects();
#ifdef Q_WS_WIN
bool winEvent(MSG* message, long* result);
bool eventFilter(QObject *object, QEvent *event);
#endif
bool m_historyMenuChanged; bool m_historyMenuChanged;
bool m_bookmarksMenuChanged; bool m_bookmarksMenuChanged;

View File

@ -191,11 +191,11 @@
</message> </message>
<message> <message>
<source>Disable on %1</source> <source>Disable on %1</source>
<translation type="unfinished"></translation> <translation>Vypnúť na %1</translation>
</message> </message>
<message> <message>
<source>Disable only on this page</source> <source>Disable only on this page</source>
<translation type="unfinished"></translation> <translation>Vypnúť len na tejto stránke</translation>
</message> </message>
</context> </context>
<context> <context>
@ -499,7 +499,7 @@
</message> </message>
<message> <message>
<source>The file doesn&apos;t contain any bookmark.</source> <source>The file doesn&apos;t contain any bookmark.</source>
<translation type="unfinished"></translation> <translation>Tento súbor neobsahuje žiadne záložky.</translation>
</message> </message>
</context> </context>
<context> <context>
@ -758,7 +758,7 @@
</message> </message>
<message> <message>
<source>Organize Bookmarks</source> <source>Organize Bookmarks</source>
<translation type="unfinished"></translation> <translation>Organizovať záložky</translation>
</message> </message>
</context> </context>
<context> <context>
@ -1171,7 +1171,7 @@
</message> </message>
<message> <message>
<source>Remove</source> <source>Remove</source>
<translation type="unfinished"></translation> <translation>Odstrániť</translation>
</message> </message>
</context> </context>
<context> <context>
@ -1261,7 +1261,7 @@
</message> </message>
<message> <message>
<source>Download with External Manager</source> <source>Download with External Manager</source>
<translation type="unfinished"></translation> <translation>Stiahnuť pomocou externého manažéra</translation>
</message> </message>
</context> </context>
<context> <context>
@ -1295,35 +1295,35 @@
<name>FileSchemeReply</name> <name>FileSchemeReply</name>
<message> <message>
<source>No Error</source> <source>No Error</source>
<translation type="unfinished">Žiadna chyba</translation> <translation>Žiadna chyba</translation>
</message> </message>
<message> <message>
<source>Up to higher level directory</source> <source>Up to higher level directory</source>
<translation type="unfinished"></translation> <translation>O adresár vyššie</translation>
</message> </message>
<message> <message>
<source>Show hidden files</source> <source>Show hidden files</source>
<translation type="unfinished"></translation> <translation>Zobraziť skryté súbory</translation>
</message> </message>
<message> <message>
<source>Name</source> <source>Name</source>
<translation type="unfinished">Meno</translation> <translation>Meno</translation>
</message> </message>
<message> <message>
<source>Size</source> <source>Size</source>
<translation type="unfinished"></translation> <translation>Veľkosť</translation>
</message> </message>
<message> <message>
<source>Last modified</source> <source>Last modified</source>
<translation type="unfinished"></translation> <translation>Zmenené</translation>
</message> </message>
<message> <message>
<source>Index for %1</source> <source>Index for %1</source>
<translation type="unfinished"></translation> <translation>Index pre %1</translation>
</message> </message>
<message> <message>
<source>Folder is empty.</source> <source>Folder is empty.</source>
<translation type="unfinished"></translation> <translation>Priečinok je prázdny.</translation>
</message> </message>
</context> </context>
<context> <context>
@ -1687,19 +1687,19 @@
<name>PluginsManager</name> <name>PluginsManager</name>
<message> <message>
<source>Add site to whitelist</source> <source>Add site to whitelist</source>
<translation type="unfinished">Pridať stránku do zoznamu výnimiek</translation> <translation>Pridať stránku do zoznamu výnimiek</translation>
</message> </message>
<message> <message>
<source>Server without http:// (ex. youtube.com)</source> <source>Server without http:// (ex. youtube.com)</source>
<translation type="unfinished">Server bez http:// (napr. youtube.com)</translation> <translation>Server bez http:// (napr. youtube.com)</translation>
</message> </message>
<message> <message>
<source>Error!</source> <source>Error!</source>
<translation type="unfinished">Chyba!</translation> <translation>Chyba!</translation>
</message> </message>
<message> <message>
<source>Cannot load extension!</source> <source>Cannot load extension!</source>
<translation type="unfinished">Nemožno načítať rozšírenie!</translation> <translation>Nemožno načítať rozšírenie!</translation>
</message> </message>
</context> </context>
<context> <context>
@ -2362,55 +2362,55 @@
</message> </message>
<message> <message>
<source>Show web search bar</source> <source>Show web search bar</source>
<translation type="unfinished"></translation> <translation>Zobraziť vyhľadávací riadok</translation>
</message> </message>
<message> <message>
<source>Suggest when typing into address bar:</source> <source>Suggest when typing into address bar:</source>
<translation type="unfinished"></translation> <translation>Odporúčanie pri písaní v adresnom riadku:</translation>
</message> </message>
<message> <message>
<source>History and Bookmarks</source> <source>History and Bookmarks</source>
<translation type="unfinished"></translation> <translation>História a záložky</translation>
</message> </message>
<message> <message>
<source>History</source> <source>History</source>
<translation type="unfinished">História</translation> <translation>História</translation>
</message> </message>
<message> <message>
<source>Bookmarks</source> <source>Bookmarks</source>
<translation type="unfinished">Záložky</translation> <translation>Záložky</translation>
</message> </message>
<message> <message>
<source>Nothing</source> <source>Nothing</source>
<translation type="unfinished"></translation> <translation>Nič</translation>
</message> </message>
<message> <message>
<source>Leave blank if unsure</source> <source>Leave blank if unsure</source>
<translation type="unfinished"></translation> <translation>Pokiaľ ste si není istý, nevyplňujte</translation>
</message> </message>
<message> <message>
<source>&lt;b&gt;Change browser identification&lt;/b&gt;</source> <source>&lt;b&gt;Change browser identification&lt;/b&gt;</source>
<translation type="unfinished"></translation> <translation>&lt;b&gt;Zmeniť identifikáciu prehliadača&lt;/b&gt;</translation>
</message> </message>
<message> <message>
<source>User Agent Manager</source> <source>User Agent Manager</source>
<translation type="unfinished"></translation> <translation>User Agent Správca</translation>
</message> </message>
<message> <message>
<source>Tabs behavior</source> <source>Tabs behavior</source>
<translation type="unfinished"></translation> <translation>Chovanie panelov</translation>
</message> </message>
<message> <message>
<source>Address Bar behavior</source> <source>Address Bar behavior</source>
<translation type="unfinished"></translation> <translation>Chovanie adresného riadku</translation>
</message> </message>
<message> <message>
<source>Show loading progress in address bar</source> <source>Show loading progress in address bar</source>
<translation type="unfinished"></translation> <translation>Zobraziť priebeh načítavania v adresnom riadku</translation>
</message> </message>
<message> <message>
<source>Show close button on tabs</source> <source>Show close button on tabs</source>
<translation type="unfinished"></translation> <translation>Zobraziť zavieracie tlačidlo na paneloch</translation>
</message> </message>
</context> </context>
<context> <context>
@ -2429,11 +2429,11 @@
</message> </message>
<message> <message>
<source>Save file as...</source> <source>Save file as...</source>
<translation type="unfinished">Uložiť súbor ako...</translation> <translation>Uložiť súbor ako...</translation>
</message> </message>
<message> <message>
<source>Unknown size</source> <source>Unknown size</source>
<translation type="unfinished">Veľkosť neznáma</translation> <translation>Neznáma veľkosť</translation>
</message> </message>
</context> </context>
<context> <context>
@ -3112,31 +3112,31 @@ Skutočne chcete skončiť?</translation>
</message> </message>
<message> <message>
<source>Are you sure to remove this speed dial?</source> <source>Are you sure to remove this speed dial?</source>
<translation type="unfinished"></translation> <translation>Ste si istý, že chcete zmazať túto stránku?</translation>
</message> </message>
<message> <message>
<source>Center speed dials</source> <source>Center speed dials</source>
<translation type="unfinished"></translation> <translation>Vycentrovať náhľady stránok</translation>
</message> </message>
<message> <message>
<source>Restore Session</source> <source>Restore Session</source>
<translation type="unfinished"></translation> <translation>Obnoviť reláciu</translation>
</message> </message>
<message> <message>
<source>Oops, QupZilla crashed.</source> <source>Oops, QupZilla crashed.</source>
<translation type="unfinished"></translation> <translation>Oops, QupZilla spadla.</translation>
</message> </message>
<message> <message>
<source>We apologize for this. Would you like to restore the last saved state?</source> <source>We apologize for this. Would you like to restore the last saved state?</source>
<translation type="unfinished"></translation> <translation>Ospravedlňujeme sa. Chcete obnoviť poslednú uloženú reláciu?</translation>
</message> </message>
<message> <message>
<source>Try removing one or more tabs that you think cause troubles</source> <source>Try removing one or more tabs that you think cause troubles</source>
<translation type="unfinished"></translation> <translation>Skúste odobrať jeden alebo viac panelov, o ktorých si myslíte, že môžu spôsobovať problémy</translation>
</message> </message>
<message> <message>
<source>Or you can start completely new session</source> <source>Or you can start completely new session</source>
<translation type="unfinished"></translation> <translation>Alebo môžete začať úplne novú reláciu</translation>
</message> </message>
</context> </context>
<context> <context>
@ -3306,15 +3306,15 @@ Prosím pridajte nejaké kliknutím na RSS ikonku v navigačnom paneli na strán
<name>RecoveryWidget</name> <name>RecoveryWidget</name>
<message> <message>
<source>Restore</source> <source>Restore</source>
<translation type="unfinished"></translation> <translation>Obnoviť</translation>
</message> </message>
<message> <message>
<source>Start New Session</source> <source>Start New Session</source>
<translation type="unfinished"></translation> <translation>Začať novú reláciu</translation>
</message> </message>
<message> <message>
<source>Window %1</source> <source>Window %1</source>
<translation type="unfinished"></translation> <translation>Okno %1</translation>
</message> </message>
</context> </context>
<context> <context>
@ -3981,51 +3981,51 @@ Po pridaní či odobratí ciest k certifikátom je nutné reštartovať prehliad
<name>UserAgentDialog</name> <name>UserAgentDialog</name>
<message> <message>
<source>User Agent Manager</source> <source>User Agent Manager</source>
<translation type="unfinished"></translation> <translation>User Agent Správca</translation>
</message> </message>
<message> <message>
<source>Change global User Agent</source> <source>Change global User Agent</source>
<translation type="unfinished"></translation> <translation>Zmeniť globálny User Agent</translation>
</message> </message>
<message> <message>
<source>Use different User Agents for specified sites</source> <source>Use different User Agents for specified sites</source>
<translation type="unfinished"></translation> <translation>Používať rôzne User Agenty pre zvolené stránky</translation>
</message> </message>
<message> <message>
<source>Site</source> <source>Site</source>
<translation type="unfinished"></translation> <translation>Stránka</translation>
</message> </message>
<message> <message>
<source>User Agent</source> <source>User Agent</source>
<translation type="unfinished"></translation> <translation>User Agent</translation>
</message> </message>
<message> <message>
<source>Add</source> <source>Add</source>
<translation type="unfinished">Pridať</translation> <translation>Pridať</translation>
</message> </message>
<message> <message>
<source>Remove</source> <source>Remove</source>
<translation type="unfinished"></translation> <translation>Odstrániť</translation>
</message> </message>
<message> <message>
<source>Edit</source> <source>Edit</source>
<translation type="unfinished"></translation> <translation>Upraviť</translation>
</message> </message>
<message> <message>
<source>Add new site</source> <source>Add new site</source>
<translation type="unfinished"></translation> <translation>Pridať novú stránku</translation>
</message> </message>
<message> <message>
<source>Edit site</source> <source>Edit site</source>
<translation type="unfinished"></translation> <translation>Upraviť stránku</translation>
</message> </message>
<message> <message>
<source>Site domain: </source> <source>Site domain: </source>
<translation type="unfinished"></translation> <translation>Doména stránky: </translation>
</message> </message>
<message> <message>
<source>User Agent: </source> <source>User Agent: </source>
<translation type="unfinished"></translation> <translation>User Agent:</translation>
</message> </message>
</context> </context>
<context> <context>
@ -4166,11 +4166,12 @@ Po pridaní či odobratí ciest k certifikátom je nutné reštartovať prehliad
<message> <message>
<source>To show this page, QupZilla must resend request which do it again <source>To show this page, QupZilla must resend request which do it again
(like searching on making an shopping, which has been already done.)</source> (like searching on making an shopping, which has been already done.)</source>
<translation type="unfinished"></translation> <translation>Pre zobrazenie tejto stránky musí QupZilla znovu odoslať požiadavku na server
(ako napr. hľadanie pri nakupovaní, ktoré prebehlo)</translation>
</message> </message>
<message> <message>
<source>QupZilla can&apos;t load page.</source> <source>QupZilla can&apos;t load page.</source>
<translation type="unfinished"></translation> <translation>QupZilla nemôže načítať stránku.</translation>
</message> </message>
</context> </context>
<context> <context>
@ -4193,7 +4194,7 @@ Po pridaní či odobratí ciest k certifikátom je nutné reštartovať prehliad
</message> </message>
<message> <message>
<source>Show suggestions</source> <source>Show suggestions</source>
<translation type="unfinished"></translation> <translation>Zobraziť našepkávač</translation>
</message> </message>
</context> </context>
<context> <context>