...
This commit is contained in:
parent
801fab9dac
commit
2263cf252c
|
@ -69,8 +69,9 @@ QString FreedesktopNotification_Frontend::getImagefromHint(const FreedesktopImag
|
|||
QFile file(filename);
|
||||
if(file.exists())return filename;
|
||||
|
||||
QImage qimage=img.toQImage();
|
||||
qimage.save(filename,"PNG");
|
||||
QImage *qimage = img.toQImage();
|
||||
qimage->save(filename,"PNG");
|
||||
delete qimage;
|
||||
qDebug()<<"Saving to "<<filename;
|
||||
return filename;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ void FreedesktopNotification::registerTypes() {
|
|||
}
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &a, const FreedesktopNotification &i) {
|
||||
Q_ASSERT(!i.notification.isNull());
|
||||
// Q_ASSERT(!i.notification.isNull());
|
||||
qDebug()<<i.notification->toString();
|
||||
a<<i.notification->application();
|
||||
a<<uint(0);
|
||||
|
@ -88,8 +88,10 @@ FreedesktopImageHint::FreedesktopImageHint(const QImage &img) {
|
|||
}
|
||||
|
||||
|
||||
QImage FreedesktopImageHint::toQImage()const {
|
||||
return QImage((uchar*)imageData.data(),width,height,QImage::Format_ARGB32 ).rgbSwapped();
|
||||
QImage *FreedesktopImageHint::toQImage() const {
|
||||
QImage *img = new QImage((uchar*)imageData.data(),width,height,QImage::Format_ARGB32 );
|
||||
img->rgbSwapped();
|
||||
return img;
|
||||
}
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &a, const FreedesktopImageHint &i) {
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
public:
|
||||
FreedesktopNotification();
|
||||
FreedesktopNotification(QSharedPointer<Notification> noti);
|
||||
|
||||
QSharedPointer<Notification> notification;
|
||||
};
|
||||
|
||||
|
@ -46,7 +47,7 @@ public:
|
|||
FreedesktopImageHint();
|
||||
FreedesktopImageHint(const QImage &img);
|
||||
|
||||
QImage toQImage()const;
|
||||
QImage* toQImage()const;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
|
|
|
@ -33,7 +33,7 @@ void FreedesktopNotification_Backend::unregisterApplication ( Application *appli
|
|||
|
||||
int FreedesktopNotification_Backend::notify ( QSharedPointer<Notification> noti )
|
||||
{
|
||||
fNotification *n = new fNotification ( noti , this);
|
||||
fNotification *n = new fNotification ( noti );
|
||||
qDebug()<<"Sending Notification wit Freedesktop_Backend"<<noti->title()<<noti->text();
|
||||
uint out = n->send();
|
||||
n->deleteLater();
|
||||
|
@ -43,7 +43,7 @@ int FreedesktopNotification_Backend::notify ( QSharedPointer<Notification> noti
|
|||
void FreedesktopNotification_Backend::closeNotification ( QSharedPointer<Notification> notification )
|
||||
{
|
||||
//TODO: fix
|
||||
fNotification *fn = new fNotification ( notification,this );
|
||||
fNotification *fn = new fNotification ( notification);
|
||||
fn->close();
|
||||
}
|
||||
|
||||
|
@ -52,8 +52,8 @@ QString fNotification::vendor ( "" );
|
|||
|
||||
QDBusInterface fNotification::notificationInterface ( "org.freedesktop.Notifications","/org/freedesktop/Notifications","org.freedesktop.Notifications" );
|
||||
|
||||
fNotification::fNotification(QSharedPointer< Notification > notification, FreedesktopNotification_Backend* parent):
|
||||
QObject(parent),
|
||||
fNotification::fNotification(QSharedPointer< Notification > notification):
|
||||
QObject(notification.data()),
|
||||
_notification(notification)
|
||||
{}
|
||||
|
||||
|
@ -62,8 +62,8 @@ fNotification::fNotification(QSharedPointer< Notification > notification, Freede
|
|||
uint fNotification::send()
|
||||
{
|
||||
Q_ASSERT(!_notification.isNull());
|
||||
FreedesktopNotification n ( _notification );
|
||||
QDBusMessage recive=notificationInterface.call ( "Notify", QVariant::fromValue ( n ) );
|
||||
QVariant n = QVariant::fromValue ( FreedesktopNotification( _notification ));
|
||||
QDBusMessage recive = notificationInterface.call ( "Notify", n );
|
||||
uint id=recive.arguments().last().toInt();
|
||||
selfdistruct = new QTimer(this );
|
||||
selfdistruct->setSingleShot ( true );
|
||||
|
@ -130,7 +130,6 @@ QString fNotification::getVendor()
|
|||
void fNotification::selfDelete()
|
||||
{
|
||||
_notification.clear();
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ private:
|
|||
static QString vendor;
|
||||
|
||||
public:
|
||||
fNotification ( QSharedPointer<Notification> notification ,FreedesktopNotification_Backend* parent );
|
||||
fNotification ( QSharedPointer<Notification> notification);
|
||||
uint send();
|
||||
QSharedPointer<Notification> notification();
|
||||
|
||||
|
|
Loading…
Reference in New Issue