mirror of
https://github.com/YACReader/yacreader
synced 2025-07-19 13:34:44 -04:00
Creada provisionalmente clase Comic2 que evita los problemas de gesti?n de memoria
This commit is contained in:
@ -10,24 +10,68 @@ extern LibraryWindow * mw;
|
||||
#include "comic_db.h"
|
||||
#include "comic.h"
|
||||
|
||||
Synchronizer::Synchronizer(Comic2 * c,QString p,QThread * f)
|
||||
:QThread(),comic(c),path(p),from(f)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Synchronizer::run()
|
||||
{
|
||||
connect(comic,SIGNAL(numPages(unsigned int)),this,SLOT(waitedSignal()));
|
||||
loaded = comic->load(path);
|
||||
}
|
||||
|
||||
void Synchronizer::waitedSignal()
|
||||
{
|
||||
if(loaded)
|
||||
{
|
||||
comic->moveToThread(from);
|
||||
quit();
|
||||
}
|
||||
else
|
||||
{
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ComicController::ComicController() {}
|
||||
|
||||
void ComicController::service(HttpRequest& request, HttpResponse& response)
|
||||
{
|
||||
|
||||
|
||||
HttpSession session=Static::sessionStore->getSession(request,response);
|
||||
|
||||
QStringList pathElements = ((QString)request.getPath()).split('/');
|
||||
QString libraryName = pathElements.at(2);
|
||||
qulonglong comicId = pathElements.at(4).toULongLong();
|
||||
|
||||
//TODO
|
||||
//if(pathElements.size() == 6)
|
||||
//{
|
||||
// QString action = pathElements.at(5);
|
||||
// if(!action.isEmpty() && (action == "close"))
|
||||
// {
|
||||
// session.dismissCurrentComic();
|
||||
// response.write("",true);
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
|
||||
QMap<QString,QString> libraries = mw->getLibraries();
|
||||
|
||||
|
||||
ComicDB comic = mw->getComicInfo(libraryName, comicId);
|
||||
|
||||
Comic * comicFile = new Comic;
|
||||
Comic2 * comicFile = new Comic2;
|
||||
//Synchronizer * synchronizer = new Synchronizer(comicFile,libraries.value(libraryName)+comic.path, this->thread());
|
||||
//comicFile->moveToThread(synchronizer);
|
||||
|
||||
|
||||
//synchronizer->start();
|
||||
//QApplication::instance()->exec();
|
||||
//synchronizer->wait(20000);
|
||||
|
||||
if(comicFile->load(libraries.value(libraryName)+comic.path))
|
||||
{
|
||||
session.setCurrentComic(comic.id, comicFile);
|
||||
@ -45,10 +89,6 @@ void ComicController::service(HttpRequest& request, HttpResponse& response)
|
||||
response.setStatus(404,"not found");
|
||||
response.write("404 not found",true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//response.write(t.toLatin1(),true);
|
||||
|
||||
}
|
Reference in New Issue
Block a user