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)));
loadSettings();
clearIcon();
updatePlaceHolderText();
// Hide icons by default
hideGoButton();
m_rssIcon->hide();
m_autofillIcon->hide();
QTimer::singleShot(0, this, SLOT(updatePlaceHolderText()));
}
void LocationBar::setWebView(TabbedWebView* view)

View File

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

View File

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

View File

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

View File

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

View File

@ -326,10 +326,6 @@ int TabWidget::addView(QNetworkRequest req, const QString &title, const Qz::NewT
QtWin::extendFrameIntoClientArea(p_QupZilla);
}
#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);
QUrl url = req.url();

View File

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

View File

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