mirror of
https://github.com/YACReader/yacreader
synced 2025-07-23 07:24:58 -04:00
some bugs fixed in local server/client communication
This commit is contained in:
@ -204,7 +204,7 @@ void MainWindowViewer::openFromArgv()
|
||||
}
|
||||
else if(QCoreApplication::argc() == 4)
|
||||
{
|
||||
isClient = true;
|
||||
|
||||
QString pathFile = QCoreApplication::arguments().at(1);
|
||||
currentDirectory = pathFile;
|
||||
quint64 comicId = QCoreApplication::arguments().at(2).toULongLong();
|
||||
@ -217,10 +217,11 @@ void MainWindowViewer::openFromArgv()
|
||||
|
||||
if(client.requestComicInfo(libraryId,currentComicDB,siblingComics))
|
||||
{
|
||||
isClient = true;
|
||||
open(pathFile+currentComicDB.path,currentComicDB,siblingComics);
|
||||
}
|
||||
else
|
||||
{/*error*/}
|
||||
{isClient = false;/*error*/}
|
||||
|
||||
optionsDialog->setFilters(currentComicDB.info.brightness, currentComicDB.info.contrast, currentComicDB.info.gamma);
|
||||
}
|
||||
|
@ -854,6 +854,8 @@ int Viewer::getCurrentPageNumber()
|
||||
|
||||
void Viewer::updateComic(ComicDB & comic)
|
||||
{
|
||||
if(render->hasLoadedComic())
|
||||
{
|
||||
//set currentPage
|
||||
comic.info.currentPage = render->getIndex()+1;
|
||||
//set bookmarks
|
||||
@ -879,6 +881,7 @@ void Viewer::updateComic(ComicDB & comic)
|
||||
comic.info.contrast = contrast;
|
||||
if(gamma != 100 || comic.info.gamma!=-1)
|
||||
comic.info.gamma = gamma;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -51,12 +51,12 @@ bool YACReaderLocalClient::requestComicInfo(quint64 libraryId, ComicDB & comic,
|
||||
|
||||
//QByteArray data;
|
||||
tries = 0;
|
||||
while(localSocket->bytesAvailable() < sizeof(quint16) && tries < 200)
|
||||
while(localSocket->bytesAvailable() < sizeof(quint16) && tries < 10)
|
||||
{
|
||||
localSocket->waitForReadyRead(10);
|
||||
localSocket->waitForReadyRead(100);
|
||||
tries++;
|
||||
}
|
||||
if(tries == 200)
|
||||
if(tries == 20)
|
||||
return false;
|
||||
QDataStream sizeStream(localSocket->read(sizeof(quint16)));
|
||||
sizeStream.setVersion(QDataStream::Qt_4_8);
|
||||
@ -64,12 +64,12 @@ bool YACReaderLocalClient::requestComicInfo(quint64 libraryId, ComicDB & comic,
|
||||
sizeStream >> totalSize;
|
||||
|
||||
tries = 0;
|
||||
while(localSocket->bytesAvailable() < totalSize && tries < 200 )
|
||||
while(localSocket->bytesAvailable() < totalSize && tries < 10 )
|
||||
{
|
||||
localSocket->waitForReadyRead(10);
|
||||
localSocket->waitForReadyRead(100);
|
||||
tries++;
|
||||
}
|
||||
if(tries == 200)
|
||||
if(tries == 20)
|
||||
return false;
|
||||
QDataStream dataStream(localSocket->read(totalSize));
|
||||
dataStream >> comic;
|
||||
|
Reference in New Issue
Block a user