use cool new connects
This commit is contained in:
parent
65931bdf9d
commit
b331644379
|
@ -17,7 +17,6 @@ Toasty::~Toasty()
|
||||||
|
|
||||||
void Toasty::slotNotify(Notification notification)
|
void Toasty::slotNotify(Notification notification)
|
||||||
{
|
{
|
||||||
if (!m_key.isEmpty()) {
|
|
||||||
QNetworkRequest request(QString("http://api.supertoasty.com/notify/%1").arg(m_key));
|
QNetworkRequest request(QString("http://api.supertoasty.com/notify/%1").arg(m_key));
|
||||||
QHttpMultiPart *mp = new QHttpMultiPart(QHttpMultiPart::FormDataType);
|
QHttpMultiPart *mp = new QHttpMultiPart(QHttpMultiPart::FormDataType);
|
||||||
QHttpPart title;
|
QHttpPart title;
|
||||||
|
@ -53,17 +52,12 @@ void Toasty::slotNotify(Notification notification)
|
||||||
mp->setParent(reply);
|
mp->setParent(reply);
|
||||||
file->setParent(reply);
|
file->setParent(reply);
|
||||||
|
|
||||||
connect(reply, SIGNAL(finished()), this, SLOT(slotRequestFinished()));
|
connect(reply, &QNetworkReply::finished, this, [reply](){
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Toasty::slotRequestFinished()
|
|
||||||
{
|
|
||||||
QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender());
|
|
||||||
snoreDebug(SNORE_DEBUG) << reply->readAll();
|
snoreDebug(SNORE_DEBUG) << reply->readAll();
|
||||||
reply->close();
|
reply->close();
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Toasty::initialize(SnoreCore *snore)
|
bool Toasty::initialize(SnoreCore *snore)
|
||||||
|
|
|
@ -19,9 +19,6 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
virtual void slotNotify(Snore::Notification notification) override;
|
virtual void slotNotify(Snore::Notification notification) override;
|
||||||
|
|
||||||
private slots:
|
|
||||||
void slotRequestFinished();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_key;
|
QString m_key;
|
||||||
QNetworkAccessManager m_manager;
|
QNetworkAccessManager m_manager;
|
||||||
|
|
Loading…
Reference in New Issue