added shortcuts management to YACReader

added shortcuts management to keyPressEvent keys
This commit is contained in:
Luis Ángel San Martín
2014-07-18 20:03:37 +02:00
parent 30a717c5d2
commit 07b2cbb7d0
22 changed files with 607 additions and 277 deletions

View File

@ -13,7 +13,7 @@ INCLUDEPATH += ../common \
./comic_vine \
./comic_vine/model
DEFINES += SERVER_RELEASE NOMINMAX
DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY
win32 {

View File

@ -65,7 +65,7 @@
#include "comics_view_transition.h"
#include "empty_folder_widget.h"
#include "shortcuts_dialog.h"
#include "edit_shortcuts_dialog.h"
#include "shortcuts_manager.h"
#include "QsLog.h"
@ -273,7 +273,7 @@ void LibraryWindow::doDialogs()
optionsDialog = new OptionsDialog(this);
optionsDialog->restoreOptions(settings);
shortcutsDialog = new ShortcutsDialog(this);
editShortcutsDialog = new EditShortcutsDialog(this);
setUpShortcutsManagement();
#ifdef SERVER_RELEASE
@ -297,7 +297,7 @@ void LibraryWindow::doDialogs()
void LibraryWindow::setUpShortcutsManagement()
{
shortcutsDialog->addActionsGroup("Comics",QIcon(":/images/openInYACReader.png"),
editShortcutsDialog->addActionsGroup("Comics",QIcon(":/images/openInYACReader.png"),
QList<QAction *>()
<< openComicAction
<< setAsReadAction
@ -310,7 +310,7 @@ void LibraryWindow::setUpShortcutsManagement()
<< deleteComicsAction
<< getInfoAction);
shortcutsDialog->addActionsGroup("Folders",QIcon(),
editShortcutsDialog->addActionsGroup("Folders",QIcon(),
QList<QAction *>()
<< setRootIndexAction
<< expandAllNodesAction
@ -321,15 +321,16 @@ void LibraryWindow::setUpShortcutsManagement()
<< setFolderAsReadAction
<< setFolderAsUnreadAction);
shortcutsDialog->addActionsGroup("General",QIcon(),
editShortcutsDialog->addActionsGroup("General",QIcon(),
QList<QAction *>()
<< backAction
<< forwardAction
<< helpAboutAction
<< optionsAction
<< serverConfigAction);
<< serverConfigAction
<< showEditShortcutsAction);
shortcutsDialog->addActionsGroup("Libraries",QIcon(),
editShortcutsDialog->addActionsGroup("Libraries",QIcon(),
QList<QAction *>()
<< createLibraryAction
<< openLibraryAction
@ -341,7 +342,7 @@ void LibraryWindow::setUpShortcutsManagement()
<< renameLibraryAction
<< removeLibraryAction);
shortcutsDialog->addActionsGroup("Visualization",QIcon(),
editShortcutsDialog->addActionsGroup("Visualization",QIcon(),
QList<QAction *>()
<< showHideMarksAction
<< toggleFullScreenAction
@ -635,6 +636,11 @@ void LibraryWindow::createActions()
getInfoAction->setIcon(QIcon(":/images/getInfo.png"));
//-------------------------------------------------------------------------
showEditShortcutsAction = new QAction(tr("Edit shortcuts"),this);
showEditShortcutsAction->setData(SHOW_EDIT_SHORTCUTS_ACTION_YL);
showEditShortcutsAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_EDIT_SHORTCUTS_ACTION_YL));
showEditShortcutsAction->setShortcutContext(Qt::ApplicationShortcut);
addAction(showEditShortcutsAction);
//disable actions
disableAllActions();
}
@ -772,7 +778,6 @@ void LibraryWindow::createToolBars()
editInfoToolBar->addWidget(new QToolBarStretch());
editInfoToolBar->addAction(hideComicViewAction);
}
void LibraryWindow::createMenus()
@ -973,7 +978,7 @@ void LibraryWindow::createConnections()
connect(serverConfigAction, SIGNAL(triggered()), serverConfigDialog, SLOT(show()));
#endif
connect(optionsDialog, SIGNAL(optionsChanged()),this,SLOT(reloadOptions()));
connect(optionsDialog, SIGNAL(editShortcuts()),shortcutsDialog,SLOT(show()));
connect(optionsDialog, SIGNAL(editShortcuts()),editShortcutsDialog,SLOT(show()));
//Folders filter
//connect(clearFoldersFilter,SIGNAL(clicked()),foldersFilter,SLOT(clear()));
@ -1007,6 +1012,8 @@ void LibraryWindow::createConnections()
connect(dmCV,SIGNAL(isEmpty()),this,SLOT(showEmptyFolderView()));
connect(emptyFolderWidget,SIGNAL(subfolderSelected(QModelIndex,int)),this,SLOT(selectSubfolder(QModelIndex,int)));
connect(showEditShortcutsAction,SIGNAL(triggered()),editShortcutsDialog,SLOT(show()));
}
void LibraryWindow::loadLibrary(const QString & name)

View File

@ -54,7 +54,7 @@ class ClassicComicsView;
class GridComicsView;
class ComicsViewTransition;
class EmptyFolderWidget;
class ShortcutsDialog;
class EditShortcutsDialog;
#include "comic_db.h"
@ -77,7 +77,7 @@ private:
RenameLibraryDialog * renameLibraryDialog;
PropertiesDialog * propertiesDialog;
ComicVineDialog * comicVineDialog;
ShortcutsDialog * shortcutsDialog;
EditShortcutsDialog * editShortcutsDialog;
//YACReaderSocialDialog * socialDialog;
bool fullscreen;
bool importedCovers; //if true, the library is read only (not updates,open comic or properties)
@ -173,6 +173,8 @@ private:
QAction * deleteComicsAction;
QAction * hideComicViewAction;
QAction *showEditShortcutsAction;
QList<QAction *> itemActions;
QList<QAction *> viewActions;

View File

@ -40,23 +40,15 @@ OptionsDialog::OptionsDialog(QWidget * parent)
flowLayout->addWidget(gl);
flowLayout->addLayout(switchFlowType);
QVBoxLayout * shortcutsLayout = new QVBoxLayout();
QPushButton * shortcutsButton = new QPushButton(tr("Edit shortcuts"));
shortcutsLayout->addWidget(shortcutsButton);
sw->hide();
QWidget * comicFlowW = new QWidget;
comicFlowW->setLayout(flowLayout);
QGroupBox *generalBox = new QGroupBox(tr("Shortcuts"));
generalBox->setLayout(shortcutsLayout);
generalLayout->addWidget(generalBox);
generalLayout->addStretch();
QWidget * generalW = new QWidget;
generalW->setLayout(generalLayout);
generalLayout->addWidget(shortcutsBox);
generalLayout->addStretch();
tabWidget->addTab(comicFlowW,tr("Comic Flow"));
tabWidget->addTab(generalW,tr("General"));
@ -71,7 +63,6 @@ OptionsDialog::OptionsDialog(QWidget * parent)
this->layout()->setSizeConstraint(QLayout::SetFixedSize);
connect(shortcutsButton,SIGNAL(clicked()),this,SIGNAL(editShortcuts()));
}

View File

@ -12,8 +12,6 @@ class OptionsDialog : public YACReaderOptionsDialog
Q_OBJECT
public:
OptionsDialog(QWidget * parent = 0);
signals:
void editShortcuts();
};