mirror of
https://github.com/YACReader/yacreader
synced 2025-06-03 17:18:23 -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)
|
void ConsoleUILibraryCreator::updateLibrary(const QString & path)
|
||||||
{
|
{
|
||||||
//TODO
|
QEventLoop eventLoop;
|
||||||
//connect(libraryCreator,SIGNAL(failedUpdatingDB(QString)),this,SLOT(manageUpdatingError(QString)));
|
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++;
|
numComicsProcessed++;
|
||||||
std::cout << ".";
|
std::cout << ".";
|
||||||
@ -48,8 +61,15 @@ void ConsoleUILibraryCreator::manageCreatingError(const QString & error)
|
|||||||
std::cout << std::endl << "Error creating library! " << error.toUtf8().constData();
|
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()
|
void ConsoleUILibraryCreator::done()
|
||||||
{
|
{
|
||||||
std::cout << "Done!" << std::endl;
|
std::cout << "Done!" << std::endl;
|
||||||
std::cout << "Number of comis processed = " << numComicsProcessed << std::endl;
|
|
||||||
|
if(numComicsProcessed > 0)
|
||||||
|
std::cout << "Number of comis processed = " << numComicsProcessed << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ public slots:
|
|||||||
protected slots:
|
protected slots:
|
||||||
void newComic(const QString & relativeComicPath, const QString & coverPath);
|
void newComic(const QString & relativeComicPath, const QString & coverPath);
|
||||||
void manageCreatingError(const QString & error);
|
void manageCreatingError(const QString & error);
|
||||||
|
void manageUpdatingError(const QString & error);
|
||||||
void done();
|
void done();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -175,7 +175,15 @@ int main( int argc, char ** argv )
|
|||||||
if(args.length() != 2)
|
if(args.length() != 2)
|
||||||
{
|
{
|
||||||
parser.showHelp();
|
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")
|
else if(command == "list-libraries")
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user