fixed qt4 etc
This commit is contained in:
parent
8b57c2a41b
commit
95075fe29a
|
@ -49,6 +49,18 @@ private:
|
|||
|
||||
};
|
||||
|
||||
template<typename Type>
|
||||
inline Type myQVariantCast(const QVariant &dat)
|
||||
{
|
||||
return qobject_cast<Type>(qvariant_cast<QObject*>(dat));
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
inline QVariant myQVariantFromValue(const Type &dat)
|
||||
{
|
||||
return qVariantFromValue(qobject_cast<QObject*>(dat));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ void SnorePlugin::startTimeout(Notification ¬ification)
|
|||
return;
|
||||
}
|
||||
uint id = notification.id();
|
||||
QTimer *timer = qvariant_cast<QTimer*>(notification.hints().privateValue(this, "timeout"));
|
||||
QTimer *timer = myQVariantCast<QTimer*>(notification.hints().privateValue(this, "timeout"));
|
||||
if(notification.updateID() != (uint)-1)
|
||||
{
|
||||
id = notification.updateID();
|
||||
|
@ -88,6 +88,7 @@ void SnorePlugin::startTimeout(Notification ¬ification)
|
|||
timer = new QTimer(this);
|
||||
timer->setSingleShot(true);
|
||||
timer->setProperty("notificationID", id);
|
||||
notification.hints().setPrivateValue(this, "timeout", myQVariantFromValue(timer));
|
||||
}
|
||||
|
||||
timer->setInterval(notification.timeout() * 1000);
|
||||
|
|
|
@ -138,7 +138,7 @@ uint FreedesktopFrontend::Notify(const QString &app_name, uint replaces_id,
|
|||
}
|
||||
|
||||
snore()->broadcastNotification(noti);
|
||||
startTimeout(noti.id(),noti.timeout());
|
||||
startTimeout(noti);
|
||||
return noti.id();
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ void Parser::parse(Notification &sNotification,const QString &msg,QTcpSocket* cl
|
|||
}
|
||||
sNotification = Notification(app,alert,title,text,icon,timeout);
|
||||
sNotification.data()->setSource(snarl);
|
||||
sNotification.hints().setPrivateValue(snarl, "clientSocket", qVariantFromValue(client));
|
||||
sNotification.hints().setPrivateValue(snarl, "clientSocket", myQVariantFromValue(client));
|
||||
break;
|
||||
}
|
||||
case ADD_CLASS:
|
||||
|
|
|
@ -129,7 +129,7 @@ void SnarlNetworkFrontend::handleMessages()
|
|||
|
||||
void SnarlNetworkFrontend::callback(Notification &sn, const QString msg)
|
||||
{
|
||||
QTcpSocket *client = qvariant_cast<QTcpSocket*>(sn.hints().privateValue(this, "clientSocket"));
|
||||
QTcpSocket *client = myQVariantCast<QTcpSocket*>(sn.hints().privateValue(this, "clientSocket"));
|
||||
if(client && !msg.isEmpty())
|
||||
{
|
||||
write(client, QString("%1%2\r\n").arg(msg, QString::number(sn.id())));
|
||||
|
|
Loading…
Reference in New Issue