mirror of
https://github.com/YACReader/yacreader
synced 2025-05-27 19:00:29 -04:00
Notify using a signal when a comic is updated using the http api
This commit is contained in:
parent
bf36672ade
commit
c576140e6a
@ -290,7 +290,12 @@ void RequestMapper::serviceV2(HttpRequest &request, HttpResponse &response)
|
||||
} else if (comicPage.exactMatch(path) || comicPageRemote.exactMatch(path)) {
|
||||
PageControllerV2().service(request, response);
|
||||
} else if (comicUpdate.exactMatch(path)) {
|
||||
UpdateComicControllerV2().service(request, response);
|
||||
auto updateController = UpdateComicControllerV2();
|
||||
updateController.service(request, response);
|
||||
|
||||
if (!updateController.error) {
|
||||
emit comicUpdated(updateController.updatedLibraryId, updateController.updatedComicId);
|
||||
}
|
||||
} else if (folderContent.exactMatch(path)) {
|
||||
FolderContentControllerV2().service(request, response);
|
||||
} else if (tags.exactMatch(path)) {
|
||||
|
@ -20,6 +20,9 @@ public:
|
||||
void loadSessionV1(stefanfrings::HttpRequest &request, stefanfrings::HttpResponse &response);
|
||||
void loadSessionV2(stefanfrings::HttpRequest &request, stefanfrings::HttpResponse &response);
|
||||
|
||||
signals:
|
||||
void comicUpdated(qulonglong libraryId, qulonglong comicId);
|
||||
|
||||
private:
|
||||
void serviceV1(stefanfrings::HttpRequest &request, stefanfrings::HttpResponse &response);
|
||||
void serviceV2(stefanfrings::HttpRequest &request, stefanfrings::HttpResponse &response);
|
||||
|
@ -137,7 +137,10 @@ void YACReaderHttpServer::start(quint16 port)
|
||||
testServer.close();
|
||||
}
|
||||
|
||||
listener = new HttpListener(listenerSettings, new RequestMapper(app), app);
|
||||
auto requestMapper = new RequestMapper(app);
|
||||
listener = new HttpListener(listenerSettings, requestMapper, app);
|
||||
|
||||
connect(requestMapper, &RequestMapper::comicUpdated, this, &YACReaderHttpServer::comicUpdated);
|
||||
|
||||
if (listener->isListening()) {
|
||||
qDebug("ServiceHelper: Service has started");
|
||||
@ -158,7 +161,7 @@ void YACReaderHttpServer::stop()
|
||||
}
|
||||
|
||||
YACReaderHttpServer::YACReaderHttpServer()
|
||||
: listener(nullptr)
|
||||
: QObject(nullptr), listener(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,16 @@
|
||||
#ifndef YACREADER_HTTP_SERVER_H
|
||||
#define YACREADER_HTTP_SERVER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
namespace stefanfrings {
|
||||
class HttpListener;
|
||||
}
|
||||
|
||||
class YACReaderHttpServer
|
||||
class YACReaderHttpServer : public QObject
|
||||
{
|
||||
private:
|
||||
stefanfrings::HttpListener *listener;
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
YACReaderHttpServer();
|
||||
|
||||
@ -20,7 +19,11 @@ public:
|
||||
|
||||
QString getPort();
|
||||
|
||||
protected:
|
||||
signals:
|
||||
void comicUpdated(qulonglong libraryId, qulonglong comicId);
|
||||
|
||||
private:
|
||||
stefanfrings::HttpListener *listener;
|
||||
};
|
||||
|
||||
#endif // YACREADER_HTTP_SERVER_H
|
||||
|
Loading…
Reference in New Issue
Block a user