From 8d6b1c5690bd78978b735d90d757f4375cf98105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Sat, 20 Jul 2013 11:00:46 +0200 Subject: [PATCH] open at page getted from data base --- YACReader/main_window_viewer.cpp | 12 ++----- common/comic_db.cpp | 54 ++++++++++++++++++++++++++++++++ common/comic_db.h | 15 +++++++++ 3 files changed, 72 insertions(+), 9 deletions(-) diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index 6ca4dee7..5f81a596 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -180,15 +180,9 @@ void MainWindowViewer::setupUI() YACReaderLocalClient client; if(client.requestComicInfo(libraryId,currentComicDB,siblingComics)) - { - if(currentComicDB.info.title == 0 || currentComicDB.info.title->isEmpty() ) - setWindowTitle("YACReader - " + currentComicDB.path); - else - setWindowTitle("YACReader - " + *currentComicDB.info.title); - } + open(pathFile+currentComicDB.path,currentComicDB,siblingComics); else - setWindowTitle("YACReader : " + currentComicDB.path); - open(pathFile+currentComicDB.path,currentComicDB,siblingComics); + {/*error*/} } versionChecker = new HttpVersionChecker(); @@ -602,7 +596,7 @@ void MainWindowViewer::open(QString path, ComicDB & comic, QList & sibl else setWindowTitle("YACReader - " + fi.fileName()); - viewer->open(path); + viewer->open(path,comic.info.currentPage); enableActions(); int index = siblings.indexOf(comic); diff --git a/common/comic_db.cpp b/common/comic_db.cpp index eb3c1742..796ce6a7 100644 --- a/common/comic_db.cpp +++ b/common/comic_db.cpp @@ -25,6 +25,11 @@ QString ComicDB::toTXT() txt.append(QString("path:%1\r\n").arg(path)); txt.append(QString("numpages:%1\r\n").arg(*info.numPages)); + //new 7.0 + txt.append(QString("rating:%1\r\n").arg(info.rating)); + txt.append(QString("currentPage:%1\r\n").arg(info.currentPage)); + txt.append(QString("contrast:%1\r\n").arg(info.contrast)); + //Información general if(info.coverPage != NULL) txt.append(QString("coverPage:%1\r\n").arg(*info.coverPage)); @@ -106,6 +111,15 @@ QString ComicDB::toTXT() //----------------------------------------------------------------------------- ComicInfo::ComicInfo() :existOnDb(false), + rating(-1), + hasBeenOpened(false), + currentPage(0), + bookmark1(-1), + bookmark2(-1), + bookmark3(-1), + brightness(-1), + contrast(-1), + gamma(-1), title(NULL), coverPage(NULL), numPages(NULL), @@ -227,6 +241,16 @@ ComicInfo & ComicInfo::operator=(const ComicInfo & comicInfo) read = comicInfo.read; edited = comicInfo.edited; + hasBeenOpened = comicInfo.hasBeenOpened; + rating = comicInfo.rating; + currentPage = comicInfo.currentPage; + bookmark1 = comicInfo.bookmark1; + bookmark2 = comicInfo.bookmark2; + bookmark3 = comicInfo.bookmark3; + brightness = comicInfo.brightness; + contrast = comicInfo.contrast; + gamma = comicInfo.gamma; + return *this; } @@ -254,18 +278,28 @@ void ComicInfo::setValue(bool * & field, bool value) void ComicInfo::copyField(QString * & field, const QString * value) { + if(field != 0) + delete field; + field = 0; if(value != NULL) field = new QString(*value); + } void ComicInfo::copyField(int * & field, int * value) { + if(field != NULL) + delete field; + field = 0; if(value != NULL) field = new int(*value); } void ComicInfo::copyField(bool * & field, bool * value) { + if(field != NULL) + delete field; + field = 0; if(value != NULL) field = new bool(*value); } @@ -488,6 +522,16 @@ QDataStream &operator<<(QDataStream & stream, const ComicInfo & comicInfo) stream << comicInfo.hash; stream << comicInfo.existOnDb; + stream << comicInfo.hasBeenOpened; + stream << comicInfo.rating; + stream << comicInfo.currentPage; + stream << comicInfo.bookmark1; + stream << comicInfo.bookmark2; + stream << comicInfo.bookmark3; + stream << comicInfo.brightness; + stream << comicInfo.contrast; + stream << comicInfo.gamma; + serializeField(stream,comicInfo.title); serializeField(stream,comicInfo.coverPage); @@ -531,6 +575,16 @@ QDataStream &operator>>(QDataStream & stream, ComicInfo & comicInfo) stream >> comicInfo.hash; stream >> comicInfo.existOnDb; + stream >> comicInfo.hasBeenOpened; + stream >> comicInfo.rating; + stream >> comicInfo.currentPage; + stream >> comicInfo.bookmark1; + stream >> comicInfo.bookmark2; + stream >> comicInfo.bookmark3; + stream >> comicInfo.brightness; + stream >> comicInfo.contrast; + stream >> comicInfo.gamma; + deserializeField(stream,comicInfo.title); deserializeField(stream,comicInfo.coverPage); diff --git a/common/comic_db.h b/common/comic_db.h index 0df4abca..6a8a00d1 100644 --- a/common/comic_db.h +++ b/common/comic_db.h @@ -21,6 +21,21 @@ public: QString hash; bool existOnDb; + int rating; + + bool hasBeenOpened; + + //viewer + int currentPage; + int bookmark1; + int bookmark2; + int bookmark3; + int brightness; + int contrast; + int gamma; + + + QString * title; int * coverPage;