mirror of
https://github.com/YACReader/yacreader
synced 2025-07-20 22:14:41 -04:00
load(path,atPage) added in viewer,render and comic classes
updated CHANGELOG
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
#include "yacreader_local_client.h"
|
||||
#include "comic_db.h"
|
||||
#include "yacreader_global.h"
|
||||
|
||||
#include <QLocalSocket>
|
||||
|
||||
@ -9,6 +10,7 @@ YACReaderLocalClient::YACReaderLocalClient(QObject *parent) :
|
||||
localSocket = new QLocalSocket(this);
|
||||
|
||||
connect(localSocket, SIGNAL(readyRead()), this, SLOT(readMessage()));
|
||||
|
||||
/*connect(socket, SIGNAL(error(QLocalSocket::LocalSocketError)),
|
||||
this, SLOT(displayError(QLocalSocket::LocalSocketError)));*/
|
||||
}
|
||||
@ -19,12 +21,45 @@ void YACReaderLocalClient::readMessage()
|
||||
|
||||
}
|
||||
|
||||
void YACReaderLocalClient::requestComicInfo(QString library, ComicDB & comic)
|
||||
bool YACReaderLocalClient::requestComicInfo(quint64 libraryId, ComicDB & comic)
|
||||
{
|
||||
localSocket->connectToServer(YACREADERLIBRARY_GUID);
|
||||
if(localSocket->isOpen())
|
||||
{
|
||||
QByteArray block;
|
||||
QDataStream out(&block, QIODevice::WriteOnly);
|
||||
out.setVersion(QDataStream::Qt_4_0);
|
||||
out << (quint16)0;
|
||||
out << libraryId;
|
||||
out << comic;
|
||||
out.device()->seek(0);
|
||||
out << (quint16)(block.size() - sizeof(quint16));
|
||||
|
||||
int written = 0;
|
||||
while(written != block.size())
|
||||
{
|
||||
written += localSocket->write(block);
|
||||
localSocket->flush();
|
||||
}
|
||||
localSocket->waitForReadyRead();
|
||||
QByteArray data;
|
||||
QDataStream in(data);
|
||||
in.setVersion(QDataStream::Qt_4_0);
|
||||
int totalSize = 0;
|
||||
while((data.size()-sizeof(quint16)) != totalSize )
|
||||
{
|
||||
data.append(localSocket->read(1000000000));
|
||||
if(data.size()>=sizeof(quint16) && totalSize == 0)
|
||||
in >> totalSize;
|
||||
}
|
||||
in >> comic;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void YACReaderLocalClient::sendComicInfo(QString library, ComicDB & comic)
|
||||
bool YACReaderLocalClient::sendComicInfo(quint64 libraryId, ComicDB & comic)
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user