mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Add support for detecting manga issues in YACReader
When an issues is open from YACReaderLibrary we can check if it is a manga an update the UI to enable manga reading. This also fixes going previous/next from the ui/shortcuts
This commit is contained in:
parent
9643274b39
commit
611d4c5e26
@ -265,7 +265,7 @@ void MainWindowViewer::createActions()
|
|||||||
openPreviousComicAction->setDisabled(true);
|
openPreviousComicAction->setDisabled(true);
|
||||||
openPreviousComicAction->setData(OPEN_PREVIOUS_COMIC_ACTION_Y);
|
openPreviousComicAction->setData(OPEN_PREVIOUS_COMIC_ACTION_Y);
|
||||||
openPreviousComicAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_PREVIOUS_COMIC_ACTION_Y));
|
openPreviousComicAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_PREVIOUS_COMIC_ACTION_Y));
|
||||||
connect(openPreviousComicAction, SIGNAL(triggered()), this, SLOT(openPreviousComic()));
|
connect(openPreviousComicAction, &QAction::triggered, this, &MainWindowViewer::openLeftComic);
|
||||||
|
|
||||||
openNextComicAction = new QAction(tr("Next Comic"), this);
|
openNextComicAction = new QAction(tr("Next Comic"), this);
|
||||||
openNextComicAction->setIcon(QIcon(":/images/viewer_toolbar/openNext.png"));
|
openNextComicAction->setIcon(QIcon(":/images/viewer_toolbar/openNext.png"));
|
||||||
@ -273,7 +273,7 @@ void MainWindowViewer::createActions()
|
|||||||
openNextComicAction->setDisabled(true);
|
openNextComicAction->setDisabled(true);
|
||||||
openNextComicAction->setData(OPEN_NEXT_COMIC_ACTION_Y);
|
openNextComicAction->setData(OPEN_NEXT_COMIC_ACTION_Y);
|
||||||
openNextComicAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_NEXT_COMIC_ACTION_Y));
|
openNextComicAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_NEXT_COMIC_ACTION_Y));
|
||||||
connect(openNextComicAction, SIGNAL(triggered()), this, SLOT(openNextComic()));
|
connect(openNextComicAction, &QAction::triggered, this, &MainWindowViewer::openRightComic);
|
||||||
|
|
||||||
prevAction = new QAction(tr("&Previous"), this);
|
prevAction = new QAction(tr("&Previous"), this);
|
||||||
prevAction->setIcon(QIcon(":/images/viewer_toolbar/previous.png"));
|
prevAction->setIcon(QIcon(":/images/viewer_toolbar/previous.png"));
|
||||||
@ -282,7 +282,7 @@ void MainWindowViewer::createActions()
|
|||||||
prevAction->setDisabled(true);
|
prevAction->setDisabled(true);
|
||||||
prevAction->setData(PREV_ACTION_Y);
|
prevAction->setData(PREV_ACTION_Y);
|
||||||
prevAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(PREV_ACTION_Y));
|
prevAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(PREV_ACTION_Y));
|
||||||
connect(prevAction, SIGNAL(triggered()), viewer, SLOT(prev()));
|
connect(prevAction, SIGNAL(triggered()), viewer, SLOT(left()));
|
||||||
|
|
||||||
nextAction = new QAction(tr("&Next"), this);
|
nextAction = new QAction(tr("&Next"), this);
|
||||||
nextAction->setIcon(QIcon(":/images/viewer_toolbar/next.png"));
|
nextAction->setIcon(QIcon(":/images/viewer_toolbar/next.png"));
|
||||||
@ -291,7 +291,7 @@ void MainWindowViewer::createActions()
|
|||||||
nextAction->setDisabled(true);
|
nextAction->setDisabled(true);
|
||||||
nextAction->setData(NEXT_ACTION_Y);
|
nextAction->setData(NEXT_ACTION_Y);
|
||||||
nextAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(NEXT_ACTION_Y));
|
nextAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(NEXT_ACTION_Y));
|
||||||
connect(nextAction, SIGNAL(triggered()), viewer, SLOT(next()));
|
connect(nextAction, SIGNAL(triggered()), viewer, SLOT(right()));
|
||||||
|
|
||||||
adjustHeightAction = new QAction(tr("Fit Height"), this);
|
adjustHeightAction = new QAction(tr("Fit Height"), this);
|
||||||
adjustHeightAction->setIcon(QIcon(":/images/viewer_toolbar/toHeight.png"));
|
adjustHeightAction->setIcon(QIcon(":/images/viewer_toolbar/toHeight.png"));
|
||||||
@ -412,6 +412,7 @@ void MainWindowViewer::createActions()
|
|||||||
doubleMangaPageAction->setData(DOUBLE_MANGA_PAGE_ACTION_Y);
|
doubleMangaPageAction->setData(DOUBLE_MANGA_PAGE_ACTION_Y);
|
||||||
doubleMangaPageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(DOUBLE_MANGA_PAGE_ACTION_Y));
|
doubleMangaPageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(DOUBLE_MANGA_PAGE_ACTION_Y));
|
||||||
connect(doubleMangaPageAction, SIGNAL(triggered()), viewer, SLOT(doubleMangaPageSwitch()));
|
connect(doubleMangaPageAction, SIGNAL(triggered()), viewer, SLOT(doubleMangaPageSwitch()));
|
||||||
|
connect(doubleMangaPageAction, &QAction::triggered, this, &MainWindowViewer::doubleMangaPageSwitch);
|
||||||
|
|
||||||
goToPageAction = new QAction(tr("Go To"), this);
|
goToPageAction = new QAction(tr("Go To"), this);
|
||||||
goToPageAction->setIcon(QIcon(":/images/viewer_toolbar/goto.png"));
|
goToPageAction->setIcon(QIcon(":/images/viewer_toolbar/goto.png"));
|
||||||
@ -822,9 +823,6 @@ void MainWindowViewer::open()
|
|||||||
|
|
||||||
void MainWindowViewer::open(QString path, ComicDB &comic, QList<ComicDB> &siblings)
|
void MainWindowViewer::open(QString path, ComicDB &comic, QList<ComicDB> &siblings)
|
||||||
{
|
{
|
||||||
//currentComicDB = comic;
|
|
||||||
//siblingComics = siblings;
|
|
||||||
|
|
||||||
QFileInfo fi(path);
|
QFileInfo fi(path);
|
||||||
|
|
||||||
if (!comic.info.title.isNull() && !comic.info.title.toString().isEmpty())
|
if (!comic.info.title.isNull() && !comic.info.title.toString().isEmpty())
|
||||||
@ -832,31 +830,22 @@ void MainWindowViewer::open(QString path, ComicDB &comic, QList<ComicDB> &siblin
|
|||||||
else
|
else
|
||||||
setWindowTitle("YACReader - " + fi.fileName());
|
setWindowTitle("YACReader - " + fi.fileName());
|
||||||
|
|
||||||
|
viewer->setMangaWithoutStoringSetting(comic.info.manga.toBool());
|
||||||
|
doubleMangaPageAction->setChecked(comic.info.manga.toBool());
|
||||||
|
|
||||||
viewer->open(path, comic);
|
viewer->open(path, comic);
|
||||||
enableActions();
|
enableActions();
|
||||||
int index = siblings.indexOf(comic);
|
int index = siblings.indexOf(comic);
|
||||||
|
updateOpenPrevNextActions(index > 0, index + 1 < siblings.count());
|
||||||
|
|
||||||
optionsDialog->setFilters(currentComicDB.info.brightness, currentComicDB.info.contrast, currentComicDB.info.gamma);
|
optionsDialog->setFilters(currentComicDB.info.brightness, currentComicDB.info.contrast, currentComicDB.info.gamma);
|
||||||
|
|
||||||
if (index > 0)
|
|
||||||
openPreviousComicAction->setDisabled(false);
|
|
||||||
else
|
|
||||||
openPreviousComicAction->setDisabled(true);
|
|
||||||
|
|
||||||
if (index + 1 < siblings.count())
|
|
||||||
openNextComicAction->setDisabled(false);
|
|
||||||
else
|
|
||||||
openNextComicAction->setDisabled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindowViewer::open(QString path, qint64 comicId, qint64 libraryId)
|
void MainWindowViewer::open(QString path, qint64 comicId, qint64 libraryId)
|
||||||
{
|
{
|
||||||
//QString pathFile = QCoreApplication::arguments().at(1);
|
|
||||||
currentDirectory = path;
|
currentDirectory = path;
|
||||||
//quint64 comicId = QCoreApplication::arguments().at(2).split("=").at(1).toULongLong();
|
|
||||||
//libraryId = QCoreApplication::arguments().at(3).split("=").at(1).toULongLong();
|
|
||||||
this->libraryId = libraryId;
|
this->libraryId = libraryId;
|
||||||
// this->path=path;
|
|
||||||
|
|
||||||
enableActions();
|
enableActions();
|
||||||
|
|
||||||
@ -881,8 +870,10 @@ void MainWindowViewer::open(QString path, qint64 comicId, qint64 libraryId)
|
|||||||
|
|
||||||
void MainWindowViewer::openComicFromPath(QString pathFile)
|
void MainWindowViewer::openComicFromPath(QString pathFile)
|
||||||
{
|
{
|
||||||
|
doubleMangaPageAction->setChecked(Configuration::getConfiguration().getDoubleMangaPage());
|
||||||
openComic(pathFile);
|
openComic(pathFile);
|
||||||
isClient = false; //this method is used for direct openings
|
isClient = false; //this method is used for direct openings
|
||||||
|
updateOpenPrevNextActions(!previousComicPath.isEmpty(), !nextComicPath.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
//isClient shouldn't be modified when a siblinig comic is opened
|
//isClient shouldn't be modified when a siblinig comic is opened
|
||||||
@ -1406,6 +1397,16 @@ void MainWindowViewer::setUpShortcutsManagement()
|
|||||||
ShortcutsManager::getShortcutsManager().registerActions(allActions);
|
ShortcutsManager::getShortcutsManager().registerActions(allActions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindowViewer::doubleMangaPageSwitch()
|
||||||
|
{
|
||||||
|
if (isClient) {
|
||||||
|
int index = siblingComics.indexOf(currentComicDB);
|
||||||
|
updateOpenPrevNextActions(index > 0, index + 1 < siblingComics.size());
|
||||||
|
} else {
|
||||||
|
updateOpenPrevNextActions(!previousComicPath.isEmpty(), !nextComicPath.isEmpty());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindowViewer::toggleFitToWidthSlider()
|
void MainWindowViewer::toggleFitToWidthSlider()
|
||||||
{
|
{
|
||||||
int y;
|
int y;
|
||||||
@ -1497,6 +1498,7 @@ void MainWindowViewer::openNextComic()
|
|||||||
currentComicDB = siblingComics.at(currentIndex + 1);
|
currentComicDB = siblingComics.at(currentIndex + 1);
|
||||||
open(currentDirectory + currentComicDB.path, currentComicDB, siblingComics);
|
open(currentDirectory + currentComicDB.path, currentComicDB, siblingComics);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!nextComicPath.isEmpty()) {
|
if (!nextComicPath.isEmpty()) {
|
||||||
@ -1504,6 +1506,24 @@ void MainWindowViewer::openNextComic()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindowViewer::openLeftComic()
|
||||||
|
{
|
||||||
|
if (viewer->getIsMangaMode()) {
|
||||||
|
openNextComic();
|
||||||
|
} else {
|
||||||
|
openPreviousComic();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindowViewer::openRightComic()
|
||||||
|
{
|
||||||
|
if (viewer->getIsMangaMode()) {
|
||||||
|
openPreviousComic();
|
||||||
|
} else {
|
||||||
|
openNextComic();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindowViewer::getSiblingComics(QString path, QString currentComic)
|
void MainWindowViewer::getSiblingComics(QString path, QString currentComic)
|
||||||
{
|
{
|
||||||
QDir d(path);
|
QDir d(path);
|
||||||
@ -1558,15 +1578,13 @@ void MainWindowViewer::getSiblingComics(QString path, QString currentComic)
|
|||||||
previousComicPath = nextComicPath = "";
|
previousComicPath = nextComicPath = "";
|
||||||
if (index > 0) {
|
if (index > 0) {
|
||||||
previousComicPath = path + "/" + list.at(index - 1);
|
previousComicPath = path + "/" + list.at(index - 1);
|
||||||
openPreviousComicAction->setDisabled(false);
|
}
|
||||||
} else
|
|
||||||
openPreviousComicAction->setDisabled(true);
|
|
||||||
|
|
||||||
if (index + 1 < list.count()) {
|
if (index + 1 < list.count()) {
|
||||||
nextComicPath = path + "/" + list.at(index + 1);
|
nextComicPath = path + "/" + list.at(index + 1);
|
||||||
openNextComicAction->setDisabled(false);
|
}
|
||||||
} else
|
|
||||||
openNextComicAction->setDisabled(true);
|
updateOpenPrevNextActions(index > 0, index + 1 < list.count());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindowViewer::dropEvent(QDropEvent *event)
|
void MainWindowViewer::dropEvent(QDropEvent *event)
|
||||||
@ -1671,3 +1689,34 @@ void MainWindowViewer::sendComic()
|
|||||||
retries--;
|
retries--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindowViewer::updateOpenPrevNextActions(bool thereIsPrevious, bool thereIsNext)
|
||||||
|
{
|
||||||
|
if (thereIsPrevious) {
|
||||||
|
if (viewer->getIsMangaMode()) {
|
||||||
|
openNextComicAction->setDisabled(false);
|
||||||
|
} else {
|
||||||
|
openPreviousComicAction->setDisabled(false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (viewer->getIsMangaMode()) {
|
||||||
|
openNextComicAction->setDisabled(true);
|
||||||
|
} else {
|
||||||
|
openPreviousComicAction->setDisabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (thereIsNext) {
|
||||||
|
if (viewer->getIsMangaMode()) {
|
||||||
|
openPreviousComicAction->setDisabled(false);
|
||||||
|
} else {
|
||||||
|
openNextComicAction->setDisabled(false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (viewer->getIsMangaMode()) {
|
||||||
|
openPreviousComicAction->setDisabled(true);
|
||||||
|
} else {
|
||||||
|
openNextComicAction->setDisabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -50,6 +50,8 @@ public slots:
|
|||||||
void newVersion();
|
void newVersion();
|
||||||
void openPreviousComic();
|
void openPreviousComic();
|
||||||
void openNextComic();
|
void openNextComic();
|
||||||
|
void openLeftComic();
|
||||||
|
void openRightComic();
|
||||||
void openComicFromPath(QString pathFile);
|
void openComicFromPath(QString pathFile);
|
||||||
void openSiblingComic(QString pathFile);
|
void openSiblingComic(QString pathFile);
|
||||||
void openComic(QString pathFile);
|
void openComic(QString pathFile);
|
||||||
@ -68,6 +70,7 @@ public slots:
|
|||||||
void checkNewVersion();
|
void checkNewVersion();
|
||||||
void processReset();
|
void processReset();
|
||||||
void setUpShortcutsManagement();
|
void setUpShortcutsManagement();
|
||||||
|
void doubleMangaPageSwitch();
|
||||||
|
|
||||||
void toggleFitToWidthSlider();
|
void toggleFitToWidthSlider();
|
||||||
|
|
||||||
@ -181,6 +184,7 @@ private:
|
|||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
void sendComic();
|
void sendComic();
|
||||||
|
void updateOpenPrevNextActions(bool thereIsPrevious, bool thereIsNext);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindowViewer();
|
MainWindowViewer();
|
||||||
|
@ -1028,6 +1028,15 @@ void Render::doublePageSwitch()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Render::setManga(bool manga)
|
||||||
|
{
|
||||||
|
doubleMangaPage = manga;
|
||||||
|
if (comic && doublePage) {
|
||||||
|
//invalidate();
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Render::doubleMangaPageSwitch()
|
void Render::doubleMangaPageSwitch()
|
||||||
{
|
{
|
||||||
doubleMangaPage = !doubleMangaPage;
|
doubleMangaPage = !doubleMangaPage;
|
||||||
|
@ -144,6 +144,7 @@ public slots:
|
|||||||
bool previousPageIsDoublePage();
|
bool previousPageIsDoublePage();
|
||||||
void goTo(int index);
|
void goTo(int index);
|
||||||
void doublePageSwitch();
|
void doublePageSwitch();
|
||||||
|
void setManga(bool manga);
|
||||||
void doubleMangaPageSwitch();
|
void doubleMangaPageSwitch();
|
||||||
void setRotation(int degrees);
|
void setRotation(int degrees);
|
||||||
void setComic(Comic *c);
|
void setComic(Comic *c);
|
||||||
|
@ -253,6 +253,24 @@ void Viewer::next()
|
|||||||
shouldOpenPrevious = false;
|
shouldOpenPrevious = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Viewer::left()
|
||||||
|
{
|
||||||
|
if (doubleMangaPage) {
|
||||||
|
next();
|
||||||
|
} else {
|
||||||
|
prev();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Viewer::right()
|
||||||
|
{
|
||||||
|
if (doubleMangaPage) {
|
||||||
|
prev();
|
||||||
|
} else {
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Viewer::prev()
|
void Viewer::prev()
|
||||||
{
|
{
|
||||||
direction = -1;
|
direction = -1;
|
||||||
@ -889,6 +907,14 @@ void Viewer::doublePageSwitch()
|
|||||||
Configuration::getConfiguration().setDoublePage(doublePage);
|
Configuration::getConfiguration().setDoublePage(doublePage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Viewer::setMangaWithoutStoringSetting(bool manga)
|
||||||
|
{
|
||||||
|
doubleMangaPage = manga;
|
||||||
|
render->setManga(manga);
|
||||||
|
goToFlow->setFlowRightToLeft(doubleMangaPage);
|
||||||
|
//goToFlow->updateConfig(config.getSettings());
|
||||||
|
}
|
||||||
|
|
||||||
void Viewer::doubleMangaPageSwitch()
|
void Viewer::doubleMangaPageSwitch()
|
||||||
{
|
{
|
||||||
doubleMangaPage = !doubleMangaPage;
|
doubleMangaPage = !doubleMangaPage;
|
||||||
@ -1026,6 +1052,11 @@ void Viewer::updateZoomRatio(int ratio)
|
|||||||
updateContentSize();
|
updateContentSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Viewer::getIsMangaMode()
|
||||||
|
{
|
||||||
|
return doubleMangaPage;
|
||||||
|
}
|
||||||
|
|
||||||
void Viewer::updateConfig(QSettings *settings)
|
void Viewer::updateConfig(QSettings *settings)
|
||||||
{
|
{
|
||||||
goToFlow->updateConfig(settings);
|
goToFlow->updateConfig(settings);
|
||||||
|
@ -48,6 +48,8 @@ public slots:
|
|||||||
void open(QString pathFile, const ComicDB &comic);
|
void open(QString pathFile, const ComicDB &comic);
|
||||||
void prev();
|
void prev();
|
||||||
void next();
|
void next();
|
||||||
|
void left();
|
||||||
|
void right();
|
||||||
void showGoToDialog();
|
void showGoToDialog();
|
||||||
void goTo(unsigned int page);
|
void goTo(unsigned int page);
|
||||||
void updatePage();
|
void updatePage();
|
||||||
@ -76,6 +78,7 @@ public slots:
|
|||||||
void setBookmark(bool);
|
void setBookmark(bool);
|
||||||
void save();
|
void save();
|
||||||
void doublePageSwitch();
|
void doublePageSwitch();
|
||||||
|
void setMangaWithoutStoringSetting(bool manga);
|
||||||
void doubleMangaPageSwitch();
|
void doubleMangaPageSwitch();
|
||||||
void resetContent();
|
void resetContent();
|
||||||
void setLoadingMessage();
|
void setLoadingMessage();
|
||||||
@ -102,6 +105,7 @@ public slots:
|
|||||||
void showIsLastMessage();
|
void showIsLastMessage();
|
||||||
int getCurrentPageNumber();
|
int getCurrentPageNumber();
|
||||||
void updateZoomRatio(int ratio);
|
void updateZoomRatio(int ratio);
|
||||||
|
bool getIsMangaMode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool information;
|
bool information;
|
||||||
|
Loading…
Reference in New Issue
Block a user