This commit is contained in:
Luis Ángel San Martín 2015-02-25 17:44:15 +01:00
parent 926dd4c0d5
commit 2c406dab8e
3 changed files with 59 additions and 50 deletions

View File

@ -710,7 +710,19 @@ void MainWindowViewer::open(QString path, qint64 comicId, qint64 libraryId)
optionsDialog->setFilters(currentComicDB.info.brightness, currentComicDB.info.contrast, currentComicDB.info.gamma); optionsDialog->setFilters(currentComicDB.info.brightness, currentComicDB.info.contrast, currentComicDB.info.gamma);
} }
void MainWindowViewer::openComicFromPath(QString pathFile) void MainWindowViewer::openComicFromPath(const QString &pathFile)
{
openComic(pathFile);
isClient = false; //this method is used for direct openings
}
//isClient shouldn't be modified when a siblinig comic is opened
void MainWindowViewer::openSiblingComic(const QString &pathFile)
{
openComic(pathFile);
}
void MainWindowViewer::openComic(const QString &pathFile)
{ {
QFileInfo fi(pathFile); QFileInfo fi(pathFile);
currentDirectory = fi.dir().absolutePath(); currentDirectory = fi.dir().absolutePath();
@ -720,10 +732,7 @@ void MainWindowViewer::openComicFromPath(QString pathFile)
enableActions(); enableActions();
viewer->open(pathFile); viewer->open(fi.absoluteFilePath());
isClient = false;
} }
void MainWindowViewer::openFolder() void MainWindowViewer::openFolder()
@ -737,7 +746,7 @@ void MainWindowViewer::openFolder()
} }
} }
void MainWindowViewer::openFolderFromPath(QString pathDir) void MainWindowViewer::openFolderFromPath(const QString & pathDir)
{ {
currentDirectory = pathDir; //TODO ?? currentDirectory = pathDir; //TODO ??
QFileInfo fi(pathDir); QFileInfo fi(pathDir);
@ -750,7 +759,7 @@ void MainWindowViewer::openFolderFromPath(QString pathDir)
viewer->open(pathDir); viewer->open(pathDir);
} }
void MainWindowViewer::openFolderFromPath(QString pathDir, QString atFileName) void MainWindowViewer::openFolderFromPath(const QString &pathDir, const QString &atFileName)
{ {
currentDirectory = pathDir; //TODO ?? currentDirectory = pathDir; //TODO ??
QFileInfo fi(pathDir); QFileInfo fi(pathDir);
@ -1230,11 +1239,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());
} }
} }
@ -1257,11 +1262,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(const QString & pathFile);
void openFolderFromPath(QString pathDir); void openSiblingComic(const QString &pathFile);
void openFolderFromPath(QString pathFile, QString atFileName); void openComic(const QString &pathFile);
void openFolderFromPath(const QString & pathDir);
void openFolderFromPath(const QString & pathFile, const QString & atFileName);
void alwaysOnTopSwitch(); void alwaysOnTopSwitch();
void adjustToFullSizeSwitch(); void adjustToFullSizeSwitch();
void reloadOptions(); void reloadOptions();
@ -68,6 +70,7 @@ class EditShortcutsDialog;
void next(); void next();
void updatePage();*/ void updatePage();*/
private: private:
//!State //!State
bool fullscreen; bool fullscreen;
@ -162,6 +165,5 @@ signals:
public: public:
MainWindowViewer(); MainWindowViewer();
~MainWindowViewer(); ~MainWindowViewer();
}; };
#endif #endif

View File

@ -937,11 +937,17 @@ void Render::setNumPages(unsigned int numPages)
void Render::pageRawDataReady(int page) void Render::pageRawDataReady(int page)
{ {
if (!hasLoadedComic())
return;
pagesEmited.push_back(page); pagesEmited.push_back(page);
if(pageRenders.size()>0) if(pageRenders.size()>0)
{ {
for(int i=0;i<pagesEmited.size();i++) for(int i=0;i<pagesEmited.size();i++)
{ {
if(pagesEmited.at(i)>= pagesReady.size())
return; //Oooops, something went wrong
pagesReady[pagesEmited.at(i)] = true; pagesReady[pagesEmited.at(i)] = true;
if(pagesEmited.at(i) == currentIndex) if(pagesEmited.at(i) == currentIndex)
update(); update();