From 68e56189bbdcf806b40183e85874cff4e43fbbb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Sun, 19 May 2013 17:09:42 +0200 Subject: [PATCH] Unificadas las acciones de eliminar y borrar bibliotecas Ahora todas las acciones relacionadas con los c?mics est?n en la misma toolbar --- YACReaderLibrary/library_window.cpp | 63 ++++++++++++++++------------- YACReaderLibrary/library_window.h | 2 +- 2 files changed, 36 insertions(+), 29 deletions(-) diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index 098bfbd2..830b56ea 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -348,9 +348,9 @@ void LibraryWindow::createActions() renameLibraryAction->setShortcut(Qt::Key_R); renameLibraryAction->setIcon(QIcon(":/images/edit.png")); - deleteLibraryAction = new QAction(this); + /*deleteLibraryAction = new QAction(this); deleteLibraryAction->setToolTip(tr("Delete current library from disk")); - deleteLibraryAction->setIcon(QIcon(":/images/deleteLibrary.png")); + deleteLibraryAction->setIcon(QIcon(":/images/deleteLibrary.png"));*/ removeLibraryAction = new QAction(this); removeLibraryAction->setToolTip(tr("Remove current library from your collection")); @@ -472,7 +472,7 @@ void LibraryWindow::disableAllActions() { updateLibraryAction->setEnabled(false); renameLibraryAction->setEnabled(false); - deleteLibraryAction->setEnabled(false); + //deleteLibraryAction->setEnabled(false); removeLibraryAction->setEnabled(false); openComicAction->setEnabled(false); showPropertiesAction->setEnabled(false); @@ -526,7 +526,7 @@ void LibraryWindow::enableActions() void LibraryWindow::enableLibraryActions() { renameLibraryAction->setEnabled(true); - deleteLibraryAction->setEnabled(true); + //deleteLibraryAction->setEnabled(true); removeLibraryAction->setEnabled(true); foldersFilter->setEnabled(true); //clearFoldersFilter->setEnabled(true); @@ -556,28 +556,7 @@ void LibraryWindow::createToolBars() libraryToolBar->addAction(updateLibraryAction); libraryToolBar->addAction(renameLibraryAction); libraryToolBar->addAction(removeLibraryAction); - libraryToolBar->addAction(deleteLibraryAction); - - libraryToolBar->addSeparator(); - libraryToolBar->addAction(openComicAction); - libraryToolBar->addAction(showPropertiesAction); - - QToolButton * tb = new QToolButton(); - tb->addAction(setAsReadAction); - tb->addAction(setAllAsReadAction); - tb->setPopupMode(QToolButton::MenuButtonPopup); - tb->setDefaultAction(setAsReadAction); - - QToolButton * tb2 = new QToolButton(); - tb2->addAction(setAsNonReadAction); - tb2->addAction(setAllAsNonReadAction); - tb2->setPopupMode(QToolButton::MenuButtonPopup); - tb2->setDefaultAction(setAsNonReadAction); - - libraryToolBar->addWidget(tb); - libraryToolBar->addWidget(tb2); - - libraryToolBar->addAction(showHideMarksAction); + //libraryToolBar->addAction(deleteLibraryAction); libraryToolBar->addSeparator(); libraryToolBar->addAction(toggleFullScreenAction); @@ -607,8 +586,29 @@ void LibraryWindow::createToolBars() editInfoToolBar->addAction(selectAllComicsAction); editInfoToolBar->addSeparator(); editInfoToolBar->addAction(asignOrderActions); + + editInfoToolBar->addSeparator(); + + QToolButton * tb = new QToolButton(); + tb->addAction(setAsReadAction); + tb->addAction(setAllAsReadAction); + tb->setPopupMode(QToolButton::MenuButtonPopup); + tb->setDefaultAction(setAsReadAction); + + QToolButton * tb2 = new QToolButton(); + tb2->addAction(setAsNonReadAction); + tb2->addAction(setAllAsNonReadAction); + tb2->setPopupMode(QToolButton::MenuButtonPopup); + tb2->setDefaultAction(setAsNonReadAction); + + editInfoToolBar->addWidget(tb); + editInfoToolBar->addWidget(tb2); + + editInfoToolBar->addAction(showHideMarksAction); + editInfoToolBar->addWidget(new QToolBarStretch()); editInfoToolBar->addAction(hideComicViewAction); + } void LibraryWindow::createMenus() @@ -688,7 +688,7 @@ void LibraryWindow::createConnections() connect(updateLibraryAction,SIGNAL(triggered()),this,SLOT(updateLibrary())); connect(renameLibraryAction,SIGNAL(triggered()),this,SLOT(renameLibrary())); - connect(deleteLibraryAction,SIGNAL(triggered()),this,SLOT(deleteLibrary())); + //connect(deleteLibraryAction,SIGNAL(triggered()),this,SLOT(deleteLibrary())); connect(removeLibraryAction,SIGNAL(triggered()),this,SLOT(removeLibrary())); connect(openComicAction,SIGNAL(triggered()),this,SLOT(openComic())); connect(helpAboutAction,SIGNAL(triggered()),had,SLOT(show())); @@ -1187,7 +1187,10 @@ void LibraryWindow::deleteCurrentLibrary() void LibraryWindow::removeLibrary() { QString currentLibrary = selectedLibrary->currentText(); - if(QMessageBox::question(this,tr("Are you sure?"),tr("Do you want remove ")+currentLibrary+tr(" library?\nFiles won't be erased from disk."),QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes) + QMessageBox * messageBox = new QMessageBox(tr("Are you sure?"),tr("Do you want remove ")+currentLibrary+tr(" library?"),QMessageBox::Question,QMessageBox::Yes,QMessageBox::YesToAll,QMessageBox::No); + messageBox->button(QMessageBox::YesToAll)->setText(tr("Remove and delete metadata")); + int ret = messageBox->exec(); + if(ret == QMessageBox::Yes) { libraries.remove(currentLibrary); selectedLibrary->removeItem(selectedLibrary->currentIndex()); @@ -1200,6 +1203,10 @@ void LibraryWindow::removeLibrary() } saveLibraries(); } + else if(ret == QMessageBox::YesToAll) + { + deleteCurrentLibrary(); + } } void LibraryWindow::renameLibrary() diff --git a/YACReaderLibrary/library_window.h b/YACReaderLibrary/library_window.h index a60f5344..5d76da9b 100644 --- a/YACReaderLibrary/library_window.h +++ b/YACReaderLibrary/library_window.h @@ -114,7 +114,7 @@ private: QAction * importLibraryAction; QAction * updateLibraryAction; - QAction * deleteLibraryAction; + //QAction * deleteLibraryAction; QAction * removeLibraryAction; QAction * helpAboutAction; QAction * renameLibraryAction;