Skip to content

Commit

Permalink
Merge pull request #258 from YACReader/develop
Browse files Browse the repository at this point in the history
9.8.1 release
  • Loading branch information
luisangelsm authored Jun 2, 2021
2 parents 9ae6acd + cfb91ed commit 52eebd1
Show file tree
Hide file tree
Showing 34 changed files with 472 additions and 273 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Version counting is based on semantic versioning (Major.Feature.Patch)

## WIP

## 9.8.1
### YACReaderLibrary
* Fix "reading lists" reading order on YACReader. Now YACReader is able to open the right comics in the right order.
### Server
* Fix "reading lists" reading order on YACReader for iOS. Now YACReader for iOS is able to open the right comics in the right order (ios app 3.15.0 or newer is needed).

## 9.8.0
### YACReader
* Add support for full manga mode.
Expand Down
14 changes: 13 additions & 1 deletion YACReader/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,22 @@ int main(int argc, char *argv[])
parser.addPositionalArgument("[File|Directory]", "File or directory to open.");
QCommandLineOption comicId("comicId", "", "comicId");
QCommandLineOption libraryId("libraryId", "", "libraryId");
QCommandLineOption readingListId("readingListId", "", "readingListId");
// hide comicId and libraryId from help
#if QT_VERSION >= 0x050800
comicId.setFlags(QCommandLineOption::HiddenFromHelp);
libraryId.setFlags(QCommandLineOption::HiddenFromHelp);
readingListId.setFlags(QCommandLineOption::HiddenFromHelp);
#else
comicId.setHidden(true);
libraryId.setHidden(true);
readingListId.setHidden(true);
#endif

// process
parser.addOption(comicId);
parser.addOption(libraryId);
parser.addOption(readingListId);
parser.process(app);

QString destLog = YACReader::getSettingsPath() + "/yacreader.log";
Expand Down Expand Up @@ -173,7 +177,15 @@ int main(int argc, char *argv[])
// some arguments need to be parsed after MainWindowViewer creation
QStringList arglist = parser.positionalArguments();
if (parser.isSet(comicId) && parser.isSet(libraryId) && arglist.count() >= 1) {
mwv->open(arglist.at(0), parser.value(comicId).toULongLong(), parser.value(libraryId).toULongLong());
OpenComicSource source;

if (parser.isSet(readingListId)) {
source = OpenComicSource { OpenComicSource::ReadingList, parser.value(readingListId).toULongLong() };
} else {
source = OpenComicSource { OpenComicSource::Folder, 33 }; //Folder is not needed to get the comic information, the comid id points to a unique comic
}

mwv->open(arglist.at(0), parser.value(comicId).toULongLong(), parser.value(libraryId).toULongLong(), source);
} else if (arglist.count() >= 1) {
mwv->openComicFromPath(arglist.at(0));
}
Expand Down
5 changes: 3 additions & 2 deletions YACReader/main_window_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -851,19 +851,20 @@ void MainWindowViewer::open(QString path, ComicDB &comic, QList<ComicDB> &siblin
optionsDialog->setFilters(currentComicDB.info.brightness, currentComicDB.info.contrast, currentComicDB.info.gamma);
}

void MainWindowViewer::open(QString path, qint64 comicId, qint64 libraryId)
void MainWindowViewer::open(QString path, qint64 comicId, qint64 libraryId, OpenComicSource source)
{
currentDirectory = path;

this->libraryId = libraryId;
this->source = source;

enableActions();

currentComicDB.id = comicId;
YACReaderLocalClient client;
int tries = 1;
bool success = false;
while (!(success = client.requestComicInfo(libraryId, currentComicDB, siblingComics)) && tries != 0)
while (!(success = client.requestComicInfo(libraryId, currentComicDB, siblingComics, source)) && tries != 0)
tries--;

if (success) {
Expand Down
9 changes: 8 additions & 1 deletion YACReader/main_window_viewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#endif

#include "comic_db.h"
#include "yacreader_global.h"

class Comic;
class Viewer;
Expand All @@ -25,14 +26,16 @@ class YACReaderSliderAction;
class YACReaderSlider;
class EditShortcutsDialog;

namespace YACReader {

class MainWindowViewer : public QMainWindow
{
Q_OBJECT

public slots:
void open();
void open(QString path, ComicDB &comic, QList<ComicDB> &siblings);
void open(QString path, qint64 comicId, qint64 libraryId);
void open(QString path, qint64 comicId, qint64 libraryId, OpenComicSource source);
void openFolder();
void openRecent();
void openLatestComic();
Expand Down Expand Up @@ -175,6 +178,7 @@ public slots:
bool isClient;
QString startComicPath;
quint64 libraryId;
OpenComicSource source;

//fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
Qt::WindowFlags previousWindowFlags;
Expand All @@ -191,4 +195,7 @@ public slots:
MainWindowViewer();
~MainWindowViewer() override;
};

}

#endif
3 changes: 2 additions & 1 deletion YACReader/yacreader_local_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void YACReaderLocalClient::readMessage()
}
#include <QMessageBox>

bool YACReaderLocalClient::requestComicInfo(quint64 libraryId, ComicDB &comic, QList<ComicDB> &siblings)
bool YACReaderLocalClient::requestComicInfo(quint64 libraryId, ComicDB &comic, QList<ComicDB> &siblings, OpenComicSource source)
{
localSocket->connectToServer(YACREADERLIBRARY_GUID);
if (localSocket->isOpen()) {
Expand All @@ -38,6 +38,7 @@ bool YACReaderLocalClient::requestComicInfo(quint64 libraryId, ComicDB &comic, Q
out << (quint32)0;
out << (quint8)YACReader::RequestComicInfo;
out << libraryId;
out << source;
out << comic;
out.device()->seek(0);
out << (quint32)(block.size() - sizeof(quint32));
Expand Down
4 changes: 3 additions & 1 deletion YACReader/yacreader_local_client.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef YACREADER_LOCAL_CLIENT_H
#define YACREADER_LOCAL_CLIENT_H

#include "yacreader_global.h"

#include <QObject>

class QLocalSocket;
Expand All @@ -16,7 +18,7 @@ class YACReaderLocalClient : public QObject
void finished();
public slots:
void readMessage();
bool requestComicInfo(quint64 libraryId, ComicDB &comic, QList<ComicDB> &siblings);
bool requestComicInfo(quint64 libraryId, ComicDB &comic, QList<ComicDB> &siblings, YACReader::OpenComicSource source);
bool sendComicInfo(quint64 libraryId, ComicDB &comic);
bool sendComicInfo(quint64 libraryId, ComicDB &comic, qulonglong nextComicId);

Expand Down
2 changes: 2 additions & 0 deletions YACReaderLibrary/YACReaderLibrary.pro
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ HEADERS += comic_flow.h \
db/comic_query_result_processor.h \
db/folder_query_result_processor.h \
db/query_lexer.h \
library_comic_opener.h \
library_creator.h \
library_window.h \
add_library_dialog.h \
Expand Down Expand Up @@ -156,6 +157,7 @@ SOURCES += comic_flow.cpp \
db/comic_query_result_processor.cpp \
db/folder_query_result_processor.cpp \
db/query_lexer.cpp \
library_comic_opener.cpp \
library_creator.cpp \
library_window.cpp \
main.cpp \
Expand Down
2 changes: 2 additions & 0 deletions YACReaderLibrary/db/comic_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ void ComicModel::setupFavoritesModelData(const QString &databasePath)
{
enableResorting = true;
mode = Favorites;
sourceId = -1;

beginResetModel();
qDeleteAll(_data);
Expand Down Expand Up @@ -574,6 +575,7 @@ void ComicModel::setupReadingModelData(const QString &databasePath)
{
enableResorting = false;
mode = Reading;
sourceId = -1;

beginResetModel();
qDeleteAll(_data);
Expand Down
1 change: 1 addition & 0 deletions YACReaderLibrary/db/comic_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class ComicModel : public QAbstractItemModel
bool isFavorite(const QModelIndex &index);

ComicModel::Mode getMode() { return mode; }
unsigned long long int getSourceId() { return sourceId; }

QHash<int, QByteArray> roleNames() const override;

Expand Down
Loading

0 comments on commit 52eebd1

Please sign in to comment.