Add support for setting issues as manga/normal in the comics view

This commit is contained in:
Luis Ángel San Martín 2021-01-16 14:25:47 +01:00
parent 52953633e5
commit 97c7723b17
10 changed files with 70 additions and 0 deletions

View File

@ -778,6 +778,24 @@ QVector<YACReaderComicReadStatus> ComicModel::setComicsRead(QList<QModelIndex> l
return getReadList(); return getReadList();
} }
void ComicModel::setComicsManga(QList<QModelIndex> list, bool isManga)
{
QString connectionName = "";
{
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
db.transaction();
foreach (QModelIndex mi, list) {
ComicDB c = DBHelper::loadComic(_data.value(mi.row())->data(ComicModel::Id).toULongLong(), db);
c.info.manga = isManga;
DBHelper::update(&(c.info), db);
}
db.commit();
connectionName = db.connectionName();
}
QSqlDatabase::removeDatabase(connectionName);
}
qint64 ComicModel::asignNumbers(QList<QModelIndex> list, int startingNumber) qint64 ComicModel::asignNumbers(QList<QModelIndex> list, int startingNumber)
{ {
qint64 idFirst; qint64 idFirst;

View File

@ -105,6 +105,7 @@ public:
//setComicInfoForAllComics(); --> inserta la información común a todos los cómics de una sola vez. //setComicInfoForAllComics(); --> inserta la información común a todos los cómics de una sola vez.
//setComicInfoForSelectedComis(QList<QModelIndex> list); -->inserta la información común para los comics seleccionados //setComicInfoForSelectedComis(QList<QModelIndex> list); -->inserta la información común para los comics seleccionados
QVector<YACReaderComicReadStatus> setComicsRead(QList<QModelIndex> list, YACReaderComicReadStatus read); QVector<YACReaderComicReadStatus> setComicsRead(QList<QModelIndex> list, YACReaderComicReadStatus read);
void setComicsManga(QList<QModelIndex> list, bool isManga);
qint64 asignNumbers(QList<QModelIndex> list, int startingNumber); qint64 asignNumbers(QList<QModelIndex> list, int startingNumber);
//void remove(ComicDB * comic, int row); //void remove(ComicDB * comic, int row);
void removeInTransaction(int row); void removeInTransaction(int row);

View File

@ -38,6 +38,10 @@
<file>../images/comics_view_toolbar/trash@2x.png</file> <file>../images/comics_view_toolbar/trash@2x.png</file>
<file>../images/comics_view_toolbar/show_comic_info.png</file> <file>../images/comics_view_toolbar/show_comic_info.png</file>
<file>../images/comics_view_toolbar/show_comic_info@2x.png</file> <file>../images/comics_view_toolbar/show_comic_info@2x.png</file>
<file>../images/comics_view_toolbar/setManga.png</file>
<file>../images/comics_view_toolbar/setManga@2x.png</file>
<file>../images/comics_view_toolbar/setNormal.png</file>
<file>../images/comics_view_toolbar/setNormal@2x.png</file>
<file>../images/coversPackage.png</file> <file>../images/coversPackage.png</file>
<file>../images/db.png</file> <file>../images/db.png</file>
<file>../images/defaultCover.png</file> <file>../images/defaultCover.png</file>

View File

@ -324,6 +324,8 @@ void LibraryWindow::setUpShortcutsManagement()
<< saveCoversToAction << saveCoversToAction
<< setAsReadAction << setAsReadAction
<< setAsNonReadAction << setAsNonReadAction
<< setMangaAction
<< setNormalAction
<< openContainingFolderComicAction << openContainingFolderComicAction
<< resetComicRatingAction << resetComicRatingAction
<< selectAllComicsAction << selectAllComicsAction
@ -508,6 +510,18 @@ void LibraryWindow::createActions()
setAsNonReadAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SET_AS_NON_READ_ACTION_YL)); setAsNonReadAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SET_AS_NON_READ_ACTION_YL));
setAsNonReadAction->setIcon(QIcon(":/images/comics_view_toolbar/setUnread.png")); setAsNonReadAction->setIcon(QIcon(":/images/comics_view_toolbar/setUnread.png"));
setMangaAction = new QAction(tr("Set as manga"), this);
setMangaAction->setToolTip(tr("Set issue as manga"));
setMangaAction->setData(SET_AS_MANGA_ACTION_YL);
setMangaAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SET_AS_MANGA_ACTION_YL));
setMangaAction->setIcon(QIcon(":/images/comics_view_toolbar/setManga.png"));
setNormalAction = new QAction(tr("Set as normal"), this);
setNormalAction->setToolTip(tr("Set issue as normal"));
setNormalAction->setData(SET_AS_NORMAL_ACTION_YL);
setNormalAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SET_AS_NORMAL_ACTION_YL));
setNormalAction->setIcon(QIcon(":/images/comics_view_toolbar/setNormal.png"));
/*setAllAsReadAction = new QAction(tr("Set all as read"),this); /*setAllAsReadAction = new QAction(tr("Set all as read"),this);
setAllAsReadAction->setToolTip(tr("Set all comics as read")); setAllAsReadAction->setToolTip(tr("Set all comics as read"));
setAllAsReadAction->setIcon(QIcon(":/images/comics_view_toolbar/setAllRead.png")); setAllAsReadAction->setIcon(QIcon(":/images/comics_view_toolbar/setAllRead.png"));
@ -753,6 +767,8 @@ void LibraryWindow::disableComicsActions(bool disabled)
asignOrderAction->setDisabled(disabled); asignOrderAction->setDisabled(disabled);
setAsReadAction->setDisabled(disabled); setAsReadAction->setDisabled(disabled);
setAsNonReadAction->setDisabled(disabled); setAsNonReadAction->setDisabled(disabled);
setNormalAction->setDisabled(disabled);
setMangaAction->setDisabled(disabled);
//setAllAsReadAction->setDisabled(disabled); //setAllAsReadAction->setDisabled(disabled);
//setAllAsNonReadAction->setDisabled(disabled); //setAllAsNonReadAction->setDisabled(disabled);
showHideMarksAction->setDisabled(disabled); showHideMarksAction->setDisabled(disabled);
@ -870,6 +886,11 @@ void LibraryWindow::createToolBars()
editInfoToolBar->addSeparator(); editInfoToolBar->addSeparator();
editInfoToolBar->addAction(setNormalAction);
editInfoToolBar->addAction(setMangaAction);
editInfoToolBar->addSeparator();
editInfoToolBar->addAction(deleteComicsAction); editInfoToolBar->addAction(deleteComicsAction);
comicsViewsManager->comicsView->setToolBar(editInfoToolBar); comicsViewsManager->comicsView->setToolBar(editInfoToolBar);
@ -1019,6 +1040,8 @@ void LibraryWindow::createConnections()
connect(openLibraryAction, SIGNAL(triggered()), this, SLOT(showAddLibrary())); connect(openLibraryAction, SIGNAL(triggered()), this, SLOT(showAddLibrary()));
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(setNormalAction, &QAction::triggered, this, &LibraryWindow::setSelectedComicsAsNormal);
connect(setMangaAction, &QAction::triggered, this, &LibraryWindow::setSelectedComicsAsManga);
//connect(setAllAsReadAction,SIGNAL(triggered()),this,SLOT(setComicsReaded())); //connect(setAllAsReadAction,SIGNAL(triggered()),this,SLOT(setComicsReaded()));
//connect(setAllAsNonReadAction,SIGNAL(triggered()),this,SLOT(setComicsUnreaded())); //connect(setAllAsNonReadAction,SIGNAL(triggered()),this,SLOT(setComicsUnreaded()));
@ -1594,6 +1617,9 @@ void LibraryWindow::showComicsViewContextMenu(const QPoint &point)
menu.addAction(setAsReadAction); menu.addAction(setAsReadAction);
menu.addAction(setAsNonReadAction); menu.addAction(setAsNonReadAction);
menu.addSeparator(); menu.addSeparator();
menu.addAction(setNormalAction);
menu.addAction(setMangaAction);
menu.addSeparator();
menu.addAction(deleteComicsAction); menu.addAction(deleteComicsAction);
menu.addSeparator(); menu.addSeparator();
menu.addAction(addToMenuAction); menu.addAction(addToMenuAction);
@ -1627,6 +1653,9 @@ void LibraryWindow::showComicsItemContextMenu(const QPoint &point)
menu.addAction(setAsReadAction); menu.addAction(setAsReadAction);
menu.addAction(setAsNonReadAction); menu.addAction(setAsNonReadAction);
menu.addSeparator(); menu.addSeparator();
menu.addAction(setNormalAction);
menu.addAction(setMangaAction);
menu.addSeparator();
menu.addAction(deleteComicsAction); menu.addAction(deleteComicsAction);
menu.addSeparator(); menu.addSeparator();
menu.addAction(addToMenuAction); menu.addAction(addToMenuAction);
@ -1793,6 +1822,16 @@ void LibraryWindow::setCurrentComicUnreaded()
this->setCurrentComicsStatusReaded(YACReader::Unread); this->setCurrentComicsStatusReaded(YACReader::Unread);
} }
void LibraryWindow::setSelectedComicsAsNormal()
{
comicsModel->setComicsManga(getSelectedComics(), false);
}
void LibraryWindow::setSelectedComicsAsManga()
{
comicsModel->setComicsManga(getSelectedComics(), true);
}
void LibraryWindow::createLibrary() void LibraryWindow::createLibrary()
{ {
checkMaxNumLibraries(); checkMaxNumLibraries();

View File

@ -193,6 +193,10 @@ public:
QAction *openContainingFolderComicAction; QAction *openContainingFolderComicAction;
QAction *setAsReadAction; QAction *setAsReadAction;
QAction *setAsNonReadAction; QAction *setAsNonReadAction;
QAction *setMangaAction;
QAction *setNormalAction;
//QAction * setAllAsReadAction; //QAction * setAllAsReadAction;
//QAction * setAllAsNonReadAction; //QAction * setAllAsNonReadAction;
QAction *showHideMarksAction; QAction *showHideMarksAction;
@ -339,6 +343,8 @@ public slots:
void setCurrentComicsStatusReaded(YACReaderComicReadStatus readStatus); void setCurrentComicsStatusReaded(YACReaderComicReadStatus readStatus);
void setCurrentComicReaded(); void setCurrentComicReaded();
void setCurrentComicUnreaded(); void setCurrentComicUnreaded();
void setSelectedComicsAsNormal();
void setSelectedComicsAsManga();
void showExportComicsInfo(); void showExportComicsInfo();
void showImportComicsInfo(); void showImportComicsInfo();
void asignNumbers(); void asignNumbers();

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

View File

@ -48,6 +48,8 @@ public:
#define OPEN_COMIC_ACTION_YL "OPEN_COMIC_ACTION_YL" #define OPEN_COMIC_ACTION_YL "OPEN_COMIC_ACTION_YL"
#define SET_AS_READ_ACTION_YL "SET_AS_READ_ACTION_YL" #define SET_AS_READ_ACTION_YL "SET_AS_READ_ACTION_YL"
#define SET_AS_NON_READ_ACTION_YL "SET_AS_NON_READ_ACTION_YL" #define SET_AS_NON_READ_ACTION_YL "SET_AS_NON_READ_ACTION_YL"
#define SET_AS_MANGA_ACTION_YL "SET_AS_MANGA_ACTION_YL"
#define SET_AS_NORMAL_ACTION_YL "SET_AS_MANGA_ACTION_YL"
#define SHOW_HIDE_MARKS_ACTION_YL "SHOW_HIDE_MARKS_ACTION_YL" #define SHOW_HIDE_MARKS_ACTION_YL "SHOW_HIDE_MARKS_ACTION_YL"
#define TOGGLE_FULL_SCREEN_ACTION_YL "TOGGLE_FULL_SCREEN_ACTION_YL" #define TOGGLE_FULL_SCREEN_ACTION_YL "TOGGLE_FULL_SCREEN_ACTION_YL"
#define HELP_ABOUT_ACTION_YL "HELP_ABOUT_ACTION_YL" #define HELP_ABOUT_ACTION_YL "HELP_ABOUT_ACTION_YL"