Extract library paths methods to it's own struct in yacreader_global.h and use it everywhere

This commit is contained in:
Luis Ángel San Martín
2025-03-29 11:31:53 +01:00
parent 5aa637fdbe
commit d4b7c6dd8a
15 changed files with 133 additions and 90 deletions

View File

@ -33,7 +33,7 @@ void ConsoleUILibraryCreator::createLibrary(const QString &name, const QString &
return;
}
libraryCreator->createLibrary(cleanPath, YACReaderLibrary::libraryDataPath(cleanPath));
libraryCreator->createLibrary(cleanPath, LibraryPaths::libraryDataPath(cleanPath));
connect(libraryCreator, &LibraryCreator::finished, this, &ConsoleUILibraryCreator::done);
connect(libraryCreator, &LibraryCreator::comicAdded, this, &ConsoleUILibraryCreator::newComic);
@ -62,7 +62,7 @@ void ConsoleUILibraryCreator::updateLibrary(const QString &path)
LibraryCreator *libraryCreator = new LibraryCreator(settings);
QString cleanPath = QDir::cleanPath(pathDir.absolutePath());
libraryCreator->updateLibrary(cleanPath, YACReaderLibrary::libraryDataPath(cleanPath));
libraryCreator->updateLibrary(cleanPath, LibraryPaths::libraryDataPath(cleanPath));
connect(libraryCreator, &LibraryCreator::finished, this, &ConsoleUILibraryCreator::done);
connect(libraryCreator, &LibraryCreator::comicAdded, this, &ConsoleUILibraryCreator::newComic);
@ -85,7 +85,7 @@ void ConsoleUILibraryCreator::addExistingLibrary(const QString &name, const QStr
}
QString cleanPath = QDir::cleanPath(pathDir.absolutePath());
if (!QDir(YACReaderLibrary::libraryDataPath(cleanPath)).exists()) {
if (!QDir(LibraryPaths::libraryDataPath(cleanPath)).exists()) {
std::cout << "No data folder found in path: " << cleanPath.toStdString() << std::endl;
return;
}
@ -135,7 +135,7 @@ void ConsoleUILibraryCreator::rescanXMLInfoLibrary(const QString &path)
connect(scanner, &XMLInfoLibraryScanner::finished, &eventLoop, &QEventLoop::quit);
std::cout << "Scanning comics";
scanner->scanLibrary(cleanPath, YACReaderLibrary::libraryDataPath(cleanPath));
scanner->scanLibrary(cleanPath, LibraryPaths::libraryDataPath(cleanPath));
eventLoop.exec();
}