Fix opening a comic from the current/next comic banner in the grid view

This commit is contained in:
Luis Ángel San Martín
2021-06-19 07:24:29 +02:00
parent ad036ec6ae
commit 91c9375dc1
5 changed files with 31 additions and 19 deletions

View File

@ -1840,31 +1840,37 @@ void LibraryWindow::checkEmptyFolder()
void LibraryWindow::openComic()
{
if (!importedCovers) {
auto libraryId = libraries.getId(selectedLibrary->currentText());
auto comic = comicsModel->getComic(comicsViewsManager->comicsView->currentIndex());
auto mode = comicsModel->getMode();
OpenComicSource::Source source;
openComic(comic, mode);
}
}
if (mode == ComicModel::ReadingList) {
source = OpenComicSource::Source::ReadingList;
} else if (mode == ComicModel::Reading) {
//TODO check where the comic was opened from the last time it was read
source = OpenComicSource::Source::Folder;
} else {
source = OpenComicSource::Source::Folder;
}
void LibraryWindow::openComic(const ComicDB &comic, const ComicModel::Mode mode)
{
auto libraryId = libraries.getId(selectedLibrary->currentText());
auto yacreaderFound = YACReader::openComic(comic, libraryId, currentPath(), OpenComicSource { source, comicsModel->getSourceId() });
OpenComicSource::Source source;
if (!yacreaderFound) {
if (mode == ComicModel::ReadingList) {
source = OpenComicSource::Source::ReadingList;
} else if (mode == ComicModel::Reading) {
//TODO check where the comic was opened from the last time it was read
source = OpenComicSource::Source::Folder;
} else {
source = OpenComicSource::Source::Folder;
}
auto yacreaderFound = YACReader::openComic(comic, libraryId, currentPath(), OpenComicSource { source, comicsModel->getSourceId() });
if (!yacreaderFound) {
#ifdef Q_OS_WIN
QMessageBox::critical(this, tr("YACReader not found"), tr("YACReader not found. YACReader should be installed in the same folder as YACReaderLibrary."));
QMessageBox::critical(this, tr("YACReader not found"), tr("YACReader not found. YACReader should be installed in the same folder as YACReaderLibrary."));
#else
QMessageBox::critical(this, tr("YACReader not found"), tr("YACReader not found. There might be a problem with your YACReader installation."));
QMessageBox::critical(this, tr("YACReader not found"), tr("YACReader not found. There might be a problem with your YACReader installation."));
#endif
}
}
}