mirror of
https://github.com/QuasarApp/SimpleQmlNotify.git
synced 2025-04-26 05:34:34 +00:00
There was fixed bug
This commit is contained in:
parent
74ec09bf4a
commit
b3ff1cc577
@ -11,11 +11,13 @@ namespace QmlNotificationService {
|
||||
NotificationData::NotificationData(const QString &title,
|
||||
const QString &text,
|
||||
const QString &img, int type) {
|
||||
|
||||
defImgI = "qrc:/icons/info";
|
||||
defImgW = "qrc:/icons/warning";
|
||||
defImgE = "qrc:/icons/error";
|
||||
_text = text;
|
||||
_title = title;
|
||||
_img = img;
|
||||
_type = type;
|
||||
_img = getDefaultImage(img, type);
|
||||
}
|
||||
|
||||
QString NotificationData::text() const {
|
||||
@ -41,6 +43,25 @@ bool NotificationData::operator !=(const NotificationData &righ) {
|
||||
return !operator==(righ);
|
||||
}
|
||||
|
||||
QString NotificationData::getDefaultImage(const QString &img, const int code)
|
||||
{
|
||||
if(img != "")
|
||||
return img;
|
||||
|
||||
const auto notificationType = static_cast<NotificationData::Type>(code);
|
||||
|
||||
switch (notificationType) {
|
||||
case NotificationData::Type::Normal:
|
||||
return defImgI;
|
||||
case NotificationData::Type::Warning:
|
||||
return defImgW;
|
||||
case NotificationData::Type::Error:
|
||||
return defImgE;
|
||||
default:
|
||||
return defImgI;
|
||||
}
|
||||
}
|
||||
|
||||
int NotificationData::type() const {
|
||||
return _type;
|
||||
}
|
||||
|
@ -71,10 +71,15 @@ public:
|
||||
bool operator !=(const NotificationData &righ);
|
||||
|
||||
private:
|
||||
QString getDefaultImage(const QString &img, const int code);
|
||||
|
||||
QString _text;
|
||||
QString _img;
|
||||
QString _title;
|
||||
int _type;
|
||||
QString defImgI;
|
||||
QString defImgW;
|
||||
QString defImgE;
|
||||
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user