mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Fix opening a comic from the current/next comic banner in the grid view
This commit is contained in:
parent
ad036ec6ae
commit
91c9375dc1
@ -38,7 +38,7 @@ public slots:
|
||||
|
||||
signals:
|
||||
void selected(unsigned int);
|
||||
void openComic();
|
||||
void openComic(const ComicDB &comic, const ComicModel::Mode mode);
|
||||
void comicRated(int, QModelIndex);
|
||||
|
||||
//Context menus
|
||||
|
@ -398,7 +398,11 @@ void GridComicsView::selectIndex(int index)
|
||||
|
||||
void GridComicsView::triggerOpenCurrentComic()
|
||||
{
|
||||
emit openComic();
|
||||
if (model == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
emit openComic(currentComic, model->getMode());
|
||||
}
|
||||
|
||||
void GridComicsView::rate(int index, int rating)
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "comic_query_result_processor.h"
|
||||
#include "folder_query_result_processor.h"
|
||||
|
||||
#include "comic_model.h"
|
||||
|
||||
#include <future>
|
||||
#include <memory>
|
||||
|
||||
@ -77,7 +79,6 @@ class YACReaderHistoryController;
|
||||
class EmptyLabelWidget;
|
||||
class EmptySpecialListWidget;
|
||||
class EmptyReadingListWidget;
|
||||
class YACReaderComicsViewsManager;
|
||||
|
||||
namespace YACReader {
|
||||
class TrayIconController;
|
||||
@ -315,6 +316,7 @@ public slots:
|
||||
void selectSubfolder(const QModelIndex &mi, int child);
|
||||
void checkEmptyFolder();
|
||||
void openComic();
|
||||
void openComic(const ComicDB &comic, const ComicModel::Mode mode);
|
||||
void createLibrary();
|
||||
void create(QString source, QString dest, QString name);
|
||||
void showAddLibrary();
|
||||
|
@ -146,7 +146,7 @@ void YACReaderComicsViewsManager::doComicsViewConnections()
|
||||
connect(comicsView, SIGNAL(comicRated(int, QModelIndex)), libraryWindow->comicsModel, SLOT(updateRating(int, QModelIndex)));
|
||||
connect(libraryWindow->showHideMarksAction, SIGNAL(toggled(bool)), comicsView, SLOT(setShowMarks(bool)));
|
||||
connect(comicsView, SIGNAL(selected(unsigned int)), libraryWindow, SLOT(openComic()));
|
||||
connect(comicsView, SIGNAL(openComic()), libraryWindow, SLOT(openComic()));
|
||||
connect(comicsView, SIGNAL(openComic(const ComicDB &, const ComicModel::Mode)), libraryWindow, SLOT(openComic(const ComicDB &, const ComicModel::Mode)));
|
||||
|
||||
connect(libraryWindow->selectAllComicsAction, SIGNAL(triggered()), comicsView, SLOT(selectAll()));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user