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

LocationBar: Use normal timer for hiding progress

This commit is contained in:
David Rosca 2016-02-27 17:12:39 +01:00
parent f46364bc55
commit 3d2001a249
2 changed files with 11 additions and 4 deletions

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -84,6 +84,11 @@ LocationBar::LocationBar(BrowserWindow* window)
domainCompleter->setModel(m_domainCompleterModel);
setCompleter(domainCompleter);
m_progressTimer = new QTimer(this);
m_progressTimer->setInterval(700);
m_progressTimer->setSingleShot(true);
connect(m_progressTimer, &QTimer::timeout, this, &LocationBar::hideProgress);
editAction(PasteAndGo)->setText(tr("Paste And &Go"));
editAction(PasteAndGo)->setIcon(QIcon::fromTheme(QSL("edit-paste")));
connect(editAction(PasteAndGo), SIGNAL(triggered()), this, SLOT(pasteAndGo()));
@ -531,6 +536,7 @@ void LocationBar::keyPressEvent(QKeyEvent* event)
void LocationBar::loadStarted()
{
m_progressVisible = true;
m_progressTimer->stop();
m_autofillIcon->hide();
m_siteIcon->setIcon(IconProvider::emptyWebIcon());
}
@ -546,7 +552,7 @@ void LocationBar::loadProgress(int progress)
void LocationBar::loadFinished()
{
if (qzSettings->showLoadingProgress) {
QTimer::singleShot(700, this, SLOT(hideProgress()));
m_progressTimer->start();
}
WebPage* page = qobject_cast<WebPage*>(m_webView->page());
@ -571,7 +577,7 @@ void LocationBar::loadSettings()
void LocationBar::hideProgress()
{
if (qzSettings->showLoadingProgress && m_loadProgress == 100) {
if (qzSettings->showLoadingProgress) {
m_progressVisible = false;
update();
}

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -108,6 +108,7 @@ private:
bool m_progressVisible;
ProgressStyle m_progressStyle;
QColor m_progressColor;
QTimer *m_progressTimer;
};
#endif // LOCATIONBAR_H