mirror of
https://github.com/YACReader/yacreader
synced 2025-09-15 09:44:51 -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
|
||||
|
Reference in New Issue
Block a user