renamed some vars

This commit is contained in:
Patrick von Reth 2012-01-26 01:26:57 +01:00
parent 57cb02094e
commit 3b15f77941
5 changed files with 93 additions and 95 deletions

View File

@ -43,10 +43,10 @@ public:
private: private:
QString _name; QString m_name;
SnoreIcon _icon; SnoreIcon m_icon;
AlertList _alerts; AlertList m_alerts;
bool _initialized; bool m_initialized;
}; };
@ -62,10 +62,10 @@ public:
const SnoreIcon &icon() const; const SnoreIcon &icon() const;
bool isActive() const; bool isActive() const;
private: private:
QString _name; QString m_name;
QString _title; QString m_title;
SnoreIcon _icon; SnoreIcon m_icon;
bool _active; bool m_active;
}; };

View File

@ -29,22 +29,22 @@ class SnoreIcon::SnoreIconData : public QObject
Q_OBJECT Q_OBJECT
public: public:
SnoreIconData(): SnoreIconData():
_isLocalFile(false) m_isLocalFile(false)
{ } { }
SnoreIconData(const QImage &img): SnoreIconData(const QImage &img):
_img(img), m_img(img),
_isLocalFile(false) m_isLocalFile(false)
{} {}
SnoreIconData(const QString &url){ SnoreIconData(const QString &url){
qDebug()<<"Creating SnoreIcon"<<url; qDebug()<<"Creating SnoreIcon"<<url;
if(url.startsWith(":/")){ if(url.startsWith(":/")){
_img = QImage(url); m_img = QImage(url);
_isLocalFile = false; m_isLocalFile = false;
}else if(QFile(url).exists()){ }else if(QFile(url).exists()){
_isLocalFile = true; m_isLocalFile = true;
_localFileName = url; m_localFileName = url;
} }
} }
@ -52,11 +52,11 @@ public:
{} {}
QImage _img; QImage m_img;
QByteArray _data; QByteArray m_data;
QString _localFileName; QString m_localFileName;
QString _hash; QString m_hash;
bool _isLocalFile; bool m_isLocalFile;
}; };
@ -88,51 +88,51 @@ SnoreIcon::~SnoreIcon()
const QImage &SnoreIcon::image() const{ const QImage &SnoreIcon::image() const{
if(d->_img.isNull() && d->_isLocalFile){ if(d->m_img.isNull() && d->m_isLocalFile){
d->_img = QImage(d->_localFileName); d->m_img = QImage(d->m_localFileName);
} }
return d->_img; return d->m_img;
} }
const QString &SnoreIcon::localUrl()const{ const QString &SnoreIcon::localUrl()const{
if(d->_localFileName.isEmpty()){ if(d->m_localFileName.isEmpty()){
if(hasedImages.contains(hash())){ if(hasedImages.contains(hash())){
d->_localFileName = hasedImages[hash()]; d->m_localFileName = hasedImages[hash()];
}else{ }else{
d->_localFileName = SnoreServer::snoreTMP(); d->m_localFileName = SnoreServer::snoreTMP();
d->_localFileName = d->_localFileName .append("/").append(hash()).append(".png"); d->m_localFileName = d->m_localFileName .append("/").append(hash()).append(".png");
hasedImages[hash()] = d->_localFileName; hasedImages[hash()] = d->m_localFileName;
d->_img.save(d->_localFileName ,"PNG"); d->m_img.save(d->m_localFileName ,"PNG");
} }
} }
return d->_localFileName; return d->m_localFileName;
} }
const QByteArray &SnoreIcon::imageData() const{ const QByteArray &SnoreIcon::imageData() const{
if(d->_data.isEmpty()){ if(d->m_data.isEmpty()){
QBuffer buffer( &d->_data ); QBuffer buffer( &d->m_data );
buffer.open( QBuffer::WriteOnly ); buffer.open( QBuffer::WriteOnly );
d->_img.save( &buffer, "PNG" ); d->m_img.save( &buffer, "PNG" );
} }
return d->_data; return d->m_data;
} }
const QString &SnoreIcon::hash() const{ const QString &SnoreIcon::hash() const{
if(d->_hash.isEmpty()){ if(d->m_hash.isEmpty()){
QCryptographicHash h(QCryptographicHash::Md5); QCryptographicHash h(QCryptographicHash::Md5);
h.addData(imageData()); h.addData(imageData());
d->_hash = h.result().toHex(); d->m_hash = h.result().toHex();
} }
return d->_hash; return d->m_hash;
} }
bool SnoreIcon::isLocalFile() const bool SnoreIcon::isLocalFile() const
{ {
return d->_isLocalFile; return d->m_isLocalFile;
} }
bool SnoreIcon::isEmpty() const{ bool SnoreIcon::isEmpty() const{
return d->_hash.isEmpty() && d->_img.isNull() && d->_localFileName.isEmpty(); return d->m_hash.isEmpty() && d->m_img.isNull() && d->m_localFileName.isEmpty();
} }
} }

View File

@ -34,26 +34,26 @@ class Notification::NotificationData : public QObject
Q_OBJECT Q_OBJECT
public: public:
NotificationData ( uint id=0 ): NotificationData ( uint id=0 ):
_id ( id ), m_id ( id ),
_timeout ( 10 ), m_timeout ( 10 ),
_source ( NULL ), m_source ( NULL ),
_closeReason(NotificationEnums::CloseReasons::NONE), m_closeReason(NotificationEnums::CloseReasons::NONE),
_priority(NotificationEnums::Prioritys::NORMAL) m_priority(NotificationEnums::Prioritys::NORMAL)
{ {
qDebug()<<"ActiveNotifications"<<++count; qDebug()<<"ActiveNotifications"<<++count;
} }
NotificationData ( const QString &application,const QString &alert,const QString &title,const QString &text,const SnoreIcon &icon,int timeout,uint id,NotificationEnums::Prioritys::prioritys priority ): NotificationData ( const QString &application,const QString &alert,const QString &title,const QString &text,const SnoreIcon &icon,int timeout,uint id,NotificationEnums::Prioritys::prioritys priority ):
_id ( id ), m_id ( id ),
_timeout ( timeout ), m_timeout ( timeout ),
_source ( NULL), m_source ( NULL),
_application ( application ), m_application ( application ),
_alert ( alert ), m_alert ( alert ),
_title ( title ), m_title ( title ),
_text ( text ), m_text ( text ),
_icon ( icon ), m_icon ( icon ),
_priority(priority), m_priority(priority),
_closeReason(NotificationEnums::CloseReasons::NONE) m_closeReason(NotificationEnums::CloseReasons::NONE)
{ {
qDebug()<<"ActiveNotifications"<<++count; qDebug()<<"ActiveNotifications"<<++count;
} }
@ -64,19 +64,19 @@ public:
qDebug()<<"ActiveNotifications"<<--count; qDebug()<<"ActiveNotifications"<<--count;
} }
uint _id; uint m_id;
int _timeout; int m_timeout;
Notification::Action *_actionInvoked; Notification::Action *m_actionInvoked;
Notification_Frontend *_source; Notification_Frontend *m_source;
QString _application; QString m_application;
QString _alert; QString m_alert;
QString _title; QString m_title;
QString _text; QString m_text;
SnoreIcon _icon; SnoreIcon m_icon;
NotificationEnums::Prioritys::prioritys _priority; NotificationEnums::Prioritys::prioritys m_priority;
NotificationEnums::CloseReasons::closeReasons _closeReason; NotificationEnums::CloseReasons::closeReasons m_closeReason;
QMap<int,Notification::Action*> _actions; QMap<int,Notification::Action*> m_actions;
QVariantHash _hints; QVariantHash m_hints;
}; };
@ -117,122 +117,122 @@ Notification &Notification::operator=(const Notification& other)
QString Notification::toString() const QString Notification::toString() const
{ {
return QString ( "Title: "+d->_title+"\nText: "+d->_text ); return QString ( "Title: "+d->m_title+"\nText: "+d->m_text );
} }
const uint &Notification::id() const const uint &Notification::id() const
{ {
return d->_id; return d->m_id;
} }
void Notification::setId(const uint &id) void Notification::setId(const uint &id)
{ {
qDebug()<<"setting notification id:"<<id; qDebug()<<"setting notification id:"<<id;
d->_id = id; d->m_id = id;
} }
const SnoreIcon &Notification::icon() const const SnoreIcon &Notification::icon() const
{ {
return d->_icon; return d->m_icon;
} }
const int &Notification::timeout() const const int &Notification::timeout() const
{ {
return d->_timeout; return d->m_timeout;
} }
const Notification::Action *Notification::actionInvoked() const const Notification::Action *Notification::actionInvoked() const
{ {
return d->_actionInvoked; return d->m_actionInvoked;
} }
void Notification::setActionInvoked ( Action *action ) void Notification::setActionInvoked ( Action *action )
{ {
d->_actionInvoked = action; d->m_actionInvoked = action;
} }
void Notification::setActionInvoked ( const int &id) void Notification::setActionInvoked ( const int &id)
{ {
d->_actionInvoked = d->_actions[id]; d->m_actionInvoked = d->m_actions[id];
} }
void Notification::setSource(Notification_Frontend *source) const{ void Notification::setSource(Notification_Frontend *source) const{
d->_source = source; d->m_source = source;
} }
Notification_Frontend *Notification::source() const Notification_Frontend *Notification::source() const
{ {
return d->_source; return d->m_source;
} }
const QString &Notification::application() const const QString &Notification::application() const
{ {
return d->_application; return d->m_application;
} }
const QString &Notification::title() const const QString &Notification::title() const
{ {
return d->_title; return d->m_title;
} }
const QString &Notification::text() const const QString &Notification::text() const
{ {
return d->_text; return d->m_text;
} }
const QString &Notification::alert() const const QString &Notification::alert() const
{ {
return d->_alert; return d->m_alert;
} }
bool Notification::sticky() const bool Notification::sticky() const
{ {
return d->_timeout == 0; return d->m_timeout == 0;
} }
void Notification::setSticky() void Notification::setSticky()
{ {
d->_timeout = 0; d->m_timeout = 0;
} }
const NotificationEnums::Prioritys::prioritys &Notification::priority() const const NotificationEnums::Prioritys::prioritys &Notification::priority() const
{ {
return d->_priority; return d->m_priority;
} }
void Notification::addAction(Notification::Action *a) void Notification::addAction(Notification::Action *a)
{ {
qDebug()<<"Added notification"<<a->id<<a->name; qDebug()<<"Added notification"<<a->id<<a->name;
d->_actions.insert(a->id,a); d->m_actions.insert(a->id,a);
} }
const QMap<int,Notification::Action*> &Notification::actions() const const QMap<int,Notification::Action*> &Notification::actions() const
{ {
return d->_actions; return d->m_actions;
} }
const NotificationEnums::CloseReasons::closeReasons &Notification::closeReason(){ const NotificationEnums::CloseReasons::closeReasons &Notification::closeReason(){
return d->_closeReason; return d->m_closeReason;
} }
void Notification::setCloseReason(const NotificationEnums::CloseReasons::closeReasons &r){ void Notification::setCloseReason(const NotificationEnums::CloseReasons::closeReasons &r){
d->_closeReason = r; d->m_closeReason = r;
} }
const QVariant Notification::hint ( const QString &key ) const const QVariant Notification::hint ( const QString &key ) const
{ {
return d->_hints.value ( key ); return d->m_hints.value ( key );
} }
bool Notification::hintExists ( const QString &key ) bool Notification::hintExists ( const QString &key )
{ {
return d->_hints.contains ( key ); return d->m_hints.contains ( key );
} }
void Notification::insertHint ( const QString &key, const QVariant &val ) void Notification::insertHint ( const QString &key, const QVariant &val )
{ {
d->_hints.insert ( key,val ); d->m_hints.insert ( key,val );
} }
QDataStream & operator<< ( QDataStream &stream, const Notification &noti ) QDataStream & operator<< ( QDataStream &stream, const Notification &noti )

View File

@ -74,7 +74,7 @@ public:
const uint &id() const; const uint &id() const;
void setId(const uint &id); void setId(const uint &id);
//timeout in seconds //timeout in seconds
//-1 means sticky //0 means sticky
const int &timeout() const; const int &timeout() const;
void setActionInvoked ( Action *action ); void setActionInvoked ( Action *action );
void setActionInvoked ( const int &actionID); void setActionInvoked ( const int &actionID);

View File

@ -68,7 +68,7 @@ uint FreedesktopNotification_Frontend::Notify(const QString &app_name, uint repl
const QString &app_icon, const QString &summary, const QString &body, const QString &app_icon, const QString &summary, const QString &body,
const QStringList &actions, const QVariantMap &hints, int timeout) const QStringList &actions, const QVariantMap &hints, int timeout)
{ {
qDebug()<<app_name<<summary<<body<<app_icon; qDebug()<<app_name<<summary<<body<<app_icon<<timeout;
SnoreIcon icon; SnoreIcon icon;
NotificationEnums::Prioritys::prioritys priotity = NotificationEnums::Prioritys::NORMAL; NotificationEnums::Prioritys::prioritys priotity = NotificationEnums::Prioritys::NORMAL;
@ -78,8 +78,6 @@ uint FreedesktopNotification_Frontend::Notify(const QString &app_name, uint repl
icon = SnoreIcon(image.toQImage()); icon = SnoreIcon(image.toQImage());
} }
qDebug()<<snore()<<this;
if(!snore()->aplications().contains(app_name)){ if(!snore()->aplications().contains(app_name)){
#ifdef HAVE_KDE #ifdef HAVE_KDE
SnoreIcon appIcon = SnoreIcon(KIconLoader::global()->iconPath(app_icon, KIconLoader::Desktop)); SnoreIcon appIcon = SnoreIcon(KIconLoader::global()->iconPath(app_icon, KIconLoader::Desktop));