Files
GUI/src/dialogs/MultyMessageDialog.h

56 lines
1.1 KiB
C
Raw Normal View History

2022-07-28 16:27:51 +08:00
#ifndef MULTYMESSAGEDIALOG_H
#define MULTYMESSAGEDIALOG_H
#include <QDialog>
#include <QTimer>
#include <QLabel>
#include <QPropertyAnimation>
enum MessageLevel:unsigned int
{
Info = 0,
Warning,
Error,
Sucess,
};
class MultyMessageDialog : public QDialog
{
Q_OBJECT
public:
MultyMessageDialog(const QString& aMessage = "",MessageLevel aMessageLevel = MessageLevel::Info,QWidget* aParent = nullptr);
~MultyMessageDialog() override;
void setAutoDisappearTime(int aAutoDisappearTime);
void setMessage(const QString& aMessage);
void stopShowAnimation();
signals:
void dialogDestroyed();
public slots:
void hideDialog();
void startHideAnimation();
protected:
void showEvent(QShowEvent* aEvent) override;
private:
void initializeAnimation();
void initializeIcon();
private:
int mAutoDisappearTime;
QTimer* mTimer;
QSize mSize;
QPropertyAnimation* mDisappearAnimation;
QPropertyAnimation* mShowAnimation;
QLabel* mMessage;
QLabel* mIcon;
MessageLevel mLevel;
};
2023-08-21 14:22:41 +08:00
#endif // MULTYMESSAGEDIALOG_H