Merged luisangelsm/yacreader into default

This commit is contained in:
Felix Kauselmann 2015-02-26 10:09:37 +01:00
commit 5b16c97140
3 changed files with 56 additions and 47 deletions

View File

@ -742,20 +742,29 @@ void MainWindowViewer::open(QString path, qint64 comicId, qint64 libraryId)
void MainWindowViewer::openComicFromPath(QString pathFile) void MainWindowViewer::openComicFromPath(QString pathFile)
{ {
QFileInfo fi(pathFile); openComic(pathFile);
currentDirectory = fi.dir().absolutePath(); isClient = false; //this method is used for direct openings
getSiblingComics(fi.absolutePath(),fi.fileName());
setWindowTitle("YACReader - " + fi.fileName());
enableActions();
viewer->open(pathFile);
isClient = false;
} }
//isClient shouldn't be modified when a siblinig comic is opened
void MainWindowViewer::openSiblingComic(QString pathFile)
{
openComic(pathFile);
}
void MainWindowViewer::openComic(QString pathFile)
{
QFileInfo fi(pathFile);
currentDirectory = fi.dir().absolutePath();
getSiblingComics(fi.absolutePath(),fi.fileName());
setWindowTitle("YACReader - " + fi.fileName());
enableActions();
viewer->open(pathFile);
}
void MainWindowViewer::openFolder() void MainWindowViewer::openFolder()
{ {
QFileDialog openDialog; QFileDialog openDialog;
@ -1275,11 +1284,7 @@ void MainWindowViewer::openPreviousComic()
} }
if(!previousComicPath.isEmpty()) if(!previousComicPath.isEmpty())
{ {
viewer->open(previousComicPath); openSiblingComic(previousComicPath);
QFileInfo fi(previousComicPath);
getSiblingComics(fi.absolutePath(),fi.fileName());
setWindowTitle("YACReader - " + fi.fileName());
} }
} }
@ -1302,11 +1307,7 @@ void MainWindowViewer::openNextComic()
} }
if(!nextComicPath.isEmpty()) if(!nextComicPath.isEmpty())
{ {
viewer->open(nextComicPath); openSiblingComic(nextComicPath);
QFileInfo fi(nextComicPath);
getSiblingComics(fi.absolutePath(),fi.fileName());
setWindowTitle("YACReader - " + fi.fileName());
} }
} }

View File

@ -48,9 +48,11 @@ class EditShortcutsDialog;
void newVersion(); void newVersion();
void openPreviousComic(); void openPreviousComic();
void openNextComic(); void openNextComic();
void openComicFromPath(QString pathFile); void openComicFromPath(QString pathFile);
void openFolderFromPath(QString pathDir); void openSiblingComic(QString pathFile);
void openFolderFromPath(QString pathFile, QString atFileName); void openComic(QString pathFile);
void openFolderFromPath(QString pathDir);
void openFolderFromPath(QString pathFile, QString atFileName);
void alwaysOnTopSwitch(); void alwaysOnTopSwitch();
void adjustToFullSizeSwitch(); void adjustToFullSizeSwitch();
void fitToPageSwitch(); void fitToPageSwitch();
@ -71,7 +73,8 @@ class EditShortcutsDialog;
void next(); void next();
void updatePage();*/ void updatePage();*/
private:
private:
//!State //!State
bool fullscreen; bool fullscreen;
bool toolbars; bool toolbars;
@ -168,6 +171,5 @@ signals:
public: public:
MainWindowViewer(); MainWindowViewer();
~MainWindowViewer(); ~MainWindowViewer();
};
};
#endif #endif

View File

@ -937,25 +937,31 @@ void Render::setNumPages(unsigned int numPages)
void Render::pageRawDataReady(int page) void Render::pageRawDataReady(int page)
{ {
pagesEmited.push_back(page); if (!hasLoadedComic())
if(pageRenders.size()>0) return;
{
for(int i=0;i<pagesEmited.size();i++) pagesEmited.push_back(page);
{ if(pageRenders.size()>0)
pagesReady[pagesEmited.at(i)] = true; {
if(pagesEmited.at(i) == currentIndex) for(int i=0;i<pagesEmited.size();i++)
update(); {
else if(pagesEmited.at(i)>= pagesReady.size())
{ return; //Oooops, something went wrong
if ( ((pagesEmited.at(i) < currentIndex) && (pagesEmited.at(i) > currentIndex-numLeftPages)) ||
((pagesEmited.at(i) > currentIndex) && (pagesEmited.at(i) < currentIndex+numRightPages)) ) pagesReady[pagesEmited.at(i)] = true;
{ if(pagesEmited.at(i) == currentIndex)
fillBuffer(); update();
} else
} {
} if ( ((pagesEmited.at(i) < currentIndex) && (pagesEmited.at(i) > currentIndex-numLeftPages)) ||
pagesEmited.clear(); ((pagesEmited.at(i) > currentIndex) && (pagesEmited.at(i) < currentIndex+numRightPages)) )
} {
fillBuffer();
}
}
}
pagesEmited.clear();
}
} }
//sólo se renderiza la página, si ha habido un cambio de página //sólo se renderiza la página, si ha habido un cambio de página