| 1 | // For license of this file, see <project-root-folder>/LICENSE.md. |
| 2 | |
| 3 | #ifndef WIDGETWITHSTATUS_H |
| 4 | #define WIDGETWITHSTATUS_H |
| 5 | |
| 6 | #include <QIcon> |
| 7 | #include <QWidget> |
| 8 | |
| 9 | class PlainToolButton; |
| 10 | class QHBoxLayout; |
| 11 | |
| 12 | class RSSGUARD_DLLSPEC WidgetWithStatus : public QWidget { |
| 13 | Q_OBJECT |
| 14 | |
| 15 | public: |
| 16 | enum class StatusType { |
| 17 | Information, |
| 18 | Warning, |
| 19 | Error, |
| 20 | Ok, |
| 21 | Progress, |
| 22 | Question |
| 23 | }; |
| 24 | |
| 25 | explicit WidgetWithStatus(QWidget* parent); |
| 26 | |
| 27 | void setStatus(StatusType status, const QString& tooltip_text); |
| 28 | StatusType status() const; |
| 29 | |
| 30 | protected: |
| 31 | StatusType m_status; |
| 32 | QWidget* m_wdgInput; |
| 33 | PlainToolButton* m_btnStatus; |
| 34 | QHBoxLayout* m_layout; |
| 35 | QIcon m_iconProgress; |
| 36 | QIcon m_iconInformation; |
| 37 | QIcon m_iconWarning; |
| 38 | QIcon m_iconError; |
| 39 | QIcon m_iconOk; |
| 40 | QIcon m_iconQuestion; |
| 41 | }; |
| 42 | |
| 43 | inline WidgetWithStatus::StatusType WidgetWithStatus::status() const { |
| 44 | return m_status; |
| 45 | } |
| 46 | |
| 47 | #endif // WIDGETWITHSTATUS_H |