File indexing completed on 2024-05-12 04:58:13
0001 /* ============================================================ 0002 * Falkon - Qt web browser 0003 * Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com> 0004 * 0005 * This program is free software: you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation, either version 3 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0017 * ============================================================ */ 0018 #pragma once 0019 0020 #include <QObject> 0021 #include <QStatusBar> 0022 0023 #include "qzcommon.h" 0024 #include "squeezelabelv1.h" 0025 0026 class QTimer; 0027 0028 class BrowserWindow; 0029 class AbstractButtonInterface; 0030 0031 class FALKON_EXPORT TipLabel : public SqueezeLabelV1 0032 { 0033 Q_OBJECT 0034 0035 public: 0036 explicit TipLabel(QWidget* parent); 0037 0038 void show(QWidget* widget); 0039 void hideDelayed(); 0040 0041 bool eventFilter(QObject* o, QEvent* e) override; 0042 0043 private: 0044 void paintEvent(QPaintEvent* ev) override; 0045 0046 QTimer* m_timer; 0047 }; 0048 0049 class FALKON_EXPORT StatusBar : public QStatusBar 0050 { 0051 Q_OBJECT 0052 0053 public: 0054 explicit StatusBar(BrowserWindow *window); 0055 0056 void showMessage(const QString &message, int timeout = 0); 0057 void clearMessage(); 0058 0059 void addButton(AbstractButtonInterface *button); 0060 void removeButton(AbstractButtonInterface *button); 0061 0062 protected: 0063 void mousePressEvent(QMouseEvent *event) override; 0064 0065 private: 0066 BrowserWindow *m_window; 0067 TipLabel *m_statusBarText; 0068 0069 struct WidgetData { 0070 QString id; 0071 QWidget *widget = nullptr; 0072 AbstractButtonInterface *button = nullptr; 0073 }; 0074 0075 QHash<QString, WidgetData> m_widgets; 0076 };