Falkon Develop
Cross-platform Qt-based web browser
statusbar.h
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com>
4*
5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation, either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#pragma once
19
20#include <QObject>
21#include <QStatusBar>
22
23#include "qzcommon.h"
24#include "squeezelabelv1.h"
25
26class QTimer;
27
28class BrowserWindow;
30
32{
33 Q_OBJECT
34
35public:
36 explicit TipLabel(QWidget* parent);
37
38 void show(QWidget* widget);
39 void hideDelayed();
40
41 bool eventFilter(QObject* o, QEvent* e) override;
42
43private:
44 void paintEvent(QPaintEvent* ev) override;
45
46 QTimer* m_timer;
47};
48
49class FALKON_EXPORT StatusBar : public QStatusBar
50{
51 Q_OBJECT
52
53public:
54 explicit StatusBar(BrowserWindow *window);
55
56 void showMessage(const QString &message, int timeout = 0);
57 void clearMessage();
58
59 void addButton(AbstractButtonInterface *button);
60 void removeButton(AbstractButtonInterface *button);
61
62protected:
63 void mousePressEvent(QMouseEvent *event) override;
64
65private:
66 BrowserWindow *m_window;
67 TipLabel *m_statusBarText;
68
69 struct WidgetData {
70 QString id;
71 QWidget *widget = nullptr;
72 AbstractButtonInterface *button = nullptr;
73 };
74
75 QHash<QString, WidgetData> m_widgets;
76};
void paintEvent(QPaintEvent *event) override
#define FALKON_EXPORT
Definition: qzcommon.h:28