mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
added update-library functionality to yacrlserver
This commit is contained in:
parent
aba3d0f1f6
commit
7153f65406
@ -33,11 +33,24 @@ void ConsoleUILibraryCreator::createLibrary(const QString & name, const QString
|
||||
|
||||
void ConsoleUILibraryCreator::updateLibrary(const QString & path)
|
||||
{
|
||||
//TODO
|
||||
//connect(libraryCreator,SIGNAL(failedUpdatingDB(QString)),this,SLOT(manageUpdatingError(QString)));
|
||||
QEventLoop eventLoop;
|
||||
LibraryCreator * libraryCreator = new LibraryCreator();
|
||||
|
||||
libraryCreator->updateLibrary(QDir::cleanPath(path),QDir::cleanPath(path)+"/.yacreaderlibrary");
|
||||
|
||||
connect(libraryCreator, &LibraryCreator::finished, this, &ConsoleUILibraryCreator::done);
|
||||
connect(libraryCreator, &LibraryCreator::comicAdded, this, &ConsoleUILibraryCreator::newComic);
|
||||
connect(libraryCreator, &LibraryCreator::failedOpeningDB, this, &ConsoleUILibraryCreator::manageUpdatingError);
|
||||
|
||||
connect(libraryCreator, &LibraryCreator::finished, &eventLoop, &QEventLoop::quit);
|
||||
|
||||
std::cout << "Processing comics";
|
||||
|
||||
libraryCreator->start();
|
||||
eventLoop.exec();
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::newComic(const QString & relativeComicPath, const QString & coverPath)
|
||||
void ConsoleUILibraryCreator::newComic(const QString & /*relativeComicPath*/, const QString & /*coverPath*/)
|
||||
{
|
||||
numComicsProcessed++;
|
||||
std::cout << ".";
|
||||
@ -48,8 +61,15 @@ void ConsoleUILibraryCreator::manageCreatingError(const QString & error)
|
||||
std::cout << std::endl << "Error creating library! " << error.toUtf8().constData();
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::manageUpdatingError(const QString & error)
|
||||
{
|
||||
std::cout << std::endl << "Error updating library! " << error.toUtf8().constData();
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::done()
|
||||
{
|
||||
std::cout << "Done!" << std::endl;
|
||||
std::cout << "Number of comis processed = " << numComicsProcessed << std::endl;
|
||||
std::cout << "Done!" << std::endl;
|
||||
|
||||
if(numComicsProcessed > 0)
|
||||
std::cout << "Number of comis processed = " << numComicsProcessed << std::endl;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ public slots:
|
||||
protected slots:
|
||||
void newComic(const QString & relativeComicPath, const QString & coverPath);
|
||||
void manageCreatingError(const QString & error);
|
||||
void manageUpdatingError(const QString & error);
|
||||
void done();
|
||||
};
|
||||
|
||||
|
@ -175,7 +175,15 @@ int main( int argc, char ** argv )
|
||||
if(args.length() != 2)
|
||||
{
|
||||
parser.showHelp();
|
||||
return 0;
|
||||
}
|
||||
|
||||
const QStringList updateArgs = parser.positionalArguments();
|
||||
|
||||
ConsoleUILibraryCreator * libraryCreatorUI = new ConsoleUILibraryCreator;
|
||||
libraryCreatorUI->updateLibrary(updateArgs.at(1));
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if(command == "list-libraries")
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user