added QLocalServer::removeServer to YACReaderLocalServer for fixing server start up after a dirty exit

This commit is contained in:
Luis Ángel San Martín 2013-11-23 15:04:48 -08:00
parent 3277a12665
commit 23d5abd329
2 changed files with 8 additions and 3 deletions

View File

@ -1026,7 +1026,7 @@ void LibraryWindow::openComic()
if(!importedCovers) if(!importedCovers)
{ {
ComicDB comic = dmCV->getComic(comicView->currentIndex()); ComicDB comic = dmCV->getComic(comicView->currentIndex());
QString path = currentPath(); QString path = currentPath();
QList<ComicDB> siblings = dmCV->getAllComics(); QList<ComicDB> siblings = dmCV->getAllComics();
quint64 comicId = comic.id; quint64 comicId = comic.id;
@ -1036,7 +1036,9 @@ void LibraryWindow::openComic()
// %1 %2 %3 NO-->%4 %5 %6 %7 %8 %9 %10 // %1 %2 %3 NO-->%4 %5 %6 %7 %8 %9 %10
//Invoke YACReader comicPath comicId libraryId NO-->currentPage bookmark1 bookmark2 bookmark3 brightness contrast gamma //Invoke YACReader comicPath comicId libraryId NO-->currentPage bookmark1 bookmark2 bookmark3 brightness contrast gamma
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
QProcess::startDetached("open", QStringList());// << "-n" << QDir::cleanPath(QCoreApplication::applicationDirPath()+"/../../../YACReader.app") << "--args" << path << QString("%1").arg(comicId) << QString("%1").arg(libraryId)); /*<< page << bookmark1 << bookmark2 << bookmark3 << brightness << contrast << gamma*/);//,QStringList() << path); QString comicIdS = QString("%1").arg(comicId);
QString libraryIdS = QString("%1").arg(libraryId);
QProcess::startDetached("open", QStringList() << "-n" << QDir::cleanPath(QCoreApplication::applicationDirPath()+"/../../../YACReader.app") << "--args" << path << comicIdS << libraryIdS ); /*<< page << bookmark1 << bookmark2 << bookmark3 << brightness << contrast << gamma*///,QStringList() << path);
#else #else
/* \"%4\" \"%5\" \"%6\" \"%7\" \"%8\" \"%9\" \"%10\" */ /* \"%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()); 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());

View File

@ -9,6 +9,8 @@
#include "comic_db.h" #include "comic_db.h"
#include "QsLog.h"
using namespace YACReader; using namespace YACReader;
QMutex YACReaderClientConnectionWorker::dbMutex; QMutex YACReaderClientConnectionWorker::dbMutex;
@ -17,8 +19,9 @@ YACReaderLocalServer::YACReaderLocalServer(QObject *parent) :
QObject(parent) QObject(parent)
{ {
localServer = new QLocalServer(this); localServer = new QLocalServer(this);
QLocalServer::removeServer(YACREADERLIBRARY_GUID);
if (!localServer->listen(YACREADERLIBRARY_GUID)) { if (!localServer->listen(YACREADERLIBRARY_GUID)) {
//error........... QLOG_ERROR() << "Unable to create local server";
} }
connect(localServer, SIGNAL(newConnection()), this, SLOT(sendResponse())); connect(localServer, SIGNAL(newConnection()), this, SLOT(sendResponse()));