mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
added new actions for updating libraries partially (folder)
This commit is contained in:
parent
2ad50ce05b
commit
4b6dc8893e
@ -334,7 +334,8 @@ void LibraryWindow::setUpShortcutsManagement()
|
|||||||
<< setFolderAsNotCompletedAction
|
<< setFolderAsNotCompletedAction
|
||||||
<< setFolderAsCompletedAction
|
<< setFolderAsCompletedAction
|
||||||
<< setFolderAsReadAction
|
<< setFolderAsReadAction
|
||||||
<< setFolderAsUnreadAction);
|
<< setFolderAsUnreadAction
|
||||||
|
<< updateCurrentFolderAction);
|
||||||
allActions << tmpList;
|
allActions << tmpList;
|
||||||
|
|
||||||
editShortcutsDialog->addActionsGroup("General",QIcon(":/images/shortcuts_group_general.png"),
|
editShortcutsDialog->addActionsGroup("General",QIcon(":/images/shortcuts_group_general.png"),
|
||||||
@ -669,6 +670,16 @@ void LibraryWindow::createActions()
|
|||||||
showEditShortcutsAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_EDIT_SHORTCUTS_ACTION_YL));
|
showEditShortcutsAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_EDIT_SHORTCUTS_ACTION_YL));
|
||||||
showEditShortcutsAction->setShortcutContext(Qt::ApplicationShortcut);
|
showEditShortcutsAction->setShortcutContext(Qt::ApplicationShortcut);
|
||||||
addAction(showEditShortcutsAction);
|
addAction(showEditShortcutsAction);
|
||||||
|
|
||||||
|
updateFolderAction = new QAction(tr("Update folder"), this);
|
||||||
|
updateFolderAction->setIcon(QIcon(":/images/updateLibraryIcon.png"));
|
||||||
|
|
||||||
|
updateCurrentFolderAction = new QAction(tr("Update current folder"), this);
|
||||||
|
updateCurrentFolderAction->setData(UPDATE_CURRENT_FOLDER_ACTION_YL);
|
||||||
|
updateCurrentFolderAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(UPDATE_CURRENT_FOLDER_ACTION_YL));
|
||||||
|
updateCurrentFolderAction->setIcon(QIcon(":/images/updateLibraryIcon.png"));
|
||||||
|
|
||||||
|
|
||||||
//disable actions
|
//disable actions
|
||||||
disableAllActions();
|
disableAllActions();
|
||||||
}
|
}
|
||||||
@ -693,6 +704,8 @@ void LibraryWindow::disableComicsActions(bool disabled)
|
|||||||
|
|
||||||
getInfoAction->setDisabled(disabled);
|
getInfoAction->setDisabled(disabled);
|
||||||
|
|
||||||
|
updateCurrentFolderAction->setDisabled(disabled);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void LibraryWindow::disableLibrariesActions(bool disabled)
|
void LibraryWindow::disableLibrariesActions(bool disabled)
|
||||||
@ -722,6 +735,8 @@ void LibraryWindow::disableFoldersActions(bool disabled)
|
|||||||
|
|
||||||
openContainingFolderAction->setDisabled(disabled);
|
openContainingFolderAction->setDisabled(disabled);
|
||||||
|
|
||||||
|
updateFolderAction->setDisabled(disabled);
|
||||||
|
|
||||||
if(disabled == false)
|
if(disabled == false)
|
||||||
{
|
{
|
||||||
setFolderAsNotCompletedAction->setVisible(false);
|
setFolderAsNotCompletedAction->setVisible(false);
|
||||||
@ -814,6 +829,7 @@ void LibraryWindow::createMenus()
|
|||||||
itemActions << openComicAction
|
itemActions << openComicAction
|
||||||
<< YACReader::createSeparator()
|
<< YACReader::createSeparator()
|
||||||
<< openContainingFolderComicAction
|
<< openContainingFolderComicAction
|
||||||
|
<< updateCurrentFolderAction
|
||||||
<< YACReader::createSeparator()
|
<< YACReader::createSeparator()
|
||||||
<< resetComicRatingAction
|
<< resetComicRatingAction
|
||||||
<< YACReader::createSeparator()
|
<< YACReader::createSeparator()
|
||||||
@ -829,6 +845,7 @@ void LibraryWindow::createMenus()
|
|||||||
viewActions << openComicAction
|
viewActions << openComicAction
|
||||||
<< YACReader::createSeparator()
|
<< YACReader::createSeparator()
|
||||||
<< openContainingFolderComicAction
|
<< openContainingFolderComicAction
|
||||||
|
<< updateCurrentFolderAction
|
||||||
<< YACReader::createSeparator()
|
<< YACReader::createSeparator()
|
||||||
<< resetComicRatingAction
|
<< resetComicRatingAction
|
||||||
<< YACReader::createSeparator()
|
<< YACReader::createSeparator()
|
||||||
@ -850,6 +867,7 @@ void LibraryWindow::createMenus()
|
|||||||
comicsView->setViewActions(viewActions);
|
comicsView->setViewActions(viewActions);
|
||||||
|
|
||||||
foldersView->addAction(openContainingFolderAction);
|
foldersView->addAction(openContainingFolderAction);
|
||||||
|
foldersView->addAction(updateFolderAction);
|
||||||
YACReader::addSperator(foldersView);
|
YACReader::addSperator(foldersView);
|
||||||
|
|
||||||
foldersView->addAction(setFolderAsNotCompletedAction);
|
foldersView->addAction(setFolderAsNotCompletedAction);
|
||||||
@ -899,6 +917,7 @@ void LibraryWindow::createMenus()
|
|||||||
//folder
|
//folder
|
||||||
QMenu * folderMenu = new QMenu(tr("Folder"));
|
QMenu * folderMenu = new QMenu(tr("Folder"));
|
||||||
folderMenu->addAction(openContainingFolderAction);
|
folderMenu->addAction(openContainingFolderAction);
|
||||||
|
folderMenu->addAction(updateFolderAction);
|
||||||
folderMenu->addSeparator();
|
folderMenu->addSeparator();
|
||||||
folderMenu->addAction(setFolderAsNotCompletedAction);
|
folderMenu->addAction(setFolderAsNotCompletedAction);
|
||||||
folderMenu->addAction(setFolderAsCompletedAction);
|
folderMenu->addAction(setFolderAsCompletedAction);
|
||||||
@ -1052,6 +1071,10 @@ void LibraryWindow::createConnections()
|
|||||||
connect(emptyFolderWidget,SIGNAL(subfolderSelected(QModelIndex,int)),this,SLOT(selectSubfolder(QModelIndex,int)));
|
connect(emptyFolderWidget,SIGNAL(subfolderSelected(QModelIndex,int)),this,SLOT(selectSubfolder(QModelIndex,int)));
|
||||||
|
|
||||||
connect(showEditShortcutsAction,SIGNAL(triggered()),editShortcutsDialog,SLOT(show()));
|
connect(showEditShortcutsAction,SIGNAL(triggered()),editShortcutsDialog,SLOT(show()));
|
||||||
|
|
||||||
|
//update folders (partial updates)
|
||||||
|
connect(updateCurrentFolderAction,SIGNAL(triggered()), this, SLOT(updateCurrentFolder()));
|
||||||
|
connect(updateFolderAction,SIGNAL(triggered()), this, SLOT(updateTreeFolder()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::loadLibrary(const QString & name)
|
void LibraryWindow::loadLibrary(const QString & name)
|
||||||
@ -1263,7 +1286,7 @@ void LibraryWindow::copyAndImportComicsToCurrentFolder(const QList<QString> &com
|
|||||||
{
|
{
|
||||||
QString destFolderPath = currentFolderPath();
|
QString destFolderPath = currentFolderPath();
|
||||||
|
|
||||||
copyMoveIndexDestination = getCurrentFolderIndex();
|
updateDestination = getCurrentFolderIndex();
|
||||||
|
|
||||||
QProgressDialog * progressDialog = newProgressDialog(tr("Copying comics..."),comics.size());
|
QProgressDialog * progressDialog = newProgressDialog(tr("Copying comics..."),comics.size());
|
||||||
|
|
||||||
@ -1277,7 +1300,7 @@ void LibraryWindow::moveAndImportComicsToCurrentFolder(const QList<QString> &com
|
|||||||
{
|
{
|
||||||
QString destFolderPath = currentFolderPath();
|
QString destFolderPath = currentFolderPath();
|
||||||
|
|
||||||
copyMoveIndexDestination = getCurrentFolderIndex();
|
updateDestination = getCurrentFolderIndex();
|
||||||
|
|
||||||
QProgressDialog * progressDialog = newProgressDialog(tr("Moving comics..."),comics.size());
|
QProgressDialog * progressDialog = newProgressDialog(tr("Moving comics..."),comics.size());
|
||||||
|
|
||||||
@ -1293,7 +1316,7 @@ void LibraryWindow::copyAndImportComicsToFolder(const QList<QString> &comics, co
|
|||||||
{
|
{
|
||||||
QString destFolderPath = QDir::cleanPath(currentPath()+foldersModel->getFolderPath(miFolder));
|
QString destFolderPath = QDir::cleanPath(currentPath()+foldersModel->getFolderPath(miFolder));
|
||||||
|
|
||||||
copyMoveIndexDestination = miFolder;
|
updateDestination = miFolder;
|
||||||
|
|
||||||
QLOG_DEBUG() << "Coping to " << destFolderPath;
|
QLOG_DEBUG() << "Coping to " << destFolderPath;
|
||||||
|
|
||||||
@ -1312,7 +1335,7 @@ void LibraryWindow::moveAndImportComicsToFolder(const QList<QString> &comics, co
|
|||||||
{
|
{
|
||||||
QString destFolderPath = QDir::cleanPath(currentPath()+foldersModel->getFolderPath(miFolder));
|
QString destFolderPath = QDir::cleanPath(currentPath()+foldersModel->getFolderPath(miFolder));
|
||||||
|
|
||||||
copyMoveIndexDestination = miFolder;
|
updateDestination = miFolder;
|
||||||
|
|
||||||
QLOG_DEBUG() << "Moving to " << destFolderPath;
|
QLOG_DEBUG() << "Moving to " << destFolderPath;
|
||||||
|
|
||||||
@ -1351,13 +1374,30 @@ void LibraryWindow::processComicFiles(ComicFilesManager * comicFilesManager, QPr
|
|||||||
|
|
||||||
void LibraryWindow::updateCopyMoveFolderDestination()
|
void LibraryWindow::updateCopyMoveFolderDestination()
|
||||||
{
|
{
|
||||||
|
updateFolder(updateDestination);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::updateCurrentFolder()
|
||||||
|
{
|
||||||
|
updateFolder(getCurrentFolderIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::updateTreeFolder()
|
||||||
|
{
|
||||||
|
updateFolder(foldersView->currentIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::updateFolder(const QModelIndex & miFolder)
|
||||||
|
{
|
||||||
|
updateDestination = miFolder;
|
||||||
|
|
||||||
importWidget->setUpdateLook();
|
importWidget->setUpdateLook();
|
||||||
showImportingWidget();
|
showImportingWidget();
|
||||||
|
|
||||||
QString currentLibrary = selectedLibrary->currentText();
|
QString currentLibrary = selectedLibrary->currentText();
|
||||||
QString path = libraries.getPath(currentLibrary);
|
QString path = libraries.getPath(currentLibrary);
|
||||||
_lastAdded = currentLibrary;
|
_lastAdded = currentLibrary;
|
||||||
libraryCreator->updateFolder(QDir::cleanPath(path),QDir::cleanPath(path+"/.yacreaderlibrary"),QDir::cleanPath(currentPath()+foldersModel->getFolderPath(copyMoveIndexDestination)));
|
libraryCreator->updateFolder(QDir::cleanPath(path),QDir::cleanPath(path+"/.yacreaderlibrary"),QDir::cleanPath(currentPath()+foldersModel->getFolderPath(miFolder)));
|
||||||
libraryCreator->start();
|
libraryCreator->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1372,7 +1412,7 @@ QProgressDialog *LibraryWindow::newProgressDialog(const QString &label, int maxV
|
|||||||
|
|
||||||
void LibraryWindow::reloadAfterCopyMove()
|
void LibraryWindow::reloadAfterCopyMove()
|
||||||
{
|
{
|
||||||
if(getCurrentFolderIndex() == copyMoveIndexDestination)
|
if(getCurrentFolderIndex() == updateDestination)
|
||||||
reloadCovers();
|
reloadCovers();
|
||||||
|
|
||||||
enableNeededActions();
|
enableNeededActions();
|
||||||
|
@ -178,6 +178,9 @@ private:
|
|||||||
|
|
||||||
QAction *showEditShortcutsAction;
|
QAction *showEditShortcutsAction;
|
||||||
|
|
||||||
|
QAction * updateFolderAction;
|
||||||
|
QAction * updateCurrentFolderAction;
|
||||||
|
|
||||||
QList<QAction *> itemActions;
|
QList<QAction *> itemActions;
|
||||||
QList<QAction *> viewActions;
|
QList<QAction *> viewActions;
|
||||||
|
|
||||||
@ -201,7 +204,7 @@ private:
|
|||||||
|
|
||||||
//QModelIndex _rootIndex;
|
//QModelIndex _rootIndex;
|
||||||
//QModelIndex _rootIndexCV;
|
//QModelIndex _rootIndexCV;
|
||||||
QModelIndex copyMoveIndexDestination;
|
QModelIndex updateDestination;
|
||||||
|
|
||||||
quint64 _comicIdEdited;
|
quint64 _comicIdEdited;
|
||||||
|
|
||||||
@ -329,6 +332,9 @@ public slots:
|
|||||||
void moveAndImportComicsToFolder(const QList<QString> & comics, const QModelIndex & miFolder);
|
void moveAndImportComicsToFolder(const QList<QString> & comics, const QModelIndex & miFolder);
|
||||||
void processComicFiles(ComicFilesManager * comicFilesManager, QProgressDialog * progressDialog);
|
void processComicFiles(ComicFilesManager * comicFilesManager, QProgressDialog * progressDialog);
|
||||||
void updateCopyMoveFolderDestination(); //imports new comics from the current folder
|
void updateCopyMoveFolderDestination(); //imports new comics from the current folder
|
||||||
|
void updateCurrentFolder();
|
||||||
|
void updateTreeFolder();
|
||||||
|
void updateFolder(const QModelIndex & miFolder);
|
||||||
QProgressDialog * newProgressDialog(const QString & label, int maxValue);
|
QProgressDialog * newProgressDialog(const QString & label, int maxValue);
|
||||||
void reloadAfterCopyMove();
|
void reloadAfterCopyMove();
|
||||||
QModelIndex getCurrentFolderIndex();
|
QModelIndex getCurrentFolderIndex();
|
||||||
|
@ -72,7 +72,7 @@ public:
|
|||||||
#define HIDE_COMIC_VIEW_ACTION_YL "HIDE_COMIC_VIEW_ACTION_YL"
|
#define HIDE_COMIC_VIEW_ACTION_YL "HIDE_COMIC_VIEW_ACTION_YL"
|
||||||
#define GET_INFO_ACTION_YL "GET_INFO_ACTION_YL"
|
#define GET_INFO_ACTION_YL "GET_INFO_ACTION_YL"
|
||||||
#define SHOW_EDIT_SHORTCUTS_ACTION_YL "SHOW_EDIT_SHORTCUTS_ACTION_YL"
|
#define SHOW_EDIT_SHORTCUTS_ACTION_YL "SHOW_EDIT_SHORTCUTS_ACTION_YL"
|
||||||
|
#define UPDATE_CURRENT_FOLDER_ACTION_YL "UPDATE_CURRENT_FOLDER_ACTION_YL"
|
||||||
//COMMANDS YACReaderLibrary
|
//COMMANDS YACReaderLibrary
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user