diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index 1539a589..8429fac3 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -1682,8 +1682,10 @@ void MainWindowViewer::decreasePageZoomLevel() void MainWindowViewer::sendComic() { YACReaderLocalClient * client = new YACReaderLocalClient; + connect(client, &YACReaderLocalClient::finished, client, &YACReaderLocalClient::deleteLater); - currentComicDB.info.lastTimeOpened = QDateTime::currentSecsSinceEpoch(); + currentComicDB.info.lastTimeOpened = QDateTime::currentMSecsSinceEpoch() / 1000; + viewer->updateComic(currentComicDB); if (currentComicDB.info.currentPage == currentComicDB.info.numPages) { diff --git a/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp b/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp index bb963b06..33c639d8 100644 --- a/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp +++ b/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp @@ -111,6 +111,8 @@ void ComicVineDialog::doConnections() connect(selectVolumeWidget,SIGNAL(loadPage(QString,int)),this,SLOT(searchVolume(QString,int))); connect(selectComicWidget,SIGNAL(loadPage(QString,int)),this,SLOT(getVolumeComicsInfo(QString,int))); connect(sortVolumeComicsWidget,SIGNAL(loadPage(QString,int)),this,SLOT(getVolumeComicsInfo(QString,int))); + + connect(this, SIGNAL(accepted()), this, SLOT(close()), Qt::QueuedConnection); } void ComicVineDialog::goNext() @@ -456,7 +458,6 @@ void ComicVineDialog::getComicsInfo(QList > & matchingIn db.close(); QSqlDatabase::removeDatabase(db.connectionName()); - close(); emit accepted(); } @@ -472,8 +473,7 @@ void ComicVineDialog::getComicInfo(const QString &comicId, int count, const QStr //TODO if(mode == SingleComic || currentIndex == (comics.count()-1)) { - close(); - emit accepted(); + emit accepted(); } else { goToNextComic(); @@ -496,7 +496,6 @@ void ComicVineDialog::getComicInfo(const QString &comicId, int count, const QStr if(mode == SingleComic || currentIndex == (comics.count()-1)) { - close(); emit accepted(); } else { @@ -645,7 +644,6 @@ void ComicVineDialog::goToNextComic() { if(mode == SingleComic || currentIndex == (comics.count()-1)) { - close(); emit accepted(); return; } diff --git a/YACReaderLibrary/db_helper.cpp b/YACReaderLibrary/db_helper.cpp index e53f9b30..2155ea11 100644 --- a/YACReaderLibrary/db_helper.cpp +++ b/YACReaderLibrary/db_helper.cpp @@ -736,7 +736,7 @@ void DBHelper::updateReadingRemoteProgress(const ComicInfo &comicInfo, QSqlDatab updateComicInfo.bindValue(":read", comicInfo.read?1:0); updateComicInfo.bindValue(":currentPage", comicInfo.currentPage); updateComicInfo.bindValue(":hasBeenOpened", comicInfo.hasBeenOpened?1:0); - updateComicInfo.bindValue(":lastTimeOpened", QDateTime::currentSecsSinceEpoch()); + updateComicInfo.bindValue(":lastTimeOpened", QDateTime::currentMSecsSinceEpoch() / 1000); updateComicInfo.bindValue(":id", comicInfo.id); updateComicInfo.bindValue(":rating", comicInfo.rating); updateComicInfo.exec(); diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index b1d34487..6a156aee 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -1054,7 +1054,7 @@ void LibraryWindow::createConnections() connect(propertiesDialog,SIGNAL(accepted()),navigationController,SLOT(reselectCurrentSource())); //comic vine - connect(comicVineDialog,SIGNAL(accepted()),navigationController,SLOT(reselectCurrentSource())); + connect(comicVineDialog,SIGNAL(accepted()),navigationController,SLOT(reselectCurrentSource()), Qt::QueuedConnection); connect(updateLibraryAction,SIGNAL(triggered()),this,SLOT(updateLibrary())); connect(renameLibraryAction,SIGNAL(triggered()),this,SLOT(renameLibrary())); diff --git a/YACReaderLibrary/server/controllers/v2/comicdownloadinfocontroller_v2.cpp b/YACReaderLibrary/server/controllers/v2/comicdownloadinfocontroller_v2.cpp index 420b9cf0..60981e3e 100644 --- a/YACReaderLibrary/server/controllers/v2/comicdownloadinfocontroller_v2.cpp +++ b/YACReaderLibrary/server/controllers/v2/comicdownloadinfocontroller_v2.cpp @@ -23,5 +23,6 @@ void ComicDownloadInfoControllerV2::service(HttpRequest& request, HttpResponse& //TODO: check if the comic wasn't found; response.write(QString("fileName:%1\r\n").arg(comic.getFileName()).toUtf8()); response.write(QString("fileSize:%1\r\n").arg(comic.getFileSize()).toUtf8()); - response.write(QString("hash:%1\r\n").arg(comic.info.hash).toUtf8(),true); + response.write(QString("libraryId:%1\r\n").arg(libraryId).toUtf8()); + response.write(comic.toTXT().toUtf8(),true); } diff --git a/YACReaderLibrary/server/controllers/v2/covercontroller_v2.cpp b/YACReaderLibrary/server/controllers/v2/covercontroller_v2.cpp index da6a2001..8984ee85 100644 --- a/YACReaderLibrary/server/controllers/v2/covercontroller_v2.cpp +++ b/YACReaderLibrary/server/controllers/v2/covercontroller_v2.cpp @@ -11,8 +11,6 @@ CoverControllerV2::CoverControllerV2() {} void CoverControllerV2::service(HttpRequest& request, HttpResponse& response) { response.setHeader("Content-Type", "image/jpeg"); - response.setHeader("Connection","close"); - //response.setHeader("Content-Type", "plain/text; charset=ISO-8859-1"); YACReaderLibraries libraries = DBHelper::getLibraries(); @@ -21,60 +19,14 @@ void CoverControllerV2::service(HttpRequest& request, HttpResponse& response) QString libraryName = DBHelper::getLibraryName(pathElements.at(3).toInt()); QString fileName = pathElements.at(5); - //response.writeText(path+"
"); - //response.writeText(libraryName+"
"); - //response.writeText(libraries.value(libraryName)+"/.yacreaderlibrary/covers/"+fileName+"
"); - - //QFile file(libraries.value(libraryName)+"/.yacreaderlibrary/covers/"+fileName); - //if (file.exists()) { - // if (file.open(QIODevice::ReadOnly)) - // { - // qDebug("StaticFileController: Open file %s",qPrintable(file.fileName())); - // // Return the file content, do not store in cache - // while (!file.atEnd() && !file.error()) { - // response.write(file.read(131072)); - // } - // } - - // file.close(); - //} - QImage img(libraries.getPath(libraryName)+"/.yacreaderlibrary/covers/"+fileName); if (!img.isNull()) { - - /*int width = 80, height = 120; - if(ySession->getDisplayType()=="@2x") - { - width = 160; - height = 240; - } - - if(float(img.width())/img.height() < 0.66666) - img = img.scaledToWidth(width,Qt::SmoothTransformation); - else - img = img.scaledToHeight(height,Qt::SmoothTransformation); - - QImage destImg(width,height,QImage::Format_RGB32); - destImg.fill(Qt::black); - QPainter p(&destImg); - - p.drawImage((width-img.width())/2,(height-img.height())/2,img); - - if(folderCover) - { - if(ySession->getDisplayType()=="@2x") - p.drawImage(0,0,QImage(":/images/f_overlayed_retina.png")); - else - p.drawImage(0,0,QImage(":/images/f_overlayed.png")); - } -*/ QByteArray ba; QBuffer buffer(&ba); buffer.open(QIODevice::WriteOnly); img.save(&buffer, "JPG"); response.write(ba,true); } - //DONE else, hay que devolver un 404 else { response.setStatus(404,"not found"); diff --git a/YACReaderLibrary/server/controllers/v2/librariescontroller_v2.cpp b/YACReaderLibrary/server/controllers/v2/librariescontroller_v2.cpp index a42e5f9e..62280b71 100644 --- a/YACReaderLibrary/server/controllers/v2/librariescontroller_v2.cpp +++ b/YACReaderLibrary/server/controllers/v2/librariescontroller_v2.cpp @@ -12,7 +12,6 @@ LibrariesControllerV2::LibrariesControllerV2() {} void LibrariesControllerV2::service(HttpRequest& request, HttpResponse& response) { response.setHeader("Content-Type", "application/json"); - response.setHeader("Connection","close"); YACReaderLibraries libraries = DBHelper::getLibraries(); QList names = DBHelper::getLibrariesNames(); diff --git a/YACReaderLibrary/server/requestmapper.cpp b/YACReaderLibrary/server/requestmapper.cpp index 7bdca900..4677d488 100644 --- a/YACReaderLibrary/server/requestmapper.cpp +++ b/YACReaderLibrary/server/requestmapper.cpp @@ -247,8 +247,8 @@ void RequestMapper::serviceV2(HttpRequest& request, HttpResponse& response) QByteArray path=request.getPath(); QRegExp folderInfo("/v2/library/.+/folder/[0-9]+/info/?"); //get folder info - QRegExp comicDownloadInfo("/v2/library/.+/comic/[0-9]+/?"); //get comic info (basic/download info) - QRegExp comicOpenForDownloading("/v2/library/.+/comic/[0-9]+/info/?"); //get comic info (full info + opening) + QRegExp comicDownloadInfo("/v2/library/.+/comic/[0-9]+/info/?"); //get comic info (full download info) + QRegExp comicOpenForDownloading("/v2/library/.+/comic/[0-9]+/?"); //get comic info (full info + opening) QRegExp comicOpenForRemoteReading("/v2/library/.+/comic/[0-9]+/remote/?"); //the server will open for reading the comic QRegExp comicFullInfo("/v2/library/.+/comic/[0-9]+/fullinfo/?"); //get comic info QRegExp comicUpdate("/v2/library/.+/comic/[0-9]+/update/?"); //get comic info