mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Sanitize YACReader launch code
This commit is contained in:
parent
6313df5407
commit
827a76413b
@ -1776,53 +1776,48 @@ void LibraryWindow::openComic()
|
|||||||
if(!importedCovers)
|
if(!importedCovers)
|
||||||
{
|
{
|
||||||
ComicDB comic = comicsModel->getComic(comicsViewsManager->comicsView->currentIndex());
|
ComicDB comic = comicsModel->getComic(comicsViewsManager->comicsView->currentIndex());
|
||||||
QString path = currentPath();
|
|
||||||
QList<ComicDB> siblings = comicsModel->getAllComics();
|
QList<ComicDB> siblings = comicsModel->getAllComics();
|
||||||
|
|
||||||
quint64 comicId = comic.id;
|
|
||||||
//TODO generate IDS for libraries...
|
//TODO generate IDS for libraries...
|
||||||
quint64 libraryId = libraries.getId(selectedLibrary->currentText());
|
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;
|
bool yacreaderFound = false;
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
QStringList possiblePaths;
|
QStringList possiblePaths{
|
||||||
|
QDir::cleanPath(QCoreApplication::applicationDirPath()+"/../../../"),
|
||||||
|
QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation)
|
||||||
|
};
|
||||||
|
|
||||||
possiblePaths.append(QDir::cleanPath(QCoreApplication::applicationDirPath()+"/../../../"));
|
for (auto && ypath: possiblePaths)
|
||||||
possiblePaths.append(QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation));
|
|
||||||
for(auto && ypath: possiblePaths)
|
|
||||||
{
|
{
|
||||||
QString yacreaderPath = QDir::cleanPath(ypath + "/YACReader.app");
|
QString yacreaderPath = QDir::cleanPath(ypath + "/YACReader.app");
|
||||||
if(QFileInfo(yacreaderPath).exists())
|
if (QFileInfo(yacreaderPath).exists())
|
||||||
{
|
{
|
||||||
yacreaderFound = true;
|
yacreaderFound = true;
|
||||||
QStringList parameters = QStringList() << "-n" << yacreaderPath << path << (QString("--comicId=") + QString::number(comicId)) << (QString("--libraryId=") + QString::number(libraryId));
|
QStringList parameters{"-n", yacreaderPath, currentPath(), QString("--comicId=%1").arg(comic.id), QString("--libraryId=%1").arg(libraryId)};
|
||||||
QProcess::startDetached("open", parameters);
|
QProcess::startDetached(QStringLiteral("open"), parameters);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#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);
|
yacreaderFound = QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath()), parameters);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined Q_OS_UNIX && !defined Q_OS_MAC
|
#if defined Q_OS_UNIX && !defined Q_OS_MAC
|
||||||
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(QString("YACReader"), parameters);
|
yacreaderFound = QProcess::startDetached(QStringLiteral("YACReader"), parameters);
|
||||||
#endif
|
#endif
|
||||||
if(!yacreaderFound)
|
if(!yacreaderFound)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#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
|
#else
|
||||||
QMessageBox::critical(this,tr("YACReader not found"),tr("YACReader not found. There might be a problem with your YACReader installation."));
|
QMessageBox::critical(this,tr("YACReader not found"),tr("YACReader not found. There might be a problem with your YACReader installation."));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
setCurrentComicOpened();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1834,11 +1829,6 @@ void LibraryWindow::setCurrentComicReaded() {
|
|||||||
this->setCurrentComicsStatusReaded(YACReader::Read);
|
this->setCurrentComicsStatusReaded(YACReader::Read);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::setCurrentComicOpened()
|
|
||||||
{
|
|
||||||
//TODO: remove?
|
|
||||||
}
|
|
||||||
|
|
||||||
void LibraryWindow::setCurrentComicUnreaded() {
|
void LibraryWindow::setCurrentComicUnreaded() {
|
||||||
this->setCurrentComicsStatusReaded(YACReader::Unread);
|
this->setCurrentComicsStatusReaded(YACReader::Unread);
|
||||||
}
|
}
|
||||||
|
@ -344,7 +344,6 @@ public slots:
|
|||||||
void libraryAlreadyExists(const QString & name);
|
void libraryAlreadyExists(const QString & name);
|
||||||
void importLibraryPackage();
|
void importLibraryPackage();
|
||||||
void updateComicsView(quint64 libraryId, const ComicDB & comic);
|
void updateComicsView(quint64 libraryId, const ComicDB & comic);
|
||||||
void setCurrentComicOpened();
|
|
||||||
void showComicVineScraper();
|
void showComicVineScraper();
|
||||||
void setRemoveError();
|
void setRemoveError();
|
||||||
void checkRemoveError();
|
void checkRemoveError();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user