Modificada la clase Comic por una jerarqu?a y una factory

corregido bug en go_to_flow_gl
This commit is contained in:
Luis Ángel San Martín
2013-01-19 23:16:32 +01:00
parent 753dba50df
commit eae74073c0
13 changed files with 335 additions and 525 deletions

View File

@ -378,7 +378,11 @@ void Render::setRotation(int degrees)
void Render::setComic(Comic * c)
{
if(comic !=0)
delete comic;
{
comic->moveToThread(QApplication::instance()->thread());
comic->disconnect();
comic->deleteLater();
}
comic = c;
}
@ -398,9 +402,29 @@ void Render::update()
void Render::load(const QString & path)
{
if(comic!=0)
delete comic;
comic = new Comic();
{
comic->moveToThread(QApplication::instance()->thread());
comic->disconnect();
comic->deleteLater();
}
//comic->moveToThread(QApplication::instance()->thread());
comic = FactoryComic::newComic(path);
if(comic == NULL) //archivo no encontrado o no v<>lido
return;
previousIndex = currentIndex = 0;
QThread * thread = NULL;
if (typeid(*comic) != typeid(FileComic))
{
thread = new QThread();
comic->moveToThread(thread);
connect(thread, SIGNAL(started()), comic, SLOT(process()));
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
}
connect(comic,SIGNAL(errorOpening()),this,SIGNAL(errorOpening()));
connect(comic,SIGNAL(errorOpening()),this,SLOT(reset()));
@ -413,12 +437,18 @@ void Render::load(const QString & path)
connect(comic,SIGNAL(isBookmark(bool)),this,SIGNAL(currentPageIsBookmark(bool)));
connect(comic,SIGNAL(bookmarksLoaded(const Bookmarks &)),this,SIGNAL(bookmarksLoaded(const Bookmarks &)));
pagesReady.clear();
if(comic->load(path)) //garantiza que se va a intentar abrir el c<>mic
{
invalidate();
loadedComic = true;
update();
}
comic->load(path); //garantiza que se va a intentar abrir el c<>mic
if(thread != NULL)
thread->start();
invalidate();
loadedComic = true;
update();
}