renamed some vars
This commit is contained in:
parent
57cb02094e
commit
3b15f77941
|
@ -43,10 +43,10 @@ public:
|
|||
|
||||
|
||||
private:
|
||||
QString _name;
|
||||
SnoreIcon _icon;
|
||||
AlertList _alerts;
|
||||
bool _initialized;
|
||||
QString m_name;
|
||||
SnoreIcon m_icon;
|
||||
AlertList m_alerts;
|
||||
bool m_initialized;
|
||||
|
||||
};
|
||||
|
||||
|
@ -62,10 +62,10 @@ public:
|
|||
const SnoreIcon &icon() const;
|
||||
bool isActive() const;
|
||||
private:
|
||||
QString _name;
|
||||
QString _title;
|
||||
SnoreIcon _icon;
|
||||
bool _active;
|
||||
QString m_name;
|
||||
QString m_title;
|
||||
SnoreIcon m_icon;
|
||||
bool m_active;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -29,22 +29,22 @@ class SnoreIcon::SnoreIconData : public QObject
|
|||
Q_OBJECT
|
||||
public:
|
||||
SnoreIconData():
|
||||
_isLocalFile(false)
|
||||
m_isLocalFile(false)
|
||||
{ }
|
||||
|
||||
SnoreIconData(const QImage &img):
|
||||
_img(img),
|
||||
_isLocalFile(false)
|
||||
m_img(img),
|
||||
m_isLocalFile(false)
|
||||
{}
|
||||
|
||||
SnoreIconData(const QString &url){
|
||||
qDebug()<<"Creating SnoreIcon"<<url;
|
||||
if(url.startsWith(":/")){
|
||||
_img = QImage(url);
|
||||
_isLocalFile = false;
|
||||
m_img = QImage(url);
|
||||
m_isLocalFile = false;
|
||||
}else if(QFile(url).exists()){
|
||||
_isLocalFile = true;
|
||||
_localFileName = url;
|
||||
m_isLocalFile = true;
|
||||
m_localFileName = url;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,11 +52,11 @@ public:
|
|||
{}
|
||||
|
||||
|
||||
QImage _img;
|
||||
QByteArray _data;
|
||||
QString _localFileName;
|
||||
QString _hash;
|
||||
bool _isLocalFile;
|
||||
QImage m_img;
|
||||
QByteArray m_data;
|
||||
QString m_localFileName;
|
||||
QString m_hash;
|
||||
bool m_isLocalFile;
|
||||
|
||||
};
|
||||
|
||||
|
@ -88,51 +88,51 @@ SnoreIcon::~SnoreIcon()
|
|||
|
||||
|
||||
const QImage &SnoreIcon::image() const{
|
||||
if(d->_img.isNull() && d->_isLocalFile){
|
||||
d->_img = QImage(d->_localFileName);
|
||||
if(d->m_img.isNull() && d->m_isLocalFile){
|
||||
d->m_img = QImage(d->m_localFileName);
|
||||
}
|
||||
return d->_img;
|
||||
return d->m_img;
|
||||
}
|
||||
|
||||
const QString &SnoreIcon::localUrl()const{
|
||||
if(d->_localFileName.isEmpty()){
|
||||
if(d->m_localFileName.isEmpty()){
|
||||
if(hasedImages.contains(hash())){
|
||||
d->_localFileName = hasedImages[hash()];
|
||||
d->m_localFileName = hasedImages[hash()];
|
||||
}else{
|
||||
d->_localFileName = SnoreServer::snoreTMP();
|
||||
d->_localFileName = d->_localFileName .append("/").append(hash()).append(".png");
|
||||
hasedImages[hash()] = d->_localFileName;
|
||||
d->_img.save(d->_localFileName ,"PNG");
|
||||
d->m_localFileName = SnoreServer::snoreTMP();
|
||||
d->m_localFileName = d->m_localFileName .append("/").append(hash()).append(".png");
|
||||
hasedImages[hash()] = d->m_localFileName;
|
||||
d->m_img.save(d->m_localFileName ,"PNG");
|
||||
}
|
||||
}
|
||||
return d->_localFileName;
|
||||
return d->m_localFileName;
|
||||
}
|
||||
|
||||
const QByteArray &SnoreIcon::imageData() const{
|
||||
if(d->_data.isEmpty()){
|
||||
QBuffer buffer( &d->_data );
|
||||
if(d->m_data.isEmpty()){
|
||||
QBuffer buffer( &d->m_data );
|
||||
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{
|
||||
if(d->_hash.isEmpty()){
|
||||
if(d->m_hash.isEmpty()){
|
||||
QCryptographicHash h(QCryptographicHash::Md5);
|
||||
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
|
||||
{
|
||||
return d->_isLocalFile;
|
||||
return d->m_isLocalFile;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,26 +34,26 @@ class Notification::NotificationData : public QObject
|
|||
Q_OBJECT
|
||||
public:
|
||||
NotificationData ( uint id=0 ):
|
||||
_id ( id ),
|
||||
_timeout ( 10 ),
|
||||
_source ( NULL ),
|
||||
_closeReason(NotificationEnums::CloseReasons::NONE),
|
||||
_priority(NotificationEnums::Prioritys::NORMAL)
|
||||
m_id ( id ),
|
||||
m_timeout ( 10 ),
|
||||
m_source ( NULL ),
|
||||
m_closeReason(NotificationEnums::CloseReasons::NONE),
|
||||
m_priority(NotificationEnums::Prioritys::NORMAL)
|
||||
{
|
||||
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 ):
|
||||
_id ( id ),
|
||||
_timeout ( timeout ),
|
||||
_source ( NULL),
|
||||
_application ( application ),
|
||||
_alert ( alert ),
|
||||
_title ( title ),
|
||||
_text ( text ),
|
||||
_icon ( icon ),
|
||||
_priority(priority),
|
||||
_closeReason(NotificationEnums::CloseReasons::NONE)
|
||||
m_id ( id ),
|
||||
m_timeout ( timeout ),
|
||||
m_source ( NULL),
|
||||
m_application ( application ),
|
||||
m_alert ( alert ),
|
||||
m_title ( title ),
|
||||
m_text ( text ),
|
||||
m_icon ( icon ),
|
||||
m_priority(priority),
|
||||
m_closeReason(NotificationEnums::CloseReasons::NONE)
|
||||
{
|
||||
qDebug()<<"ActiveNotifications"<<++count;
|
||||
}
|
||||
|
@ -64,19 +64,19 @@ public:
|
|||
qDebug()<<"ActiveNotifications"<<--count;
|
||||
}
|
||||
|
||||
uint _id;
|
||||
int _timeout;
|
||||
Notification::Action *_actionInvoked;
|
||||
Notification_Frontend *_source;
|
||||
QString _application;
|
||||
QString _alert;
|
||||
QString _title;
|
||||
QString _text;
|
||||
SnoreIcon _icon;
|
||||
NotificationEnums::Prioritys::prioritys _priority;
|
||||
NotificationEnums::CloseReasons::closeReasons _closeReason;
|
||||
QMap<int,Notification::Action*> _actions;
|
||||
QVariantHash _hints;
|
||||
uint m_id;
|
||||
int m_timeout;
|
||||
Notification::Action *m_actionInvoked;
|
||||
Notification_Frontend *m_source;
|
||||
QString m_application;
|
||||
QString m_alert;
|
||||
QString m_title;
|
||||
QString m_text;
|
||||
SnoreIcon m_icon;
|
||||
NotificationEnums::Prioritys::prioritys m_priority;
|
||||
NotificationEnums::CloseReasons::closeReasons m_closeReason;
|
||||
QMap<int,Notification::Action*> m_actions;
|
||||
QVariantHash m_hints;
|
||||
};
|
||||
|
||||
|
||||
|
@ -117,122 +117,122 @@ Notification &Notification::operator=(const Notification& other)
|
|||
|
||||
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
|
||||
{
|
||||
return d->_id;
|
||||
return d->m_id;
|
||||
}
|
||||
|
||||
void Notification::setId(const uint &id)
|
||||
{
|
||||
qDebug()<<"setting notification id:"<<id;
|
||||
d->_id = id;
|
||||
d->m_id = id;
|
||||
}
|
||||
|
||||
const SnoreIcon &Notification::icon() const
|
||||
{
|
||||
return d->_icon;
|
||||
return d->m_icon;
|
||||
}
|
||||
|
||||
const int &Notification::timeout() const
|
||||
{
|
||||
return d->_timeout;
|
||||
return d->m_timeout;
|
||||
}
|
||||
|
||||
const Notification::Action *Notification::actionInvoked() const
|
||||
{
|
||||
return d->_actionInvoked;
|
||||
return d->m_actionInvoked;
|
||||
}
|
||||
|
||||
void Notification::setActionInvoked ( Action *action )
|
||||
{
|
||||
d->_actionInvoked = action;
|
||||
d->m_actionInvoked = action;
|
||||
}
|
||||
|
||||
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{
|
||||
d->_source = source;
|
||||
d->m_source = source;
|
||||
}
|
||||
|
||||
Notification_Frontend *Notification::source() const
|
||||
{
|
||||
return d->_source;
|
||||
return d->m_source;
|
||||
}
|
||||
|
||||
const QString &Notification::application() const
|
||||
{
|
||||
return d->_application;
|
||||
return d->m_application;
|
||||
}
|
||||
|
||||
const QString &Notification::title() const
|
||||
{
|
||||
return d->_title;
|
||||
return d->m_title;
|
||||
}
|
||||
|
||||
const QString &Notification::text() const
|
||||
{
|
||||
return d->_text;
|
||||
return d->m_text;
|
||||
}
|
||||
|
||||
const QString &Notification::alert() const
|
||||
{
|
||||
return d->_alert;
|
||||
return d->m_alert;
|
||||
}
|
||||
|
||||
bool Notification::sticky() const
|
||||
{
|
||||
return d->_timeout == 0;
|
||||
return d->m_timeout == 0;
|
||||
}
|
||||
|
||||
void Notification::setSticky()
|
||||
{
|
||||
d->_timeout = 0;
|
||||
d->m_timeout = 0;
|
||||
}
|
||||
|
||||
const NotificationEnums::Prioritys::prioritys &Notification::priority() const
|
||||
{
|
||||
return d->_priority;
|
||||
return d->m_priority;
|
||||
}
|
||||
|
||||
void Notification::addAction(Notification::Action *a)
|
||||
{
|
||||
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
|
||||
{
|
||||
return d->_actions;
|
||||
return d->m_actions;
|
||||
}
|
||||
|
||||
const NotificationEnums::CloseReasons::closeReasons &Notification::closeReason(){
|
||||
return d->_closeReason;
|
||||
return d->m_closeReason;
|
||||
}
|
||||
|
||||
void Notification::setCloseReason(const NotificationEnums::CloseReasons::closeReasons &r){
|
||||
d->_closeReason = r;
|
||||
d->m_closeReason = r;
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
return d->_hints.contains ( key );
|
||||
return d->m_hints.contains ( key );
|
||||
}
|
||||
|
||||
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 ¬i )
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
const uint &id() const;
|
||||
void setId(const uint &id);
|
||||
//timeout in seconds
|
||||
//-1 means sticky
|
||||
//0 means sticky
|
||||
const int &timeout() const;
|
||||
void setActionInvoked ( Action *action );
|
||||
void setActionInvoked ( const int &actionID);
|
||||
|
|
|
@ -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 QStringList &actions, const QVariantMap &hints, int timeout)
|
||||
{
|
||||
qDebug()<<app_name<<summary<<body<<app_icon;
|
||||
qDebug()<<app_name<<summary<<body<<app_icon<<timeout;
|
||||
SnoreIcon icon;
|
||||
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());
|
||||
}
|
||||
|
||||
qDebug()<<snore()<<this;
|
||||
|
||||
if(!snore()->aplications().contains(app_name)){
|
||||
#ifdef HAVE_KDE
|
||||
SnoreIcon appIcon = SnoreIcon(KIconLoader::global()->iconPath(app_icon, KIconLoader::Desktop));
|
||||
|
|
Loading…
Reference in New Issue