mirror of
https://github.com/YACReader/yacreader
synced 2025-07-19 21:44:43 -04:00
actions management fixed
This commit is contained in:
@ -385,12 +385,6 @@ void LibraryWindow::createActions()
|
|||||||
showHideMarksAction->setIcon(QIcon(":/images/showMarks.png"));
|
showHideMarksAction->setIcon(QIcon(":/images/showMarks.png"));
|
||||||
showHideMarksAction->setChecked(true);
|
showHideMarksAction->setChecked(true);
|
||||||
|
|
||||||
|
|
||||||
showPropertiesAction = new QAction(this);
|
|
||||||
showPropertiesAction->setToolTip(tr("Show properties of current comic"));
|
|
||||||
showPropertiesAction->setShortcut(Qt::Key_P);
|
|
||||||
showPropertiesAction->setIcon(QIcon(":/images/properties.png"));
|
|
||||||
|
|
||||||
toggleFullScreenAction = new QAction(tr("Fullscreen mode on/off"),this);
|
toggleFullScreenAction = new QAction(tr("Fullscreen mode on/off"),this);
|
||||||
toggleFullScreenAction->setToolTip(tr("Fullscreen mode on/off (F)"));
|
toggleFullScreenAction->setToolTip(tr("Fullscreen mode on/off (F)"));
|
||||||
toggleFullScreenAction->setShortcut(Qt::Key_F);
|
toggleFullScreenAction->setShortcut(Qt::Key_F);
|
||||||
@ -436,9 +430,6 @@ void LibraryWindow::createActions()
|
|||||||
|
|
||||||
//socialAction = new QAction(this);
|
//socialAction = new QAction(this);
|
||||||
|
|
||||||
//disable actions
|
|
||||||
disableAllActions();
|
|
||||||
|
|
||||||
openContainingFolderAction = new QAction(this);
|
openContainingFolderAction = new QAction(this);
|
||||||
openContainingFolderAction->setText(tr("Open folder..."));
|
openContainingFolderAction->setText(tr("Open folder..."));
|
||||||
openContainingFolderAction->setIcon(QIcon(":/images/open.png"));
|
openContainingFolderAction->setIcon(QIcon(":/images/open.png"));
|
||||||
@ -474,71 +465,62 @@ void LibraryWindow::createActions()
|
|||||||
hideComicViewAction->setCheckable(true);
|
hideComicViewAction->setCheckable(true);
|
||||||
hideComicViewAction->setChecked(false);
|
hideComicViewAction->setChecked(false);
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
//disable actions
|
||||||
|
disableAllActions();
|
||||||
|
}
|
||||||
|
void LibraryWindow::disableComicsActions(bool disabled)
|
||||||
|
{
|
||||||
|
//if there aren't comics, no fullscreen option will be available
|
||||||
|
toggleFullScreenAction->setDisabled(disabled);
|
||||||
|
//edit toolbar
|
||||||
|
openComicAction->setDisabled(disabled);
|
||||||
|
editSelectedComicsAction->setDisabled(disabled);
|
||||||
|
selectAllComicsAction->setDisabled(disabled);
|
||||||
|
asignOrderActions->setDisabled(disabled);
|
||||||
|
setAsReadAction->setDisabled(disabled);
|
||||||
|
setAsNonReadAction->setDisabled(disabled);
|
||||||
|
setAllAsReadAction->setDisabled(disabled);
|
||||||
|
setAllAsNonReadAction->setDisabled(disabled);
|
||||||
|
showHideMarksAction->setDisabled(disabled);
|
||||||
|
deleteComicsAction->setDisabled(disabled);
|
||||||
|
//context menu
|
||||||
|
openContainingFolderComicAction->setDisabled(disabled);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
void LibraryWindow::disableLibrariesActions(bool disabled)
|
||||||
|
{
|
||||||
|
updateLibraryAction->setDisabled(disabled);
|
||||||
|
renameLibraryAction->setDisabled(disabled);
|
||||||
|
removeLibraryAction->setDisabled(disabled);
|
||||||
|
exportComicsInfo->setDisabled(disabled);
|
||||||
|
importComicsInfo->setDisabled(disabled);
|
||||||
|
exportLibraryAction->setDisabled(disabled);
|
||||||
|
//importLibraryAction->setDisabled(disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::disableNoUpdatedLibrariesActions(bool disabled)
|
||||||
|
{
|
||||||
|
updateLibraryAction->setDisabled(disabled);
|
||||||
|
exportComicsInfo->setDisabled(disabled);
|
||||||
|
importComicsInfo->setDisabled(disabled);
|
||||||
|
exportLibraryAction->setDisabled(disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::disableFoldersActions(bool disabled)
|
||||||
|
{
|
||||||
|
setRootIndexAction->setDisabled(disabled);
|
||||||
|
expandAllNodesAction->setDisabled(disabled);
|
||||||
|
colapseAllNodesAction->setDisabled(disabled);
|
||||||
|
|
||||||
|
openContainingFolderAction->setDisabled(disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO unificar con disableActions
|
|
||||||
void LibraryWindow::disableAllActions()
|
void LibraryWindow::disableAllActions()
|
||||||
{
|
{
|
||||||
updateLibraryAction->setEnabled(false);
|
disableComicsActions(true);
|
||||||
renameLibraryAction->setEnabled(false);
|
disableLibrariesActions(true);
|
||||||
//deleteLibraryAction->setEnabled(false);
|
disableFoldersActions(true);
|
||||||
removeLibraryAction->setEnabled(false);
|
|
||||||
openComicAction->setEnabled(false);
|
|
||||||
showPropertiesAction->setEnabled(false);
|
|
||||||
setAsReadAction->setEnabled(false);
|
|
||||||
setAsNonReadAction->setEnabled(false);
|
|
||||||
setAllAsReadAction->setEnabled(false);
|
|
||||||
setAllAsNonReadAction->setEnabled(false);
|
|
||||||
|
|
||||||
showHideMarksAction->setEnabled(false);
|
|
||||||
importComicsInfo->setEnabled(false);
|
|
||||||
exportComicsInfo->setEnabled(false);
|
|
||||||
exportLibraryAction->setEnabled(false);
|
|
||||||
toggleFullScreenAction->setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//librer<65>a de s<>lo lectura
|
|
||||||
void LibraryWindow::disableActions()
|
|
||||||
{
|
|
||||||
updateLibraryAction->setEnabled(false);
|
|
||||||
openComicAction->setEnabled(false);
|
|
||||||
showPropertiesAction->setEnabled(false);
|
|
||||||
openContainingFolderAction->setEnabled(false);
|
|
||||||
openContainingFolderComicAction->setEnabled(false);
|
|
||||||
setAsReadAction->setEnabled(false);
|
|
||||||
setAsNonReadAction->setEnabled(false);
|
|
||||||
setAllAsReadAction->setEnabled(false);
|
|
||||||
setAllAsNonReadAction->setEnabled(false);
|
|
||||||
selectAllComicsAction->setEnabled(false);
|
|
||||||
editSelectedComicsAction->setEnabled(false);
|
|
||||||
asignOrderActions->setEnabled(false);
|
|
||||||
}
|
|
||||||
//librer<65>a abierta
|
|
||||||
void LibraryWindow::enableActions()
|
|
||||||
{
|
|
||||||
updateLibraryAction->setEnabled(true);
|
|
||||||
openComicAction->setEnabled(true);
|
|
||||||
showPropertiesAction->setEnabled(true);
|
|
||||||
openContainingFolderAction->setEnabled(true);
|
|
||||||
openContainingFolderComicAction->setEnabled(true);
|
|
||||||
setAsReadAction->setEnabled(true);
|
|
||||||
setAsNonReadAction->setEnabled(true);
|
|
||||||
setAllAsReadAction->setEnabled(true);
|
|
||||||
setAllAsNonReadAction->setEnabled(true);
|
|
||||||
|
|
||||||
showHideMarksAction->setEnabled(true);
|
|
||||||
importComicsInfo->setEnabled(true);
|
|
||||||
exportComicsInfo->setEnabled(true);
|
|
||||||
exportLibraryAction->setEnabled(true);
|
|
||||||
toggleFullScreenAction->setEnabled(true);
|
|
||||||
}
|
|
||||||
void LibraryWindow::enableLibraryActions()
|
|
||||||
{
|
|
||||||
renameLibraryAction->setEnabled(true);
|
|
||||||
//deleteLibraryAction->setEnabled(true);
|
|
||||||
removeLibraryAction->setEnabled(true);
|
|
||||||
foldersFilter->setEnabled(true);
|
|
||||||
//clearFoldersFilter->setEnabled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::createToolBars()
|
void LibraryWindow::createToolBars()
|
||||||
@ -698,7 +680,6 @@ void LibraryWindow::createConnections()
|
|||||||
connect(importLibraryAction,SIGNAL(triggered()),this,SLOT(importLibraryPackage()));
|
connect(importLibraryAction,SIGNAL(triggered()),this,SLOT(importLibraryPackage()));
|
||||||
|
|
||||||
connect(openLibraryAction,SIGNAL(triggered()),this,SLOT(showAddLibrary()));
|
connect(openLibraryAction,SIGNAL(triggered()),this,SLOT(showAddLibrary()));
|
||||||
connect(showPropertiesAction,SIGNAL(triggered()),this,SLOT(showProperties()));
|
|
||||||
connect(setAsReadAction,SIGNAL(triggered()),this,SLOT(setCurrentComicReaded()));
|
connect(setAsReadAction,SIGNAL(triggered()),this,SLOT(setCurrentComicReaded()));
|
||||||
connect(setAsNonReadAction,SIGNAL(triggered()),this,SLOT(setCurrentComicUnreaded()));
|
connect(setAsNonReadAction,SIGNAL(triggered()),this,SLOT(setCurrentComicUnreaded()));
|
||||||
connect(setAllAsReadAction,SIGNAL(triggered()),this,SLOT(setComicsReaded()));
|
connect(setAllAsReadAction,SIGNAL(triggered()),this,SLOT(setComicsReaded()));
|
||||||
@ -789,6 +770,9 @@ void LibraryWindow::loadLibrary(const QString & name)
|
|||||||
foldersView->setModel(NULL);
|
foldersView->setModel(NULL);
|
||||||
comicFlow->clear();
|
comicFlow->clear();
|
||||||
disableAllActions();//TODO comprobar que se deben deshabilitar
|
disableAllActions();//TODO comprobar que se deben deshabilitar
|
||||||
|
//ser<65> posible renombrar y borrar estas bibliotecas
|
||||||
|
renameLibraryAction->setEnabled(true);
|
||||||
|
removeLibraryAction->setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -800,20 +784,27 @@ void LibraryWindow::loadLibrary(const QString & name)
|
|||||||
dm->setupModelData(path);
|
dm->setupModelData(path);
|
||||||
foldersView->setModel(dm);
|
foldersView->setModel(dm);
|
||||||
|
|
||||||
|
if(dm->rowCount(QModelIndex())>0)
|
||||||
|
disableFoldersActions(false);
|
||||||
|
else
|
||||||
|
disableFoldersActions(true);
|
||||||
|
|
||||||
d.setCurrent(libraries.value(name));
|
d.setCurrent(libraries.value(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<65>a de s<>lo lectura
|
if(d.count()<=1) //librer<65>a de s<>lo lectura
|
||||||
{
|
{
|
||||||
//QMessageBox::critical(NULL,QString::number(d.count()),QString::number(d.count()));
|
//QMessageBox::critical(NULL,QString::number(d.count()),QString::number(d.count()));
|
||||||
disableActions();
|
updateLibraryAction->setDisabled(true);
|
||||||
|
openContainingFolderAction->setDisabled(true);
|
||||||
|
disableComicsActions(true);
|
||||||
|
|
||||||
importedCovers = true;
|
importedCovers = true;
|
||||||
}
|
}
|
||||||
else //librer<65>a normal abierta
|
else //librer<65>a normal abierta
|
||||||
{
|
{
|
||||||
enableActions();
|
disableLibrariesActions(false);
|
||||||
importedCovers = false;
|
importedCovers = false;
|
||||||
}
|
}
|
||||||
enableLibraryActions();
|
|
||||||
|
|
||||||
setRootIndex();
|
setRootIndex();
|
||||||
//TODO encontrar el bug que provoca que no se carguen adecuadamente las car<61>tulas en root.
|
//TODO encontrar el bug que provoca que no se carguen adecuadamente las car<61>tulas en root.
|
||||||
@ -831,6 +822,9 @@ void LibraryWindow::loadLibrary(const QString & name)
|
|||||||
foldersView->setModel(NULL);
|
foldersView->setModel(NULL);
|
||||||
comicFlow->clear();
|
comicFlow->clear();
|
||||||
disableAllActions();//TODO comprobar que se deben deshabilitar
|
disableAllActions();//TODO comprobar que se deben deshabilitar
|
||||||
|
//ser<65> posible renombrar y borrar estas bibliotecas
|
||||||
|
renameLibraryAction->setEnabled(true);
|
||||||
|
removeLibraryAction->setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -959,37 +953,11 @@ void LibraryWindow::checkEmptyFolder(QStringList * paths)
|
|||||||
|
|
||||||
if(paths->size()>0 && !importedCovers)
|
if(paths->size()>0 && !importedCovers)
|
||||||
{
|
{
|
||||||
openComicAction->setEnabled(true);
|
disableComicsActions(false);
|
||||||
showPropertiesAction->setEnabled(true);
|
|
||||||
setAsReadAction->setEnabled(true);
|
|
||||||
setAsNonReadAction->setEnabled(true);
|
|
||||||
setAllAsReadAction->setEnabled(true);
|
|
||||||
setAllAsNonReadAction->setEnabled(true);
|
|
||||||
selectAllComicsAction->setEnabled(true);
|
|
||||||
editSelectedComicsAction->setEnabled(true);
|
|
||||||
asignOrderActions->setEnabled(true);
|
|
||||||
|
|
||||||
showHideMarksAction->setEnabled(true);
|
|
||||||
toggleFullScreenAction->setEnabled(true);
|
|
||||||
|
|
||||||
deleteComicsAction->setEnabled(true);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
openComicAction->setEnabled(false);
|
disableComicsActions(true);
|
||||||
showPropertiesAction->setEnabled(false);
|
|
||||||
setAsReadAction->setEnabled(false);
|
|
||||||
setAsNonReadAction->setEnabled(false);
|
|
||||||
setAllAsReadAction->setEnabled(false);
|
|
||||||
setAllAsNonReadAction->setEnabled(false);
|
|
||||||
selectAllComicsAction->setEnabled(false);
|
|
||||||
editSelectedComicsAction->setEnabled(false);
|
|
||||||
asignOrderActions->setEnabled(false);
|
|
||||||
|
|
||||||
showHideMarksAction->setEnabled(false);
|
|
||||||
toggleFullScreenAction->setEnabled(false);
|
|
||||||
|
|
||||||
deleteComicsAction->setEnabled(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1536,7 +1504,6 @@ void LibraryWindow::showNoLibrariesWidget()
|
|||||||
|
|
||||||
void LibraryWindow::showRootWidget()
|
void LibraryWindow::showRootWidget()
|
||||||
{
|
{
|
||||||
enableActions();
|
|
||||||
libraryToolBar->setDisabled(false);
|
libraryToolBar->setDisabled(false);
|
||||||
foldersFilter->setEnabled(true);
|
foldersFilter->setEnabled(true);
|
||||||
mainWidget->setCurrentIndex(0);
|
mainWidget->setCurrentIndex(0);
|
||||||
|
@ -108,7 +108,6 @@ private:
|
|||||||
QAction * forwardAction;
|
QAction * forwardAction;
|
||||||
|
|
||||||
QAction * openComicAction;
|
QAction * openComicAction;
|
||||||
QAction * showPropertiesAction;
|
|
||||||
QAction * createLibraryAction;
|
QAction * createLibraryAction;
|
||||||
QAction * openLibraryAction;
|
QAction * openLibraryAction;
|
||||||
|
|
||||||
@ -180,10 +179,16 @@ private:
|
|||||||
void doDialogs();
|
void doDialogs();
|
||||||
void doModels();
|
void doModels();
|
||||||
|
|
||||||
|
//ACTIONS MANAGEMENT
|
||||||
|
void disableComicsActions(bool disabled);
|
||||||
|
void disableLibrariesActions(bool disabled);
|
||||||
|
void disableNoUpdatedLibrariesActions(bool disabled);
|
||||||
|
void disableFoldersActions(bool disabled);
|
||||||
|
|
||||||
void disableAllActions();
|
void disableAllActions();
|
||||||
void disableActions();
|
//void disableActions();
|
||||||
void enableActions();
|
//void enableActions();
|
||||||
void enableLibraryActions();
|
//void enableLibraryActions();
|
||||||
|
|
||||||
QString currentPath();
|
QString currentPath();
|
||||||
|
|
||||||
@ -256,6 +261,7 @@ public:
|
|||||||
void updateHistory(const QModelIndex & mi);
|
void updateHistory(const QModelIndex & mi);
|
||||||
void libraryAlreadyExists(const QString & name);
|
void libraryAlreadyExists(const QString & name);
|
||||||
void importLibraryPackage();
|
void importLibraryPackage();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user