swift
managedstatusbar.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_GUI_MANAGEDSTATUSBAR_H
7 #define SWIFT_GUI_MANAGEDSTATUSBAR_H
8 
9 #include <QObject>
10 #include <QPushButton>
11 #include <QTimer>
12 
13 #include "gui/swiftguiexport.h"
14 #include "misc/statusmessage.h"
15 #include "misc/statusmessagelist.h"
16 
17 class QLabel;
18 class QStatusBar;
19 
20 namespace swift::gui
21 {
23  class SWIFT_GUI_EXPORT CManagedStatusBar : public QObject
24  {
25  Q_OBJECT
26 
27  public:
29  explicit CManagedStatusBar(QObject *parent = nullptr);
30 
32  virtual ~CManagedStatusBar() override;
33 
35  QStatusBar *getStatusBar() const { return m_statusBar; }
36 
38  void initStatusBar(QStatusBar *statusBar = nullptr);
39 
41  void showWarningButton();
42 
44  void showErrorButton();
45 
47  void show();
48 
50  void hide();
51 
53  void setElideMode(Qt::TextElideMode mode) { m_elideMode = mode; }
54 
56  void displayStatusMessage(const swift::misc::CStatusMessage &statusMessage);
57 
59  void displayStatusMessages(const swift::misc::CStatusMessageList &statusMessages);
60 
62  void setSizeGripEnabled(bool enabled);
63 
64  signals:
67 
68  private:
70  void clearStatusBar();
71 
73  void pressedWarnButton();
74 
76  void pressedErrorButton();
77 
78  QStatusBar *m_statusBar = nullptr;
79  QLabel *m_statusBarIcon = nullptr;
80  QLabel *m_statusBarLabel = nullptr;
81  QPushButton *m_warningButton = nullptr;
82  QPushButton *m_errorButton = nullptr;
83  QTimer m_timerStatusBar { this };
84  bool m_ownedStatusBar = false;
85  bool m_showWarnButtonInitially =
86  false;
87  bool m_showErrorButtonInitially =
88  false;
89  Qt::TextElideMode m_elideMode = Qt::ElideMiddle;
90  swift::misc::StatusSeverity m_currentSeverity =
91  swift::misc::StatusSeverity::SeverityDebug;
92  };
93 } // namespace swift::gui
94 
95 #endif // SWIFT_GUI_MANAGEDSTATUSBAR_H
void setElideMode(Qt::TextElideMode mode)
Set the label elide mode.
void requestLogPage()
Request to show the log page.
QStatusBar * getStatusBar() const
Get the status bar.
Streamable status message, e.g.
Status messages, e.g. from Core -> GUI.
GUI related classes.
StatusSeverity
Status severities.
Definition: statusmessage.h:35
#define SWIFT_GUI_EXPORT
Export a class or function from the library.