Logo Search packages:      
Sourcecode: qcomicbook version File versions  Download package

ImlibImage * ImgDirSink::getImage ( unsigned int  num,
int &  result 
) [virtual]

Returns an image for specifiled page.

The imgcache is first checked for image. If not found, the image is loaded. Optionally, the preload thread is started to preload next images.

Parameters:
num page number
result contains 0 on succes or value greater than 0 for error
preload number of pages to preload in preloading thread
Returns:
an image

Definition at line 206 of file imgdirsink.cpp.

References imgfiles, and listmtx.

Referenced by QComicBook::ImgLoaderThread::run().

{
        result = SINKERR_LOADERROR;

        listmtx.lock();
        const int imgcnt = imgfiles.count();
        if (num < imgcnt)
      {
            const QString fname = imgfiles[num];
            listmtx.unlock();

            ImlibImage *im = new ImlibImage();
            if (!im->load(fname))
            {
                  delete im;
                  im = NULL;
            }
            result = 0;

            /*const QFileInfo finf(fname);

            if (rimg.load(fname))
            {
                  result = 0;
                  if (timestamps[fname] != finf.lastModified())
                        timestamps[fname].set(finf.lastModified(), true);
            }*/
            return im;
      }
        else
                listmtx.unlock();
      return NULL;
}


Generated by  Doxygen 1.6.0   Back to index