remove title from alert, dont set an icon by default
This commit is contained in:
parent
a439bea131
commit
478de37909
|
@ -26,8 +26,8 @@ Alert::Alert() :
|
||||||
d(NULL)
|
d(NULL)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Alert::Alert (const QString &name, const QString &title, const Icon &icon, bool active):
|
Alert::Alert (const QString &name, const Icon &icon, bool active):
|
||||||
d(new AlertData(name, title, icon, active))
|
d(new AlertData(name, icon, active))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Alert::Alert(const Alert &other):
|
Alert::Alert(const Alert &other):
|
||||||
|
@ -47,17 +47,11 @@ Alert::~Alert()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString Alert::name() const
|
QString Alert::name() const
|
||||||
{
|
{
|
||||||
return d->m_name;
|
return d->m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Alert::title() const
|
|
||||||
{
|
|
||||||
return d->m_title;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Icon &Alert::icon() const
|
const Icon &Alert::icon() const
|
||||||
{
|
{
|
||||||
return d->m_icon;
|
return d->m_icon;
|
||||||
|
@ -78,7 +72,7 @@ QDebug operator<<(QDebug debug, const Alert &alert)
|
||||||
{
|
{
|
||||||
if(alert.isValid())
|
if(alert.isValid())
|
||||||
{
|
{
|
||||||
debug << "Snore::Alert(" << alert.name() << ", " << alert.title() << ")" ;
|
debug << "Snore::Alert(" << alert.name() << ")" ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,13 +34,12 @@ class SNORE_EXPORT Alert
|
||||||
friend class AlertData;
|
friend class AlertData;
|
||||||
public:
|
public:
|
||||||
Alert();
|
Alert();
|
||||||
explicit Alert(const QString &name, const QString &title="", const Icon &icon = Icon(":/root/snore.png"), bool active=true );
|
explicit Alert(const QString &name, const Icon &icon, bool active=true );
|
||||||
Alert(const Alert &other);
|
Alert(const Alert &other);
|
||||||
Alert &operator=(const Alert &other);
|
Alert &operator=(const Alert &other);
|
||||||
~Alert();
|
~Alert();
|
||||||
|
|
||||||
QString name() const;
|
QString name() const;
|
||||||
QString title() const;
|
|
||||||
const Icon &icon() const;
|
const Icon &icon() const;
|
||||||
bool isActive() const;
|
bool isActive() const;
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
|
@ -21,9 +21,8 @@
|
||||||
|
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
|
||||||
AlertData::AlertData(const QString &name, const QString &title, const Icon &icon, bool active):
|
AlertData::AlertData(const QString &name, const Icon &icon, bool active):
|
||||||
m_name(name),
|
m_name(name),
|
||||||
m_title(title),
|
|
||||||
m_icon(icon),
|
m_icon(icon),
|
||||||
m_active(active)
|
m_active(active)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,11 +32,10 @@ class AlertData : public QSharedData
|
||||||
{
|
{
|
||||||
friend class Alert;
|
friend class Alert;
|
||||||
public:
|
public:
|
||||||
AlertData(const QString &name, const QString &title, const Icon &icon, bool active);
|
AlertData(const QString &name, const Icon &icon, bool active);
|
||||||
~AlertData();
|
~AlertData();
|
||||||
|
|
||||||
QString m_name;
|
QString m_name;
|
||||||
QString m_title;
|
|
||||||
Icon m_icon;
|
Icon m_icon;
|
||||||
bool m_active;
|
bool m_active;
|
||||||
|
|
||||||
|
|
|
@ -30,16 +30,19 @@ namespace Snore{
|
||||||
SNORE_EXPORT QDebug operator<< ( QDebug, const Snore::Icon &);
|
SNORE_EXPORT QDebug operator<< ( QDebug, const Snore::Icon &);
|
||||||
|
|
||||||
namespace Snore{
|
namespace Snore{
|
||||||
|
|
||||||
class IconData;
|
class IconData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Icon contains an image for Notifications.
|
||||||
|
* @author Patrick von Reth \<vonreth at kde.org\>
|
||||||
|
*/
|
||||||
class SNORE_EXPORT Icon
|
class SNORE_EXPORT Icon
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Icon();
|
Icon();
|
||||||
Icon(const QImage &img);
|
Icon(const QImage &img);
|
||||||
Icon(const class QString &url);
|
explicit Icon(const QString &url);
|
||||||
|
|
||||||
Icon(const Icon &other);
|
Icon(const Icon &other);
|
||||||
Icon &operator=(const Icon &other);
|
Icon &operator=(const Icon &other);
|
||||||
~Icon();
|
~Icon();
|
||||||
|
|
|
@ -54,7 +54,7 @@ SnoreCorePrivate::SnoreCorePrivate(QSystemTrayIcon *trayIcon):
|
||||||
m_trayIcon(trayIcon),
|
m_trayIcon(trayIcon),
|
||||||
m_defaultApp("SnoreNotify",Icon(":/root/snore.png"))
|
m_defaultApp("SnoreNotify",Icon(":/root/snore.png"))
|
||||||
{
|
{
|
||||||
m_defaultApp.addAlert(Alert("Default"));
|
m_defaultApp.addAlert(Alert("Default",Icon(":/root/snore.png")));
|
||||||
}
|
}
|
||||||
|
|
||||||
SnoreCorePrivate::~SnoreCorePrivate()
|
SnoreCorePrivate::~SnoreCorePrivate()
|
||||||
|
|
|
@ -113,7 +113,7 @@ uint FreedesktopFrontend::Notify(const QString &app_name, uint replaces_id,
|
||||||
#else
|
#else
|
||||||
Icon appIcon(":/root/images/freedesktop-dbus.png");
|
Icon appIcon(":/root/images/freedesktop-dbus.png");
|
||||||
#endif
|
#endif
|
||||||
Alert alert("DBus Alert","DBus Alert",appIcon);
|
Alert alert("DBus Alert", appIcon);
|
||||||
app = Application(app_name, appIcon);
|
app = Application(app_name, appIcon);
|
||||||
app.addAlert(alert);
|
app.addAlert(alert);
|
||||||
snore()->registerApplication(app);
|
snore()->registerApplication(app);
|
||||||
|
|
|
@ -89,7 +89,7 @@ void Parser::parse(Notification &sNotification,const QString &msg,QTcpSocket* cl
|
||||||
text = value;
|
text = value;
|
||||||
break;
|
break;
|
||||||
case ICON:
|
case ICON:
|
||||||
icon = value;
|
icon = Icon(value);
|
||||||
break;
|
break;
|
||||||
case CLASS:
|
case CLASS:
|
||||||
alertName = value;
|
alertName = value;
|
||||||
|
@ -147,14 +147,7 @@ void Parser::parse(Notification &sNotification,const QString &msg,QTcpSocket* cl
|
||||||
snoreDebug( SNORE_DEBUG )<<"Error registering alert with empty name";
|
snoreDebug( SNORE_DEBUG )<<"Error registering alert with empty name";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(title.isEmpty())
|
alert = Alert(alertName, icon);
|
||||||
{
|
|
||||||
alert = Alert(alertName, alertName, icon);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
alert = Alert(alertName, title, icon);
|
|
||||||
}
|
|
||||||
app.addAlert(alert);
|
app.addAlert(alert);
|
||||||
break;
|
break;
|
||||||
case REGISTER:
|
case REGISTER:
|
||||||
|
|
|
@ -32,7 +32,7 @@ using namespace Snore;
|
||||||
TrayIcon::TrayIcon():
|
TrayIcon::TrayIcon():
|
||||||
m_trayIcon(new QSystemTrayIcon(QIcon(":/root/snore.png"))),
|
m_trayIcon(new QSystemTrayIcon(QIcon(":/root/snore.png"))),
|
||||||
m_app("SnoreNotify Test", Icon(":/root/snore.png")),
|
m_app("SnoreNotify Test", Icon(":/root/snore.png")),
|
||||||
m_alert("Default")
|
m_alert("Default",Icon(":/root/snore.png"))
|
||||||
{
|
{
|
||||||
m_app.addAlert(m_alert);
|
m_app.addAlert(m_alert);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue