File indexing completed on 2024-04-28 03:51:17
0001 /*. 0002 SPDX-FileCopyrightText: 2007 Vladimir Kuznetsov <ks.vladimir@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef STEP_MESSAGEFRAME_H 0008 #define STEP_MESSAGEFRAME_H 0009 0010 #include <QFrame> 0011 0012 class QVBoxLayout; 0013 class QSignalMapper; 0014 0015 0016 class MessageFrame: public QFrame 0017 { 0018 Q_OBJECT 0019 0020 public: 0021 enum Type { Information, Warning, Error }; 0022 enum Flag { CloseButton = 1, CloseTimer = 2 }; 0023 Q_DECLARE_FLAGS(Flags, Flag) 0024 0025 explicit MessageFrame(QWidget* parent = nullptr); 0026 0027 int showMessage(Type type, const QString& text, Flags flags = {}); 0028 int changeMessage(int id, Type type, const QString& text, Flags flags = {}); 0029 void closeMessage(int id); 0030 0031 signals: 0032 void linkActivated(const QString& url); 0033 0034 protected slots: 0035 void messageLinkActivated(const QString& link); 0036 void messageCloseClicked(QWidget* widget); 0037 0038 protected: 0039 QVBoxLayout* _layout; 0040 QSignalMapper* _signalMapper; 0041 int _lastId; 0042 }; 0043 0044 Q_DECLARE_OPERATORS_FOR_FLAGS(MessageFrame::Flags) 0045 0046 #endif 0047