mirror of
https://github.com/YACReader/yacreader
synced 2025-07-21 06:24:39 -04:00
YACReaderLibrary.Comic renombrada a YACReaderLibrary.ComicDB
A?adida la clase YACReader.Comic a YACReaderLibrary Implementado el controlador que sirve la informaci?n de descarga de un c?mic
This commit is contained in:
@ -0,0 +1,31 @@
|
||||
#include "comiccontroller.h"
|
||||
#include "library_window.h"
|
||||
|
||||
extern LibraryWindow * mw;
|
||||
|
||||
#include "template.h"
|
||||
#include "../static.h"
|
||||
|
||||
#include "comic_db.h"
|
||||
|
||||
ComicController::ComicController() {}
|
||||
|
||||
void ComicController::service(HttpRequest& request, HttpResponse& response)
|
||||
{
|
||||
response.setHeader("Content-Type", "plain/text; charset=ISO-8859-1");
|
||||
|
||||
QStringList pathElements = ((QString)request.getPath()).split('/');
|
||||
QString libraryName = pathElements.at(2);
|
||||
qulonglong comicId = pathElements.at(4).toULongLong();
|
||||
|
||||
ComicDB comic = mw->getComicInfo(libraryName, comicId);
|
||||
|
||||
response.writeText(QString("comicid:%1\n").arg(comic.id));
|
||||
response.writeText(QString("hash:%1\n").arg(comic.info.hash));
|
||||
response.writeText(QString("path:%1\n").arg(comic.path));
|
||||
response.writeText(QString("numpages:%1\n").arg(*comic.info.numPages));
|
||||
response.writeText(QString("library:%1\n").arg(libraryName),true);
|
||||
|
||||
//response.write(t.toLatin1(),true);
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
#ifndef COMICCONTROLLER_H
|
||||
#define COMICCONTROLLER_H
|
||||
|
||||
#include "httprequest.h"
|
||||
#include "httpresponse.h"
|
||||
#include "httprequesthandler.h"
|
||||
|
||||
class ComicController : public HttpRequestHandler {
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(ComicController);
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
ComicController();
|
||||
|
||||
/** Generates the response */
|
||||
void service(HttpRequest& request, HttpResponse& response);
|
||||
};
|
||||
|
||||
#endif // COMICCONTROLLER_H
|
||||
|
@ -103,7 +103,7 @@ void FolderController::service(HttpRequest& request, HttpResponse& response)
|
||||
|
||||
while(j<numComicsAtCurrentPage)
|
||||
{
|
||||
const Comic * comic = (Comic *)folderComics.at(j+comicsOffset);
|
||||
const ComicDB * comic = (ComicDB *)folderComics.at(j+comicsOffset);
|
||||
//if(comic->info.title == 0 || comic->info.title->isEmpty())
|
||||
t.setVariable(QString("elementcomic%1.name").arg(j),comic->name);
|
||||
//else
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "controllers/librariescontroller.h"
|
||||
#include "controllers/foldercontroller.h"
|
||||
#include "controllers/covercontroller.h"
|
||||
#include "controllers/comiccontroller.h"
|
||||
|
||||
RequestMapper::RequestMapper(QObject* parent)
|
||||
:HttpRequestHandler(parent) {}
|
||||
@ -30,40 +31,26 @@ void RequestMapper::service(HttpRequest& request, HttpResponse& response) {
|
||||
}
|
||||
|
||||
//listar el contenido del folder
|
||||
if(path.contains("folder") && !path.contains("info"))
|
||||
else if(path.contains("folder") && !path.contains("info"))
|
||||
{
|
||||
FolderController().service(request, response);
|
||||
}
|
||||
|
||||
if(path.contains("cover") )
|
||||
else if(path.contains("cover") )
|
||||
{
|
||||
CoverController().service(request, response);
|
||||
}
|
||||
else if(path.contains("comic") && !path.contains("page"))
|
||||
{
|
||||
ComicController().service(request, response);
|
||||
}
|
||||
else if(path.contains("page"))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (path.startsWith("/dump")) {
|
||||
DumpController().service(request, response);
|
||||
}
|
||||
|
||||
else if (path.startsWith("/template")) {
|
||||
TemplateController().service(request, response);
|
||||
}
|
||||
|
||||
else if (path.startsWith("/form")) {
|
||||
FormController().service(request, response);
|
||||
}
|
||||
|
||||
else if (path.startsWith("/file")) {
|
||||
FileUploadController().service(request, response);
|
||||
}
|
||||
|
||||
else if (path.startsWith("/session")) {
|
||||
SessionController().service(request, response);
|
||||
}
|
||||
|
||||
// All other pathes are mapped to the static file controller.
|
||||
else {
|
||||
Static::staticFileController->service(request, response);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user