mirror of
https://github.com/YACReader/yacreader
synced 2025-05-27 10:50:27 -04:00
Update the UI when a comic is updated using the http api
This commit is contained in:
parent
61458b966c
commit
e7b6f46cd3
@ -2818,6 +2818,29 @@ void LibraryWindow::importLibraryPackage()
|
||||
importLibraryDialog->open(libraries);
|
||||
}
|
||||
|
||||
void LibraryWindow::updateViewsOnComicUpdateWithId(quint64 libraryId, quint64 comicId)
|
||||
{
|
||||
if (libraryId == (quint64)libraries.getId(selectedLibrary->currentText())) {
|
||||
auto path = libraries.getPath(libraryId);
|
||||
if (path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
QString connectionName = "";
|
||||
{
|
||||
QSqlDatabase db = DataBaseManagement::loadDatabase(path + "/.yacreaderlibrary");
|
||||
bool found;
|
||||
auto comic = DBHelper::loadComic(comicId, db, found);
|
||||
if (found) {
|
||||
updateViewsOnComicUpdate(libraryId, comic);
|
||||
}
|
||||
|
||||
qDebug() << db.lastError();
|
||||
connectionName = db.connectionName();
|
||||
}
|
||||
QSqlDatabase::removeDatabase(connectionName);
|
||||
}
|
||||
}
|
||||
|
||||
void LibraryWindow::updateViewsOnComicUpdate(quint64 libraryId, const ComicDB &comic)
|
||||
{
|
||||
if (libraryId == (quint64)libraries.getId(selectedLibrary->currentText())) {
|
||||
|
@ -385,6 +385,7 @@ public slots:
|
||||
void showContinueReadingContextMenu(QPoint point, ComicDB comic);
|
||||
void libraryAlreadyExists(const QString &name);
|
||||
void importLibraryPackage();
|
||||
void updateViewsOnComicUpdateWithId(quint64 libraryId, quint64 comicId);
|
||||
void updateViewsOnComicUpdate(quint64 libraryId, const ComicDB &comic);
|
||||
void showComicVineScraper();
|
||||
void setRemoveError();
|
||||
|
@ -256,7 +256,7 @@ int main(int argc, char **argv)
|
||||
auto mw = new LibraryWindow();
|
||||
|
||||
mw->connect(localServer, &YACReaderLocalServer::comicUpdated, mw, &LibraryWindow::updateViewsOnComicUpdate, Qt::QueuedConnection);
|
||||
|
||||
mw->connect(httpServer, &YACReaderHttpServer::comicUpdated, mw, &LibraryWindow::updateViewsOnComicUpdateWithId, Qt::QueuedConnection);
|
||||
// connections to localServer
|
||||
|
||||
// start as tray
|
||||
|
Loading…
Reference in New Issue
Block a user