diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index febfbc1b..e41c55fe 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -1776,53 +1776,48 @@ void LibraryWindow::openComic() if(!importedCovers) { ComicDB comic = comicsModel->getComic(comicsViewsManager->comicsView->currentIndex()); - QString path = currentPath(); QList siblings = comicsModel->getAllComics(); - quint64 comicId = comic.id; //TODO generate IDS for libraries... quint64 libraryId = libraries.getId(selectedLibrary->currentText()); - - // %1 %2 %3 NO-->%4 %5 %6 %7 %8 %9 %10 - //Invoke YACReader comicPath comicId libraryId NO-->currentPage bookmark1 bookmark2 bookmark3 brightness contrast gamma bool yacreaderFound = false; #ifdef Q_OS_MAC - QStringList possiblePaths; + QStringList possiblePaths{ + QDir::cleanPath(QCoreApplication::applicationDirPath()+"/../../../"), + QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation) + }; - possiblePaths.append(QDir::cleanPath(QCoreApplication::applicationDirPath()+"/../../../")); - possiblePaths.append(QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation)); - for(auto && ypath: possiblePaths) + for (auto && ypath: possiblePaths) { QString yacreaderPath = QDir::cleanPath(ypath + "/YACReader.app"); - if(QFileInfo(yacreaderPath).exists()) + if (QFileInfo(yacreaderPath).exists()) { yacreaderFound = true; - QStringList parameters = QStringList() << "-n" << yacreaderPath << path << (QString("--comicId=") + QString::number(comicId)) << (QString("--libraryId=") + QString::number(libraryId)); - QProcess::startDetached("open", parameters); + QStringList parameters{"-n", yacreaderPath, currentPath(), QString("--comicId=%1").arg(comic.id), QString("--libraryId=%1").arg(libraryId)}; + QProcess::startDetached(QStringLiteral("open"), parameters); break; } } #endif #ifdef Q_OS_WIN - QStringList parameters = QStringList() << path << (QString("--comicId=") + QString::number(comicId)) << (QString("--libraryId=") + QString::number(libraryId)); + QStringList parameters {currentPath(), QString("--comicId=%1").arg(comic.id), QString("--libraryId=%1").arg(libraryId)}; yacreaderFound = QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath()), parameters); #endif #if defined Q_OS_UNIX && !defined Q_OS_MAC - QStringList parameters = QStringList() << path << (QString("--comicId=") + QString::number(comicId)) << (QString("--libraryId=") + QString::number(libraryId)); - yacreaderFound = QProcess::startDetached(QString("YACReader"), parameters); + QStringList parameters {currentPath(), QString("--comicId=%1").arg(comic.id), QString("--libraryId=%1").arg(libraryId)}; + yacreaderFound = QProcess::startDetached(QStringLiteral("YACReader"), parameters); #endif if(!yacreaderFound) { #ifdef Q_OS_WIN - QMessageBox::critical(this,tr("YACReader not found"),tr("YACReader not found, YACReader should be installed in the same folder as YACReaderLibrary.")); + QMessageBox::critical(this,tr("YACReader not found"),tr("YACReader not found. YACReader should be installed in the same folder as YACReaderLibrary.")); #else QMessageBox::critical(this,tr("YACReader not found"),tr("YACReader not found. There might be a problem with your YACReader installation.")); #endif } - setCurrentComicOpened(); } } @@ -1834,11 +1829,6 @@ void LibraryWindow::setCurrentComicReaded() { this->setCurrentComicsStatusReaded(YACReader::Read); } -void LibraryWindow::setCurrentComicOpened() -{ - //TODO: remove? -} - void LibraryWindow::setCurrentComicUnreaded() { this->setCurrentComicsStatusReaded(YACReader::Unread); } diff --git a/YACReaderLibrary/library_window.h b/YACReaderLibrary/library_window.h index 95fd512a..02de9e8e 100644 --- a/YACReaderLibrary/library_window.h +++ b/YACReaderLibrary/library_window.h @@ -344,7 +344,6 @@ public slots: void libraryAlreadyExists(const QString & name); void importLibraryPackage(); void updateComicsView(quint64 libraryId, const ComicDB & comic); - void setCurrentComicOpened(); void showComicVineScraper(); void setRemoveError(); void checkRemoveError();