bookmarks and image optiones are now stored in the library for each comic

This commit is contained in:
Luis Ángel San Martín
2013-08-18 22:06:59 +02:00
parent 2dd51a0df7
commit db9aad8521
18 changed files with 599 additions and 353 deletions

View File

@ -170,14 +170,14 @@ void DBHelper::removeFromDB(Folder * folder, QSqlDatabase & db)
{
QSqlQuery query(db);
query.prepare("DELETE FROM folder WHERE id = :id");
query.bindValue(":id", folder->id);
query.bindValue(":id", folder->id);
query.exec();
}
void DBHelper::removeFromDB(ComicDB * comic, QSqlDatabase & db)
{
QSqlQuery query(db);
query.prepare("DELETE FROM comic WHERE id = :id");
query.bindValue(":id", comic->id);
query.bindValue(":id", comic->id);
query.exec();
}
@ -314,9 +314,9 @@ qulonglong DBHelper::insert(Folder * folder, QSqlDatabase & db)
{
QSqlQuery query(db);
query.prepare("INSERT INTO folder (parentId, name, path) "
"VALUES (:parentId, :name, :path)");
query.bindValue(":parentId", folder->parentId);
query.bindValue(":name", folder->name);
"VALUES (:parentId, :name, :path)");
query.bindValue(":parentId", folder->parentId);
query.bindValue(":name", folder->name);
query.bindValue(":path", folder->path);
query.exec();
return query.lastInsertId().toULongLong();
@ -340,10 +340,10 @@ qulonglong DBHelper::insert(ComicDB * comic, QSqlDatabase & db)
QSqlQuery query(db);
query.prepare("INSERT INTO comic (parentId, comicInfoId, fileName, path) "
"VALUES (:parentId,:comicInfoId,:name, :path)");
query.bindValue(":parentId", comic->parentId);
"VALUES (:parentId,:comicInfoId,:name, :path)");
query.bindValue(":parentId", comic->parentId);
query.bindValue(":comicInfoId", comic->info.id);
query.bindValue(":name", comic->name);
query.bindValue(":name", comic->name);
query.bindValue(":path", comic->path);
query.exec();
return query.lastInsertId().toULongLong();

View File

@ -1012,17 +1012,15 @@ void LibraryWindow::openComic()
quint64 comicId = comic.id;
//TODO generate IDS for libraries...
quint64 libraryId = selectedLibrary->currentIndex();
int page = *(comic.info.numPages) / 2;
// %1 %2 %3 NO-->%4 %5 %6 %7 %8 %9 %10
//Invoke YACReader comicPath comicId libraryId NO-->currentPage bookmark1 bookmark2 bookmark3 brightness contrast gamma
#ifdef Q_OS_MAC
QProcess::startDetached("open", QStringList() << "-n" << QDir::cleanPath(QCoreApplication::applicationDirPath()+"/../../../YACReader.app") << "--args" << path << comicId << libraryId << page);//,QStringList() << path);
#else
QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath())+QString("/YACReader \"%1\" \"%2\" \"%3\" \"%4\"").arg(path).arg(comicId).arg(libraryId).arg(page),QStringList());
QProcess::startDetached("open", QStringList() << "-n" << QDir::cleanPath(QCoreApplication::applicationDirPath()+"/../../../YACReader.app") << "--args" << path << comicId << libraryId /*<< page << bookmark1 << bookmark2 << bookmark3 << brightness << contrast << gamma*/);//,QStringList() << path);
#else
/* \"%4\" \"%5\" \"%6\" \"%7\" \"%8\" \"%9\" \"%10\" */
QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath())+QString("/YACReader \"%1\" \"%2\" \"%3\"").arg(path).arg(comicId).arg(libraryId)/*.arg(page).arg(bookmark1).arg(bookmark2).arg(bookmark3).arg(brightness).arg(contrast).arg(gamma)*/,QStringList());
#endif
//Comic is readed
//setCurrentComicReaded();
setCurrentComicOpened();
}
}

View File

@ -9,26 +9,26 @@
#include "comic_db.h"
YACReaderLocalServer::YACReaderLocalServer(QObject *parent) :
QObject(parent)
QObject(parent)
{
localServer = new QLocalServer(this);
if (!localServer->listen(YACREADERLIBRARY_GUID)) {
//error...........
}
localServer = new QLocalServer(this);
if (!localServer->listen(YACREADERLIBRARY_GUID)) {
//error...........
}
connect(localServer, SIGNAL(newConnection()), this, SLOT(sendResponse()));
connect(localServer, SIGNAL(newConnection()), this, SLOT(sendResponse()));
}
bool YACReaderLocalServer::isListening()
{
return localServer->isListening();
return localServer->isListening();
}
void YACReaderLocalServer::sendResponse()
{
QLocalSocket *clientConnection = localServer->nextPendingConnection();
connect(clientConnection, SIGNAL(disconnected()),
clientConnection, SLOT(deleteLater()));
connect(clientConnection, SIGNAL(disconnected()),
clientConnection, SLOT(deleteLater()));
quint64 libraryId;
ComicDB comic;