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

Rename StatusBarMessage -> StatusBar

This commit is contained in:
David Rosca 2018-01-24 19:18:58 +01:00
parent 77cb017e1d
commit 444884bee9
12 changed files with 73 additions and 75 deletions

View File

@ -151,7 +151,7 @@ set(SRCS ${SRCS}
other/qzsettings.cpp
other/siteinfo.cpp
other/siteinfowidget.cpp
other/statusbarmessage.cpp
other/statusbar.cpp
other/updater.cpp
other/useragentmanager.cpp
plugins/pluginproxy.cpp

View File

@ -38,7 +38,7 @@
#include "iconprovider.h"
#include "progressbar.h"
#include "closedwindowsmanager.h"
#include "statusbarmessage.h"
#include "statusbar.h"
#include "browsinglibrary.h"
#include "navigationbar.h"
#include "bookmarksimport/bookmarksimportdialog.h"
@ -60,7 +60,6 @@
#include <QKeyEvent>
#include <QSplitter>
#include <QStatusBar>
#include <QMenuBar>
#include <QTimer>
#include <QShortcut>
@ -190,7 +189,6 @@ BrowserWindow::BrowserWindow(Qz::BrowserWindowType type, const QUrl &startUrl)
, m_startTab(0)
, m_startPage(0)
, m_sideBarManager(new SideBarManager(this))
, m_statusBarMessage(new StatusBarMessage(this))
, m_isHtmlFullScreen(false)
, m_hideNavigationTimer(0)
{
@ -375,15 +373,17 @@ void BrowserWindow::setupUi()
m_mainLayout->addWidget(m_navigationContainer);
m_mainLayout->addWidget(m_mainSplitter);
statusBar()->setObjectName("mainwindow-statusbar");
statusBar()->setCursor(Qt::ArrowCursor);
m_progressBar = new ProgressBar(statusBar());
m_statusBar = new StatusBar(this);
m_statusBar->setObjectName("mainwindow-statusbar");
m_statusBar->setCursor(Qt::ArrowCursor);
setStatusBar(m_statusBar);
m_progressBar = new ProgressBar(m_statusBar);
m_ipLabel = new QLabel(this);
m_ipLabel->setObjectName("statusbar-ip-label");
m_ipLabel->setToolTip(tr("IP Address of current page"));
statusBar()->addPermanentWidget(m_progressBar);
statusBar()->addPermanentWidget(m_ipLabel);
m_statusBar->addPermanentWidget(m_progressBar);
m_statusBar->addPermanentWidget(m_ipLabel);
m_navigationToolbar->addToolButton(new DownloadsButton(this));
@ -668,9 +668,9 @@ BookmarksToolbar* BrowserWindow::bookmarksToolbar() const
return m_bookmarksToolbar;
}
StatusBarMessage* BrowserWindow::statusBarMessage() const
StatusBar* BrowserWindow::statusBar() const
{
return m_statusBarMessage;
return m_statusBar;
}
NavigationBar* BrowserWindow::navigationBar() const
@ -861,11 +861,11 @@ void BrowserWindow::toggleShowStatusBar()
{
setUpdatesEnabled(false);
statusBar()->setVisible(!statusBar()->isVisible());
m_statusBar->setVisible(!m_statusBar->isVisible());
setUpdatesEnabled(true);
Settings().setValue("Browser-View-Settings/showStatusBar", statusBar()->isVisible());
Settings().setValue("Browser-View-Settings/showStatusBar", m_statusBar->isVisible());
}
@ -1197,19 +1197,19 @@ bool BrowserWindow::event(QEvent *event)
QWindowStateChangeEvent *e = static_cast<QWindowStateChangeEvent*>(event);
if (!(e->oldState() & Qt::WindowFullScreen) && windowState() & Qt::WindowFullScreen) {
// Enter fullscreen
m_statusBarVisible = statusBar()->isVisible();
m_statusBarVisible = m_statusBar->isVisible();
#ifndef Q_OS_MACOS
m_menuBarVisible = menuBar()->isVisible();
menuBar()->hide();
#endif
statusBar()->hide();
m_statusBar->hide();
m_navigationContainer->hide();
m_navigationToolbar->enterFullScreen();
}
else if (e->oldState() & Qt::WindowFullScreen && !(windowState() & Qt::WindowFullScreen)) {
// Leave fullscreen
statusBar()->setVisible(m_statusBarVisible);
m_statusBar->setVisible(m_statusBarVisible);
#ifndef Q_OS_MACOS
menuBar()->setVisible(m_menuBarVisible);
#endif

View File

@ -46,7 +46,7 @@ class WebPage;
class SideBar;
class SideBarManager;
class ProgressBar;
class StatusBarMessage;
class StatusBar;
class NavigationBar;
class NavigationContainer;
class ClickableLabel;
@ -110,7 +110,7 @@ public:
LocationBar* locationBar() const;
TabWidget* tabWidget() const;
BookmarksToolbar* bookmarksToolbar() const;
StatusBarMessage* statusBarMessage() const;
StatusBar* statusBar() const;
NavigationBar* navigationBar() const;
SideBarManager* sideBarManager() const;
QLabel* ipLabel() const;
@ -202,7 +202,7 @@ private:
TabWidget* m_tabWidget;
QPointer<SideBar> m_sideBar;
SideBarManager* m_sideBarManager;
StatusBarMessage* m_statusBarMessage;
StatusBar* m_statusBar;
NavigationContainer* m_navigationContainer;
NavigationBar* m_navigationToolbar;

View File

@ -33,10 +33,10 @@
#include "pluginproxy.h"
#include "webinspector.h"
#include "sessionmanager.h"
#include "statusbar.h"
#include <QApplication>
#include <QMetaObject>
#include <QStatusBar>
#include <QWebEnginePage>
#include <QMenuBar>
#include <QDesktopServices>

View File

@ -1,6 +1,6 @@
/* ============================================================
* Falkon - Qt web browser
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2018 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
@ -15,7 +15,7 @@
* 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 "statusbarmessage.h"
#include "statusbar.h"
#include "browserwindow.h"
#include "tabwidget.h"
#include "tabbedwebview.h"
@ -107,46 +107,46 @@ bool TipLabel::eventFilter(QObject* o, QEvent* e)
return false;
}
StatusBarMessage::StatusBarMessage(BrowserWindow* window)
StatusBar::StatusBar(BrowserWindow* window)
: m_window(window)
, m_statusBarText(new TipLabel(window))
{
}
void StatusBarMessage::showMessage(const QString &message)
void StatusBar::showMessage(const QString &message, int timeout)
{
if (m_window->statusBar()->isVisible()) {
if (isVisible()) {
const static QChar LRE(0x202a);
m_window->statusBar()->showMessage(message.isRightToLeft() ? message : (LRE + message));
QStatusBar::showMessage(message.isRightToLeft() ? message : (LRE + message), timeout);
return;
}
else if (mApp->activeWindow() == m_window) {
WebView* view = m_window->weView();
const int verticalScrollSize = view->scrollBarGeometry(Qt::Vertical).width();;
const int horizontalScrollSize = view->scrollBarGeometry(Qt::Horizontal).height();
m_statusBarText->setText(message);
m_statusBarText->setMaximumWidth(view->width() - verticalScrollSize);
m_statusBarText->resize(m_statusBarText->sizeHint());
QPoint position(0, view->height() - horizontalScrollSize - m_statusBarText->height());
const QRect statusRect = QRect(view->mapToGlobal(QPoint(0, position.y())), m_statusBarText->size());
if (statusRect.contains(QCursor::pos())) {
position.setY(position.y() - m_statusBarText->height());
}
m_statusBarText->move(view->mapToGlobal(position));
m_statusBarText->show(view);
if (mApp->activeWindow() != m_window) {
return;
}
WebView* view = m_window->weView();
const int verticalScrollSize = view->scrollBarGeometry(Qt::Vertical).width();;
const int horizontalScrollSize = view->scrollBarGeometry(Qt::Horizontal).height();
m_statusBarText->setText(message);
m_statusBarText->setMaximumWidth(view->width() - verticalScrollSize);
m_statusBarText->resize(m_statusBarText->sizeHint());
QPoint position(0, view->height() - horizontalScrollSize - m_statusBarText->height());
const QRect statusRect = QRect(view->mapToGlobal(QPoint(0, position.y())), m_statusBarText->size());
if (statusRect.contains(QCursor::pos())) {
position.setY(position.y() - m_statusBarText->height());
}
m_statusBarText->move(view->mapToGlobal(position));
m_statusBarText->show(view);
}
void StatusBarMessage::clearMessage()
void StatusBar::clearMessage()
{
if (m_window->statusBar()->isVisible()) {
m_window->statusBar()->showMessage(QString());
}
else {
m_statusBarText->hideDelayed();
}
QStatusBar::clearMessage();
m_statusBarText->hideDelayed();
}

View File

@ -1,6 +1,6 @@
/* ============================================================
* Falkon - Qt web browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2018 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
@ -15,14 +15,13 @@
* 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 STATUSBARMESSAGE_H
#define STATUSBARMESSAGE_H
#pragma once
#include <QObject>
#include <QStatusBar>
#include "qzcommon.h"
#include "squeezelabelv1.h"
#include "animatedwidget.h"
class QTimer;
@ -45,17 +44,15 @@ private:
QTimer* m_timer;
};
class FALKON_EXPORT StatusBarMessage
class FALKON_EXPORT StatusBar : public QStatusBar
{
public:
explicit StatusBarMessage(BrowserWindow* window);
explicit StatusBar(BrowserWindow *window);
void showMessage(const QString &message);
void showMessage(const QString &message, int timeout = 0);
void clearMessage();
private:
BrowserWindow* m_window;
TipLabel* m_statusBarText;
BrowserWindow *m_window;
TipLabel *m_statusBarText;
};
#endif // STATUSBARMESSAGE_H

View File

@ -1,6 +1,6 @@
/* ============================================================
* Falkon - Qt web browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2018 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
@ -19,7 +19,6 @@
#include "popupwindow.h"
#include "popupwebview.h"
#include "webpage.h"
#include "statusbarmessage.h"
#include "mainapplication.h"
#include <QStatusBar>

View File

@ -1,6 +1,6 @@
/* ============================================================
* Falkon - Qt web browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2018 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
@ -19,6 +19,7 @@
#define POPUPSTATUSBARMESSAGE_H
#include "qzcommon.h"
#include "statusbar.h"
class PopupWindow;
class TipLabel;

View File

@ -22,7 +22,7 @@
#include "mainapplication.h"
#include "tabbar.h"
#include "webtab.h"
#include "statusbarmessage.h"
#include "statusbar.h"
#include "progressbar.h"
#include "navigationbar.h"
#include "iconprovider.h"
@ -139,10 +139,10 @@ void TabbedWebView::linkHovered(const QString &link)
{
if (m_webTab->isCurrentTab() && m_window) {
if (link.isEmpty()) {
m_window->statusBarMessage()->clearMessage();
m_window->statusBar()->clearMessage();
}
else {
m_window->statusBarMessage()->showMessage(link);
m_window->statusBar()->showMessage(link);
}
}
}

View File

@ -1,7 +1,7 @@
/* ============================================================
* FlashCookieManager plugin for Falkon
* Copyright (C) 2014 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
* Copyright (C) 2017 David Rosca <nowrep@gmail.com>
* Copyright (C) 2014-2018 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
* Copyright (C) 2017-2018 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
@ -26,8 +26,8 @@
#include "fcm_notification.h"
#include "datapaths.h"
#include "../config.h"
#include "statusbar.h"
#include <QStatusBar>
#include <QTimer>
#include <QSettings>
#include <QTranslator>

View File

@ -1,6 +1,6 @@
/* ============================================================
* StatusBarIcons - Extra icons in statusbar for Falkon
* Copyright (C) 2013-2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2013-2018 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
@ -22,9 +22,9 @@
#include "sbi_networkicon.h"
#include "sbi_networkmanager.h"
#include "browserwindow.h"
#include "statusbar.h"
#include <QSettings>
#include <QStatusBar>
SBI_IconsManager::SBI_IconsManager(const QString &settingsPath, QObject* parent)
: QObject(parent)

View File

@ -1,6 +1,7 @@
/* ============================================================
* TabManager plugin for Falkon
* Copyright (C) 2013-2017 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
* Copyright (C) 2013-2018 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
* Copyright (C) 2017-2018 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
@ -22,9 +23,9 @@
#include "tabwidget.h"
#include "mainapplication.h"
#include "tabbar.h"
#include "statusbar.h"
#include <QDesktopWidget>
#include <QStatusBar>
#include <QAction>
#include <QStyle>