mirror of
https://github.com/YACReader/yacreader
synced 2025-06-03 00:58:32 -04:00
added sedComicInfo
This commit is contained in:
parent
8d6b1c5690
commit
97db3f582a
@ -357,22 +357,15 @@ QList<QVector<quint32> > FileComic::getSections(int & sectionIndex)
|
||||
|
||||
void FileComic::process()
|
||||
{
|
||||
QFile f("c:/temp/out.txt");
|
||||
f.open(QIODevice::WriteOnly);
|
||||
QTextStream out(&f);
|
||||
|
||||
QTime myTimer;
|
||||
myTimer.start();
|
||||
// do something..
|
||||
|
||||
CompressedArchive archive(_path);
|
||||
out << "tiempo en abrir : " << myTimer.elapsed() << endl;
|
||||
//se filtran para obtener sólo los formatos soportados
|
||||
_order = archive.getFileNames();
|
||||
_fileNames = filter(_order);
|
||||
|
||||
out << "tiempo en filtrar : " << myTimer.elapsed() << endl;
|
||||
|
||||
if(_fileNames.size()==0)
|
||||
{
|
||||
//QMessageBox::critical(NULL,tr("File error"),tr("File not found or not images in file"));
|
||||
@ -395,8 +388,6 @@ void FileComic::process()
|
||||
int index = 0;
|
||||
int sortedIndex = 0;
|
||||
|
||||
out << "tiempo en ordenar : " << myTimer.elapsed() << endl;
|
||||
|
||||
if(_firstPage == -1)
|
||||
_firstPage = bm->getLastPage();
|
||||
_index = _firstPage;
|
||||
@ -410,7 +401,6 @@ void FileComic::process()
|
||||
for(int i = 0; i<sectionIndex; i++)
|
||||
archive.getAllData(sections.at(i),this);
|
||||
//archive.getAllData(QVector<quint32>(),this);
|
||||
out << "tiempo en obtener datos : " << myTimer.elapsed() << endl;
|
||||
/*
|
||||
foreach(QString name,_fileNames)
|
||||
{
|
||||
@ -421,8 +411,6 @@ void FileComic::process()
|
||||
emit imageLoaded(sortedIndex,_pages[sortedIndex]);
|
||||
}*/
|
||||
|
||||
out << "--tiempo en copiar datos : " << myTimer.elapsed() << endl;
|
||||
f.close();
|
||||
emit imagesLoaded();
|
||||
moveToThread(QApplication::instance()->thread());
|
||||
}
|
||||
|
@ -20,17 +20,12 @@ void YACReaderLocalClient::readMessage()
|
||||
{
|
||||
|
||||
}
|
||||
#include <QFile>
|
||||
|
||||
bool YACReaderLocalClient::requestComicInfo(quint64 libraryId, ComicDB & comic, QList<ComicDB> & siblings)
|
||||
{
|
||||
localSocket->connectToServer(YACREADERLIBRARY_GUID);
|
||||
if(localSocket->isOpen())
|
||||
{
|
||||
QFile f("c:/temp/socket.txt");
|
||||
f.open(QIODevice::WriteOnly);
|
||||
QTextStream outt(&f);
|
||||
outt << QString(" antes : %1").arg(comic.id) << endl;
|
||||
|
||||
QByteArray block;
|
||||
QDataStream out(&block, QIODevice::WriteOnly);
|
||||
out.setVersion(QDataStream::Qt_4_8);
|
||||
@ -63,7 +58,6 @@ bool YACReaderLocalClient::requestComicInfo(quint64 libraryId, ComicDB & comic,
|
||||
QDataStream dataStream(localSocket->read(totalSize));
|
||||
dataStream >> comic;
|
||||
dataStream >> siblings;
|
||||
outt << QString(" despues : %1").arg(comic.id) << endl;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -72,5 +66,27 @@ bool YACReaderLocalClient::requestComicInfo(quint64 libraryId, ComicDB & comic,
|
||||
|
||||
bool YACReaderLocalClient::sendComicInfo(quint64 libraryId, ComicDB & comic)
|
||||
{
|
||||
return true;
|
||||
localSocket->connectToServer(YACREADERLIBRARY_GUID);
|
||||
if(localSocket->isOpen())
|
||||
{
|
||||
QByteArray block;
|
||||
QDataStream out(&block, QIODevice::WriteOnly);
|
||||
out.setVersion(QDataStream::Qt_4_8);
|
||||
out << (quint16)0;
|
||||
out << (quint8)YACReaderIPCMessages::RequestComicInfo;
|
||||
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);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ bool YACReaderLocalServer::isListening()
|
||||
{
|
||||
return localServer->isListening();
|
||||
}
|
||||
#include <QFile>
|
||||
|
||||
void YACReaderLocalServer::sendResponse()
|
||||
{
|
||||
QLocalSocket *clientConnection = localServer->nextPendingConnection();
|
||||
@ -50,17 +50,10 @@ void YACReaderLocalServer::sendResponse()
|
||||
dataStream >> msgType;
|
||||
dataStream >> libraryId;
|
||||
dataStream >> comic;
|
||||
QFile f("c:/temp/socket_server.txt");
|
||||
f.open(QIODevice::WriteOnly);
|
||||
QTextStream outt(&f);
|
||||
outt << QString(" antes : %1 - size : %2").arg(comic.id).arg(totalSize) << endl;
|
||||
|
||||
QList<ComicDB> siblings;
|
||||
getComicInfo(libraryId,comic,siblings);
|
||||
|
||||
|
||||
outt << QString(" despues : %1 - num sib : %2").arg(comic.id).arg(siblings.count()) << endl;
|
||||
|
||||
QByteArray block;
|
||||
QDataStream out(&block, QIODevice::WriteOnly);
|
||||
out.setVersion(QDataStream::Qt_4_8);
|
||||
|
Loading…
x
Reference in New Issue
Block a user