| 51 | } |
| 52 | |
| 53 | void ConsoleUILibraryCreator::updateLibrary(const QString &path) |
| 54 | { |
| 55 | QDir pathDir(path); |
| 56 | if (!pathDir.exists()) { |
| 57 | std::cout << "Directory not found." << std::endl; |
| 58 | return; |
| 59 | } |
| 60 | |
| 61 | QEventLoop eventLoop; |
| 62 | LibraryCreator *libraryCreator = new LibraryCreator(settings); |
| 63 | QString cleanPath = QDir::cleanPath(pathDir.absolutePath()); |
| 64 | |
| 65 | libraryCreator->updateLibrary(cleanPath, LibraryPaths::libraryDataPath(cleanPath)); |
| 66 | |
| 67 | connect(libraryCreator, &LibraryCreator::finished, this, &ConsoleUILibraryCreator::done); |
| 68 | connect(libraryCreator, &LibraryCreator::comicAdded, this, &ConsoleUILibraryCreator::newComic); |
| 69 | connect(libraryCreator, &LibraryCreator::failedOpeningDB, this, &ConsoleUILibraryCreator::manageUpdatingError); |
| 70 | |
| 71 | connect(libraryCreator, &LibraryCreator::finished, &eventLoop, &QEventLoop::quit); |
| 72 | |
| 73 | std::cout << "Processing comics"; |
| 74 | |
| 75 | libraryCreator->start(); |
| 76 | eventLoop.exec(); |
| 77 | } |
| 78 | |
| 79 | void ConsoleUILibraryCreator::addExistingLibrary(const QString &name, const QString &path) |
| 80 | { |
no test coverage detected