From 23d5abd32967d0dbe814b1e31ac24793bca046ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Sat, 23 Nov 2013 15:04:48 -0800 Subject: [PATCH] added QLocalServer::removeServer to YACReaderLocalServer for fixing server start up after a dirty exit --- YACReaderLibrary/library_window.cpp | 6 ++++-- YACReaderLibrary/yacreader_local_server.cpp | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index 9e9f691b..ce71b0ff 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -1026,7 +1026,7 @@ void LibraryWindow::openComic() if(!importedCovers) { ComicDB comic = dmCV->getComic(comicView->currentIndex()); - QString path = currentPath(); + QString path = currentPath(); QList siblings = dmCV->getAllComics(); quint64 comicId = comic.id; @@ -1036,7 +1036,9 @@ void LibraryWindow::openComic() // %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 << 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 /* \"%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()); diff --git a/YACReaderLibrary/yacreader_local_server.cpp b/YACReaderLibrary/yacreader_local_server.cpp index cff21ee2..92b7e1d9 100644 --- a/YACReaderLibrary/yacreader_local_server.cpp +++ b/YACReaderLibrary/yacreader_local_server.cpp @@ -9,6 +9,8 @@ #include "comic_db.h" +#include "QsLog.h" + using namespace YACReader; QMutex YACReaderClientConnectionWorker::dbMutex; @@ -17,8 +19,9 @@ YACReaderLocalServer::YACReaderLocalServer(QObject *parent) : QObject(parent) { localServer = new QLocalServer(this); + QLocalServer::removeServer(YACREADERLIBRARY_GUID); if (!localServer->listen(YACREADERLIBRARY_GUID)) { - //error........... + QLOG_ERROR() << "Unable to create local server"; } connect(localServer, SIGNAL(newConnection()), this, SLOT(sendResponse()));