mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Add support for scanning xml info from the libraries context menu
This will let people to rescan their existing libraries.
This commit is contained in:
parent
dc68387fbc
commit
b4c90a8920
@ -33,6 +33,7 @@
|
|||||||
#include "comic_db.h"
|
#include "comic_db.h"
|
||||||
#include "library_creator.h"
|
#include "library_creator.h"
|
||||||
#include "package_manager.h"
|
#include "package_manager.h"
|
||||||
|
#include "xml_info_library_scanner.h"
|
||||||
#include "comic_flow_widget.h"
|
#include "comic_flow_widget.h"
|
||||||
#include "create_library_dialog.h"
|
#include "create_library_dialog.h"
|
||||||
#include "rename_library_dialog.h"
|
#include "rename_library_dialog.h"
|
||||||
@ -167,6 +168,7 @@ void LibraryWindow::setupUI()
|
|||||||
|
|
||||||
libraryCreator = new LibraryCreator();
|
libraryCreator = new LibraryCreator();
|
||||||
packageManager = new PackageManager();
|
packageManager = new PackageManager();
|
||||||
|
xmlInfoLibraryScanner = new XMLInfoLibraryScanner();
|
||||||
|
|
||||||
historyController = new YACReaderHistoryController(this);
|
historyController = new YACReaderHistoryController(this);
|
||||||
|
|
||||||
@ -425,7 +427,8 @@ void LibraryWindow::setUpShortcutsManagement()
|
|||||||
<< importLibraryAction
|
<< importLibraryAction
|
||||||
<< updateLibraryAction
|
<< updateLibraryAction
|
||||||
<< renameLibraryAction
|
<< renameLibraryAction
|
||||||
<< removeLibraryAction);
|
<< removeLibraryAction
|
||||||
|
<< rescanLibraryForXMLInfoAction);
|
||||||
|
|
||||||
allActions << tmpList;
|
allActions << tmpList;
|
||||||
|
|
||||||
@ -532,6 +535,11 @@ void LibraryWindow::createActions()
|
|||||||
removeLibraryAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(REMOVE_LIBRARY_ACTION_YL));
|
removeLibraryAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(REMOVE_LIBRARY_ACTION_YL));
|
||||||
removeLibraryAction->setIcon(QIcon(":/images/menus_icons/removeLibraryIcon.png"));
|
removeLibraryAction->setIcon(QIcon(":/images/menus_icons/removeLibraryIcon.png"));
|
||||||
|
|
||||||
|
rescanLibraryForXMLInfoAction = new QAction(tr("Rescan library for XML info"), this);
|
||||||
|
rescanLibraryForXMLInfoAction->setToolTip(tr("Tries to find XML info embedded in comic files. You only need to do this if the library was created with 9.8.2 or earlier versions or if you are using third party software to embed XML info in the files."));
|
||||||
|
rescanLibraryForXMLInfoAction->setData(RESCAN_LIBRARY_XML_INFO_ACTION_YL);
|
||||||
|
rescanLibraryForXMLInfoAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(RESCAN_LIBRARY_XML_INFO_ACTION_YL));
|
||||||
|
|
||||||
openComicAction = new QAction(tr("Open current comic"), this);
|
openComicAction = new QAction(tr("Open current comic"), this);
|
||||||
openComicAction->setToolTip(tr("Open current comic on YACReader"));
|
openComicAction->setToolTip(tr("Open current comic on YACReader"));
|
||||||
openComicAction->setData(OPEN_COMIC_ACTION_YL);
|
openComicAction->setData(OPEN_COMIC_ACTION_YL);
|
||||||
@ -868,6 +876,7 @@ void LibraryWindow::disableLibrariesActions(bool disabled)
|
|||||||
exportComicsInfoAction->setDisabled(disabled);
|
exportComicsInfoAction->setDisabled(disabled);
|
||||||
importComicsInfoAction->setDisabled(disabled);
|
importComicsInfoAction->setDisabled(disabled);
|
||||||
exportLibraryAction->setDisabled(disabled);
|
exportLibraryAction->setDisabled(disabled);
|
||||||
|
rescanLibraryForXMLInfoAction->setDisabled(disabled);
|
||||||
//importLibraryAction->setDisabled(disabled);
|
//importLibraryAction->setDisabled(disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -877,6 +886,7 @@ void LibraryWindow::disableNoUpdatedLibrariesActions(bool disabled)
|
|||||||
exportComicsInfoAction->setDisabled(disabled);
|
exportComicsInfoAction->setDisabled(disabled);
|
||||||
importComicsInfoAction->setDisabled(disabled);
|
importComicsInfoAction->setDisabled(disabled);
|
||||||
exportLibraryAction->setDisabled(disabled);
|
exportLibraryAction->setDisabled(disabled);
|
||||||
|
rescanLibraryForXMLInfoAction->setDisabled(disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::disableFoldersActions(bool disabled)
|
void LibraryWindow::disableFoldersActions(bool disabled)
|
||||||
@ -1001,6 +1011,9 @@ void LibraryWindow::createMenus()
|
|||||||
selectedLibrary->addAction(removeLibraryAction);
|
selectedLibrary->addAction(removeLibraryAction);
|
||||||
YACReader::addSperator(selectedLibrary);
|
YACReader::addSperator(selectedLibrary);
|
||||||
|
|
||||||
|
selectedLibrary->addAction(rescanLibraryForXMLInfoAction);
|
||||||
|
YACReader::addSperator(selectedLibrary);
|
||||||
|
|
||||||
selectedLibrary->addAction(exportComicsInfoAction);
|
selectedLibrary->addAction(exportComicsInfoAction);
|
||||||
selectedLibrary->addAction(importComicsInfoAction);
|
selectedLibrary->addAction(importComicsInfoAction);
|
||||||
YACReader::addSperator(selectedLibrary);
|
YACReader::addSperator(selectedLibrary);
|
||||||
@ -1022,6 +1035,9 @@ void LibraryWindow::createMenus()
|
|||||||
libraryMenu->addAction(removeLibraryAction);
|
libraryMenu->addAction(removeLibraryAction);
|
||||||
libraryMenu->addSeparator();
|
libraryMenu->addSeparator();
|
||||||
|
|
||||||
|
libraryMenu->addAction(rescanLibraryForXMLInfo);
|
||||||
|
libraryMenu->addSeparator();
|
||||||
|
|
||||||
libraryMenu->addAction(exportComicsInfoAction);
|
libraryMenu->addAction(exportComicsInfoAction);
|
||||||
libraryMenu->addAction(importComicsInfoAction);
|
libraryMenu->addAction(importComicsInfoAction);
|
||||||
|
|
||||||
@ -1083,8 +1099,13 @@ void LibraryWindow::createConnections()
|
|||||||
connect(libraryCreator, &LibraryCreator::failedCreatingDB, this, &LibraryWindow::manageCreatingError);
|
connect(libraryCreator, &LibraryCreator::failedCreatingDB, this, &LibraryWindow::manageCreatingError);
|
||||||
connect(libraryCreator, SIGNAL(failedUpdatingDB(QString)), this, SLOT(manageUpdatingError(QString))); //TODO: implement failedUpdatingDB
|
connect(libraryCreator, SIGNAL(failedUpdatingDB(QString)), this, SLOT(manageUpdatingError(QString))); //TODO: implement failedUpdatingDB
|
||||||
|
|
||||||
|
connect(xmlInfoLibraryScanner, &QThread::finished, this, &LibraryWindow::showRootWidget);
|
||||||
|
connect(xmlInfoLibraryScanner, &QThread::finished, this, &LibraryWindow::reloadCurrentFolderComicsContent);
|
||||||
|
connect(xmlInfoLibraryScanner, &XMLInfoLibraryScanner::comicScanned, importWidget, &ImportWidget::newComic);
|
||||||
|
|
||||||
//new import widget
|
//new import widget
|
||||||
connect(importWidget, &ImportWidget::stop, this, &LibraryWindow::stopLibraryCreator);
|
connect(importWidget, &ImportWidget::stop, this, &LibraryWindow::stopLibraryCreator);
|
||||||
|
connect(importWidget, &ImportWidget::stop, this, &LibraryWindow::stopXMLScanning);
|
||||||
|
|
||||||
//packageManager connections
|
//packageManager connections
|
||||||
connect(exportLibraryDialog, &ExportLibraryDialog::exportPath, this, &LibraryWindow::exportLibrary);
|
connect(exportLibraryDialog, &ExportLibraryDialog::exportPath, this, &LibraryWindow::exportLibrary);
|
||||||
@ -1147,6 +1168,7 @@ void LibraryWindow::createConnections()
|
|||||||
connect(renameLibraryAction, &QAction::triggered, this, &LibraryWindow::renameLibrary);
|
connect(renameLibraryAction, &QAction::triggered, this, &LibraryWindow::renameLibrary);
|
||||||
//connect(deleteLibraryAction,SIGNAL(triggered()),this,SLOT(deleteLibrary()));
|
//connect(deleteLibraryAction,SIGNAL(triggered()),this,SLOT(deleteLibrary()));
|
||||||
connect(removeLibraryAction, &QAction::triggered, this, &LibraryWindow::removeLibrary);
|
connect(removeLibraryAction, &QAction::triggered, this, &LibraryWindow::removeLibrary);
|
||||||
|
connect(rescanLibraryForXMLInfoAction, &QAction::triggered, this, &LibraryWindow::rescanLibraryForXMLInfo);
|
||||||
connect(openComicAction, &QAction::triggered, this, QOverload<>::of(&LibraryWindow::openComic));
|
connect(openComicAction, &QAction::triggered, this, QOverload<>::of(&LibraryWindow::openComic));
|
||||||
connect(helpAboutAction, &QAction::triggered, had, &QWidget::show);
|
connect(helpAboutAction, &QAction::triggered, had, &QWidget::show);
|
||||||
connect(addFolderAction, &QAction::triggered, this, &LibraryWindow::addFolderToCurrentIndex);
|
connect(addFolderAction, &QAction::triggered, this, &LibraryWindow::addFolderToCurrentIndex);
|
||||||
@ -1298,12 +1320,13 @@ void LibraryWindow::loadLibrary(const QString &name)
|
|||||||
|
|
||||||
d.setCurrent(libraries.getPath(name));
|
d.setCurrent(libraries.getPath(name));
|
||||||
d.setFilter(QDir::AllDirs | QDir::Files | QDir::Hidden | QDir::NoSymLinks | QDir::NoDotAndDotDot);
|
d.setFilter(QDir::AllDirs | QDir::Files | QDir::Hidden | QDir::NoSymLinks | QDir::NoDotAndDotDot);
|
||||||
if (d.count() <= 1) //librería de sólo lectura
|
if (d.count() <= 1) //read only library
|
||||||
{
|
{
|
||||||
//QMessageBox::critical(NULL,QString::number(d.count()),QString::number(d.count()));
|
|
||||||
disableLibrariesActions(false);
|
disableLibrariesActions(false);
|
||||||
updateLibraryAction->setDisabled(true);
|
updateLibraryAction->setDisabled(true);
|
||||||
openContainingFolderAction->setDisabled(true);
|
openContainingFolderAction->setDisabled(true);
|
||||||
|
rescanLibraryForXMLInfoAction->setDisabled(true);
|
||||||
|
|
||||||
disableComicsActions(true);
|
disableComicsActions(true);
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
toggleFullScreenAction->setEnabled(true);
|
toggleFullScreenAction->setEnabled(true);
|
||||||
@ -1514,6 +1537,13 @@ QProgressDialog *LibraryWindow::newProgressDialog(const QString &label, int maxV
|
|||||||
return progressDialog;
|
return progressDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::reloadCurrentFolderComicsContent()
|
||||||
|
{
|
||||||
|
navigationController->loadFolderInfo(getCurrentFolderIndex());
|
||||||
|
|
||||||
|
enableNeededActions();
|
||||||
|
}
|
||||||
|
|
||||||
void LibraryWindow::reloadAfterCopyMove(const QModelIndex &mi)
|
void LibraryWindow::reloadAfterCopyMove(const QModelIndex &mi)
|
||||||
{
|
{
|
||||||
if (getCurrentFolderIndex() == mi) {
|
if (getCurrentFolderIndex() == mi) {
|
||||||
@ -2076,6 +2106,18 @@ void LibraryWindow::rename(QString newName) //TODO replace
|
|||||||
//selectedLibrary->setCurrentIndex(selectedLibrary->findText(newName));
|
//selectedLibrary->setCurrentIndex(selectedLibrary->findText(newName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::rescanLibraryForXMLInfo()
|
||||||
|
{
|
||||||
|
importWidget->setXMLScanLook();
|
||||||
|
showImportingWidget();
|
||||||
|
|
||||||
|
QString currentLibrary = selectedLibrary->currentText();
|
||||||
|
QString path = libraries.getPath(currentLibrary);
|
||||||
|
_lastAdded = currentLibrary;
|
||||||
|
|
||||||
|
xmlInfoLibraryScanner->scanLibrary(path, path + "/.yacreaderlibrary");
|
||||||
|
}
|
||||||
|
|
||||||
void LibraryWindow::cancelCreating()
|
void LibraryWindow::cancelCreating()
|
||||||
{
|
{
|
||||||
stopLibraryCreator();
|
stopLibraryCreator();
|
||||||
@ -2087,6 +2129,12 @@ void LibraryWindow::stopLibraryCreator()
|
|||||||
libraryCreator->wait();
|
libraryCreator->wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::stopXMLScanning()
|
||||||
|
{
|
||||||
|
xmlInfoLibraryScanner->stop();
|
||||||
|
xmlInfoLibraryScanner->wait();
|
||||||
|
}
|
||||||
|
|
||||||
void LibraryWindow::setRootIndex()
|
void LibraryWindow::setRootIndex()
|
||||||
{
|
{
|
||||||
if (!libraries.isEmpty()) {
|
if (!libraries.isEmpty()) {
|
||||||
|
@ -82,6 +82,7 @@ class EmptyReadingListWidget;
|
|||||||
|
|
||||||
namespace YACReader {
|
namespace YACReader {
|
||||||
class TrayIconController;
|
class TrayIconController;
|
||||||
|
class XMLInfoLibraryScanner;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "comic_db.h"
|
#include "comic_db.h"
|
||||||
@ -103,6 +104,7 @@ public:
|
|||||||
ImportComicsInfoDialog *importComicsInfoDialog;
|
ImportComicsInfoDialog *importComicsInfoDialog;
|
||||||
AddLibraryDialog *addLibraryDialog;
|
AddLibraryDialog *addLibraryDialog;
|
||||||
LibraryCreator *libraryCreator;
|
LibraryCreator *libraryCreator;
|
||||||
|
XMLInfoLibraryScanner *xmlInfoLibraryScanner;
|
||||||
HelpAboutDialog *had;
|
HelpAboutDialog *had;
|
||||||
RenameLibraryDialog *renameLibraryDialog;
|
RenameLibraryDialog *renameLibraryDialog;
|
||||||
PropertiesDialog *propertiesDialog;
|
PropertiesDialog *propertiesDialog;
|
||||||
@ -163,6 +165,8 @@ public:
|
|||||||
QAction *exportLibraryAction;
|
QAction *exportLibraryAction;
|
||||||
QAction *importLibraryAction;
|
QAction *importLibraryAction;
|
||||||
|
|
||||||
|
QAction *rescanLibraryForXMLInfoAction;
|
||||||
|
|
||||||
QAction *updateLibraryAction;
|
QAction *updateLibraryAction;
|
||||||
QAction *removeLibraryAction;
|
QAction *removeLibraryAction;
|
||||||
QAction *helpAboutAction;
|
QAction *helpAboutAction;
|
||||||
@ -338,9 +342,11 @@ public slots:
|
|||||||
void deleteCurrentLibrary();
|
void deleteCurrentLibrary();
|
||||||
void removeLibrary();
|
void removeLibrary();
|
||||||
void renameLibrary();
|
void renameLibrary();
|
||||||
|
void rescanLibraryForXMLInfo();
|
||||||
void rename(QString newName);
|
void rename(QString newName);
|
||||||
void cancelCreating();
|
void cancelCreating();
|
||||||
void stopLibraryCreator();
|
void stopLibraryCreator();
|
||||||
|
void stopXMLScanning();
|
||||||
void setRootIndex();
|
void setRootIndex();
|
||||||
void toggleFullScreen();
|
void toggleFullScreen();
|
||||||
void toNormal();
|
void toNormal();
|
||||||
@ -391,6 +397,7 @@ public slots:
|
|||||||
void updateCurrentFolder();
|
void updateCurrentFolder();
|
||||||
void updateFolder(const QModelIndex &miFolder);
|
void updateFolder(const QModelIndex &miFolder);
|
||||||
QProgressDialog *newProgressDialog(const QString &label, int maxValue);
|
QProgressDialog *newProgressDialog(const QString &label, int maxValue);
|
||||||
|
void reloadCurrentFolderComicsContent();
|
||||||
void reloadAfterCopyMove(const QModelIndex &mi);
|
void reloadAfterCopyMove(const QModelIndex &mi);
|
||||||
QModelIndex getCurrentFolderIndex();
|
QModelIndex getCurrentFolderIndex();
|
||||||
void enableNeededActions();
|
void enableNeededActions();
|
||||||
|
Loading…
Reference in New Issue
Block a user