mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Fix progress bar
The custom ProgressBar no longer changed direction correctly. Since I couldn't see a need for it, I removed it and used QProgressBar
This commit is contained in:
parent
b059b661c2
commit
064eb92e77
@ -254,7 +254,6 @@ set(SRCS ${SRCS}
|
|||||||
tools/mactoolbutton.cpp
|
tools/mactoolbutton.cpp
|
||||||
tools/menubar.cpp
|
tools/menubar.cpp
|
||||||
tools/pagethumbnailer.cpp
|
tools/pagethumbnailer.cpp
|
||||||
tools/progressbar.cpp
|
|
||||||
tools/qztools.cpp
|
tools/qztools.cpp
|
||||||
tools/removeitemfocusdelegate.cpp
|
tools/removeitemfocusdelegate.cpp
|
||||||
tools/scripts.cpp
|
tools/scripts.cpp
|
||||||
@ -488,7 +487,6 @@ set(SRCS ${SRCS}
|
|||||||
tools/mactoolbutton.h
|
tools/mactoolbutton.h
|
||||||
tools/menubar.h
|
tools/menubar.h
|
||||||
tools/pagethumbnailer.h
|
tools/pagethumbnailer.h
|
||||||
tools/progressbar.h
|
|
||||||
tools/qztools.h
|
tools/qztools.h
|
||||||
tools/removeitemfocusdelegate.h
|
tools/removeitemfocusdelegate.h
|
||||||
tools/scripts.h
|
tools/scripts.h
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
#include "clickablelabel.h"
|
#include "clickablelabel.h"
|
||||||
#include "docktitlebarwidget.h"
|
#include "docktitlebarwidget.h"
|
||||||
#include "iconprovider.h"
|
#include "iconprovider.h"
|
||||||
#include "progressbar.h"
|
|
||||||
#include "closedwindowsmanager.h"
|
#include "closedwindowsmanager.h"
|
||||||
#include "statusbar.h"
|
#include "statusbar.h"
|
||||||
#include "browsinglibrary.h"
|
#include "browsinglibrary.h"
|
||||||
@ -72,6 +71,7 @@
|
|||||||
#include <QWebEngineHistory>
|
#include <QWebEngineHistory>
|
||||||
#include <QWebEngineSettings>
|
#include <QWebEngineSettings>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QProgressBar>
|
||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QCollator>
|
#include <QCollator>
|
||||||
@ -387,7 +387,7 @@ void BrowserWindow::setupUi()
|
|||||||
m_statusBar->setObjectName(QSL("mainwindow-statusbar"));
|
m_statusBar->setObjectName(QSL("mainwindow-statusbar"));
|
||||||
m_statusBar->setCursor(Qt::ArrowCursor);
|
m_statusBar->setCursor(Qt::ArrowCursor);
|
||||||
setStatusBar(m_statusBar);
|
setStatusBar(m_statusBar);
|
||||||
m_progressBar = new ProgressBar(m_statusBar);
|
m_progressBar = new QProgressBar(m_statusBar);
|
||||||
m_ipLabel = new QLabel(this);
|
m_ipLabel = new QLabel(this);
|
||||||
m_ipLabel->setObjectName(QSL("statusbar-ip-label"));
|
m_ipLabel->setObjectName(QSL("statusbar-ip-label"));
|
||||||
m_ipLabel->setToolTip(tr("IP Address of current page"));
|
m_ipLabel->setToolTip(tr("IP Address of current page"));
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QVBoxLayout;
|
class QVBoxLayout;
|
||||||
|
class QProgressBar;
|
||||||
class QSplitter;
|
class QSplitter;
|
||||||
class QWebEngineFrame;
|
class QWebEngineFrame;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
@ -45,7 +46,6 @@ class WebView;
|
|||||||
class WebPage;
|
class WebPage;
|
||||||
class SideBar;
|
class SideBar;
|
||||||
class SideBarManager;
|
class SideBarManager;
|
||||||
class ProgressBar;
|
|
||||||
class StatusBar;
|
class StatusBar;
|
||||||
class NavigationBar;
|
class NavigationBar;
|
||||||
class NavigationContainer;
|
class NavigationContainer;
|
||||||
@ -214,7 +214,7 @@ private:
|
|||||||
NavigationBar* m_navigationToolbar;
|
NavigationBar* m_navigationToolbar;
|
||||||
BookmarksToolbar* m_bookmarksToolbar;
|
BookmarksToolbar* m_bookmarksToolbar;
|
||||||
|
|
||||||
ProgressBar* m_progressBar;
|
QProgressBar* m_progressBar;
|
||||||
QLabel* m_ipLabel;
|
QLabel* m_ipLabel;
|
||||||
|
|
||||||
QMenu* m_superMenu;
|
QMenu* m_superMenu;
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
#include "popupwebview.h"
|
#include "popupwebview.h"
|
||||||
#include "webpage.h"
|
#include "webpage.h"
|
||||||
#include "popupstatusbarmessage.h"
|
#include "popupstatusbarmessage.h"
|
||||||
#include "progressbar.h"
|
|
||||||
#include "searchtoolbar.h"
|
#include "searchtoolbar.h"
|
||||||
#include "qzsettings.h"
|
#include "qzsettings.h"
|
||||||
#include "popuplocationbar.h"
|
#include "popuplocationbar.h"
|
||||||
@ -27,10 +26,11 @@
|
|||||||
#include "mainapplication.h"
|
#include "mainapplication.h"
|
||||||
#include "browserwindow.h"
|
#include "browserwindow.h"
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QStatusBar>
|
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
|
#include <QProgressBar>
|
||||||
|
#include <QStatusBar>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
PopupWindow::PopupWindow(PopupWebView* view)
|
PopupWindow::PopupWindow(PopupWebView* view)
|
||||||
: QWidget()
|
: QWidget()
|
||||||
@ -53,7 +53,7 @@ PopupWindow::PopupWindow(PopupWebView* view)
|
|||||||
m_statusBar = new QStatusBar(this);
|
m_statusBar = new QStatusBar(this);
|
||||||
m_statusBar->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
|
m_statusBar->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
|
||||||
|
|
||||||
m_progressBar = new ProgressBar(m_statusBar);
|
m_progressBar = new QProgressBar(m_statusBar);
|
||||||
m_statusBar->addPermanentWidget(m_progressBar);
|
m_statusBar->addPermanentWidget(m_progressBar);
|
||||||
m_progressBar->hide();
|
m_progressBar->hide();
|
||||||
|
|
||||||
|
@ -23,16 +23,16 @@
|
|||||||
|
|
||||||
#include "qzcommon.h"
|
#include "qzcommon.h"
|
||||||
|
|
||||||
class QVBoxLayout;
|
|
||||||
class QStatusBar;
|
|
||||||
class QMenuBar;
|
|
||||||
class QMenu;
|
class QMenu;
|
||||||
|
class QMenuBar;
|
||||||
|
class QProgressBar;
|
||||||
|
class QStatusBar;
|
||||||
|
class QVBoxLayout;
|
||||||
|
|
||||||
class WebPage;
|
class WebPage;
|
||||||
class PopupWebView;
|
class PopupWebView;
|
||||||
class PopupStatusBarMessage;
|
class PopupStatusBarMessage;
|
||||||
class PopupLocationBar;
|
class PopupLocationBar;
|
||||||
class ProgressBar;
|
|
||||||
class SearchToolBar;
|
class SearchToolBar;
|
||||||
|
|
||||||
class FALKON_EXPORT PopupWindow : public QWidget
|
class FALKON_EXPORT PopupWindow : public QWidget
|
||||||
@ -65,7 +65,7 @@ private:
|
|||||||
PopupWebView* m_view;
|
PopupWebView* m_view;
|
||||||
PopupLocationBar* m_locationBar;
|
PopupLocationBar* m_locationBar;
|
||||||
PopupStatusBarMessage* m_statusBarMessage;
|
PopupStatusBarMessage* m_statusBarMessage;
|
||||||
ProgressBar* m_progressBar;
|
QProgressBar* m_progressBar;
|
||||||
|
|
||||||
QVBoxLayout* m_layout;
|
QVBoxLayout* m_layout;
|
||||||
QStatusBar* m_statusBar;
|
QStatusBar* m_statusBar;
|
||||||
|
@ -1,64 +0,0 @@
|
|||||||
/* ============================================================
|
|
||||||
* Falkon - Qt web browser
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
* ============================================================ */
|
|
||||||
#include "progressbar.h"
|
|
||||||
|
|
||||||
#include <QStylePainter>
|
|
||||||
#include <QStyleOptionProgressBar>
|
|
||||||
|
|
||||||
ProgressBar::ProgressBar(QWidget* parent)
|
|
||||||
: QWidget(parent)
|
|
||||||
, m_value(0)
|
|
||||||
, m_lastPaintedValue(-1)
|
|
||||||
{
|
|
||||||
setMinimumSize(130, 16);
|
|
||||||
setMaximumSize(150, 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProgressBar::setValue(int value)
|
|
||||||
{
|
|
||||||
m_value = value;
|
|
||||||
if (m_lastPaintedValue != m_value) {
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProgressBar::initStyleOption(QStyleOptionProgressBar* option)
|
|
||||||
{
|
|
||||||
if (!option) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
option->initFrom(this);
|
|
||||||
option->minimum = 0;
|
|
||||||
option->maximum = 100;
|
|
||||||
option->progress = m_value;
|
|
||||||
option->textAlignment = Qt::AlignLeft;
|
|
||||||
option->textVisible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProgressBar::paintEvent(QPaintEvent*)
|
|
||||||
{
|
|
||||||
QStylePainter paint(this);
|
|
||||||
|
|
||||||
QStyleOptionProgressBar opt;
|
|
||||||
initStyleOption(&opt);
|
|
||||||
|
|
||||||
paint.drawControl(QStyle::CE_ProgressBar, opt);
|
|
||||||
|
|
||||||
m_lastPaintedValue = m_value;
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
/* ============================================================
|
|
||||||
* Falkon - Qt web browser
|
|
||||||
* Copyright (C) 2010-2014 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
* ============================================================ */
|
|
||||||
#ifndef PROGRESSBAR_H
|
|
||||||
#define PROGRESSBAR_H
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
#include "qzcommon.h"
|
|
||||||
|
|
||||||
class QStyleOptionProgressBar;
|
|
||||||
|
|
||||||
class FALKON_EXPORT ProgressBar : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit ProgressBar(QWidget* parent = nullptr);
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
void setValue(int value);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void paintEvent(QPaintEvent* e) override;
|
|
||||||
void initStyleOption(QStyleOptionProgressBar* option);
|
|
||||||
|
|
||||||
private:
|
|
||||||
int m_value;
|
|
||||||
int m_lastPaintedValue;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // PROGRESSBAR_H
|
|
@ -23,7 +23,6 @@
|
|||||||
#include "tabbar.h"
|
#include "tabbar.h"
|
||||||
#include "webtab.h"
|
#include "webtab.h"
|
||||||
#include "statusbar.h"
|
#include "statusbar.h"
|
||||||
#include "progressbar.h"
|
|
||||||
#include "navigationbar.h"
|
#include "navigationbar.h"
|
||||||
#include "iconprovider.h"
|
#include "iconprovider.h"
|
||||||
#include "searchenginesmanager.h"
|
#include "searchenginesmanager.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user