mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -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)) {
|
} else if (comicPage.exactMatch(path) || comicPageRemote.exactMatch(path)) {
|
||||||
PageControllerV2().service(request, response);
|
PageControllerV2().service(request, response);
|
||||||
} else if (comicUpdate.exactMatch(path)) {
|
} 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)) {
|
} else if (folderContent.exactMatch(path)) {
|
||||||
FolderContentControllerV2().service(request, response);
|
FolderContentControllerV2().service(request, response);
|
||||||
} else if (tags.exactMatch(path)) {
|
} else if (tags.exactMatch(path)) {
|
||||||
|
@ -20,6 +20,9 @@ public:
|
|||||||
void loadSessionV1(stefanfrings::HttpRequest &request, stefanfrings::HttpResponse &response);
|
void loadSessionV1(stefanfrings::HttpRequest &request, stefanfrings::HttpResponse &response);
|
||||||
void loadSessionV2(stefanfrings::HttpRequest &request, stefanfrings::HttpResponse &response);
|
void loadSessionV2(stefanfrings::HttpRequest &request, stefanfrings::HttpResponse &response);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void comicUpdated(qulonglong libraryId, qulonglong comicId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void serviceV1(stefanfrings::HttpRequest &request, stefanfrings::HttpResponse &response);
|
void serviceV1(stefanfrings::HttpRequest &request, stefanfrings::HttpResponse &response);
|
||||||
void serviceV2(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();
|
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()) {
|
if (listener->isListening()) {
|
||||||
qDebug("ServiceHelper: Service has started");
|
qDebug("ServiceHelper: Service has started");
|
||||||
@ -158,7 +161,7 @@ void YACReaderHttpServer::stop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
YACReaderHttpServer::YACReaderHttpServer()
|
YACReaderHttpServer::YACReaderHttpServer()
|
||||||
: listener(nullptr)
|
: QObject(nullptr), listener(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
#ifndef YACREADER_HTTP_SERVER_H
|
#ifndef YACREADER_HTTP_SERVER_H
|
||||||
#define YACREADER_HTTP_SERVER_H
|
#define YACREADER_HTTP_SERVER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
namespace stefanfrings {
|
namespace stefanfrings {
|
||||||
class HttpListener;
|
class HttpListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
class YACReaderHttpServer
|
class YACReaderHttpServer : public QObject
|
||||||
{
|
{
|
||||||
private:
|
Q_OBJECT
|
||||||
stefanfrings::HttpListener *listener;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
YACReaderHttpServer();
|
YACReaderHttpServer();
|
||||||
|
|
||||||
@ -20,7 +19,11 @@ public:
|
|||||||
|
|
||||||
QString getPort();
|
QString getPort();
|
||||||
|
|
||||||
protected:
|
signals:
|
||||||
|
void comicUpdated(qulonglong libraryId, qulonglong comicId);
|
||||||
|
|
||||||
|
private:
|
||||||
|
stefanfrings::HttpListener *listener;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // YACREADER_HTTP_SERVER_H
|
#endif // YACREADER_HTTP_SERVER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user