some destructors added

This commit is contained in:
Luis Ángel San Martín
2013-07-18 17:38:54 +02:00
parent 1728f85cc0
commit 69c86c9344
17 changed files with 164 additions and 44 deletions

View File

@ -27,7 +27,7 @@ Comic::Comic(const QString & pathFile, int atPage )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
Comic::~Comic() Comic::~Comic()
{ {
delete bm; //TODO safe delete
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void Comic::setup() void Comic::setup()
@ -188,7 +188,7 @@ FileComic::FileComic(const QString & path, int atPage )
FileComic::~FileComic() FileComic::~FileComic()
{ {
//Comic::~Comic(); _pages.clear();
} }
bool FileComic::load(const QString & path, int atPage) bool FileComic::load(const QString & path, int atPage)

View File

@ -29,7 +29,7 @@
/*#define WIDTH 126 /*#define WIDTH 126
#define HEIGHT 200*/ #define HEIGHT 200*/
QMutex mutexGoToFlow;
@ -39,7 +39,7 @@ GoToFlow::GoToFlow(QWidget *parent,FlowType flowType)
updateTimer = new QTimer; updateTimer = new QTimer;
connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateImageData())); connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateImageData()));
worker = new PageLoader; worker = new PageLoader(&mutexGoToFlow);
flow = new YACReaderFlow(this,flowType); flow = new YACReaderFlow(this,flowType);
@ -70,7 +70,12 @@ GoToFlow::GoToFlow(QWidget *parent,FlowType flowType)
} }
GoToFlow::~GoToFlow()
{
delete flow;
delete updateTimer;
worker->deleteLater();
}
void GoToFlow::centerSlide(int slide) void GoToFlow::centerSlide(int slide)
{ {
@ -97,7 +102,7 @@ void GoToFlow::setNumSlides(unsigned int slides)
toolBar->setTop(slides); toolBar->setTop(slides);
SlideInitializer * si = new SlideInitializer(flow,slides); SlideInitializer * si = new SlideInitializer(&mutexGoToFlow,flow,slides);
imagesLoaded.clear(); imagesLoaded.clear();
imagesLoaded.fill(false,slides); imagesLoaded.fill(false,slides);
@ -235,37 +240,37 @@ void GoToFlow::updateConfig(QSettings * settings)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//SlideInitializer //SlideInitializer
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
SlideInitializer::SlideInitializer(PictureFlow * flow,int slides) SlideInitializer::SlideInitializer(QMutex * m,PictureFlow * flow,int slides)
:QThread(),_flow(flow),_slides(slides) :QThread(),mutex(m),_flow(flow),_slides(slides)
{ {
} }
void SlideInitializer::run() void SlideInitializer::run()
{ {
mutexGoToFlow.lock(); mutex->lock();
_flow->clear(); _flow->clear();
for(int i=0;i<_slides;i++) for(int i=0;i<_slides;i++)
_flow->addSlide(QImage()); _flow->addSlide(QImage());
_flow->setCenterIndex(0); _flow->setCenterIndex(0);
mutexGoToFlow.unlock(); mutex->unlock();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//PageLoader //PageLoader
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
PageLoader::PageLoader(): PageLoader::PageLoader(QMutex * m):
QThread(), restart(false), working(false), idx(-1) QThread(),mutex(m), restart(false), working(false), idx(-1)
{ {
} }
PageLoader::~PageLoader() PageLoader::~PageLoader()
{ {
mutexGoToFlow.lock(); mutex->lock();
condition.wakeOne(); condition.wakeOne();
mutexGoToFlow.unlock(); mutex->unlock();
wait(); wait();
} }
@ -276,12 +281,12 @@ bool PageLoader::busy() const
void PageLoader::generate(int index, QSize size,const QByteArray & rImage) void PageLoader::generate(int index, QSize size,const QByteArray & rImage)
{ {
mutexGoToFlow.lock(); mutex->lock();
this->idx = index; this->idx = index;
//this->img = QImage(); //this->img = QImage();
this->size = size; this->size = size;
this->rawImage = rImage; this->rawImage = rImage;
mutexGoToFlow.unlock(); mutex->unlock();
if (!isRunning()) if (!isRunning())
start(); start();
@ -298,7 +303,7 @@ void PageLoader::run()
for(;;) for(;;)
{ {
// copy necessary data // copy necessary data
mutexGoToFlow.lock(); mutex->lock();
this->working = true; this->working = true;
//int idx = this->idx; //int idx = this->idx;
@ -308,18 +313,18 @@ void PageLoader::run()
// let everyone knows it is ready // let everyone knows it is ready
image = image.scaled(this->size,Qt::KeepAspectRatio,Qt::SmoothTransformation); image = image.scaled(this->size,Qt::KeepAspectRatio,Qt::SmoothTransformation);
mutexGoToFlow.unlock(); mutex->unlock();
mutexGoToFlow.lock(); mutex->lock();
this->working = false; this->working = false;
this->img = image; this->img = image;
mutexGoToFlow.unlock(); mutex->unlock();
// put to sleep // put to sleep
mutexGoToFlow.lock(); mutex->lock();
if (!this->restart) if (!this->restart)
condition.wait(&mutexGoToFlow); condition.wait(mutex);
restart = false; restart = false;
mutexGoToFlow.unlock(); mutex->unlock();
} }
} }

View File

@ -5,6 +5,7 @@
#include <QThread> #include <QThread>
#include <QWaitCondition> #include <QWaitCondition>
#include <QMutex>
class QLineEdit; class QLineEdit;
class QPushButton; class QPushButton;
@ -28,6 +29,7 @@ class GoToFlow : public GoToFlowWidget
Q_OBJECT Q_OBJECT
public: public:
GoToFlow(QWidget* parent = 0,FlowType flowType = CoverFlowLike); GoToFlow(QWidget* parent = 0,FlowType flowType = CoverFlowLike);
~GoToFlow();
bool ready; //comic is ready for read. bool ready; //comic is ready for read.
bool eventFilter(QObject *target, QEvent *event); bool eventFilter(QObject *target, QEvent *event);
private: private:
@ -43,6 +45,7 @@ private:
QTimer* updateTimer; QTimer* updateTimer;
PageLoader* worker; PageLoader* worker;
virtual void wheelEvent(QWheelEvent * event); virtual void wheelEvent(QWheelEvent * event);
QMutex mutexGoToFlow;
private slots: private slots:
void preload(); void preload();
@ -59,7 +62,6 @@ private:
signals: signals:
void goToPage(unsigned int page); void goToPage(unsigned int page);
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//SlideInitializer //SlideInitializer
@ -67,8 +69,9 @@ signals:
class SlideInitializer : public QThread class SlideInitializer : public QThread
{ {
public: public:
SlideInitializer(PictureFlow * flow,int slides); SlideInitializer(QMutex * m,PictureFlow * flow,int slides);
private: private:
QMutex * mutex;
PictureFlow * _flow; PictureFlow * _flow;
int _slides; int _slides;
void run(); void run();
@ -80,7 +83,7 @@ private:
class PageLoader : public QThread class PageLoader : public QThread
{ {
public: public:
PageLoader(); PageLoader(QMutex * m);
~PageLoader(); ~PageLoader();
// returns FALSE if worker is still busy and can't take the task // returns FALSE if worker is still busy and can't take the task
bool busy() const; bool busy() const;
@ -91,6 +94,7 @@ public:
protected: protected:
void run(); void run();
private: private:
QMutex * mutex;
QWaitCondition condition; QWaitCondition condition;
bool restart; bool restart;

View File

@ -41,6 +41,11 @@ GoToFlowGL::GoToFlowGL(QWidget* parent, FlowType flowType)
this->setCursor(QCursor(Qt::ArrowCursor)); this->setCursor(QCursor(Qt::ArrowCursor));
} }
GoToFlowGL::~GoToFlowGL()
{
delete flow;
}
bool GoToFlowGL::eventFilter(QObject *target, QEvent *event) bool GoToFlowGL::eventFilter(QObject *target, QEvent *event)
{ {
if (event->type() == QEvent::KeyPress) if (event->type() == QEvent::KeyPress)

View File

@ -16,6 +16,7 @@ class GoToFlowGL : public GoToFlowWidget
Q_OBJECT Q_OBJECT
public: public:
GoToFlowGL(QWidget* parent = 0,FlowType flowType = CoverFlowLike); GoToFlowGL(QWidget* parent = 0,FlowType flowType = CoverFlowLike);
~GoToFlowGL();
void reset(); void reset();
void centerSlide(int slide); void centerSlide(int slide);
void setFlowType(FlowType flowType); void setFlowType(FlowType flowType);

View File

@ -28,6 +28,12 @@ GoToFlowWidget::GoToFlowWidget(QWidget * parent)
setLayout(mainLayout); setLayout(mainLayout);
} }
GoToFlowWidget::~GoToFlowWidget() {
delete topBar;
delete toolBar;
delete mainLayout;
}
void GoToFlowWidget::setPageNumber(int page) void GoToFlowWidget::setPageNumber(int page)
{ {
toolBar->setPage(page); toolBar->setPage(page);

View File

@ -19,6 +19,7 @@ protected:
GoToFlowToolBar * toolBar; GoToFlowToolBar * toolBar;
public: public:
GoToFlowWidget(QWidget * paret = 0); GoToFlowWidget(QWidget * paret = 0);
virtual ~GoToFlowWidget() = 0;
public slots: public slots:
virtual void reset() = 0; virtual void reset() = 0;
virtual void centerSlide(int slide) = 0; virtual void centerSlide(int slide) = 0;

View File

@ -60,6 +60,40 @@ MainWindowViewer::MainWindowViewer()
setupUI(); setupUI();
} }
MainWindowViewer::~MainWindowViewer()
{
delete settings;
delete viewer;
delete had;
delete sliderAction;
delete openAction;
delete openFolderAction;
delete saveImageAction;
delete openPreviousComicAction;
delete openNextComicAction;
delete prevAction;
delete nextAction;
delete adjustHeight;
delete adjustWidth;
delete leftRotationAction;
delete rightRotationAction;
delete doublePageAction;
delete goToPage;
delete optionsAction;
delete helpAboutAction;
delete showMagnifyingGlass;
delete setBookmark;
delete showBookmarks;
delete showShorcutsAction;
delete showInfo;
delete closeAction;
delete showDictionaryAction;
delete alwaysOnTopAction;
delete adjustToFullSizeAction;
delete showFlowAction;
}
void MainWindowViewer::loadConfiguration() void MainWindowViewer::loadConfiguration()
{ {
settings = new QSettings(QCoreApplication::applicationDirPath()+"/YACReader.ini",QSettings::IniFormat); settings = new QSettings(QCoreApplication::applicationDirPath()+"/YACReader.ini",QSettings::IniFormat);
@ -823,7 +857,7 @@ void MainWindowViewer::closeEvent ( QCloseEvent * event )
conf.setSize(size()); conf.setSize(size());
} }
conf.setMaximized(isMaximized()); conf.setMaximized(isMaximized());
emit (closed()); emit (closed());
} }

View File

@ -127,6 +127,7 @@ signals:
virtual void closeEvent ( QCloseEvent * event ); virtual void closeEvent ( QCloseEvent * event );
public: public:
MainWindowViewer(); MainWindowViewer();
~MainWindowViewer();
}; };
#endif #endif

View File

@ -130,7 +130,7 @@ QImage changeGamma( const QImage& image, int gamma )
return changeImage< changeGamma >( image, gamma ); return changeImage< changeGamma >( image, gamma );
} }
QMutex mutex;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// MeanNoiseReductionFilter // MeanNoiseReductionFilter
@ -336,8 +336,9 @@ PageRender::PageRender()
{ {
} }
PageRender::PageRender(int np, const QByteArray & rd, QImage * p,unsigned int d, QVector<ImageFilter *> f) PageRender::PageRender(Render * r,int np, const QByteArray & rd, QImage * p,unsigned int d, QVector<ImageFilter *> f)
:QThread(), :QThread(),
render(r),
numPage(np), numPage(np),
data(rd), data(rd),
page(p), page(p),
@ -348,7 +349,7 @@ filters(f)
void PageRender::run() void PageRender::run()
{ {
QMutexLocker locker(&mutex); QMutexLocker locker(&(render->mutex));
QImage img; QImage img;
img.loadFromData(data); img.loadFromData(data);
@ -373,8 +374,9 @@ void PageRender::run()
// DoublePageRender // DoublePageRender
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
DoublePageRender::DoublePageRender(int np, const QByteArray & rd, const QByteArray & rd2, QImage * p,unsigned int d, QVector<ImageFilter *> f) DoublePageRender::DoublePageRender(Render * r, int np, const QByteArray & rd, const QByteArray & rd2, QImage * p,unsigned int d, QVector<ImageFilter *> f)
:PageRender(), :PageRender(),
render(r),
numPage(np), numPage(np),
data(rd), data(rd),
data2(rd2), data2(rd2),
@ -388,7 +390,7 @@ filters(f)
void DoublePageRender::run() void DoublePageRender::run()
{ {
//QImage result; //QImage result;
QMutexLocker locker(&mutex); QMutexLocker locker(&(render->mutex));
QImage img, img2; QImage img, img2;
if(!data.isEmpty()) if(!data.isEmpty())
img.loadFromData(data); img.loadFromData(data);
@ -470,6 +472,24 @@ Render::Render()
filters.push_back(new GammaFilter()); filters.push_back(new GammaFilter());
} }
Render::~Render()
{
if(comic!=0)
{
comic->moveToThread(QApplication::instance()->thread());
comic->deleteLater();
}
foreach(ImageFilter * filter, filters)
delete filter;
foreach(PageRender * pr,pageRenders)
if(pr !=0)
{
if(pr->wait())
delete pr;
}
}
//Este m<>todo se encarga de forzar el renderizado de las p<>ginas. //Este m<>todo se encarga de forzar el renderizado de las p<>ginas.
//Actualiza el buffer seg<65>n es necesario. //Actualiza el buffer seg<65>n es necesario.
//si la pagina actual no est<73> renderizada, se lanza un hilo que la renderize (double or single page mode) y se emite una se<73>al que indica que se est<73> renderizando. //si la pagina actual no est<73> renderizada, se lanza un hilo que la renderize (double or single page mode) y se emite una se<73>al que indica que se est<73> renderizando.
@ -484,16 +504,16 @@ void Render::render()
{ {
if(pagesReady[currentIndex] && pagesReady[qMin(currentIndex+1,(int)comic->numPages()-1)]) if(pagesReady[currentIndex] && pagesReady[qMin(currentIndex+1,(int)comic->numPages()-1)])
if(currentIndex+1 > comic->numPages()-1) if(currentIndex+1 > comic->numPages()-1)
pageRenders[currentPageBufferedIndex] = new DoublePageRender(currentIndex,comic->getRawData()->at(currentIndex),QByteArray(),buffer[currentPageBufferedIndex],imageRotation,filters); pageRenders[currentPageBufferedIndex] = new DoublePageRender(this,currentIndex,comic->getRawData()->at(currentIndex),QByteArray(),buffer[currentPageBufferedIndex],imageRotation,filters);
else else
pageRenders[currentPageBufferedIndex] = new DoublePageRender(currentIndex,comic->getRawData()->at(currentIndex),comic->getRawData()->at(currentIndex+1),buffer[currentPageBufferedIndex],imageRotation,filters); pageRenders[currentPageBufferedIndex] = new DoublePageRender(this,currentIndex,comic->getRawData()->at(currentIndex),comic->getRawData()->at(currentIndex+1),buffer[currentPageBufferedIndex],imageRotation,filters);
else else
//las p<>ginas no est<73>n listas, y se est<73>n cargando en el c<>mic //las p<>ginas no est<73>n listas, y se est<73>n cargando en el c<>mic
emit processingPage(); //para evitar confusiones esta se<73>al deber<65>a llamarse de otra forma emit processingPage(); //para evitar confusiones esta se<73>al deber<65>a llamarse de otra forma
} }
else else
if(pagesReady[currentIndex]) if(pagesReady[currentIndex])
pageRenders[currentPageBufferedIndex] = new PageRender(currentIndex,comic->getRawData()->at(currentIndex),buffer[currentPageBufferedIndex],imageRotation,filters); pageRenders[currentPageBufferedIndex] = new PageRender(this,currentIndex,comic->getRawData()->at(currentIndex),buffer[currentPageBufferedIndex],imageRotation,filters);
else else
//las p<>ginas no est<73>n listas, y se est<73>n cargando en el c<>mic //las p<>ginas no est<73>n listas, y se est<73>n cargando en el c<>mic
emit processingPage(); //para evitar confusiones esta se<73>al deber<65>a llamarse de otra forma emit processingPage(); //para evitar confusiones esta se<73>al deber<65>a llamarse de otra forma
@ -862,7 +882,7 @@ void Render::fillBuffer()
pageRenders[currentPageBufferedIndex+i]==0 && pageRenders[currentPageBufferedIndex+i]==0 &&
pagesReady[currentIndex+1]) //preload next pages pagesReady[currentIndex+1]) //preload next pages
{ {
pageRenders[currentPageBufferedIndex+i] = new PageRender(currentIndex+i,comic->getRawData()->at(currentIndex+i),buffer[currentPageBufferedIndex+i],imageRotation,filters); pageRenders[currentPageBufferedIndex+i] = new PageRender(this,currentIndex+i,comic->getRawData()->at(currentIndex+i),buffer[currentPageBufferedIndex+i],imageRotation,filters);
connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int))); connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int)));
pageRenders[currentPageBufferedIndex+i]->start(); pageRenders[currentPageBufferedIndex+i]->start();
} }
@ -873,7 +893,7 @@ void Render::fillBuffer()
pageRenders[currentPageBufferedIndex-i]==0 && pageRenders[currentPageBufferedIndex-i]==0 &&
pagesReady[currentIndex-1]) //preload previous pages pagesReady[currentIndex-1]) //preload previous pages
{ {
pageRenders[currentPageBufferedIndex-i] = new PageRender(currentIndex-i,comic->getRawData()->at(currentIndex-i),buffer[currentPageBufferedIndex-i],imageRotation,filters); pageRenders[currentPageBufferedIndex-i] = new PageRender(this,currentIndex-i,comic->getRawData()->at(currentIndex-i),buffer[currentPageBufferedIndex-i],imageRotation,filters);
connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int))); connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int)));
pageRenders[currentPageBufferedIndex-i]->start(); pageRenders[currentPageBufferedIndex-i]->start();
} }
@ -891,9 +911,9 @@ void Render::fillBufferDoublePage()
(pagesReady[currentIndex+2*i] && pagesReady[qMin(currentIndex+(2*i)+1,(int)comic->numPages()-1)])) //preload next pages (pagesReady[currentIndex+2*i] && pagesReady[qMin(currentIndex+(2*i)+1,(int)comic->numPages()-1)])) //preload next pages
{ {
if(currentIndex+(2*i)+1 > comic->numPages()-1) if(currentIndex+(2*i)+1 > comic->numPages()-1)
pageRenders[currentPageBufferedIndex+i] = new DoublePageRender(currentIndex+2*i,comic->getRawData()->at(currentIndex+(2*i)),QByteArray(),buffer[currentPageBufferedIndex+i],imageRotation,filters); pageRenders[currentPageBufferedIndex+i] = new DoublePageRender(this,currentIndex+2*i,comic->getRawData()->at(currentIndex+(2*i)),QByteArray(),buffer[currentPageBufferedIndex+i],imageRotation,filters);
else else
pageRenders[currentPageBufferedIndex+i] = new DoublePageRender(currentIndex+2*i,comic->getRawData()->at(currentIndex+(2*i)),comic->getRawData()->at(currentIndex+(2*i)+1),buffer[currentPageBufferedIndex+i],imageRotation,filters); pageRenders[currentPageBufferedIndex+i] = new DoublePageRender(this,currentIndex+2*i,comic->getRawData()->at(currentIndex+(2*i)),comic->getRawData()->at(currentIndex+(2*i)+1),buffer[currentPageBufferedIndex+i],imageRotation,filters);
connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int))); connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int)));
pageRenders[currentPageBufferedIndex+i]->start(); pageRenders[currentPageBufferedIndex+i]->start();
} }
@ -905,9 +925,9 @@ void Render::fillBufferDoublePage()
(pagesReady[qMax(currentIndex-2*i,0)] && pagesReady[qMin(currentIndex-(2*i)+1,(int)comic->numPages()-1)])) //preload previous pages (pagesReady[qMax(currentIndex-2*i,0)] && pagesReady[qMin(currentIndex-(2*i)+1,(int)comic->numPages()-1)])) //preload previous pages
{ {
if(currentIndex-2*i == -1) if(currentIndex-2*i == -1)
pageRenders[currentPageBufferedIndex-i] = new DoublePageRender(0,QByteArray(),comic->getRawData()->at(0),buffer[currentPageBufferedIndex-i],imageRotation,filters); pageRenders[currentPageBufferedIndex-i] = new DoublePageRender(this,0,QByteArray(),comic->getRawData()->at(0),buffer[currentPageBufferedIndex-i],imageRotation,filters);
else else
pageRenders[currentPageBufferedIndex-i] = new DoublePageRender(currentIndex-2*i,comic->getRawData()->at(currentIndex-(2*i)),comic->getRawData()->at(currentIndex-(2*i)+1),buffer[currentPageBufferedIndex-i],imageRotation,filters); pageRenders[currentPageBufferedIndex-i] = new DoublePageRender(this,currentIndex-2*i,comic->getRawData()->at(currentIndex-(2*i)),comic->getRawData()->at(currentIndex-(2*i)+1),buffer[currentPageBufferedIndex-i],imageRotation,filters);
connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int))); connect(pageRenders[currentPageBufferedIndex],SIGNAL(pageReady(int)),this,SLOT(prepareAvailablePage(int)));
pageRenders[currentPageBufferedIndex-i]->start(); pageRenders[currentPageBufferedIndex-i]->start();
} }

View File

@ -15,6 +15,7 @@
#include <QThread> #include <QThread>
class Comic; class Comic;
class Render;
class ImageFilter { class ImageFilter {
public: public:
@ -73,7 +74,7 @@ class PageRender : public QThread
Q_OBJECT Q_OBJECT
public: public:
PageRender(); PageRender();
PageRender(int numPage, const QByteArray & rawData, QImage * page,unsigned int degrees=0, QVector<ImageFilter *> filters = QVector<ImageFilter *>()); PageRender(Render * render,int numPage, const QByteArray & rawData, QImage * page,unsigned int degrees=0, QVector<ImageFilter *> filters = QVector<ImageFilter *>());
int getNumPage(){return numPage;}; int getNumPage(){return numPage;};
void setData(const QByteArray & rawData){data = rawData;}; void setData(const QByteArray & rawData){data = rawData;};
void setPage(QImage * p){page = p;}; void setPage(QImage * p){page = p;};
@ -86,6 +87,7 @@ private:
unsigned int degrees; unsigned int degrees;
QVector<ImageFilter *> filters; QVector<ImageFilter *> filters;
void run(); void run();
Render * render;
signals: signals:
void pageReady(int); void pageReady(int);
@ -98,7 +100,7 @@ class DoublePageRender : public PageRender
{ {
Q_OBJECT Q_OBJECT
public: public:
DoublePageRender(int firstPage, const QByteArray & firstPageData,const QByteArray & secondPageData, QImage * page,unsigned int degrees=0, QVector<ImageFilter *> filters = QVector<ImageFilter *>()); DoublePageRender(Render * render, int firstPage, const QByteArray & firstPageData,const QByteArray & secondPageData, QImage * page,unsigned int degrees=0, QVector<ImageFilter *> filters = QVector<ImageFilter *>());
private: private:
int numPage; int numPage;
QByteArray data; QByteArray data;
@ -107,6 +109,7 @@ private:
unsigned int degrees; unsigned int degrees;
QVector<ImageFilter *> filters; QVector<ImageFilter *> filters;
void run(); void run();
Render * render;
signals: signals:
void pageReady(int); void pageReady(int);
@ -117,6 +120,7 @@ class Render : public QObject {
Q_OBJECT Q_OBJECT
public: public:
Render(); Render();
~Render();
public slots: public slots:
void render(); void render();
@ -187,6 +191,10 @@ private:
QVector<bool> pagesReady; QVector<bool> pagesReady;
int imageRotation; int imageRotation;
QVector<ImageFilter *> filters; QVector<ImageFilter *> filters;
QMutex mutex;
friend class PageRender;
friend class DoublePageRender;
}; };

View File

@ -115,6 +115,23 @@ drag(false)
} }
Viewer::~Viewer()
{
delete render;
delete goToFlow;
delete translator;
delete translatorAnimation;
delete content;
delete hideCursorTimer;
delete informationLabel;
delete verticalScroller;
delete bd;
delete notificationsLabel;
delete mglass;
if(currentPage != 0)
delete currentPage;
}
void Viewer::createConnections() void Viewer::createConnections()
{ {
//magnifyingGlass (update mg after a background change //magnifyingGlass (update mg after a background change

View File

@ -132,6 +132,7 @@ virtual void mouseReleaseEvent ( QMouseEvent * event );
public: public:
Viewer(QWidget * parent = 0); Viewer(QWidget * parent = 0);
~Viewer();
void toggleFullScreen(); void toggleFullScreen();
const QPixmap * pixmap(); const QPixmap * pixmap();
//Comic * getComic(){return comic;} //Comic * getComic(){return comic;}

View File

@ -1131,6 +1131,14 @@ YACReaderPageFlowGL::YACReaderPageFlowGL(QWidget *parent,struct Preset p )
worker->flow = this; worker->flow = this;
} }
YACReaderPageFlowGL::~YACReaderPageFlowGL()
{
this->killTimer(timerId);
//worker->deleteLater();
rawImages.clear();
free(cfImages);
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////

View File

@ -170,7 +170,7 @@ public:
/*Constructor*/ /*Constructor*/
YACReaderFlowGL(QWidget *parent = 0,struct Preset p = pressetYACReaderFlowDownConfig); YACReaderFlowGL(QWidget *parent = 0,struct Preset p = pressetYACReaderFlowDownConfig);
~YACReaderFlowGL(); virtual ~YACReaderFlowGL();
//size; //size;
QSize minimumSizeHint() const; QSize minimumSizeHint() const;
@ -301,6 +301,7 @@ class YACReaderPageFlowGL : public YACReaderFlowGL
{ {
public: public:
YACReaderPageFlowGL(QWidget *parent = 0,struct Preset p = defaultYACReaderFlowConfig); YACReaderPageFlowGL(QWidget *parent = 0,struct Preset p = defaultYACReaderFlowConfig);
~YACReaderPageFlowGL();
void updateImageData(); void updateImageData();
void populate(int n); void populate(int n);
QVector<bool> imagesReady; QVector<bool> imagesReady;

View File

@ -34,6 +34,13 @@ HelpAboutDialog::HelpAboutDialog(QWidget * parent)
resize(500, QApplication::desktop()->availableGeometry().height()*0.83); resize(500, QApplication::desktop()->availableGeometry().height()*0.83);
} }
HelpAboutDialog::~HelpAboutDialog()
{
delete aboutText;
delete helpText;
delete tabWidget;
}
HelpAboutDialog::HelpAboutDialog(const QString & pathAbout,const QString & pathHelp,QWidget * parent) HelpAboutDialog::HelpAboutDialog(const QString & pathAbout,const QString & pathHelp,QWidget * parent)
:QDialog(parent) :QDialog(parent)
{ {

View File

@ -12,6 +12,7 @@ Q_OBJECT
public: public:
HelpAboutDialog(QWidget * parent=0); HelpAboutDialog(QWidget * parent=0);
HelpAboutDialog(const QString & pathAbout,const QString & pathHelp,QWidget * parent =0); HelpAboutDialog(const QString & pathAbout,const QString & pathHelp,QWidget * parent =0);
~HelpAboutDialog();
public slots: public slots:
void loadAboutInformation(const QString & path); void loadAboutInformation(const QString & path);
void loadHelp(const QString & path); void loadHelp(const QString & path);