mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
added reset comic rating action to the comics list context menu
This commit is contained in:
parent
ea990b8261
commit
9267c0335c
@ -577,7 +577,23 @@ void TableModel::reload(const ComicDB & comic)
|
||||
row++;
|
||||
}
|
||||
if(found)
|
||||
emit dataChanged(index(row,TableModel::CurrentPage),index(row,TableModel::CurrentPage));
|
||||
emit dataChanged(index(row,TableModel::CurrentPage),index(row,TableModel::CurrentPage));
|
||||
}
|
||||
|
||||
void TableModel::resetComicRating(const QModelIndex &mi)
|
||||
{
|
||||
ComicDB comic = getComic(mi);
|
||||
|
||||
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
|
||||
|
||||
comic.info.rating = 0;
|
||||
_data[mi.row()]->setData(TableModel::Rating,0);
|
||||
DBHelper::update(&(comic.info),db);
|
||||
|
||||
emit dataChanged(mi,mi);
|
||||
|
||||
db.close();
|
||||
QSqlDatabase::removeDatabase(_databasePath);
|
||||
}
|
||||
|
||||
void TableModel::updateRating(int rating, QModelIndex mi)
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
void remove(ComicDB * comic, int row);
|
||||
void removeInTransaction(int row);
|
||||
void reload(const ComicDB & comic);
|
||||
void resetComicRating(const QModelIndex & mi);
|
||||
|
||||
enum Columns {
|
||||
Number = 0,
|
||||
|
@ -445,6 +445,9 @@ void LibraryWindow::createActions()
|
||||
openContainingFolderComicAction->setText(tr("Open containing folder..."));
|
||||
openContainingFolderComicAction->setIcon(QIcon(":/images/open.png"));
|
||||
|
||||
resetComicRatingAction = new QAction(this);
|
||||
resetComicRatingAction->setText(tr("Reset comic rating"));
|
||||
|
||||
//Edit comics actions------------------------------------------------------
|
||||
selectAllComicsAction = new QAction(this);
|
||||
selectAllComicsAction->setText(tr("Select all comics"));
|
||||
@ -496,6 +499,8 @@ void LibraryWindow::disableComicsActions(bool disabled)
|
||||
deleteComicsAction->setDisabled(disabled);
|
||||
//context menu
|
||||
openContainingFolderComicAction->setDisabled(disabled);
|
||||
resetComicRatingAction->setDisabled(disabled);
|
||||
|
||||
getInfoAction->setDisabled(disabled);
|
||||
|
||||
|
||||
@ -607,6 +612,14 @@ void LibraryWindow::createToolBars()
|
||||
void LibraryWindow::createMenus()
|
||||
{
|
||||
comicView->addAction(openContainingFolderComicAction);
|
||||
|
||||
{
|
||||
QAction *act = new QAction(this);
|
||||
act->setSeparator(true);
|
||||
comicView->addAction(act);
|
||||
}
|
||||
comicView->addAction(resetComicRatingAction);
|
||||
|
||||
foldersView->addAction(openContainingFolderAction);
|
||||
|
||||
selectedLibrary->addAction(updateLibraryAction);
|
||||
@ -739,6 +752,7 @@ void LibraryWindow::createConnections()
|
||||
//ContextMenus
|
||||
connect(openContainingFolderComicAction,SIGNAL(triggered()),this,SLOT(openContainingFolderComic()));
|
||||
connect(openContainingFolderAction,SIGNAL(triggered()),this,SLOT(openContainingFolder()));
|
||||
connect(resetComicRatingAction,SIGNAL(triggered()),this,SLOT(resetComicRating()));
|
||||
|
||||
//connect(dm,SIGNAL(directoryLoaded(QString)),foldersView,SLOT(expandAll()));
|
||||
//connect(dm,SIGNAL(directoryLoaded(QString)),this,SLOT(updateFoldersView(QString)));
|
||||
@ -1443,7 +1457,19 @@ void LibraryWindow::checkRemoveError()
|
||||
{
|
||||
QMessageBox::critical(this,tr("Unable to delete"),tr("There was an issue trying to delete the selected comics. Please, check for write permissions in the selected files or containing folder."));
|
||||
}
|
||||
removeError = false;
|
||||
removeError = false;
|
||||
}
|
||||
|
||||
void LibraryWindow::resetComicRating()
|
||||
{
|
||||
QModelIndexList indexList = getSelectedComics();
|
||||
|
||||
dmCV->startTransaction();
|
||||
for(auto & index:indexList)
|
||||
{
|
||||
dmCV->resetComicRating(index);
|
||||
}
|
||||
dmCV->finishTransaction();
|
||||
}
|
||||
|
||||
void LibraryWindow::asignNumbers()
|
||||
|
@ -144,6 +144,7 @@ private:
|
||||
//QAction * setAllAsNonReadAction;
|
||||
QAction * showHideMarksAction;
|
||||
QAction * getInfoAction; //comic vine
|
||||
QAction * resetComicRatingAction;
|
||||
|
||||
//edit info actions
|
||||
QAction * selectAllComicsAction;
|
||||
@ -274,6 +275,7 @@ public:
|
||||
void showComicVineScraper();
|
||||
void setRemoveError();
|
||||
void checkRemoveError();
|
||||
void resetComicRating();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user