Skip to content

Commit

Permalink
Merge pull request #262 from YACReader/develop
Browse files Browse the repository at this point in the history
9.8.2 Release
  • Loading branch information
luisangelsm authored Jun 19, 2021
2 parents 52eebd1 + 85677af commit 7394944
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 50 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion YACReaderLibrary/comics_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion YACReaderLibrary/grid_comics_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
78 changes: 41 additions & 37 deletions YACReaderLibrary/library_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,20 @@
#include <shellapi.h>
#endif

namespace {
template<class Remover>
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()
Expand Down Expand Up @@ -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();
}
}
}
Expand Down Expand Up @@ -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
}
}
}

Expand Down Expand Up @@ -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();
}
}

Expand Down
4 changes: 3 additions & 1 deletion YACReaderLibrary/library_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "comic_query_result_processor.h"
#include "folder_query_result_processor.h"

#include "comic_model.h"

#include <future>
#include <memory>

Expand Down Expand Up @@ -77,7 +79,6 @@ class YACReaderHistoryController;
class EmptyLabelWidget;
class EmptySpecialListWidget;
class EmptyReadingListWidget;
class YACReaderComicsViewsManager;

namespace YACReader {
class TrayIconController;
Expand Down Expand Up @@ -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();
Expand Down
14 changes: 10 additions & 4 deletions YACReaderLibrary/server/controllers/v2/comiccontroller_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ComicDB *>(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<ComicDB *>(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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion YACReaderLibrary/yacreader_comics_views_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));

Expand Down
2 changes: 1 addition & 1 deletion common/yacreader_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <QStandardPaths>
#include <QDataStream>

#define VERSION "9.8.1"
#define VERSION "9.8.2"

#define REMOTE_BROWSE_PERFORMANCE_WORKAROUND "REMOTE_BROWSE_PERFORMANCE_WORKAROUND"

Expand Down
3 changes: 3 additions & 0 deletions custom_widgets/whats_new_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,13 @@ YACReader::WhatsNewDialog::WhatsNewDialog(QWidget *parent)
" &#8226; Support for HTML in comic synopsis, this fixes the synopsis when it comes from Comic Vine with HTML tags.<br/>"
" &#8226; Improve keyboard navigation in Comic Vine dialog. Enter will trigger next or search and Backspace will go back to the previous section.<br/>"
" &#8226; 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)<br/>"
" &#8226; Fixed opening comics from the continue reading banner. (new in 9.8.2)<br/>"
" &#8226; Make available next/prev comic covers in the iOS app while reading. (new in 9.8.2)<br/>"
"<br/>"
"<span style=\"font-weight:600\">Server</span><br/>"
" &#8226; 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.<br/>"
" &#8226; 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).<br/>"
" &#8226; Make available next/prev comic covers in the iOS app while reading. (new in 9.8.2)<br/>"
"<br/>"
"I hope you enjoy the new update. Please, if you like YACReader consider to become a patron in <a href=\"https://www.patreon.com/yacreader\" style=\"color:#E8B800;\">Patreon</a> or donate some money using <a href=\"https://www.paypal.com/donate?business=5TAMNQCDDMVP8&item_name=Support+YACReader\" style=\"color:#E8B800;\">Pay-Pal</a> and help keeping the project alive. Remember that there is an iOS version available in the <a href=\"https://apps.apple.com/app/id635717885\" style=\"color:#E8B800;\">Apple App Store</a>.");
QFont textLabelFont("Arial", 15, QFont::Light);
Expand Down

0 comments on commit 7394944

Please sign in to comment.