diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a889d976..e3a496af8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ Version counting is based on semantic versioning (Major.Feature.Patch) ## WIP +## 9.8.2 +### YACReaderLibrary +* Fix opening comics from the continue reading banner. +* Make available next/prev comic covers in the iOS app while reading. (ios app 3.16.1 needed) +### Server +* Make available next/prev comic covers in the iOS app while reading. (ios app 3.16.1 needed) + ## 9.8.1 ### YACReaderLibrary * Fix "reading lists" reading order on YACReader. Now YACReader is able to open the right comics in the right order. diff --git a/YACReaderLibrary/comics_view.h b/YACReaderLibrary/comics_view.h index 9b98eee7e..cee4c6abb 100644 --- a/YACReaderLibrary/comics_view.h +++ b/YACReaderLibrary/comics_view.h @@ -38,7 +38,7 @@ public slots: signals: void selected(unsigned int); - void openComic(const ComicDB &comic); + void openComic(const ComicDB &comic, const ComicModel::Mode mode); void comicRated(int, QModelIndex); //Context menus diff --git a/YACReaderLibrary/grid_comics_view.cpp b/YACReaderLibrary/grid_comics_view.cpp index b844bfa6a..40140c16f 100644 --- a/YACReaderLibrary/grid_comics_view.cpp +++ b/YACReaderLibrary/grid_comics_view.cpp @@ -398,7 +398,11 @@ void GridComicsView::selectIndex(int index) void GridComicsView::triggerOpenCurrentComic() { - emit openComic(currentComic); + if (model == nullptr) { + return; + } + + emit openComic(currentComic, model->getMode()); } void GridComicsView::rate(int index, int rating) diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index e359f8fb0..a8d6aa311 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -94,6 +94,20 @@ #include #endif +namespace { +template +void moveAndConnectRemoverToThread(Remover *remover, QThread *thread) +{ + Q_ASSERT(remover); + Q_ASSERT(thread); + remover->moveToThread(thread); + QObject::connect(thread, &QThread::started, remover, &Remover::process); + QObject::connect(remover, &Remover::finished, remover, &QObject::deleteLater); + QObject::connect(remover, &Remover::finished, thread, &QThread::quit); + QObject::connect(thread, &QThread::finished, thread, &QObject::deleteLater); +} +} + using namespace YACReader; LibraryWindow::LibraryWindow() @@ -1576,22 +1590,14 @@ void LibraryWindow::deleteSelectedFolder() paths << folderPath; auto remover = new FoldersRemover(indexList, paths); + const auto thread = new QThread(this); + moveAndConnectRemoverToThread(remover, thread); - QThread *thread = NULL; - - thread = new QThread(this); - - remover->moveToThread(thread); - - connect(thread, SIGNAL(started()), remover, SLOT(process())); connect(remover, SIGNAL(remove(QModelIndex)), foldersModel, SLOT(deleteFolder(QModelIndex))); connect(remover, SIGNAL(removeError()), this, SLOT(errorDeletingFolder())); connect(remover, SIGNAL(finished()), navigationController, SLOT(reselectCurrentFolder())); - connect(remover, SIGNAL(finished()), remover, SLOT(deleteLater())); - connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); - if (thread != NULL) - thread->start(); + thread->start(); } } } @@ -1840,31 +1846,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()); + + OpenComicSource::Source source; + + 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() }); + auto yacreaderFound = YACReader::openComic(comic, libraryId, currentPath(), OpenComicSource { source, comicsModel->getSourceId() }); - if (!yacreaderFound) { + 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 - } } } @@ -2556,28 +2568,20 @@ void LibraryWindow::deleteComicsFromDisk() } auto remover = new ComicsRemover(indexList, paths, comics.at(0).parentId); - QThread *thread = NULL; - - thread = new QThread(this); - - remover->moveToThread(thread); + const auto thread = new QThread(this); + moveAndConnectRemoverToThread(remover, thread); comicsModel->startTransaction(); - connect(thread, SIGNAL(started()), remover, SLOT(process())); connect(remover, SIGNAL(remove(int)), comicsModel, SLOT(remove(int))); connect(remover, SIGNAL(removeError()), this, SLOT(setRemoveError())); connect(remover, SIGNAL(finished()), comicsModel, SLOT(finishTransaction())); - connect(remover, SIGNAL(finished()), comicsModel, SLOT(finishTransaction())); connect(remover, SIGNAL(removedItemsFromFolder(qulonglong)), foldersModel, SLOT(updateFolderChildrenInfo(qulonglong))); connect(remover, SIGNAL(finished()), this, SLOT(checkEmptyFolder())); connect(remover, SIGNAL(finished()), this, SLOT(checkRemoveError())); - connect(remover, SIGNAL(finished()), remover, SLOT(deleteLater())); - connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); - if (thread != NULL) - thread->start(); + thread->start(); } } diff --git a/YACReaderLibrary/library_window.h b/YACReaderLibrary/library_window.h index 7b0a14e88..2db2c7c46 100644 --- a/YACReaderLibrary/library_window.h +++ b/YACReaderLibrary/library_window.h @@ -13,6 +13,8 @@ #include "comic_query_result_processor.h" #include "folder_query_result_processor.h" +#include "comic_model.h" + #include #include @@ -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(); diff --git a/YACReaderLibrary/server/controllers/v2/comiccontroller_v2.cpp b/YACReaderLibrary/server/controllers/v2/comiccontroller_v2.cpp index e962d6b0a..d78fd8e20 100644 --- a/YACReaderLibrary/server/controllers/v2/comiccontroller_v2.cpp +++ b/YACReaderLibrary/server/controllers/v2/comiccontroller_v2.cpp @@ -105,10 +105,16 @@ void ComicControllerV2::service(HttpRequest &request, HttpResponse &response) } } if (found) { - if (i > 0) - response.write(QString("previousComic:%1\r\n").arg(siblings.at(i - 1)->id).toUtf8()); - if (i < siblings.length() - 1) - response.write(QString("nextComic:%1\r\n").arg(siblings.at(i + 1)->id).toUtf8()); + if (i > 0) { + ComicDB *previousComic = static_cast(siblings.at(i - 1)); + response.write(QString("previousComic:%1\r\n").arg(previousComic->id).toUtf8()); + response.write(QString("previousComicHash:%1\r\n").arg(previousComic->info.hash).toUtf8()); + } + if (i < siblings.length() - 1) { + ComicDB *nextComic = static_cast(siblings.at(i + 1)); + response.write(QString("nextComic:%1\r\n").arg(nextComic->id).toUtf8()); + response.write(QString("nextComicHash:%1\r\n").arg(nextComic->info.hash).toUtf8()); + } } else { //ERROR } diff --git a/YACReaderLibrary/server/controllers/v2/comiccontrollerinreadinglist_v2.cpp b/YACReaderLibrary/server/controllers/v2/comiccontrollerinreadinglist_v2.cpp index bbadf8e04..84b2fda0b 100644 --- a/YACReaderLibrary/server/controllers/v2/comiccontrollerinreadinglist_v2.cpp +++ b/YACReaderLibrary/server/controllers/v2/comiccontrollerinreadinglist_v2.cpp @@ -83,10 +83,16 @@ void ComicControllerInReadingListV2::service(HttpRequest &request, HttpResponse } } if (found) { - if (i > 0) - response.write(QString("previousComic:%1\r\n").arg(siblings.at(i - 1).id).toUtf8()); - if (i < siblings.length() - 1) - response.write(QString("nextComic:%1\r\n").arg(siblings.at(i + 1).id).toUtf8()); + if (i > 0) { + ComicDB previousComic = siblings.at(i - 1); + response.write(QString("previousComic:%1\r\n").arg(previousComic.id).toUtf8()); + response.write(QString("previousComicHash:%1\r\n").arg(previousComic.info.hash).toUtf8()); + } + if (i < siblings.length() - 1) { + ComicDB nextComic = siblings.at(i + 1); + response.write(QString("nextComic:%1\r\n").arg(nextComic.id).toUtf8()); + response.write(QString("nextComicHash:%1\r\n").arg(nextComic.info.hash).toUtf8()); + } } else { //ERROR } diff --git a/YACReaderLibrary/yacreader_comics_views_manager.cpp b/YACReaderLibrary/yacreader_comics_views_manager.cpp index 453018312..585a6533f 100644 --- a/YACReaderLibrary/yacreader_comics_views_manager.cpp +++ b/YACReaderLibrary/yacreader_comics_views_manager.cpp @@ -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(ComicDB)), libraryWindow, SLOT(openComic(ComicDB))); + 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())); diff --git a/common/yacreader_global.h b/common/yacreader_global.h index 8b2a0b214..d01c9af97 100644 --- a/common/yacreader_global.h +++ b/common/yacreader_global.h @@ -4,7 +4,7 @@ #include #include -#define VERSION "9.8.1" +#define VERSION "9.8.2" #define REMOTE_BROWSE_PERFORMANCE_WORKAROUND "REMOTE_BROWSE_PERFORMANCE_WORKAROUND" diff --git a/custom_widgets/whats_new_dialog.cpp b/custom_widgets/whats_new_dialog.cpp index 90dad39ff..bc31826b2 100644 --- a/custom_widgets/whats_new_dialog.cpp +++ b/custom_widgets/whats_new_dialog.cpp @@ -59,10 +59,13 @@ YACReader::WhatsNewDialog::WhatsNewDialog(QWidget *parent) " • Support for HTML in comic synopsis, this fixes the synopsis when it comes from Comic Vine with HTML tags.
" " • Improve keyboard navigation in Comic Vine dialog. Enter will trigger next or search and Backspace will go back to the previous section.
" " • Fixed opening comics from readings lists, now YACReader will follow the right order and it will open the right comics in the list. (new in 9.8.1)
" + " • Fixed opening comics from the continue reading banner. (new in 9.8.2)
" + " • Make available next/prev comic covers in the iOS app while reading. (new in 9.8.2)
" "
" "Server
" " • New `manga` field is sent to YACReader for iOS, so comics tagged as manga will be recognized as such when reading remotely or importing comics.
" " • Fixed opening comics from readings lists, now YACReader for iOS will follow the right order and it will open the right comics in the list, it needs YACReader for iOS 3.15.0 or newer. (new in 9.8.1).
" + " • Make available next/prev comic covers in the iOS app while reading. (new in 9.8.2)
" "
" "I hope you enjoy the new update. Please, if you like YACReader consider to become a patron in Patreon or donate some money using Pay-Pal and help keeping the project alive. Remember that there is an iOS version available in the Apple App Store."); QFont textLabelFont("Arial", 15, QFont::Light);