mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
[PrivateBrowsing] Show PrivateBrowsing indicator as left corner widget in tabbar
Removed PrivateBrowsing icon in Status Bar
This commit is contained in:
parent
da6ccdcee5
commit
bfe08409b4
|
@ -321,10 +321,6 @@ void BrowserWindow::setupUi()
|
|||
statusBar()->setObjectName("mainwindow-statusbar");
|
||||
statusBar()->setCursor(Qt::ArrowCursor);
|
||||
m_progressBar = new ProgressBar(statusBar());
|
||||
m_privateBrowsing = new QLabel(this);
|
||||
m_privateBrowsing->setPixmap(IconProvider::privateBrowsingIcon().pixmap(16));
|
||||
m_privateBrowsing->setVisible(false);
|
||||
m_privateBrowsing->setToolTip(tr("Private Browsing Enabled"));
|
||||
m_adblockIcon = new AdBlockIcon(this);
|
||||
m_ipLabel = new QLabel(this);
|
||||
m_ipLabel->setObjectName("statusbar-ip-label");
|
||||
|
@ -332,7 +328,6 @@ void BrowserWindow::setupUi()
|
|||
|
||||
statusBar()->addPermanentWidget(m_progressBar);
|
||||
statusBar()->addPermanentWidget(m_ipLabel);
|
||||
statusBar()->addPermanentWidget(m_privateBrowsing);
|
||||
statusBar()->addPermanentWidget(m_adblockIcon);
|
||||
|
||||
// Workaround for Oxygen tooltips not having transparent background
|
||||
|
@ -438,9 +433,6 @@ void BrowserWindow::loadSettings()
|
|||
|
||||
m_sideBarManager->showSideBar(activeSideBar, false);
|
||||
|
||||
// Private browsing
|
||||
m_privateBrowsing->setVisible(mApp->isPrivate());
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
if (m_useTransparentBackground && !makeTransparent) {
|
||||
QtWin::extendFrameIntoClientArea(this, 0, 0, 0, 0);
|
||||
|
|
|
@ -183,7 +183,6 @@ private:
|
|||
QVBoxLayout* m_mainLayout;
|
||||
QSplitter* m_mainSplitter;
|
||||
|
||||
QLabel* m_privateBrowsing;
|
||||
AdBlockIcon* m_adblockIcon;
|
||||
QPointer<WebInspectorDockWidget> m_webInspectorDock;
|
||||
|
||||
|
|
|
@ -729,6 +729,19 @@ bool ComboTabBar::isMainBarOverflowed() const
|
|||
return m_mainBarOverFlowed;
|
||||
}
|
||||
|
||||
int ComboTabBar::cornerWidth(Qt::Corner corner) const
|
||||
{
|
||||
if (corner == Qt::TopLeftCorner) {
|
||||
return m_leftContainer->width();
|
||||
}
|
||||
else if (corner == Qt::TopRightCorner) {
|
||||
return m_rightContainer->width();
|
||||
}
|
||||
|
||||
qFatal("ComboTabBar::cornerWidth Only TopLeft and TopRight corners are implemented!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ComboTabBar::addCornerWidget(QWidget* widget, Qt::Corner corner)
|
||||
{
|
||||
if (corner == Qt::TopLeftCorner) {
|
||||
|
@ -738,7 +751,7 @@ void ComboTabBar::addCornerWidget(QWidget* widget, Qt::Corner corner)
|
|||
m_rightLayout->addWidget(widget);
|
||||
}
|
||||
else {
|
||||
qWarning() << "ComboTabBar::addCornerWidget Only TopLeft and TopRight corners are implemented!";
|
||||
qFatal("ComboTabBar::addCornerWidget Only TopLeft and TopRight corners are implemented!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -835,7 +848,8 @@ void ComboTabBar::setMinimumWidths()
|
|||
comboTabBarPixelMetric(ExtraReservedWidth);
|
||||
|
||||
// This is the full width that would be needed for the tabbar (including pinned tabbar)
|
||||
int realTabBarWidth = mainTabBarWidth + m_pinnedTabBarWidget->width();
|
||||
int realTabBarWidth = mainTabBarWidth + m_pinnedTabBarWidget->width() +
|
||||
cornerWidth(Qt::TopLeftCorner);
|
||||
|
||||
// Does it fit in our widget?
|
||||
if (realTabBarWidth <= width()) {
|
||||
|
|
|
@ -37,12 +37,9 @@ class ToolButton;
|
|||
class QUPZILLA_EXPORT ComboTabBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged)
|
||||
Q_PROPERTY(int count READ count)
|
||||
|
||||
friend class TabBarHelper;
|
||||
|
||||
public:
|
||||
enum SizeType {
|
||||
PinnedTabWidth,
|
||||
|
@ -132,6 +129,9 @@ public:
|
|||
bool isDragInProgress() const;
|
||||
bool isMainBarOverflowed() const;
|
||||
|
||||
// Width of all widgets in the corner
|
||||
int cornerWidth(Qt::Corner corner) const;
|
||||
// Add widget to the left/right corner
|
||||
void addCornerWidget(QWidget* widget, Qt::Corner corner);
|
||||
|
||||
public slots:
|
||||
|
@ -195,6 +195,8 @@ private:
|
|||
bool m_lastAppliedOverflow;
|
||||
bool m_usesScrollButtons;
|
||||
bool m_bluredBackground;
|
||||
|
||||
friend class TabBarHelper;
|
||||
};
|
||||
|
||||
class QUPZILLA_EXPORT TabBarHelper : public QTabBar
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <QApplication>
|
||||
#include <QTimer>
|
||||
#include <QRect>
|
||||
#include <QLabel>
|
||||
#include <QScrollArea>
|
||||
#include <QHBoxLayout>
|
||||
#include <QToolTip>
|
||||
|
@ -81,6 +82,15 @@ TabBar::TabBar(BrowserWindow* window, TabWidget* tabWidget)
|
|||
setCloseButtonsToolTip(BrowserWindow::tr("Close Tab"));
|
||||
connect(this, SIGNAL(scrollBarValueChanged(int)), this, SLOT(hideTabPreview()));
|
||||
connect(this, SIGNAL(overFlowChanged(bool)), this, SLOT(overflowChanged(bool)));
|
||||
|
||||
if (mApp->isPrivate()) {
|
||||
QLabel* privateBrowsing = new QLabel(this);
|
||||
privateBrowsing->setObjectName(QSL("private-browsing-icon"));
|
||||
privateBrowsing->setPixmap(IconProvider::privateBrowsingIcon().pixmap(16, 16));
|
||||
privateBrowsing->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
privateBrowsing->setFixedWidth(30);
|
||||
addCornerWidget(privateBrowsing, Qt::TopLeftCorner);
|
||||
}
|
||||
}
|
||||
|
||||
void TabBar::loadSettings()
|
||||
|
@ -290,13 +300,12 @@ QSize TabBar::tabSizeHint(int index, bool fast) const
|
|||
|
||||
if (index == count() - 1) {
|
||||
WebTab* lastMainActiveTab = qobject_cast<WebTab*>(m_tabWidget->widget(mainTabBarCurrentIndex()));
|
||||
int xForAddTabButton = pinTabBarWidth() + normalTabsCount() * m_normalTabWidth;
|
||||
int xForAddTabButton = cornerWidth(Qt::TopLeftCorner) + pinTabBarWidth() + normalTabsCount() * m_normalTabWidth;
|
||||
|
||||
if (lastMainActiveTab && m_activeTabWidth > m_normalTabWidth) {
|
||||
xForAddTabButton += m_activeTabWidth - m_normalTabWidth;
|
||||
}
|
||||
|
||||
// RTL Support
|
||||
if (QApplication::layoutDirection() == Qt::RightToLeft) {
|
||||
xForAddTabButton = width() - xForAddTabButton;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user