mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
fixed comic view context menus
This commit is contained in:
parent
f6436a3722
commit
c645fe4c66
@ -29,13 +29,7 @@ ClassicComicsView::ClassicComicsView(QWidget *parent)
|
|||||||
|
|
||||||
comicFlow->setFocus(Qt::OtherFocusReason);
|
comicFlow->setFocus(Qt::OtherFocusReason);
|
||||||
|
|
||||||
comicFlow->setContextMenuPolicy(Qt::ActionsContextMenu);
|
comicFlow->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
|
||||||
//TODO!!! set actions....
|
|
||||||
//comicFlow->addAction(toggleFullScreenAction);
|
|
||||||
//comicFlow->addAction(openComicAction);
|
|
||||||
|
|
||||||
//END FLOW----
|
|
||||||
|
|
||||||
|
|
||||||
//layout-----------------------------------------------
|
//layout-----------------------------------------------
|
||||||
@ -61,6 +55,8 @@ ClassicComicsView::ClassicComicsView(QWidget *parent)
|
|||||||
comics->setLayout(comicsLayout);
|
comics->setLayout(comicsLayout);
|
||||||
sVertical->addWidget(comics);
|
sVertical->addWidget(comics);
|
||||||
|
|
||||||
|
tableView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
|
||||||
//config--------------------------------------------------
|
//config--------------------------------------------------
|
||||||
if(settings->contains(COMICS_VIEW_HEADERS))
|
if(settings->contains(COMICS_VIEW_HEADERS))
|
||||||
tableView->horizontalHeader()->restoreState(settings->value(COMICS_VIEW_HEADERS).toByteArray());
|
tableView->horizontalHeader()->restoreState(settings->value(COMICS_VIEW_HEADERS).toByteArray());
|
||||||
@ -72,6 +68,8 @@ ClassicComicsView::ClassicComicsView(QWidget *parent)
|
|||||||
connect(tableView, SIGNAL(comicRated(int,QModelIndex)), this, SIGNAL(comicRated(int,QModelIndex)));
|
connect(tableView, SIGNAL(comicRated(int,QModelIndex)), this, SIGNAL(comicRated(int,QModelIndex)));
|
||||||
connect(comicFlow, SIGNAL(selected(uint)), this, SIGNAL(selected(uint)));
|
connect(comicFlow, SIGNAL(selected(uint)), this, SIGNAL(selected(uint)));
|
||||||
connect(tableView->horizontalHeader(), SIGNAL(sectionMoved(int,int,int)), this, SLOT(saveTableHeadersStatus()));
|
connect(tableView->horizontalHeader(), SIGNAL(sectionMoved(int,int,int)), this, SLOT(saveTableHeadersStatus()));
|
||||||
|
connect(comicFlow, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(requestedViewContextMenu(QPoint)));
|
||||||
|
connect(tableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(requestedItemContextMenu(QPoint)));
|
||||||
layout->addWidget(sVertical);
|
layout->addWidget(sVertical);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
@ -194,16 +192,6 @@ void ClassicComicsView::updateConfig(QSettings *settings)
|
|||||||
comicFlow->updateConfig(settings);
|
comicFlow->updateConfig(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassicComicsView::setItemActions(const QList<QAction *> &actions)
|
|
||||||
{
|
|
||||||
tableView->addActions(actions);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClassicComicsView::setViewActions(const QList<QAction *> &actions)
|
|
||||||
{
|
|
||||||
comicFlow->addActions(actions);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClassicComicsView::enableFilterMode(bool enabled)
|
void ClassicComicsView::enableFilterMode(bool enabled)
|
||||||
{
|
{
|
||||||
if(enabled)
|
if(enabled)
|
||||||
@ -239,6 +227,16 @@ void ClassicComicsView::selectedComicForOpening(const QModelIndex &mi)
|
|||||||
emit selected(mi.row());
|
emit selected(mi.row());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClassicComicsView::requestedViewContextMenu(const QPoint &point)
|
||||||
|
{
|
||||||
|
emit customContextMenuViewRequested(comicFlow->mapTo(this, point));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClassicComicsView::requestedItemContextMenu(const QPoint &point)
|
||||||
|
{
|
||||||
|
emit customContextMenuItemRequested(tableView->mapTo(this, point));
|
||||||
|
}
|
||||||
|
|
||||||
void ClassicComicsView::setShowMarks(bool show)
|
void ClassicComicsView::setShowMarks(bool show)
|
||||||
{
|
{
|
||||||
comicFlow->setShowMarks(show);
|
comicFlow->setShowMarks(show);
|
||||||
|
@ -27,8 +27,6 @@ public:
|
|||||||
void toFullScreen();
|
void toFullScreen();
|
||||||
void toNormal();
|
void toNormal();
|
||||||
void updateConfig(QSettings * settings);
|
void updateConfig(QSettings * settings);
|
||||||
void setItemActions(const QList<QAction *> & actions);
|
|
||||||
void setViewActions(const QList<QAction *> & actions);
|
|
||||||
void enableFilterMode(bool enabled);
|
void enableFilterMode(bool enabled);
|
||||||
void selectIndex(int index);
|
void selectIndex(int index);
|
||||||
|
|
||||||
@ -44,6 +42,10 @@ public slots:
|
|||||||
void selectAll();
|
void selectAll();
|
||||||
void selectedComicForOpening(const QModelIndex & mi);
|
void selectedComicForOpening(const QModelIndex & mi);
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void requestedViewContextMenu(const QPoint & point);
|
||||||
|
void requestedItemContextMenu(const QPoint & point);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
YACReaderTableView * tableView;
|
YACReaderTableView * tableView;
|
||||||
QWidget *comics;
|
QWidget *comics;
|
||||||
|
@ -24,10 +24,6 @@ public:
|
|||||||
virtual void toFullScreen() = 0;
|
virtual void toFullScreen() = 0;
|
||||||
virtual void toNormal() = 0;
|
virtual void toNormal() = 0;
|
||||||
virtual void updateConfig(QSettings * settings) = 0;
|
virtual void updateConfig(QSettings * settings) = 0;
|
||||||
//Actions for tableviews
|
|
||||||
virtual void setItemActions(const QList<QAction *> & actions) = 0;
|
|
||||||
//actions for visual-oriented views
|
|
||||||
virtual void setViewActions(const QList<QAction *> & actions) = 0;
|
|
||||||
virtual void enableFilterMode(bool enabled) = 0;
|
virtual void enableFilterMode(bool enabled) = 0;
|
||||||
virtual void selectIndex(int index) = 0;
|
virtual void selectIndex(int index) = 0;
|
||||||
|
|
||||||
@ -35,6 +31,10 @@ signals:
|
|||||||
void selected(unsigned int);
|
void selected(unsigned int);
|
||||||
void comicRated(int,QModelIndex);
|
void comicRated(int,QModelIndex);
|
||||||
|
|
||||||
|
//Context menus
|
||||||
|
void customContextMenuViewRequested(QPoint);
|
||||||
|
void customContextMenuItemRequested(QPoint);
|
||||||
|
|
||||||
//Drops
|
//Drops
|
||||||
void copyComicsToCurrentFolder(QList<QPair<QString, QString> >);
|
void copyComicsToCurrentFolder(QList<QPair<QString, QString> >);
|
||||||
void moveComicsToCurrentFolder(QList<QPair<QString, QString> >);
|
void moveComicsToCurrentFolder(QList<QPair<QString, QString> >);
|
||||||
|
@ -59,6 +59,7 @@ void GridComicsView::setModel(ComicModel *model)
|
|||||||
|
|
||||||
ctxt->setContextProperty("comicsList", this->model);
|
ctxt->setContextProperty("comicsList", this->model);
|
||||||
ctxt->setContextProperty("comicsSelection", _selectionModel);
|
ctxt->setContextProperty("comicsSelection", _selectionModel);
|
||||||
|
ctxt->setContextProperty("contextMenuHelper",this);
|
||||||
ctxt->setContextProperty("comicsSelectionHelper", this);
|
ctxt->setContextProperty("comicsSelectionHelper", this);
|
||||||
ctxt->setContextProperty("comicRatingHelper", this);
|
ctxt->setContextProperty("comicRatingHelper", this);
|
||||||
ctxt->setContextProperty("dummyValue", true);
|
ctxt->setContextProperty("dummyValue", true);
|
||||||
@ -76,9 +77,9 @@ void GridComicsView::setModel(ComicModel *model)
|
|||||||
ctxt->setContextProperty("titleColor", "#121212");
|
ctxt->setContextProperty("titleColor", "#121212");
|
||||||
ctxt->setContextProperty("textColor", "#636363");
|
ctxt->setContextProperty("textColor", "#636363");
|
||||||
//fonts settings
|
//fonts settings
|
||||||
ctxt->setContextProperty("fontSize", "11");
|
ctxt->setContextProperty("fontSize", 11);
|
||||||
ctxt->setContextProperty("fontFamily", "none");
|
ctxt->setContextProperty("fontFamily", "none");
|
||||||
ctxt->setContextProperty("fontSpacing", "0.5");
|
ctxt->setContextProperty("fontSpacing", 0.5);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
ctxt->setContextProperty("backgroundColor", "#2A2A2A");
|
ctxt->setContextProperty("backgroundColor", "#2A2A2A");
|
||||||
@ -92,7 +93,7 @@ void GridComicsView::setModel(ComicModel *model)
|
|||||||
//fonts settings
|
//fonts settings
|
||||||
ctxt->setContextProperty("fontSize", "none");
|
ctxt->setContextProperty("fontSize", "none");
|
||||||
ctxt->setContextProperty("fontFamily", "none");
|
ctxt->setContextProperty("fontFamily", "none");
|
||||||
ctxt->setContextProperty("fontSpacing", "0.5");
|
ctxt->setContextProperty("fontSpacing", 0.5);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -144,54 +145,6 @@ void GridComicsView::updateConfig(QSettings *settings)
|
|||||||
QLOG_INFO() << "updateConfig";
|
QLOG_INFO() << "updateConfig";
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridComicsView::setItemActions(const QList<QAction *> &actions)
|
|
||||||
{
|
|
||||||
QLOG_INFO() << "setItemActions";
|
|
||||||
}
|
|
||||||
|
|
||||||
void GridComicsView::setViewActions(const QList<QAction *> &actions)
|
|
||||||
{
|
|
||||||
//TODO generate QML Menu from actions
|
|
||||||
QLOG_INFO() << "setViewActions";
|
|
||||||
this->addActions(actions);
|
|
||||||
|
|
||||||
//TODO this is completely unsafe, but QActions can't be used directly in QML
|
|
||||||
if(actions.length()>=19)
|
|
||||||
{
|
|
||||||
QQmlContext *ctxt = view->rootContext();
|
|
||||||
|
|
||||||
ctxt->setContextProperty("openComicAction",actions[0]);
|
|
||||||
|
|
||||||
ctxt->setContextProperty("openContainingFolderComicAction",actions[2]);
|
|
||||||
ctxt->setContextProperty("updateCurrentFolderAction",actions[3]);
|
|
||||||
|
|
||||||
ctxt->setContextProperty("resetComicRatingAction",actions[5]);
|
|
||||||
|
|
||||||
ctxt->setContextProperty("editSelectedComicsAction",actions[7]);
|
|
||||||
ctxt->setContextProperty("getInfoAction",actions[8]);
|
|
||||||
ctxt->setContextProperty("asignOrderAction",actions[9]);
|
|
||||||
|
|
||||||
ctxt->setContextProperty("selectAllComicsAction",actions[11]);
|
|
||||||
|
|
||||||
ctxt->setContextProperty("setAsReadAction",actions[13]);
|
|
||||||
ctxt->setContextProperty("setAsNonReadAction",actions[14]);
|
|
||||||
ctxt->setContextProperty("showHideMarksAction",actions[15]);
|
|
||||||
|
|
||||||
ctxt->setContextProperty("deleteComicsAction",actions[17]);
|
|
||||||
|
|
||||||
QAction * tmpAction = actions[19];
|
|
||||||
QMenu * menu = tmpAction->menu();
|
|
||||||
if(menu)
|
|
||||||
{
|
|
||||||
ctxt->setContextProperty("addToFavoritesAction",menu->actions().at(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
ctxt->setContextProperty("toggleFullScreenAction",actions[21]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
QLOG_ERROR() << "setViewActions invoked with the wrong number of actions";
|
|
||||||
}
|
|
||||||
|
|
||||||
void GridComicsView::enableFilterMode(bool enabled)
|
void GridComicsView::enableFilterMode(bool enabled)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -208,6 +161,11 @@ void GridComicsView::rate(int index, int rating)
|
|||||||
model->updateRating(rating,model->index(index,0));
|
model->updateRating(rating,model->index(index,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GridComicsView::requestedContextMenu(const QPoint &point)
|
||||||
|
{
|
||||||
|
emit customContextMenuViewRequested(point);
|
||||||
|
}
|
||||||
|
|
||||||
QSize GridComicsView::sizeHint()
|
QSize GridComicsView::sizeHint()
|
||||||
{
|
{
|
||||||
QLOG_INFO() << "sizeHint";
|
QLOG_INFO() << "sizeHint";
|
||||||
|
@ -26,8 +26,6 @@ public:
|
|||||||
void toFullScreen();
|
void toFullScreen();
|
||||||
void toNormal();
|
void toNormal();
|
||||||
void updateConfig(QSettings * settings);
|
void updateConfig(QSettings * settings);
|
||||||
void setItemActions(const QList<QAction *> & actions);
|
|
||||||
void setViewActions(const QList<QAction *> & actions);
|
|
||||||
void enableFilterMode(bool enabled);
|
void enableFilterMode(bool enabled);
|
||||||
QSize sizeHint();
|
QSize sizeHint();
|
||||||
|
|
||||||
@ -50,6 +48,8 @@ public slots:
|
|||||||
//rating
|
//rating
|
||||||
void rate(int index, int rating);
|
void rate(int index, int rating);
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void requestedContextMenu(const QPoint & point);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QItemSelectionModel * _selectionModel;
|
QItemSelectionModel * _selectionModel;
|
||||||
|
@ -440,6 +440,8 @@ void LibraryWindow::disconnectComicsViewConnections(ComicsView * widget)
|
|||||||
disconnect(selectAllComicsAction,SIGNAL(triggered()),widget,SLOT(selectAll()));
|
disconnect(selectAllComicsAction,SIGNAL(triggered()),widget,SLOT(selectAll()));
|
||||||
disconnect(comicsView, SIGNAL(copyComicsToCurrentFolder(QList<QPair<QString, QString> >)), this, SLOT(copyAndImportComicsToCurrentFolder(QList<QPair<QString, QString> >)));
|
disconnect(comicsView, SIGNAL(copyComicsToCurrentFolder(QList<QPair<QString, QString> >)), this, SLOT(copyAndImportComicsToCurrentFolder(QList<QPair<QString, QString> >)));
|
||||||
disconnect(comicsView, SIGNAL(moveComicsToCurrentFolder(QList<QPair<QString, QString> >)), this, SLOT(moveAndImportComicsToCurrentFolder(QList<QPair<QString, QString> >)));
|
disconnect(comicsView, SIGNAL(moveComicsToCurrentFolder(QList<QPair<QString, QString> >)), this, SLOT(moveAndImportComicsToCurrentFolder(QList<QPair<QString, QString> >)));
|
||||||
|
disconnect(comicsView,SIGNAL(customContextMenuViewRequested(QPoint)),this,SLOT(showComicsViewContextMenu(QPoint)));
|
||||||
|
disconnect(comicsView,SIGNAL(customContextMenuItemRequested(QPoint)),this,SLOT(showComicsItemContextMenu(QPoint)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::doComicsViewConnections()
|
void LibraryWindow::doComicsViewConnections()
|
||||||
@ -449,6 +451,9 @@ void LibraryWindow::doComicsViewConnections()
|
|||||||
connect(comicsView,SIGNAL(selected(unsigned int)),this,SLOT(openComic()));
|
connect(comicsView,SIGNAL(selected(unsigned int)),this,SLOT(openComic()));
|
||||||
connect(comicsView,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(openComic()));
|
connect(comicsView,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(openComic()));
|
||||||
connect(selectAllComicsAction,SIGNAL(triggered()),comicsView,SLOT(selectAll()));
|
connect(selectAllComicsAction,SIGNAL(triggered()),comicsView,SLOT(selectAll()));
|
||||||
|
|
||||||
|
connect(comicsView,SIGNAL(customContextMenuViewRequested(QPoint)),this,SLOT(showComicsViewContextMenu(QPoint)));
|
||||||
|
connect(comicsView,SIGNAL(customContextMenuItemRequested(QPoint)),this,SLOT(showComicsItemContextMenu(QPoint)));
|
||||||
//Drops
|
//Drops
|
||||||
connect(comicsView, SIGNAL(copyComicsToCurrentFolder(QList<QPair<QString, QString> >)), this, SLOT(copyAndImportComicsToCurrentFolder(QList<QPair<QString, QString> >)));
|
connect(comicsView, SIGNAL(copyComicsToCurrentFolder(QList<QPair<QString, QString> >)), this, SLOT(copyAndImportComicsToCurrentFolder(QList<QPair<QString, QString> >)));
|
||||||
connect(comicsView, SIGNAL(moveComicsToCurrentFolder(QList<QPair<QString, QString> >)), this, SLOT(moveAndImportComicsToCurrentFolder(QList<QPair<QString, QString> >)));
|
connect(comicsView, SIGNAL(moveComicsToCurrentFolder(QList<QPair<QString, QString> >)), this, SLOT(moveAndImportComicsToCurrentFolder(QList<QPair<QString, QString> >)));
|
||||||
@ -766,9 +771,6 @@ void LibraryWindow::createActions()
|
|||||||
addToFavoritesAction->setToolTip(tr("Add selected comics to favorites list"));
|
addToFavoritesAction->setToolTip(tr("Add selected comics to favorites list"));
|
||||||
addToFavoritesAction->setIcon(QIcon(":/images/lists/default_1.png"));
|
addToFavoritesAction->setIcon(QIcon(":/images/lists/default_1.png"));
|
||||||
|
|
||||||
QMenu * menu = new QMenu(this);
|
|
||||||
menu->addAction(addToFavoritesAction);
|
|
||||||
addToMenuAction->setMenu(menu);
|
|
||||||
//disable actions
|
//disable actions
|
||||||
disableAllActions();
|
disableAllActions();
|
||||||
}
|
}
|
||||||
@ -913,56 +915,6 @@ void LibraryWindow::createToolBars()
|
|||||||
|
|
||||||
void LibraryWindow::createMenus()
|
void LibraryWindow::createMenus()
|
||||||
{
|
{
|
||||||
itemActions << openComicAction
|
|
||||||
<< YACReader::createSeparator()
|
|
||||||
<< openContainingFolderComicAction
|
|
||||||
<< updateCurrentFolderAction
|
|
||||||
<< YACReader::createSeparator()
|
|
||||||
<< resetComicRatingAction
|
|
||||||
<< YACReader::createSeparator()
|
|
||||||
<< editSelectedComicsAction
|
|
||||||
<< getInfoAction
|
|
||||||
<< asignOrderAction
|
|
||||||
<< YACReader::createSeparator()
|
|
||||||
<< setAsReadAction
|
|
||||||
<< setAsNonReadAction
|
|
||||||
<< YACReader::createSeparator()
|
|
||||||
<< deleteComicsAction
|
|
||||||
<< YACReader::createSeparator()
|
|
||||||
<< addToMenuAction;
|
|
||||||
|
|
||||||
viewActions << openComicAction
|
|
||||||
<< YACReader::createSeparator()
|
|
||||||
<< openContainingFolderComicAction
|
|
||||||
<< updateCurrentFolderAction
|
|
||||||
<< YACReader::createSeparator()
|
|
||||||
<< resetComicRatingAction
|
|
||||||
<< YACReader::createSeparator()
|
|
||||||
<< editSelectedComicsAction
|
|
||||||
<< getInfoAction
|
|
||||||
<< asignOrderAction
|
|
||||||
<< YACReader::createSeparator()
|
|
||||||
<< selectAllComicsAction
|
|
||||||
<< YACReader::createSeparator()
|
|
||||||
<< setAsReadAction
|
|
||||||
<< setAsNonReadAction
|
|
||||||
<< showHideMarksAction
|
|
||||||
<< YACReader::createSeparator()
|
|
||||||
<< deleteComicsAction
|
|
||||||
<< YACReader::createSeparator()
|
|
||||||
<< addToMenuAction
|
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
|
||||||
<< YACReader::createSeparator()
|
|
||||||
<< toggleFullScreenAction;
|
|
||||||
#else
|
|
||||||
;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
comicsView->setItemActions(itemActions);
|
|
||||||
comicsView->setViewActions(viewActions);
|
|
||||||
|
|
||||||
foldersView->addAction(addFolderAction);
|
foldersView->addAction(addFolderAction);
|
||||||
foldersView->addAction(deleteFolderAction);
|
foldersView->addAction(deleteFolderAction);
|
||||||
YACReader::addSperator(foldersView);
|
YACReader::addSperator(foldersView);
|
||||||
@ -1681,6 +1633,73 @@ void LibraryWindow::addSelectedComicsToFavorites()
|
|||||||
comicsModel->addComicsToFavorites(indexList);
|
comicsModel->addComicsToFavorites(indexList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::showComicsViewContextMenu(const QPoint &point)
|
||||||
|
{
|
||||||
|
QMenu menu;
|
||||||
|
|
||||||
|
menu.addAction(openComicAction);
|
||||||
|
menu.addSeparator();
|
||||||
|
menu.addAction(openContainingFolderComicAction);
|
||||||
|
menu.addAction(updateCurrentFolderAction);
|
||||||
|
menu.addSeparator();
|
||||||
|
menu.addAction(resetComicRatingAction);
|
||||||
|
menu.addSeparator();
|
||||||
|
menu.addAction(editSelectedComicsAction);
|
||||||
|
menu.addAction(getInfoAction);
|
||||||
|
menu.addAction(asignOrderAction);
|
||||||
|
menu.addSeparator();
|
||||||
|
menu.addAction(selectAllComicsAction);
|
||||||
|
menu.addSeparator();
|
||||||
|
menu.addAction(setAsReadAction);
|
||||||
|
menu.addAction(setAsNonReadAction);
|
||||||
|
menu.addSeparator();
|
||||||
|
menu.addAction(deleteComicsAction);
|
||||||
|
menu.addSeparator();
|
||||||
|
menu.addAction(addToMenuAction);
|
||||||
|
QMenu subMenu;
|
||||||
|
setupAddToSubmenu(subMenu);
|
||||||
|
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
menu.addSeparator();
|
||||||
|
menu.addAction(toggleFullScreenAction);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
menu.exec(comicsView->mapToGlobal(point));
|
||||||
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::showComicsItemContextMenu(const QPoint &point)
|
||||||
|
{
|
||||||
|
QMenu menu;
|
||||||
|
|
||||||
|
menu.addAction(openComicAction);
|
||||||
|
menu.addSeparator();
|
||||||
|
menu.addAction(openContainingFolderComicAction);
|
||||||
|
menu.addAction(updateCurrentFolderAction);
|
||||||
|
menu.addSeparator();
|
||||||
|
menu.addAction(resetComicRatingAction);
|
||||||
|
menu.addSeparator();
|
||||||
|
menu.addAction(editSelectedComicsAction);
|
||||||
|
menu.addAction(getInfoAction);
|
||||||
|
menu.addAction(asignOrderAction);
|
||||||
|
menu.addSeparator();
|
||||||
|
menu.addAction(setAsReadAction);
|
||||||
|
menu.addAction(setAsNonReadAction);
|
||||||
|
menu.addSeparator();
|
||||||
|
menu.addAction(deleteComicsAction);
|
||||||
|
menu.addSeparator();
|
||||||
|
menu.addAction(addToMenuAction);
|
||||||
|
QMenu subMenu;
|
||||||
|
setupAddToSubmenu(subMenu);
|
||||||
|
|
||||||
|
menu.exec(comicsView->mapToGlobal(point));
|
||||||
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::setupAddToSubmenu(QMenu &menu)
|
||||||
|
{
|
||||||
|
menu.addAction(addToFavoritesAction);
|
||||||
|
addToMenuAction->setMenu(&menu);
|
||||||
|
}
|
||||||
|
|
||||||
void LibraryWindow::selectSubfolder(const QModelIndex &mi, int child)
|
void LibraryWindow::selectSubfolder(const QModelIndex &mi, int child)
|
||||||
{
|
{
|
||||||
QModelIndex dest = foldersModel->index(child,0,mi);
|
QModelIndex dest = foldersModel->index(child,0,mi);
|
||||||
@ -2119,8 +2138,6 @@ void LibraryWindow::switchToComicsView(ComicsView * from, ComicsView * to)
|
|||||||
|
|
||||||
comicsView = to;
|
comicsView = to;
|
||||||
doComicsViewConnections();
|
doComicsViewConnections();
|
||||||
to->setItemActions(itemActions);
|
|
||||||
to->setViewActions(viewActions);
|
|
||||||
|
|
||||||
comicsView->setToolBar(editInfoToolBar);
|
comicsView->setToolBar(editInfoToolBar);
|
||||||
|
|
||||||
|
@ -220,9 +220,6 @@ private:
|
|||||||
QAction * addToMenuAction;
|
QAction * addToMenuAction;
|
||||||
QAction * addToFavoritesAction;
|
QAction * addToFavoritesAction;
|
||||||
|
|
||||||
QList<QAction *> itemActions;
|
|
||||||
QList<QAction *> viewActions;
|
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
YACReaderMacOSXToolbar * libraryToolBar;
|
YACReaderMacOSXToolbar * libraryToolBar;
|
||||||
#else
|
#else
|
||||||
@ -391,6 +388,9 @@ public slots:
|
|||||||
void showAddNewLabelDialog();
|
void showAddNewLabelDialog();
|
||||||
void showRenameCurrentList();
|
void showRenameCurrentList();
|
||||||
void addSelectedComicsToFavorites();
|
void addSelectedComicsToFavorites();
|
||||||
|
void showComicsViewContextMenu(const QPoint & point);
|
||||||
|
void showComicsItemContextMenu(const QPoint & point);
|
||||||
|
void setupAddToSubmenu(QMenu & menu);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -78,14 +78,11 @@ Rectangle {
|
|||||||
//grid.currentIndex = index
|
//grid.currentIndex = index
|
||||||
//comicsSelection.setCurrentIndex(index,0x0002)
|
//comicsSelection.setCurrentIndex(index,0x0002)
|
||||||
var ci = grid.currentIndex;
|
var ci = grid.currentIndex;
|
||||||
if(mouse.button == Qt.RightButton || !(mouse.modifiers & Qt.ControlModifier || mouse.modifiers & Qt.ShiftModifier))
|
if(mouse.button != Qt.RightButton && !(mouse.modifiers & Qt.ControlModifier || mouse.modifiers & Qt.ShiftModifier))
|
||||||
{
|
{
|
||||||
comicsSelectionHelper.clear();
|
comicsSelectionHelper.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mouse.button == Qt.RightButton)
|
|
||||||
myContextMenu.popup();
|
|
||||||
|
|
||||||
if(mouse.modifiers & Qt.ShiftModifier)
|
if(mouse.modifiers & Qt.ShiftModifier)
|
||||||
if(index < ci)
|
if(index < ci)
|
||||||
selectAll(index,ci);
|
selectAll(index,ci);
|
||||||
@ -94,46 +91,28 @@ Rectangle {
|
|||||||
|
|
||||||
mouse.accepted = true;
|
mouse.accepted = true;
|
||||||
|
|
||||||
|
if(mouse.button == Qt.RightButton)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(!comicsSelectionHelper.isSelectedIndex(index))
|
||||||
|
{
|
||||||
|
comicsSelectionHelper.selectIndex(index)
|
||||||
|
grid.currentIndex = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
var coordinates = main.mapFromItem(realCell,mouseX,mouseY)
|
||||||
|
contextMenuHelper.requestedContextMenu(Qt.point(coordinates.x,coordinates.y));
|
||||||
|
|
||||||
|
} else
|
||||||
|
{
|
||||||
comicsSelectionHelper.selectIndex(index)
|
comicsSelectionHelper.selectIndex(index)
|
||||||
grid.currentIndex = index;
|
grid.currentIndex = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Menu emits the 'main' signals
|
|
||||||
Menu {
|
|
||||||
id: myContextMenu
|
|
||||||
MenuItem { text: "Open comic"; enabled: true; iconSource:"qrc:///images/openInYACReader.png"; onTriggered: openComicAction.trigger() }
|
|
||||||
MenuSeparator{}
|
|
||||||
MenuItem { text: "Open containing folder..."; enabled: true; iconSource: "qrc:///images/open.png"; onTriggered: openContainingFolderComicAction.trigger() }
|
|
||||||
MenuItem { text: "Update current folder"; enabled: true; iconSource: "qrc:///images/updateLibraryIcon.png"; onTriggered: updateCurrentFolderAction.trigger() }
|
|
||||||
MenuSeparator{}
|
|
||||||
MenuItem { text: "Reset comic rating"; onTriggered: resetComicRatingAction.trigger() }
|
|
||||||
MenuSeparator{}
|
|
||||||
MenuItem { text: "Edit"; enabled: true; iconSource:"qrc:///images/editComic.png"; onTriggered: editSelectedComicsAction.trigger() }
|
|
||||||
MenuItem { text: "Download tags from Comic Vine"; enabled: true; iconSource:"qrc:///images/getInfo.png"; onTriggered: getInfoAction.trigger() }
|
|
||||||
MenuItem { text: "Asign current order to comics"; enabled: true; iconSource:"qrc:///images/asignNumber.png"; onTriggered: asignOrderAction.trigger() }
|
|
||||||
MenuSeparator{}
|
|
||||||
MenuItem { text: "Select all comics"; enabled: true; iconSource:"qrc:///images/selectAll.png"; onTriggered: selectAllComicsAction.trigger() }
|
|
||||||
MenuSeparator{}
|
|
||||||
MenuItem { text: "Set as read"; enabled: true; iconSource:"qrc:///images/setReadButton.png"; onTriggered: setAsReadAction.trigger() }
|
|
||||||
MenuItem { text: "Set as unread"; enabled: true; iconSource:"qrc:///images/setUnread.png"; onTriggered: setAsNonReadAction.trigger() }
|
|
||||||
MenuItem { text: "Show or hide read marks"; enabled: true; iconSource:"qrc:///images/showMarks.png"; onTriggered: showHideMarksAction.trigger() }
|
|
||||||
MenuSeparator{}
|
|
||||||
MenuItem { text: "Delete selected comics"; enabled: true; iconSource:"qrc:///images/trash.png"; onTriggered: deleteComicsAction.trigger() }
|
|
||||||
MenuSeparator{}
|
|
||||||
Menu {
|
|
||||||
id: addToMenu
|
|
||||||
title: "Add to..."
|
|
||||||
MenuItem { text: "Favorites"; enabled: true; iconSource:"qrc:///images/lists/default_1.png"; onTriggered: addToFavoritesAction.trigger() }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuSeparator{}
|
|
||||||
MenuItem { text: "Fullscreen mode on/off"; onTriggered: toggleFullScreenAction.trigger() }
|
|
||||||
//MenuItem { text: "Show details"; onTriggered: cell.state = 'Details';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user