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++;
|
row++;
|
||||||
}
|
}
|
||||||
if(found)
|
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)
|
void TableModel::updateRating(int rating, QModelIndex mi)
|
||||||
|
@ -54,6 +54,7 @@ public:
|
|||||||
void remove(ComicDB * comic, int row);
|
void remove(ComicDB * comic, int row);
|
||||||
void removeInTransaction(int row);
|
void removeInTransaction(int row);
|
||||||
void reload(const ComicDB & comic);
|
void reload(const ComicDB & comic);
|
||||||
|
void resetComicRating(const QModelIndex & mi);
|
||||||
|
|
||||||
enum Columns {
|
enum Columns {
|
||||||
Number = 0,
|
Number = 0,
|
||||||
|
@ -445,6 +445,9 @@ void LibraryWindow::createActions()
|
|||||||
openContainingFolderComicAction->setText(tr("Open containing folder..."));
|
openContainingFolderComicAction->setText(tr("Open containing folder..."));
|
||||||
openContainingFolderComicAction->setIcon(QIcon(":/images/open.png"));
|
openContainingFolderComicAction->setIcon(QIcon(":/images/open.png"));
|
||||||
|
|
||||||
|
resetComicRatingAction = new QAction(this);
|
||||||
|
resetComicRatingAction->setText(tr("Reset comic rating"));
|
||||||
|
|
||||||
//Edit comics actions------------------------------------------------------
|
//Edit comics actions------------------------------------------------------
|
||||||
selectAllComicsAction = new QAction(this);
|
selectAllComicsAction = new QAction(this);
|
||||||
selectAllComicsAction->setText(tr("Select all comics"));
|
selectAllComicsAction->setText(tr("Select all comics"));
|
||||||
@ -496,6 +499,8 @@ void LibraryWindow::disableComicsActions(bool disabled)
|
|||||||
deleteComicsAction->setDisabled(disabled);
|
deleteComicsAction->setDisabled(disabled);
|
||||||
//context menu
|
//context menu
|
||||||
openContainingFolderComicAction->setDisabled(disabled);
|
openContainingFolderComicAction->setDisabled(disabled);
|
||||||
|
resetComicRatingAction->setDisabled(disabled);
|
||||||
|
|
||||||
getInfoAction->setDisabled(disabled);
|
getInfoAction->setDisabled(disabled);
|
||||||
|
|
||||||
|
|
||||||
@ -607,6 +612,14 @@ void LibraryWindow::createToolBars()
|
|||||||
void LibraryWindow::createMenus()
|
void LibraryWindow::createMenus()
|
||||||
{
|
{
|
||||||
comicView->addAction(openContainingFolderComicAction);
|
comicView->addAction(openContainingFolderComicAction);
|
||||||
|
|
||||||
|
{
|
||||||
|
QAction *act = new QAction(this);
|
||||||
|
act->setSeparator(true);
|
||||||
|
comicView->addAction(act);
|
||||||
|
}
|
||||||
|
comicView->addAction(resetComicRatingAction);
|
||||||
|
|
||||||
foldersView->addAction(openContainingFolderAction);
|
foldersView->addAction(openContainingFolderAction);
|
||||||
|
|
||||||
selectedLibrary->addAction(updateLibraryAction);
|
selectedLibrary->addAction(updateLibraryAction);
|
||||||
@ -739,6 +752,7 @@ void LibraryWindow::createConnections()
|
|||||||
//ContextMenus
|
//ContextMenus
|
||||||
connect(openContainingFolderComicAction,SIGNAL(triggered()),this,SLOT(openContainingFolderComic()));
|
connect(openContainingFolderComicAction,SIGNAL(triggered()),this,SLOT(openContainingFolderComic()));
|
||||||
connect(openContainingFolderAction,SIGNAL(triggered()),this,SLOT(openContainingFolder()));
|
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)),foldersView,SLOT(expandAll()));
|
||||||
//connect(dm,SIGNAL(directoryLoaded(QString)),this,SLOT(updateFoldersView(QString)));
|
//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."));
|
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()
|
void LibraryWindow::asignNumbers()
|
||||||
|
@ -144,6 +144,7 @@ private:
|
|||||||
//QAction * setAllAsNonReadAction;
|
//QAction * setAllAsNonReadAction;
|
||||||
QAction * showHideMarksAction;
|
QAction * showHideMarksAction;
|
||||||
QAction * getInfoAction; //comic vine
|
QAction * getInfoAction; //comic vine
|
||||||
|
QAction * resetComicRatingAction;
|
||||||
|
|
||||||
//edit info actions
|
//edit info actions
|
||||||
QAction * selectAllComicsAction;
|
QAction * selectAllComicsAction;
|
||||||
@ -274,6 +275,7 @@ public:
|
|||||||
void showComicVineScraper();
|
void showComicVineScraper();
|
||||||
void setRemoveError();
|
void setRemoveError();
|
||||||
void checkRemoveError();
|
void checkRemoveError();
|
||||||
|
void resetComicRating();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user