remove title from alert, dont set an icon by default

This commit is contained in:
Patrick von Reth 2014-01-20 15:52:35 +01:00
parent a439bea131
commit 478de37909
9 changed files with 19 additions and 32 deletions

View File

@ -26,8 +26,8 @@ Alert::Alert() :
d(NULL)
{}
Alert::Alert (const QString &name, const QString &title, const Icon &icon, bool active):
d(new AlertData(name, title, icon, active))
Alert::Alert (const QString &name, const Icon &icon, bool active):
d(new AlertData(name, icon, active))
{}
Alert::Alert(const Alert &other):
@ -47,17 +47,11 @@ Alert::~Alert()
}
QString Alert::name() const
{
return d->m_name;
}
QString Alert::title() const
{
return d->m_title;
}
const Icon &Alert::icon() const
{
return d->m_icon;
@ -78,7 +72,7 @@ QDebug operator<<(QDebug debug, const Alert &alert)
{
if(alert.isValid())
{
debug << "Snore::Alert(" << alert.name() << ", " << alert.title() << ")" ;
debug << "Snore::Alert(" << alert.name() << ")" ;
}
else
{

View File

@ -34,13 +34,12 @@ class SNORE_EXPORT Alert
friend class AlertData;
public:
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 &operator=(const Alert &other);
~Alert();
QString name() const;
QString title() const;
const Icon &icon() const;
bool isActive() const;
bool isValid() const;

View File

@ -21,9 +21,8 @@
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_title(title),
m_icon(icon),
m_active(active)
{

View File

@ -32,11 +32,10 @@ class AlertData : public QSharedData
{
friend class Alert;
public:
AlertData(const QString &name, const QString &title, const Icon &icon, bool active);
AlertData(const QString &name, const Icon &icon, bool active);
~AlertData();
QString m_name;
QString m_title;
Icon m_icon;
bool m_active;

View File

@ -30,16 +30,19 @@ namespace Snore{
SNORE_EXPORT QDebug operator<< ( QDebug, const Snore::Icon &);
namespace Snore{
class IconData;
/**
* Icon contains an image for Notifications.
* @author Patrick von Reth \<vonreth at kde.org\>
*/
class SNORE_EXPORT Icon
{
public:
Icon();
Icon(const QImage &img);
Icon(const class QString &url);
explicit Icon(const QString &url);
Icon(const Icon &other);
Icon &operator=(const Icon &other);
~Icon();

View File

@ -54,7 +54,7 @@ SnoreCorePrivate::SnoreCorePrivate(QSystemTrayIcon *trayIcon):
m_trayIcon(trayIcon),
m_defaultApp("SnoreNotify",Icon(":/root/snore.png"))
{
m_defaultApp.addAlert(Alert("Default"));
m_defaultApp.addAlert(Alert("Default",Icon(":/root/snore.png")));
}
SnoreCorePrivate::~SnoreCorePrivate()

View File

@ -113,8 +113,8 @@ uint FreedesktopFrontend::Notify(const QString &app_name, uint replaces_id,
#else
Icon appIcon(":/root/images/freedesktop-dbus.png");
#endif
Alert alert("DBus Alert","DBus Alert",appIcon);
app = Application(app_name,appIcon);
Alert alert("DBus Alert", appIcon);
app = Application(app_name, appIcon);
app.addAlert(alert);
snore()->registerApplication(app);
}

View File

@ -89,7 +89,7 @@ void Parser::parse(Notification &sNotification,const QString &msg,QTcpSocket* cl
text = value;
break;
case ICON:
icon = value;
icon = Icon(value);
break;
case CLASS:
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";
break;
}
if(title.isEmpty())
{
alert = Alert(alertName, alertName, icon);
}
else
{
alert = Alert(alertName, title, icon);
}
alert = Alert(alertName, icon);
app.addAlert(alert);
break;
case REGISTER:

View File

@ -32,8 +32,8 @@ using namespace Snore;
TrayIcon::TrayIcon():
m_trayIcon(new QSystemTrayIcon(QIcon(":/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);
}