1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

[Flicker] Another set of flicker patches

Old approach caused navigationbar to be empty for a moment while
opening a lot of tabs at once
This commit is contained in:
nowrep 2014-02-13 16:44:00 +01:00
parent 6a4a41a5d9
commit 5e131033e6
9 changed files with 45 additions and 36 deletions

View File

@ -95,14 +95,14 @@ LocationBar::LocationBar(QupZilla* mainClass)
connect(mApp, SIGNAL(message(Qz::AppMessageType,bool)), SLOT(onMessage(Qz::AppMessageType,bool))); connect(mApp, SIGNAL(message(Qz::AppMessageType,bool)), SLOT(onMessage(Qz::AppMessageType,bool)));
loadSettings(); loadSettings();
clearIcon(); clearIcon();
updatePlaceHolderText();
// Hide icons by default // Hide icons by default
hideGoButton(); hideGoButton();
m_rssIcon->hide(); m_rssIcon->hide();
m_autofillIcon->hide(); m_autofillIcon->hide();
QTimer::singleShot(0, this, SLOT(updatePlaceHolderText()));
} }
void LocationBar::setWebView(TabbedWebView* view) void LocationBar::setWebView(TabbedWebView* view)

View File

@ -242,12 +242,6 @@ void NavigationBar::setLayoutSpacing(int spacing)
m_layout->setSpacing(spacing); m_layout->setSpacing(spacing);
} }
void NavigationBar::pauseUpdates()
{
setUpdatesEnabled(false);
QTimer::singleShot(100, this, SLOT(enableUpdates()));
}
void NavigationBar::aboutToShowHistoryBackMenu() void NavigationBar::aboutToShowHistoryBackMenu()
{ {
if (!m_menuBack || !p_QupZilla->weView()) { if (!m_menuBack || !p_QupZilla->weView()) {
@ -323,11 +317,6 @@ void NavigationBar::clearHistory()
refreshHistory(); refreshHistory();
} }
void NavigationBar::enableUpdates()
{
setUpdatesEnabled(true);
}
void NavigationBar::contextMenuRequested(const QPoint &pos) void NavigationBar::contextMenuRequested(const QPoint &pos)
{ {
p_QupZilla->popupToolbarsMenu(mapToGlobal(pos)); p_QupZilla->popupToolbarsMenu(mapToGlobal(pos));

View File

@ -63,9 +63,6 @@ public:
int layoutSpacing() const; int layoutSpacing() const;
void setLayoutSpacing(int spacing); void setLayoutSpacing(int spacing);
// Pause updates for 100 msecs
void pauseUpdates();
signals: signals:
public slots: public slots:
@ -84,8 +81,6 @@ private slots:
void goAtHistoryIndexInNewTab(int index = -1); void goAtHistoryIndexInNewTab(int index = -1);
void clearHistory(); void clearHistory();
void enableUpdates();
void contextMenuRequested(const QPoint &pos); void contextMenuRequested(const QPoint &pos);
private: private:

View File

@ -18,6 +18,7 @@
#include "reloadstopbutton.h" #include "reloadstopbutton.h"
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QTimer>
ReloadStopButton::ReloadStopButton(QWidget* parent) ReloadStopButton::ReloadStopButton(QWidget* parent)
: QWidget(parent) : QWidget(parent)
@ -46,22 +47,39 @@ ReloadStopButton::ReloadStopButton(QWidget* parent)
lay->setSpacing(0); lay->setSpacing(0);
} }
void ReloadStopButton::showReloadButton()
{
setUpdatesEnabled(false);
m_buttonStop->hide();
m_buttonReload->show();
setUpdatesEnabled(true);
}
void ReloadStopButton::showStopButton() void ReloadStopButton::showStopButton()
{ {
setUpdatesEnabled(false); if (updatesEnabled()) {
setUpdatesEnabled(false);
QTimer::singleShot(100, this, SLOT(enableUpdates()));
}
m_buttonReload->hide(); m_buttonReload->hide();
m_buttonStop->show(); m_buttonStop->show();
setUpdatesEnabled(true);
} }
ReloadStopButton::~ReloadStopButton() void ReloadStopButton::showReloadButton()
{ {
if (updatesEnabled()) {
setUpdatesEnabled(false);
QTimer::singleShot(100, this, SLOT(enableUpdates()));
}
m_buttonStop->hide();
m_buttonReload->show();
}
ToolButton* ReloadStopButton::buttonStop() const
{
return m_buttonStop;
}
ToolButton* ReloadStopButton::buttonReload() const
{
return m_buttonReload;
}
void ReloadStopButton::enableUpdates()
{
setUpdatesEnabled(true);
} }

View File

@ -23,15 +23,19 @@
class QT_QUPZILLA_EXPORT ReloadStopButton : public QWidget class QT_QUPZILLA_EXPORT ReloadStopButton : public QWidget
{ {
Q_OBJECT
public: public:
explicit ReloadStopButton(QWidget* parent = 0); explicit ReloadStopButton(QWidget* parent = 0);
~ReloadStopButton();
void showStopButton(); void showStopButton();
void showReloadButton(); void showReloadButton();
ToolButton* buttonStop() { return m_buttonStop; } ToolButton* buttonStop() const;
ToolButton* buttonReload() { return m_buttonReload; } ToolButton* buttonReload() const;
private slots:
void enableUpdates();
private: private:
ToolButton* m_buttonStop; ToolButton* m_buttonStop;

View File

@ -22,6 +22,7 @@
#include "qztools.h" #include "qztools.h"
#include <QDrag> #include <QDrag>
#include <QTimer>
#include <QMimeData> #include <QMimeData>
#include <QApplication> #include <QApplication>
#include <QContextMenuEvent> #include <QContextMenuEvent>

View File

@ -326,10 +326,6 @@ int TabWidget::addView(QNetworkRequest req, const QString &title, const Qz::NewT
QtWin::extendFrameIntoClientArea(p_QupZilla); QtWin::extendFrameIntoClientArea(p_QupZilla);
} }
#endif #endif
// Pause updates, so pages that loads instantly (eg. qupzilla: internal pages) don't cause
// flickering in navigationbar (load button and locationbar)
// Also disable updates of tabwidget, so background of webview doesn't flashes
p_QupZilla->navigationBar()->pauseUpdates();
setUpdatesEnabled(false); setUpdatesEnabled(false);
QUrl url = req.url(); QUrl url = req.url();

View File

@ -357,6 +357,11 @@ void WebTab::slotRestore()
m_view->tabWidget()->getTabBar()->restoreTabTextColor(tabIndex()); m_view->tabWidget()->getTabBar()->restoreTabTextColor(tabIndex());
} }
void WebTab::enableUpdates()
{
setUpdatesEnabled(true);
}
int WebTab::tabIndex() const int WebTab::tabIndex() const
{ {
return m_view->tabIndex(); return m_view->tabIndex();

View File

@ -100,6 +100,7 @@ public:
private slots: private slots:
void showNotification(QWidget* notif); void showNotification(QWidget* notif);
void slotRestore(); void slotRestore();
void enableUpdates();
private: private:
QupZilla* p_QupZilla; QupZilla* p_QupZilla;