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

@ -134,6 +134,7 @@ SOURCES += $$PWD/../common/comic.cpp \
include($$PWD/../custom_widgets/custom_widgets_yacreader.pri) include($$PWD/../custom_widgets/custom_widgets_yacreader.pri)
include($$PWD/../compressed_archive/wrapper.pri) include($$PWD/../compressed_archive/wrapper.pri)
include($$PWD/../shortcuts_management/shortcuts_management.pri)
RESOURCES += $$PWD/yacreader_images.qrc \ RESOURCES += $$PWD/yacreader_images.qrc \
$$PWD/yacreader_files.qrc $$PWD/yacreader_files.qrc

View File

@ -6,7 +6,7 @@ TARGET = YACReader
DEPENDPATH += . \ DEPENDPATH += . \
release release
DEFINES += NOMINMAX DEFINES += NOMINMAX YACREADER
unix:!macx{ unix:!macx{
QMAKE_CXXFLAGS += -std=c++11 QMAKE_CXXFLAGS += -std=c++11

View File

@ -1,6 +1,7 @@
#include "magnifying_glass.h" #include "magnifying_glass.h"
#include "viewer.h" #include "viewer.h"
#include "configuration.h" #include "configuration.h"
#include "shortcuts_manager.h"
#include <QScrollBar> #include <QScrollBar>
@ -244,26 +245,48 @@ void MagnifyingGlass::widthDown()
void MagnifyingGlass::keyPressEvent(QKeyEvent *event) void MagnifyingGlass::keyPressEvent(QKeyEvent *event)
{ {
bool validKey = false; bool validKey = false;
switch (event->key())
int _key = event->key();
Qt::KeyboardModifiers modifiers = event->modifiers();
if(modifiers & Qt::ShiftModifier)
_key |= Qt::SHIFT;
if (modifiers & Qt::ControlModifier)
_key |= Qt::CTRL;
if (modifiers & Qt::MetaModifier)
_key |= Qt::META;
if (modifiers & Qt::AltModifier)
_key |= Qt::ALT;
QKeySequence key(_key);
if (key == ShortcutsManager::getShortcutsManager().getShortcut(SIZE_UP_MGLASS_ACTION_Y))
{ {
case Qt::Key_Plus:
sizeUp(); sizeUp();
validKey = true; validKey = true;
break; }
case Qt::Key_Minus:
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(SIZE_DOWN_MGLASS_ACTION_Y))
{
sizeDown(); sizeDown();
validKey = true; validKey = true;
break; }
case Qt::Key_Underscore:
zoomOut(); else if (key == ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_IN_MGLASS_ACTION_Y))
validKey = true; {
break;
case Qt::Key_Asterisk:
zoomIn(); zoomIn();
validKey = true; validKey = true;
break;
} }
updateImage();
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_OUT_MGLASS_ACTION_Y))
{
zoomOut();
validKey = true;
}
if(validKey) if(validKey)
{
updateImage();
event->setAccepted(true); event->setAccepted(true);
} }
}

View File

@ -17,6 +17,8 @@
#include "yacreader_local_client.h" #include "yacreader_local_client.h"
#include "yacreader_global.h" #include "yacreader_global.h"
#include "edit_shortcuts_dialog.h"
#include "shortcuts_manager.h"
#include <ctime> #include <ctime>
#include <algorithm> #include <algorithm>
@ -87,19 +89,19 @@ MainWindowViewer::~MainWindowViewer()
delete openNextComicAction; delete openNextComicAction;
delete prevAction; delete prevAction;
delete nextAction; delete nextAction;
delete adjustHeight; delete adjustHeightAction;
delete adjustWidth; delete adjustWidthAction;
delete leftRotationAction; delete leftRotationAction;
delete rightRotationAction; delete rightRotationAction;
delete doublePageAction; delete doublePageAction;
delete goToPage; delete goToPageAction;
delete optionsAction; delete optionsAction;
delete helpAboutAction; delete helpAboutAction;
delete showMagnifyingGlass; delete showMagnifyingGlassAction;
delete setBookmark; delete setBookmarkAction;
delete showBookmarks; delete showBookmarksAction;
delete showShorcutsAction; delete showShorcutsAction;
delete showInfo; delete showInfoAction;
delete closeAction; delete closeAction;
delete showDictionaryAction; delete showDictionaryAction;
delete alwaysOnTopAction; delete alwaysOnTopAction;
@ -163,8 +165,12 @@ void MainWindowViewer::setupUI()
optionsDialog->restoreOptions(settings); optionsDialog->restoreOptions(settings);
shortcutsDialog = new ShortcutsDialog(this); shortcutsDialog = new ShortcutsDialog(this);
editShortcutsDialog = new EditShortcutsDialog(this);
connect(optionsDialog,SIGNAL(editShortcuts()),editShortcutsDialog,SLOT(show()));
createActions(); createActions();
setUpShortcutsManagement();
createToolBars(); createToolBars();
setWindowTitle("YACReader"); setWindowTitle("YACReader");
@ -241,180 +247,215 @@ void MainWindowViewer::openFromArgv()
void MainWindowViewer::createActions() void MainWindowViewer::createActions()
{ {
openAction = new QAction(tr("&Open"),this); openAction = new QAction(tr("&Open"),this);
openAction->setShortcut(tr("O"));
openAction->setIcon(QIcon(":/images/viewer_toolbar/open.png")); openAction->setIcon(QIcon(":/images/viewer_toolbar/open.png"));
openAction->setToolTip(tr("Open a comic")); openAction->setToolTip(tr("Open a comic"));
openAction->setData(OPEN_ACTION_Y);
openAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_ACTION_Y));
connect(openAction, SIGNAL(triggered()), this, SLOT(open())); connect(openAction, SIGNAL(triggered()), this, SLOT(open()));
openFolderAction = new QAction(tr("Open Folder"),this); openFolderAction = new QAction(tr("Open Folder"),this);
openFolderAction->setShortcut(tr("Ctrl+O"));
openFolderAction->setIcon(QIcon(":/images/viewer_toolbar/openFolder.png")); openFolderAction->setIcon(QIcon(":/images/viewer_toolbar/openFolder.png"));
openFolderAction->setToolTip(tr("Open image folder")); openFolderAction->setToolTip(tr("Open image folder"));
openFolderAction->setData(OPEN_FOLDER_ACTION_Y);
openFolderAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_FOLDER_ACTION_Y));
connect(openFolderAction, SIGNAL(triggered()), this, SLOT(openFolder())); connect(openFolderAction, SIGNAL(triggered()), this, SLOT(openFolder()));
saveImageAction = new QAction(tr("Save"),this); saveImageAction = new QAction(tr("Save"),this);
saveImageAction->setIcon(QIcon(":/images/viewer_toolbar/save.png")); saveImageAction->setIcon(QIcon(":/images/viewer_toolbar/save.png"));
saveImageAction->setToolTip(tr("Save current page")); saveImageAction->setToolTip(tr("Save current page"));
saveImageAction->setDisabled(true); saveImageAction->setDisabled(true);
saveImageAction->setData(SAVE_IMAGE_ACTION_Y);
saveImageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SAVE_IMAGE_ACTION_Y));
connect(saveImageAction,SIGNAL(triggered()),this,SLOT(saveImage())); connect(saveImageAction,SIGNAL(triggered()),this,SLOT(saveImage()));
openPreviousComicAction = new QAction(tr("Previous Comic"),this); openPreviousComicAction = new QAction(tr("Previous Comic"),this);
openPreviousComicAction->setIcon(QIcon(":/images/viewer_toolbar/openPrevious.png")); openPreviousComicAction->setIcon(QIcon(":/images/viewer_toolbar/openPrevious.png"));
openPreviousComicAction->setShortcut(Qt::CTRL + Qt::Key_Left);
openPreviousComicAction->setToolTip(tr("Open previous comic")); openPreviousComicAction->setToolTip(tr("Open previous comic"));
openPreviousComicAction->setDisabled(true); openPreviousComicAction->setDisabled(true);
openPreviousComicAction->setData(OPEN_PREVIOUS_COMIC_ACTION_Y);
openPreviousComicAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_PREVIOUS_COMIC_ACTION_Y));
connect(openPreviousComicAction,SIGNAL(triggered()),this,SLOT(openPreviousComic())); connect(openPreviousComicAction,SIGNAL(triggered()),this,SLOT(openPreviousComic()));
openNextComicAction = new QAction(tr("Next Comic"),this); openNextComicAction = new QAction(tr("Next Comic"),this);
openNextComicAction->setIcon(QIcon(":/images/viewer_toolbar/openNext.png")); openNextComicAction->setIcon(QIcon(":/images/viewer_toolbar/openNext.png"));
openNextComicAction->setShortcut(Qt::CTRL + Qt::Key_Right);
openNextComicAction->setToolTip(tr("Open next comic")); openNextComicAction->setToolTip(tr("Open next comic"));
openNextComicAction->setDisabled(true); openNextComicAction->setDisabled(true);
openNextComicAction->setData(OPEN_NEXT_COMIC_ACTION_Y);
openNextComicAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_NEXT_COMIC_ACTION_Y));
connect(openNextComicAction,SIGNAL(triggered()),this,SLOT(openNextComic())); connect(openNextComicAction,SIGNAL(triggered()),this,SLOT(openNextComic()));
prevAction = new QAction(tr("&Previous"),this); prevAction = new QAction(tr("&Previous"),this);
prevAction->setIcon(QIcon(":/images/viewer_toolbar/previous.png")); prevAction->setIcon(QIcon(":/images/viewer_toolbar/previous.png"));
prevAction->setShortcut(Qt::Key_Left);
prevAction->setShortcutContext(Qt::WidgetShortcut); prevAction->setShortcutContext(Qt::WidgetShortcut);
prevAction->setToolTip(tr("Go to previous page")); prevAction->setToolTip(tr("Go to previous page"));
prevAction->setDisabled(true); prevAction->setDisabled(true);
prevAction->setData(PREV_ACTION_Y);
prevAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(PREV_ACTION_Y));
connect(prevAction, SIGNAL(triggered()),viewer,SLOT(prev())); connect(prevAction, SIGNAL(triggered()),viewer,SLOT(prev()));
nextAction = new QAction(tr("&Next"),this); nextAction = new QAction(tr("&Next"),this);
nextAction->setIcon(QIcon(":/images/viewer_toolbar/next.png")); nextAction->setIcon(QIcon(":/images/viewer_toolbar/next.png"));
nextAction->setShortcut(Qt::Key_Right);
nextAction->setShortcutContext(Qt::WidgetShortcut); nextAction->setShortcutContext(Qt::WidgetShortcut);
nextAction->setToolTip(tr("Go to next page")); nextAction->setToolTip(tr("Go to next page"));
nextAction->setDisabled(true); nextAction->setDisabled(true);
nextAction->setData(NEXT_ACTION_Y);
nextAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(NEXT_ACTION_Y));
connect(nextAction, SIGNAL(triggered()),viewer,SLOT(next())); connect(nextAction, SIGNAL(triggered()),viewer,SLOT(next()));
adjustHeight = new QAction(tr("Fit Height"),this); adjustHeightAction = new QAction(tr("Fit Height"),this);
adjustHeight->setIcon(QIcon(":/images/viewer_toolbar/toHeight.png")); adjustHeightAction->setIcon(QIcon(":/images/viewer_toolbar/toHeight.png"));
//adjustWidth->setCheckable(true); //adjustWidth->setCheckable(true);
adjustHeight->setDisabled(true); adjustHeightAction->setDisabled(true);
adjustHeight->setChecked(Configuration::getConfiguration().getAdjustToWidth()); adjustHeightAction->setChecked(Configuration::getConfiguration().getAdjustToWidth());
adjustHeight->setToolTip(tr("Fit image to height")); adjustHeightAction->setToolTip(tr("Fit image to height"));
//adjustWidth->setIcon(QIcon(":/images/fitWidth.png")); //adjustWidth->setIcon(QIcon(":/images/fitWidth.png"));
connect(adjustHeight, SIGNAL(triggered()),this,SLOT(fitToHeight())); adjustHeightAction->setData(ADJUST_HEIGHT_ACTION_Y);
adjustHeightAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ADJUST_HEIGHT_ACTION_Y));
connect(adjustHeightAction, SIGNAL(triggered()),this,SLOT(fitToHeight()));
adjustWidth = new QAction(tr("Fit Width"),this); adjustWidthAction = new QAction(tr("Fit Width"),this);
adjustWidth->setIcon(QIcon(":/images/viewer_toolbar/toWidth.png")); adjustWidthAction->setIcon(QIcon(":/images/viewer_toolbar/toWidth.png"));
//adjustWidth->setCheckable(true); //adjustWidth->setCheckable(true);
adjustWidth->setDisabled(true); adjustWidthAction->setDisabled(true);
adjustWidth->setChecked(Configuration::getConfiguration().getAdjustToWidth()); adjustWidthAction->setChecked(Configuration::getConfiguration().getAdjustToWidth());
adjustWidth->setToolTip(tr("Fit image to width")); adjustWidthAction->setToolTip(tr("Fit image to width"));
//adjustWidth->setIcon(QIcon(":/images/fitWidth.png")); //adjustWidth->setIcon(QIcon(":/images/fitWidth.png"));
connect(adjustWidth, SIGNAL(triggered()),this,SLOT(fitToWidth())); adjustWidthAction->setData(ADJUST_WIDTH_ACTION_Y);
adjustWidthAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ADJUST_WIDTH_ACTION_Y));
connect(adjustWidthAction, SIGNAL(triggered()),this,SLOT(fitToWidth()));
leftRotationAction = new QAction(tr("Rotate image to the left"),this); leftRotationAction = new QAction(tr("Rotate image to the left"),this);
leftRotationAction->setShortcut(tr("L"));
leftRotationAction->setIcon(QIcon(":/images/viewer_toolbar/rotateL.png")); leftRotationAction->setIcon(QIcon(":/images/viewer_toolbar/rotateL.png"));
leftRotationAction->setDisabled(true); leftRotationAction->setDisabled(true);
leftRotationAction->setData(LEFT_ROTATION_ACTION_Y);
leftRotationAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(LEFT_ROTATION_ACTION_Y));
connect(leftRotationAction, SIGNAL(triggered()),viewer,SLOT(rotateLeft())); connect(leftRotationAction, SIGNAL(triggered()),viewer,SLOT(rotateLeft()));
rightRotationAction = new QAction(tr("Rotate image to the right"),this); rightRotationAction = new QAction(tr("Rotate image to the right"),this);
rightRotationAction->setShortcut(tr("R"));
rightRotationAction->setIcon(QIcon(":/images/viewer_toolbar/rotateR.png")); rightRotationAction->setIcon(QIcon(":/images/viewer_toolbar/rotateR.png"));
rightRotationAction->setDisabled(true); rightRotationAction->setDisabled(true);
rightRotationAction->setData(RIGHT_ROTATION_ACTION_Y);
rightRotationAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(RIGHT_ROTATION_ACTION_Y));
connect(rightRotationAction, SIGNAL(triggered()),viewer,SLOT(rotateRight())); connect(rightRotationAction, SIGNAL(triggered()),viewer,SLOT(rotateRight()));
doublePageAction = new QAction(tr("Double page mode"),this); doublePageAction = new QAction(tr("Double page mode"),this);
doublePageAction->setToolTip(tr("Switch to double page mode")); doublePageAction->setToolTip(tr("Switch to double page mode"));
doublePageAction->setShortcut(tr("D"));
doublePageAction->setIcon(QIcon(":/images/viewer_toolbar/doublePage.png")); doublePageAction->setIcon(QIcon(":/images/viewer_toolbar/doublePage.png"));
doublePageAction->setDisabled(true); doublePageAction->setDisabled(true);
doublePageAction->setCheckable(true); doublePageAction->setCheckable(true);
doublePageAction->setChecked(Configuration::getConfiguration().getDoublePage()); doublePageAction->setChecked(Configuration::getConfiguration().getDoublePage());
doublePageAction->setData(DOUBLE_PAGE_ACTION_Y);
doublePageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(DOUBLE_PAGE_ACTION_Y));
connect(doublePageAction, SIGNAL(triggered()),viewer,SLOT(doublePageSwitch())); connect(doublePageAction, SIGNAL(triggered()),viewer,SLOT(doublePageSwitch()));
goToPage = new QAction(tr("Go To"),this); goToPageAction = new QAction(tr("Go To"),this);
goToPage->setShortcut(tr("G")); goToPageAction->setIcon(QIcon(":/images/viewer_toolbar/goto.png"));
goToPage->setIcon(QIcon(":/images/viewer_toolbar/goto.png")); goToPageAction->setDisabled(true);
goToPage->setDisabled(true); goToPageAction->setToolTip(tr("Go to page ..."));
goToPage->setToolTip(tr("Go to page ...")); goToPageAction->setData(GO_TO_PAGE_ACTION_Y);
connect(goToPage, SIGNAL(triggered()),viewer,SLOT(showGoToDialog())); goToPageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(GO_TO_PAGE_ACTION_Y));
connect(goToPageAction, SIGNAL(triggered()),viewer,SLOT(showGoToDialog()));
optionsAction = new QAction(tr("Options"),this); optionsAction = new QAction(tr("Options"),this);
optionsAction->setShortcut(tr("C"));
optionsAction->setToolTip(tr("YACReader options")); optionsAction->setToolTip(tr("YACReader options"));
optionsAction->setData(OPTIONS_ACTION_Y);
optionsAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPTIONS_ACTION_Y));
optionsAction->setIcon(QIcon(":/images/viewer_toolbar/options.png")); optionsAction->setIcon(QIcon(":/images/viewer_toolbar/options.png"));
connect(optionsAction, SIGNAL(triggered()),optionsDialog,SLOT(show())); connect(optionsAction, SIGNAL(triggered()),optionsDialog,SLOT(show()));
helpAboutAction = new QAction(tr("Help"),this); helpAboutAction = new QAction(tr("Help"),this);
helpAboutAction->setToolTip(tr("Help, About YACReader")); helpAboutAction->setToolTip(tr("Help, About YACReader"));
helpAboutAction->setShortcut(Qt::Key_F1);
helpAboutAction->setIcon(QIcon(":/images/viewer_toolbar/help.png")); helpAboutAction->setIcon(QIcon(":/images/viewer_toolbar/help.png"));
helpAboutAction->setData(HELP_ABOUT_ACTION_Y);
helpAboutAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(HELP_ABOUT_ACTION_Y));
connect(helpAboutAction, SIGNAL(triggered()),had,SLOT(show())); connect(helpAboutAction, SIGNAL(triggered()),had,SLOT(show()));
showMagnifyingGlass = new QAction(tr("Magnifying glass"),this); showMagnifyingGlassAction = new QAction(tr("Magnifying glass"),this);
showMagnifyingGlass->setToolTip(tr("Switch Magnifying glass")); showMagnifyingGlassAction->setToolTip(tr("Switch Magnifying glass"));
showMagnifyingGlass->setShortcut(tr("Z")); showMagnifyingGlassAction->setIcon(QIcon(":/images/viewer_toolbar/magnifyingGlass.png"));
showMagnifyingGlass->setIcon(QIcon(":/images/viewer_toolbar/magnifyingGlass.png")); showMagnifyingGlassAction->setDisabled(true);
showMagnifyingGlass->setDisabled(true); showMagnifyingGlassAction->setCheckable(true);
showMagnifyingGlass->setCheckable(true); showMagnifyingGlassAction->setData(SHOW_MAGNIFYING_GLASS_ACTION_Y);
connect(showMagnifyingGlass, SIGNAL(triggered()),viewer,SLOT(magnifyingGlassSwitch())); showMagnifyingGlassAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_MAGNIFYING_GLASS_ACTION_Y));
connect(showMagnifyingGlassAction, SIGNAL(triggered()),viewer,SLOT(magnifyingGlassSwitch()));
setBookmark = new QAction(tr("Set bookmark"),this); setBookmarkAction = new QAction(tr("Set bookmark"),this);
setBookmark->setToolTip(tr("Set a bookmark on the current page")); setBookmarkAction->setToolTip(tr("Set a bookmark on the current page"));
setBookmark->setShortcut(Qt::CTRL+Qt::Key_M); setBookmarkAction->setIcon(QIcon(":/images/viewer_toolbar/bookmark.png"));
setBookmark->setIcon(QIcon(":/images/viewer_toolbar/bookmark.png")); setBookmarkAction->setDisabled(true);
setBookmark->setDisabled(true); setBookmarkAction->setCheckable(true);
setBookmark->setCheckable(true); setBookmarkAction->setData(SET_BOOKMARK_ACTION_Y);
connect(setBookmark,SIGNAL(triggered (bool)),viewer,SLOT(setBookmark(bool))); setBookmarkAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SET_BOOKMARK_ACTION_Y));
connect(viewer,SIGNAL(pageAvailable(bool)),setBookmark,SLOT(setEnabled(bool))); connect(setBookmarkAction,SIGNAL(triggered (bool)),viewer,SLOT(setBookmarkAction(bool)));
connect(viewer,SIGNAL(pageIsBookmark(bool)),setBookmark,SLOT(setChecked(bool))); connect(viewer,SIGNAL(pageAvailable(bool)),setBookmarkAction,SLOT(setEnabled(bool)));
connect(viewer,SIGNAL(pageIsBookmark(bool)),setBookmarkAction,SLOT(setChecked(bool)));
showBookmarks = new QAction(tr("Show bookmarks"),this); showBookmarksAction = new QAction(tr("Show bookmarks"),this);
showBookmarks->setToolTip(tr("Show the bookmarks of the current comic")); showBookmarksAction->setToolTip(tr("Show the bookmarks of the current comic"));
showBookmarks->setShortcut(tr("M")); showBookmarksAction->setIcon(QIcon(":/images/viewer_toolbar/showBookmarks.png"));
showBookmarks->setIcon(QIcon(":/images/viewer_toolbar/showBookmarks.png")); showBookmarksAction->setDisabled(true);
showBookmarks->setDisabled(true); showBookmarksAction->setData(SHOW_BOOKMARKS_ACTION_Y);
connect(showBookmarks, SIGNAL(triggered()),viewer->getBookmarksDialog(),SLOT(show())); showBookmarksAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_BOOKMARKS_ACTION_Y));
connect(showBookmarksAction, SIGNAL(triggered()),viewer->getBookmarksDialog(),SLOT(show()));
showShorcutsAction = new QAction(tr("Show keyboard shortcuts"), this ); showShorcutsAction = new QAction(tr("Show keyboard shortcuts"), this );
showShorcutsAction->setIcon(QIcon(":/images/viewer_toolbar/shortcuts.png")); showShorcutsAction->setIcon(QIcon(":/images/viewer_toolbar/shortcuts.png"));
showShorcutsAction->setData(SHOW_SHORCUTS_ACTION_Y);
showShorcutsAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_SHORCUTS_ACTION_Y));
connect(showShorcutsAction, SIGNAL(triggered()),shortcutsDialog,SLOT(show())); connect(showShorcutsAction, SIGNAL(triggered()),shortcutsDialog,SLOT(show()));
showInfo = new QAction(tr("Show Info"),this); showInfoAction = new QAction(tr("Show Info"),this);
showInfo->setShortcut(tr("I")); showInfoAction->setIcon(QIcon(":/images/viewer_toolbar/info.png"));
showInfo->setIcon(QIcon(":/images/viewer_toolbar/info.png")); showInfoAction->setDisabled(true);
showInfo->setDisabled(true); showInfoAction->setData(SHOW_INFO_ACTION_Y);
connect(showInfo, SIGNAL(triggered()),viewer,SLOT(informationSwitch())); showInfoAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_INFO_ACTION_Y));
connect(showInfoAction, SIGNAL(triggered()),viewer,SLOT(informationSwitch()));
closeAction = new QAction(tr("Close"),this); closeAction = new QAction(tr("Close"),this);
closeAction->setShortcut(Qt::Key_Escape);
closeAction->setIcon(QIcon(":/images/viewer_toolbar/close.png")); closeAction->setIcon(QIcon(":/images/viewer_toolbar/close.png"));
closeAction->setData(CLOSE_ACTION_Y);
closeAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(CLOSE_ACTION_Y));
connect(closeAction,SIGNAL(triggered()),this,SLOT(close())); connect(closeAction,SIGNAL(triggered()),this,SLOT(close()));
showDictionaryAction = new QAction(tr("Show Dictionary"),this); showDictionaryAction = new QAction(tr("Show Dictionary"),this);
showDictionaryAction->setShortcut(Qt::Key_T);
showDictionaryAction->setIcon(QIcon(":/images/viewer_toolbar/translator.png")); showDictionaryAction->setIcon(QIcon(":/images/viewer_toolbar/translator.png"));
//showDictionaryAction->setCheckable(true); //showDictionaryAction->setCheckable(true);
showDictionaryAction->setDisabled(true); showDictionaryAction->setDisabled(true);
showDictionaryAction->setData(SHOW_DICTIONARY_ACTION_Y);
showDictionaryAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_DICTIONARY_ACTION_Y));
connect(showDictionaryAction,SIGNAL(triggered()),viewer,SLOT(translatorSwitch())); connect(showDictionaryAction,SIGNAL(triggered()),viewer,SLOT(translatorSwitch()));
//deprecated
alwaysOnTopAction = new QAction(tr("Always on top"),this); alwaysOnTopAction = new QAction(tr("Always on top"),this);
alwaysOnTopAction->setShortcut(Qt::Key_Q);
alwaysOnTopAction->setIcon(QIcon(":/images/alwaysOnTop.png")); alwaysOnTopAction->setIcon(QIcon(":/images/alwaysOnTop.png"));
alwaysOnTopAction->setCheckable(true); alwaysOnTopAction->setCheckable(true);
alwaysOnTopAction->setDisabled(true); alwaysOnTopAction->setDisabled(true);
alwaysOnTopAction->setChecked(Configuration::getConfiguration().getAlwaysOnTop()); alwaysOnTopAction->setChecked(Configuration::getConfiguration().getAlwaysOnTop());
alwaysOnTopAction->setData(ALWAYS_ON_TOP_ACTION_Y);
alwaysOnTopAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ALWAYS_ON_TOP_ACTION_Y));
connect(alwaysOnTopAction,SIGNAL(triggered()),this,SLOT(alwaysOnTopSwitch())); connect(alwaysOnTopAction,SIGNAL(triggered()),this,SLOT(alwaysOnTopSwitch()));
adjustToFullSizeAction = new QAction(tr("Show full size"),this); adjustToFullSizeAction = new QAction(tr("Show full size"),this);
adjustToFullSizeAction->setShortcut(Qt::Key_W);
adjustToFullSizeAction->setIcon(QIcon(":/images/viewer_toolbar/full.png")); adjustToFullSizeAction->setIcon(QIcon(":/images/viewer_toolbar/full.png"));
adjustToFullSizeAction->setCheckable(true); adjustToFullSizeAction->setCheckable(true);
adjustToFullSizeAction->setDisabled(true); adjustToFullSizeAction->setDisabled(true);
adjustToFullSizeAction->setChecked(Configuration::getConfiguration().getAdjustToFullSize()); adjustToFullSizeAction->setChecked(Configuration::getConfiguration().getAdjustToFullSize());
adjustToFullSizeAction->setData(ADJUST_TO_FULL_SIZE_ACTION_Y);
adjustToFullSizeAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ADJUST_TO_FULL_SIZE_ACTION_Y));
connect(adjustToFullSizeAction,SIGNAL(triggered()),this,SLOT(adjustToFullSizeSwitch())); connect(adjustToFullSizeAction,SIGNAL(triggered()),this,SLOT(adjustToFullSizeSwitch()));
showFlowAction = new QAction(tr("Show go to flow"),this); showFlowAction = new QAction(tr("Show go to flow"),this);
showFlowAction->setShortcut(Qt::Key_S);
showFlowAction->setIcon(QIcon(":/images/viewer_toolbar/flow.png")); showFlowAction->setIcon(QIcon(":/images/viewer_toolbar/flow.png"));
showFlowAction->setDisabled(true); showFlowAction->setDisabled(true);
showFlowAction->setData(SHOW_FLOW_ACTION_Y);
showFlowAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_FLOW_ACTION_Y));
connect(showFlowAction,SIGNAL(triggered()),viewer,SLOT(goToFlowSwitch())); connect(showFlowAction,SIGNAL(triggered()),viewer,SLOT(goToFlowSwitch()));
showEditShortcutsAction = new QAction(tr("Edit shortcuts"),this);
showEditShortcutsAction->setData(SHOW_EDIT_SHORTCUTS_ACTION_Y);
showEditShortcutsAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_EDIT_SHORTCUTS_ACTION_Y));
connect(showEditShortcutsAction,SIGNAL(triggered()),editShortcutsDialog,SLOT(show()));
} }
void MainWindowViewer::createToolBars() void MainWindowViewer::createToolBars()
@ -445,7 +486,7 @@ void MainWindowViewer::createToolBars()
#endif #endif
comicToolBar->addAction(prevAction); comicToolBar->addAction(prevAction);
comicToolBar->addAction(nextAction); comicToolBar->addAction(nextAction);
comicToolBar->addAction(goToPage); comicToolBar->addAction(goToPageAction);
//#ifndef Q_OS_MAC //#ifndef Q_OS_MAC
// comicToolBar->addSeparator(); // comicToolBar->addSeparator();
@ -486,7 +527,7 @@ void MainWindowViewer::createToolBars()
); );
menu->addAction(sliderAction); menu->addAction(sliderAction);
QToolButton * tb2 = new QToolButton(); QToolButton * tb2 = new QToolButton();
tb2->addAction(adjustWidth); tb2->addAction(adjustWidthAction);
tb2->setMenu(menu); tb2->setMenu(menu);
connect(sliderAction,SIGNAL(fitToWidthRatioChanged(float)),viewer,SLOT(updateFitToWidthRatio(float))); connect(sliderAction,SIGNAL(fitToWidthRatioChanged(float)),viewer,SLOT(updateFitToWidthRatio(float)));
@ -495,9 +536,9 @@ void MainWindowViewer::createToolBars()
//tb2->addAction(); //tb2->addAction();
tb2->setPopupMode(QToolButton::MenuButtonPopup); tb2->setPopupMode(QToolButton::MenuButtonPopup);
tb2->setDefaultAction(adjustWidth); tb2->setDefaultAction(adjustWidthAction);
comicToolBar->addWidget(tb2); comicToolBar->addWidget(tb2);
comicToolBar->addAction(adjustHeight); comicToolBar->addAction(adjustHeightAction);
comicToolBar->addAction(adjustToFullSizeAction); comicToolBar->addAction(adjustToFullSizeAction);
comicToolBar->addAction(leftRotationAction); comicToolBar->addAction(leftRotationAction);
comicToolBar->addAction(rightRotationAction); comicToolBar->addAction(rightRotationAction);
@ -508,15 +549,15 @@ void MainWindowViewer::createToolBars()
#else #else
comicToolBar->addSeparator(); comicToolBar->addSeparator();
#endif #endif
comicToolBar->addAction(showMagnifyingGlass); comicToolBar->addAction(showMagnifyingGlassAction);
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
comicToolBar->addWidget(new MacToolBarSeparator); comicToolBar->addWidget(new MacToolBarSeparator);
#else #else
comicToolBar->addSeparator(); comicToolBar->addSeparator();
#endif #endif
comicToolBar->addAction(setBookmark); comicToolBar->addAction(setBookmarkAction);
comicToolBar->addAction(showBookmarks); comicToolBar->addAction(showBookmarksAction);
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
comicToolBar->addWidget(new MacToolBarSeparator); comicToolBar->addWidget(new MacToolBarSeparator);
@ -525,7 +566,7 @@ void MainWindowViewer::createToolBars()
#endif #endif
comicToolBar->addAction(showDictionaryAction); comicToolBar->addAction(showDictionaryAction);
comicToolBar->addAction(showFlowAction); comicToolBar->addAction(showFlowAction);
comicToolBar->addAction(showInfo); comicToolBar->addAction(showInfoAction);
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
comicToolBar->addWidget(new MacToolBarSeparator); comicToolBar->addWidget(new MacToolBarSeparator);
@ -551,27 +592,28 @@ void MainWindowViewer::createToolBars()
viewer->addAction(prevAction); viewer->addAction(prevAction);
viewer->addAction(nextAction); viewer->addAction(nextAction);
viewer->addAction(goToPage); viewer->addAction(goToPageAction);
viewer->addAction(adjustHeight); viewer->addAction(adjustHeightAction);
viewer->addAction(adjustWidth); viewer->addAction(adjustWidthAction);
viewer->addAction(adjustToFullSizeAction); viewer->addAction(adjustToFullSizeAction);
viewer->addAction(leftRotationAction); viewer->addAction(leftRotationAction);
viewer->addAction(rightRotationAction); viewer->addAction(rightRotationAction);
YACReader::addSperator(viewer); YACReader::addSperator(viewer);
viewer->addAction(showMagnifyingGlass); viewer->addAction(showMagnifyingGlassAction);
YACReader::addSperator(viewer); YACReader::addSperator(viewer);
viewer->addAction(setBookmark); viewer->addAction(setBookmarkAction);
viewer->addAction(showBookmarks); viewer->addAction(showBookmarksAction);
YACReader::addSperator(viewer); YACReader::addSperator(viewer);
viewer->addAction(showDictionaryAction); viewer->addAction(showDictionaryAction);
viewer->addAction(showFlowAction); viewer->addAction(showFlowAction);
viewer->addAction(showInfo); viewer->addAction(showInfoAction);
YACReader::addSperator(viewer); YACReader::addSperator(viewer);
viewer->addAction(showShorcutsAction); viewer->addAction(showShorcutsAction);
viewer->addAction(showEditShortcutsAction);
viewer->addAction(optionsAction); viewer->addAction(optionsAction);
viewer->addAction(helpAboutAction); viewer->addAction(helpAboutAction);
YACReader::addSperator(viewer); YACReader::addSperator(viewer);
@ -740,18 +782,18 @@ void MainWindowViewer::enableActions()
saveImageAction->setDisabled(false); saveImageAction->setDisabled(false);
prevAction->setDisabled(false); prevAction->setDisabled(false);
nextAction->setDisabled(false); nextAction->setDisabled(false);
adjustHeight->setDisabled(false); adjustHeightAction->setDisabled(false);
adjustWidth->setDisabled(false); adjustWidthAction->setDisabled(false);
goToPage->setDisabled(false); goToPageAction->setDisabled(false);
//alwaysOnTopAction->setDisabled(false); //alwaysOnTopAction->setDisabled(false);
leftRotationAction->setDisabled(false); leftRotationAction->setDisabled(false);
rightRotationAction->setDisabled(false); rightRotationAction->setDisabled(false);
showMagnifyingGlass->setDisabled(false); showMagnifyingGlassAction->setDisabled(false);
doublePageAction->setDisabled(false); doublePageAction->setDisabled(false);
adjustToFullSizeAction->setDisabled(false); adjustToFullSizeAction->setDisabled(false);
//setBookmark->setDisabled(false); //setBookmark->setDisabled(false);
showBookmarks->setDisabled(false); showBookmarksAction->setDisabled(false);
showInfo->setDisabled(false); //TODO enable goTo and showInfo (or update) when numPages emited showInfoAction->setDisabled(false); //TODO enable goTo and showInfo (or update) when numPages emited
showDictionaryAction->setDisabled(false); showDictionaryAction->setDisabled(false);
showFlowAction->setDisabled(false); showFlowAction->setDisabled(false);
} }
@ -760,18 +802,18 @@ void MainWindowViewer::disableActions()
saveImageAction->setDisabled(true); saveImageAction->setDisabled(true);
prevAction->setDisabled(true); prevAction->setDisabled(true);
nextAction->setDisabled(true); nextAction->setDisabled(true);
adjustHeight->setDisabled(true); adjustHeightAction->setDisabled(true);
adjustWidth->setDisabled(true); adjustWidthAction->setDisabled(true);
goToPage->setDisabled(true); goToPageAction->setDisabled(true);
//alwaysOnTopAction->setDisabled(true); //alwaysOnTopAction->setDisabled(true);
leftRotationAction->setDisabled(true); leftRotationAction->setDisabled(true);
rightRotationAction->setDisabled(true); rightRotationAction->setDisabled(true);
showMagnifyingGlass->setDisabled(true); showMagnifyingGlassAction->setDisabled(true);
doublePageAction->setDisabled(true); doublePageAction->setDisabled(true);
adjustToFullSizeAction->setDisabled(true); adjustToFullSizeAction->setDisabled(true);
setBookmark->setDisabled(true); setBookmarkAction->setDisabled(true);
showBookmarks->setDisabled(true); showBookmarksAction->setDisabled(true);
showInfo->setDisabled(true); //TODO enable goTo and showInfo (or update) when numPages emited showInfoAction->setDisabled(true); //TODO enable goTo and showInfo (or update) when numPages emited
openPreviousComicAction->setDisabled(true); openPreviousComicAction->setDisabled(true);
openNextComicAction->setDisabled(true); openNextComicAction->setDisabled(true);
showDictionaryAction->setDisabled(true); showDictionaryAction->setDisabled(true);
@ -781,27 +823,37 @@ void MainWindowViewer::disableActions()
void MainWindowViewer::keyPressEvent(QKeyEvent *event) void MainWindowViewer::keyPressEvent(QKeyEvent *event)
{ {
//TODO remove unused keys //TODO remove unused keys
switch (event->key()) int _key = event->key();
Qt::KeyboardModifiers modifiers = event->modifiers();
if(modifiers & Qt::ShiftModifier)
_key |= Qt::SHIFT;
if (modifiers & Qt::ControlModifier)
_key |= Qt::CTRL;
if (modifiers & Qt::MetaModifier)
_key |= Qt::META;
if (modifiers & Qt::AltModifier)
_key |= Qt::ALT;
QKeySequence key(_key);
if (key == ShortcutsManager::getShortcutsManager().getShortcut(TOGGLE_FULL_SCREEN_ACTION_Y))
{ {
case Qt::Key_Escape:
this->close();
break;
case Qt::Key_F:
toggleFullScreen(); toggleFullScreen();
break; event->accept();
case Qt::Key_H:
toggleToolBars();
break;
case Qt::Key_O:
open();
break;
case Qt::Key_A:
changeFit();
break;
default:
QWidget::keyPressEvent(event);
break;
} }
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(TOGGLE_TOOL_BARS_ACTION_Y))
{
toggleToolBars();
event->accept();
}
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(CHANGE_FIT_ACTION_Y))
{
changeFit();
event->accept();
}
else
QWidget::keyPressEvent(event);
} }
void MainWindowViewer::mouseDoubleClickEvent ( QMouseEvent * event ) void MainWindowViewer::mouseDoubleClickEvent ( QMouseEvent * event )
@ -900,7 +952,7 @@ void MainWindowViewer::checkNewVersion()
QTimer * tT = new QTimer; QTimer * tT = new QTimer;
tT->setSingleShot(true); tT->setSingleShot(true);
connect(tT, SIGNAL(timeout()), versionChecker, SLOT(get())); connect(tT, SIGNAL(timeout()), versionChecker, SLOT(get()));
//versionChecker->get(); //TODÓ //versionChecker->get(); //TOD<EFBFBD>
tT->start(100); tT->start(100);
conf.setLastVersionCheck(current); conf.setLastVersionCheck(current);
@ -926,6 +978,131 @@ void MainWindowViewer::processReset()
disableActions(); disableActions();
} }
void MainWindowViewer::setUpShortcutsManagement()
{
//actions holder
QObject * orphanActions = new QObject;
editShortcutsDialog->addActionsGroup(tr("Comics"),QIcon(":/images/openInYACReader.png"),
QList<QAction *>()
<< openAction
<< openFolderAction
<< saveImageAction
<< openPreviousComicAction
<< openNextComicAction);
//keys without actions (General)
QAction * toggleFullScreenAction = new QAction(tr("Toggle fullscreen mode"),orphanActions);
toggleFullScreenAction->setData(TOGGLE_FULL_SCREEN_ACTION_Y);
toggleFullScreenAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(TOGGLE_FULL_SCREEN_ACTION_Y));
QAction * toggleToolbarsAction = new QAction(tr("Hide/show toolbar"),orphanActions);
toggleToolbarsAction->setData(TOGGLE_TOOL_BARS_ACTION_Y);
toggleToolbarsAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(TOGGLE_TOOL_BARS_ACTION_Y));
editShortcutsDialog->addActionsGroup(tr("General"),QIcon(),
QList<QAction *>()
<< optionsAction
<< helpAboutAction
<< showShorcutsAction
<< showInfoAction
<< closeAction
<< showDictionaryAction
<< showFlowAction
<< toggleFullScreenAction
<< toggleToolbarsAction
<< showEditShortcutsAction);
//keys without actions (MGlass)
QAction * sizeUpMglassAction = new QAction(tr("Size up magnifying glass"),orphanActions);
sizeUpMglassAction->setData(SIZE_UP_MGLASS_ACTION_Y);
sizeUpMglassAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SIZE_UP_MGLASS_ACTION_Y));
QAction * sizeDownMglassAction = new QAction(tr("Size down magnifying glass"),orphanActions);
sizeDownMglassAction->setData(SIZE_DOWN_MGLASS_ACTION_Y);
sizeDownMglassAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SIZE_DOWN_MGLASS_ACTION_Y));
QAction * zoomInMglassAction = new QAction(tr("Zoom in magnifying glass"),orphanActions);
zoomInMglassAction->setData(ZOOM_IN_MGLASS_ACTION_Y);
zoomInMglassAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_IN_MGLASS_ACTION_Y));
QAction * zoomOutMglassAction = new QAction(tr("Zoom out magnifying glass"),orphanActions);
zoomOutMglassAction->setData(ZOOM_OUT_MGLASS_ACTION_Y);
zoomOutMglassAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_OUT_MGLASS_ACTION_Y));
editShortcutsDialog->addActionsGroup(tr("Magnifiying glass"),QIcon(),
QList<QAction *>()
<< showMagnifyingGlassAction
<< sizeUpMglassAction
<< sizeDownMglassAction
<< zoomInMglassAction
<< zoomOutMglassAction);
//keys without actions
QAction * toggleFitToScreenAction = new QAction(tr("Toggle between fit to width and fit to height"),orphanActions);
toggleFitToScreenAction->setData(CHANGE_FIT_ACTION_Y);
toggleFitToScreenAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(CHANGE_FIT_ACTION_Y));
editShortcutsDialog->addActionsGroup(tr("Page adjustement"),QIcon(),
QList<QAction *>()
<< adjustHeightAction
<< adjustWidthAction
<< toggleFitToScreenAction
<< leftRotationAction
<< rightRotationAction
<< doublePageAction
<< adjustToFullSizeAction);
QAction * autoScrollForwardAction = new QAction(tr("Autoscroll down"),orphanActions);
autoScrollForwardAction->setData(AUTO_SCROLL_FORWARD_ACTION_Y);
autoScrollForwardAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_FORWARD_ACTION_Y));
QAction * autoScrollBackwardAction = new QAction(tr("Autoscroll up"),orphanActions);
autoScrollBackwardAction->setData(AUTO_SCROLL_BACKWARD_ACTION_Y);
autoScrollBackwardAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_BACKWARD_ACTION_Y));
QAction * moveDownAction = new QAction(tr("Move down"),orphanActions);
moveDownAction->setData(MOVE_DOWN_ACTION_Y);
moveDownAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(MOVE_DOWN_ACTION_Y));
QAction * moveUpAction = new QAction(tr("Move up"),orphanActions);
moveUpAction->setData(MOVE_UP_ACTION_Y);
moveUpAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(MOVE_UP_ACTION_Y));
QAction * moveLeftAction = new QAction(tr("Move left"),orphanActions);
moveLeftAction->setData(MOVE_LEFT_ACTION_Y);
moveLeftAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(MOVE_LEFT_ACTION_Y));
QAction * moveRightAction = new QAction(tr("Move right"),orphanActions);
moveRightAction->setData(MOVE_RIGHT_ACTION_Y);
moveRightAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(MOVE_RIGHT_ACTION_Y));
QAction * goToFirstPageAction = new QAction(tr("Go to the first page"),orphanActions);
goToFirstPageAction->setData(GO_TO_FIRST_PAGE_ACTION_Y);
goToFirstPageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(GO_TO_FIRST_PAGE_ACTION_Y));
QAction * goToLastPageAction = new QAction(tr("Go to the last page"),orphanActions);
goToLastPageAction->setData(GO_TO_LAST_PAGE_ACTION_Y);
goToLastPageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(GO_TO_LAST_PAGE_ACTION_Y));
editShortcutsDialog->addActionsGroup(tr("Reading"),QIcon(),
QList<QAction *>()
<< nextAction
<< prevAction
<< setBookmarkAction
<< showBookmarksAction
<< autoScrollForwardAction
<< autoScrollBackwardAction
<< moveDownAction
<< moveUpAction
<< moveLeftAction
<< moveRightAction
<< goToFirstPageAction
<< goToLastPageAction
<< goToPageAction);
}
void MainWindowViewer::changeFit() void MainWindowViewer::changeFit()
{ {
Configuration & conf = Configuration::getConfiguration(); Configuration & conf = Configuration::getConfiguration();

View File

@ -18,6 +18,7 @@ class HelpAboutDialog;
class HttpVersionChecker; class HttpVersionChecker;
class ShortcutsDialog; class ShortcutsDialog;
class YACReaderSliderAction; class YACReaderSliderAction;
class EditShortcutsDialog;
class MainWindowViewer : public QMainWindow class MainWindowViewer : public QMainWindow
{ {
@ -51,6 +52,7 @@ class YACReaderSliderAction;
void fitToHeight(); void fitToHeight();
void checkNewVersion(); void checkNewVersion();
void processReset(); void processReset();
void setUpShortcutsManagement();
/*void viewComic(); /*void viewComic();
void prev(); void prev();
void next(); void next();
@ -71,6 +73,7 @@ class YACReaderSliderAction;
OptionsDialog * optionsDialog; OptionsDialog * optionsDialog;
HelpAboutDialog * had; HelpAboutDialog * had;
ShortcutsDialog * shortcutsDialog; ShortcutsDialog * shortcutsDialog;
EditShortcutsDialog * editShortcutsDialog;
//! ToolBars //! ToolBars
QToolBar *comicToolBar; QToolBar *comicToolBar;
@ -83,17 +86,17 @@ class YACReaderSliderAction;
QAction *openNextComicAction; QAction *openNextComicAction;
QAction *nextAction; QAction *nextAction;
QAction *prevAction; QAction *prevAction;
QAction *adjustWidth; QAction *adjustWidthAction;
QAction *adjustHeight; QAction *adjustHeightAction;
QAction *goToPage; QAction *goToPageAction;
QAction *optionsAction; QAction *optionsAction;
QAction *helpAboutAction; QAction *helpAboutAction;
QAction *showMagnifyingGlass; QAction *showMagnifyingGlassAction;
QAction *setBookmark; QAction *setBookmarkAction;
QAction *showBookmarks; QAction *showBookmarksAction;
QAction *leftRotationAction; QAction *leftRotationAction;
QAction *rightRotationAction; QAction *rightRotationAction;
QAction *showInfo; QAction *showInfoAction;
QAction *closeAction; QAction *closeAction;
QAction *doublePageAction; QAction *doublePageAction;
QAction *showShorcutsAction; QAction *showShorcutsAction;
@ -102,6 +105,8 @@ class YACReaderSliderAction;
QAction *adjustToFullSizeAction; QAction *adjustToFullSizeAction;
QAction *showFlowAction; QAction *showFlowAction;
QAction *showEditShortcutsAction;
YACReaderSliderAction * sliderAction; YACReaderSliderAction * sliderAction;
HttpVersionChecker * versionChecker; HttpVersionChecker * versionChecker;

View File

@ -113,6 +113,7 @@ OptionsDialog::OptionsDialog(QWidget * parent)
layoutGeneral->addWidget(slideSizeBox); layoutGeneral->addWidget(slideSizeBox);
layoutGeneral->addWidget(fitBox); layoutGeneral->addWidget(fitBox);
layoutGeneral->addWidget(colorBox); layoutGeneral->addWidget(colorBox);
layoutGeneral->addWidget(shortcutsBox);
layoutGeneral->addStretch(); layoutGeneral->addStretch();
layoutFlow->addWidget(sw); layoutFlow->addWidget(sw);
layoutFlow->addWidget(gl); layoutFlow->addWidget(gl);

View File

@ -12,6 +12,8 @@
#include "page_label_widget.h" #include "page_label_widget.h"
#include "notifications_label_widget.h" #include "notifications_label_widget.h"
#include "comic_db.h" #include "comic_db.h"
#include "shortcuts_manager.h"
#include <QFile> #include <QFile>
@ -369,57 +371,67 @@ void Viewer::keyPressEvent(QKeyEvent *event)
{ {
if(render->hasLoadedComic()) if(render->hasLoadedComic())
{ {
if(goToFlow->isVisible() && event->key()!=Qt::Key_S) int _key = event->key();
Qt::KeyboardModifiers modifiers = event->modifiers();
if(modifiers & Qt::ShiftModifier)
_key |= Qt::SHIFT;
if (modifiers & Qt::ControlModifier)
_key |= Qt::CTRL;
if (modifiers & Qt::MetaModifier)
_key |= Qt::META;
if (modifiers & Qt::AltModifier)
_key |= Qt::ALT;
QKeySequence key(_key);
/*if(goToFlow->isVisible() && event->key()!=Qt::Key_S)
QCoreApplication::sendEvent(goToFlow,event); QCoreApplication::sendEvent(goToFlow,event);
else else*/
switch (event->key())
if (key == ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_FORWARD_ACTION_Y))
{ {
case Qt::Key_Space:
posByStep = height()/numScrollSteps; posByStep = height()/numScrollSteps;
nextPos=verticalScrollBar()->sliderPosition()+static_cast<int>((height()*0.80)); nextPos=verticalScrollBar()->sliderPosition()+static_cast<int>((height()*0.80));
scrollDown(); scrollDown();
break; }
case Qt::Key_B:
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_BACKWARD_ACTION_Y))
{
posByStep = height()/numScrollSteps; posByStep = height()/numScrollSteps;
nextPos=verticalScrollBar()->sliderPosition()-static_cast<int>((height()*0.80)); nextPos=verticalScrollBar()->sliderPosition()-static_cast<int>((height()*0.80));
scrollUp(); scrollUp();
break;
case Qt::Key_S:
goToFlowSwitch();
break;
case Qt::Key_T:
translatorSwitch();
break;
case Qt::Key_Down:
/*if(verticalScrollBar()->sliderPosition()==verticalScrollBar()->maximum())
next();
else*/
QAbstractScrollArea::keyPressEvent(event);
emit backgroundChanges();
break;
case Qt::Key_Up:
/*if(verticalScrollBar()->sliderPosition()==verticalScrollBar()->minimum())
prev();
else*/
QAbstractScrollArea::keyPressEvent(event);
emit backgroundChanges();
break;
case Qt::Key_Home:
goTo(0);
break;
case Qt::Key_End:
goTo(this->render->numPages()-1);
break;
default:
QAbstractScrollArea::keyPressEvent(event);
break;
} }
if(mglass->isVisible())
switch(event->key()) else if (key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_DOWN_ACTION_Y) ||
key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_UP_ACTION_Y) ||
key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_LEFT_ACTION_Y) ||
key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_RIGHT_ACTION_Y))
{
QAbstractScrollArea::keyPressEvent(event);
emit backgroundChanges();
}
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(GO_TO_FIRST_PAGE_ACTION_Y))
{
goTo(0);
}
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(GO_TO_LAST_PAGE_ACTION_Y))
{
goTo(this->render->numPages()-1);
}
else
QAbstractScrollArea::keyPressEvent(event);
if(mglass->isVisible() && (key == ShortcutsManager::getShortcutsManager().getShortcut(SIZE_UP_MGLASS_ACTION_Y) ||
key == ShortcutsManager::getShortcutsManager().getShortcut(SIZE_DOWN_MGLASS_ACTION_Y) ||
key == ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_IN_MGLASS_ACTION_Y) ||
key == ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_OUT_MGLASS_ACTION_Y)))
{ {
case Qt::Key_Plus: case Qt::Key_Minus: case Qt::Key_Underscore: case Qt::Key_Asterisk:
QCoreApplication::sendEvent(mglass,event); QCoreApplication::sendEvent(mglass,event);
} }
} }
else else
QAbstractScrollArea::keyPressEvent(event); QAbstractScrollArea::keyPressEvent(event);

View File

@ -73,5 +73,7 @@
<file>../images/dropDownArrow.png</file> <file>../images/dropDownArrow.png</file>
<file>../images/translatorSearch.png</file> <file>../images/translatorSearch.png</file>
<file>../images/speaker.png</file> <file>../images/speaker.png</file>
<file>../images/clear_shortcut.png</file>
<file>../images/accept_shortcut.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,6 +10,7 @@
#include <QRadioButton> #include <QRadioButton>
#include <QSlider> #include <QSlider>
#include <QSettings> #include <QSettings>
#include <QGroupBox>
YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent) YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent)
:QDialog(parent) :QDialog(parent)
@ -23,6 +24,16 @@ YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent)
cancel->setDefault(true); cancel->setDefault(true);
QVBoxLayout * shortcutsLayout = new QVBoxLayout();
QPushButton * shortcutsButton = new QPushButton(tr("Edit shortcuts"));
shortcutsLayout->addWidget(shortcutsButton);
shortcutsBox = new QGroupBox(tr("Shortcuts"));
shortcutsBox->setLayout(shortcutsLayout);
connect(shortcutsButton,SIGNAL(clicked()),this,SIGNAL(editShortcuts()));
connect(accept,SIGNAL(clicked()),this,SLOT(saveOptions())); connect(accept,SIGNAL(clicked()),this,SLOT(saveOptions()));
connect(cancel,SIGNAL(clicked()),this,SLOT(restoreOptions())); //TODO fix this connect(cancel,SIGNAL(clicked()),this,SLOT(restoreOptions())); //TODO fix this
connect(cancel,SIGNAL(clicked()),this,SLOT(close())); connect(cancel,SIGNAL(clicked()),this,SLOT(close()));

View File

@ -8,6 +8,7 @@ class YACReaderGLFlowConfigWidget;
class QCheckBox; class QCheckBox;
class QPushButton; class QPushButton;
class QSettings; class QSettings;
class QGroupBox;
class YACReaderOptionsDialog : public QDialog class YACReaderOptionsDialog : public QDialog
{ {
@ -20,6 +21,8 @@ protected:
QPushButton * accept; QPushButton * accept;
QPushButton * cancel; QPushButton * cancel;
QGroupBox * shortcutsBox;
QSettings * settings; QSettings * settings;
QSettings * previousSettings; QSettings * previousSettings;
@ -56,6 +59,7 @@ protected slots:
signals: signals:
void optionsChanged(); void optionsChanged();
void editShortcuts();
}; };
#endif // YACREADER_OPTIONS_DIALOG_H #endif // YACREADER_OPTIONS_DIALOG_H

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 B

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 200 B

View File

@ -1,4 +1,4 @@
#include "shortcuts_dialog.h" #include "edit_shortcuts_dialog.h"
#include "actions_groups_model.h" #include "actions_groups_model.h"
#include "actions_shortcuts_model.h" #include "actions_shortcuts_model.h"
@ -14,7 +14,7 @@
#include "QsLog.h" #include "QsLog.h"
ShortcutsDialog::ShortcutsDialog(QWidget *parent) : EditShortcutsDialog::EditShortcutsDialog(QWidget *parent) :
QDialog(parent) QDialog(parent)
{ {
QPushButton * resetButton = new QPushButton(tr("Restore defaults"),this); QPushButton * resetButton = new QPushButton(tr("Restore defaults"),this);
@ -64,19 +64,19 @@ ShortcutsDialog::ShortcutsDialog(QWidget *parent) :
setModal(true); setModal(true);
} }
void ShortcutsDialog::addActionsGroup(const QString &name, const QIcon &ico, QList<QAction *> &group) void EditShortcutsDialog::addActionsGroup(const QString &name, const QIcon &ico, QList<QAction *> &group)
{ {
//TODO //TODO
//groups model add //groups model add
groupsModel->addActionsGroup(ActionsGroup(name,ico,group)); groupsModel->addActionsGroup(ActionsGroup(name,ico,group));
} }
void ShortcutsDialog::resetToDefaults() void EditShortcutsDialog::resetToDefaults()
{ {
} }
void ShortcutsDialog::loadShortcuts(const QModelIndex &mi,const QModelIndex &mi2) void EditShortcutsDialog::loadShortcuts(const QModelIndex &mi,const QModelIndex &mi2)
{ {
actionsModel->addActions(groupsModel->getActions(mi)); actionsModel->addActions(groupsModel->getActions(mi));
} }

View File

@ -1,5 +1,5 @@
#ifndef SHORTCUTS_DIALOG_H #ifndef EDIT_SHORTCUTS_DIALOG_H
#define SHORTCUTS_DIALOG_H #define EDIT_SHORTCUTS_DIALOG_H
#include <QDialog> #include <QDialog>
#include <QModelIndex> #include <QModelIndex>
@ -10,11 +10,11 @@ class QTableView;
class ActionsGroupsModel; class ActionsGroupsModel;
class ActionsShortcutsModel; class ActionsShortcutsModel;
class ShortcutsDialog : public QDialog class EditShortcutsDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ShortcutsDialog(QWidget * parent = 0); explicit EditShortcutsDialog(QWidget * parent = 0);
void addActionsGroup(const QString & name, const QIcon & ico, QList<QAction *> & group); void addActionsGroup(const QString & name, const QIcon & ico, QList<QAction *> & group);
signals: signals:
@ -29,4 +29,4 @@ protected:
ActionsShortcutsModel * actionsModel; ActionsShortcutsModel * actionsModel;
}; };
#endif // SHORTCUTS_DIALOG_H #endif // EDIT_SHORTCUTS_DIALOG_H

View File

@ -2,14 +2,14 @@ INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD DEPENDPATH += $$PWD
HEADERS += \ HEADERS += \
$$PWD/shortcuts_dialog.h \ $$PWD/edit_shortcuts_dialog.h \
$$PWD/actions_groups_model.h \ $$PWD/actions_groups_model.h \
$$PWD/actions_shortcuts_model.h \ $$PWD/actions_shortcuts_model.h \
$$PWD/edit_shortcut_item_delegate.h \ $$PWD/edit_shortcut_item_delegate.h \
$$PWD/shortcuts_manager.h $$PWD/shortcuts_manager.h
SOURCES += \ SOURCES += \
$$PWD/shortcuts_dialog.cpp \ $$PWD/edit_shortcuts_dialog.cpp \
$$PWD/actions_groups_model.cpp \ $$PWD/actions_groups_model.cpp \
$$PWD/actions_shortcuts_model.cpp \ $$PWD/actions_shortcuts_model.cpp \
$$PWD/edit_shortcut_item_delegate.cpp \ $$PWD/edit_shortcut_item_delegate.cpp \

View File

@ -11,6 +11,8 @@ ShortcutsManager::ShortcutsManager()
void ShortcutsManager::initDefaultShorcuts() void ShortcutsManager::initDefaultShorcuts()
{ {
#ifdef YACREADER_LIBRARY
//ACTIONS
defaultShorcuts.insert(CREATE_LIBRARY_ACTION_YL,Qt::Key_A); defaultShorcuts.insert(CREATE_LIBRARY_ACTION_YL,Qt::Key_A);
defaultShorcuts.insert(OPEN_LIBRARY_ACTION_YL,Qt::Key_O); defaultShorcuts.insert(OPEN_LIBRARY_ACTION_YL,Qt::Key_O);
defaultShorcuts.insert(UPDATE_LIBRARY_ACTION_YL,Qt::Key_U); defaultShorcuts.insert(UPDATE_LIBRARY_ACTION_YL,Qt::Key_U);
@ -25,6 +27,50 @@ void ShortcutsManager::initDefaultShorcuts()
defaultShorcuts.insert(OPTIONS_ACTION_YL,Qt::Key_C); defaultShorcuts.insert(OPTIONS_ACTION_YL,Qt::Key_C);
defaultShorcuts.insert(SERVER_CONFIG_ACTION_YL,Qt::Key_S); defaultShorcuts.insert(SERVER_CONFIG_ACTION_YL,Qt::Key_S);
defaultShorcuts.insert(TOGGLE_COMICS_VIEW_ACTION_YL,Qt::Key_V); defaultShorcuts.insert(TOGGLE_COMICS_VIEW_ACTION_YL,Qt::Key_V);
//COMMANDS (used in keypressevent)
#else
defaultShorcuts.insert(OPEN_ACTION_Y, Qt::Key_O);
defaultShorcuts.insert(OPEN_FOLDER_ACTION_Y, Qt::CTRL | Qt::Key_O);
defaultShorcuts.insert(OPEN_PREVIOUS_COMIC_ACTION_Y, Qt::CTRL | Qt::Key_Left);
defaultShorcuts.insert(OPEN_NEXT_COMIC_ACTION_Y, Qt::CTRL | Qt::Key_Right);
defaultShorcuts.insert(PREV_ACTION_Y, Qt::Key_Left);
defaultShorcuts.insert(NEXT_ACTION_Y, Qt::Key_Right);
defaultShorcuts.insert(LEFT_ROTATION_ACTION_Y, Qt::Key_L);
defaultShorcuts.insert(RIGHT_ROTATION_ACTION_Y, Qt::Key_R);
defaultShorcuts.insert(DOUBLE_PAGE_ACTION_Y, Qt::Key_D);
defaultShorcuts.insert(GO_TO_PAGE_ACTION_Y, Qt::Key_G);
defaultShorcuts.insert(OPTIONS_ACTION_Y, Qt::Key_C);
defaultShorcuts.insert(HELP_ABOUT_ACTION_Y, Qt::Key_F1);
defaultShorcuts.insert(SHOW_MAGNIFYING_GLASS_ACTION_Y, Qt::Key_Z);
defaultShorcuts.insert(SET_BOOKMARK_ACTION_Y, Qt::CTRL | Qt::Key_M);
defaultShorcuts.insert(SHOW_BOOKMARKS_ACTION_Y, Qt::Key_M);
defaultShorcuts.insert(SHOW_INFO_ACTION_Y, Qt::Key_I);
defaultShorcuts.insert(CLOSE_ACTION_Y, Qt::Key_Escape);
defaultShorcuts.insert(SHOW_DICTIONARY_ACTION_Y, Qt::Key_T);
defaultShorcuts.insert(ALWAYS_ON_TOP_ACTION_Y, Qt::Key_Q); //deprecated
defaultShorcuts.insert(ADJUST_TO_FULL_SIZE_ACTION_Y, Qt::Key_W);
defaultShorcuts.insert(SHOW_FLOW_ACTION_Y, Qt::Key_S);
//main_window_viewer
defaultShorcuts.insert(TOGGLE_FULL_SCREEN_ACTION_Y, Qt::Key_F);
defaultShorcuts.insert(TOGGLE_TOOL_BARS_ACTION_Y, Qt::Key_H);
defaultShorcuts.insert(CHANGE_FIT_ACTION_Y, Qt::Key_A);
//viewer
defaultShorcuts.insert(AUTO_SCROLL_FORWARD_ACTION_Y, Qt::Key_Space);
defaultShorcuts.insert(AUTO_SCROLL_BACKWARD_ACTION_Y, Qt::Key_B);
defaultShorcuts.insert(MOVE_DOWN_ACTION_Y, Qt::Key_Down);
defaultShorcuts.insert(MOVE_UP_ACTION_Y, Qt::Key_Up);
defaultShorcuts.insert(GO_TO_FIRST_PAGE_ACTION_Y, Qt::Key_Home);
defaultShorcuts.insert(GO_TO_LAST_PAGE_ACTION_Y, Qt::Key_End);
//mglass
defaultShorcuts.insert(SIZE_UP_MGLASS_ACTION_Y, Qt::Key_Plus);
defaultShorcuts.insert(SIZE_DOWN_MGLASS_ACTION_Y, Qt::Key_Minus);
defaultShorcuts.insert(ZOOM_IN_MGLASS_ACTION_Y, Qt::Key_Asterisk);
defaultShorcuts.insert(ZOOM_OUT_MGLASS_ACTION_Y, Qt::Key_Underscore);
#endif
} }
void ShortcutsManager::resetToDefaults() void ShortcutsManager::resetToDefaults()

View File

@ -67,7 +67,57 @@ public:
#define DELETE_COMICS_ACTION_YL "DELETE_COMICS_ACTION_YL" #define DELETE_COMICS_ACTION_YL "DELETE_COMICS_ACTION_YL"
#define HIDE_COMIC_VIEW_ACTION_YL "HIDE_COMIC_VIEW_ACTION_YL" #define HIDE_COMIC_VIEW_ACTION_YL "HIDE_COMIC_VIEW_ACTION_YL"
#define GET_INFO_ACTION_YL "GET_INFO_ACTION_YL" #define GET_INFO_ACTION_YL "GET_INFO_ACTION_YL"
#define SHOW_EDIT_SHORTCUTS_ACTION_YL "SHOW_EDIT_SHORTCUTS_ACTION_YL"
//COMMANDS YACReaderLibrary
//ACTION NAMES YACReader
#define OPEN_ACTION_Y "OPEN_ACTION_Y"
#define OPEN_FOLDER_ACTION_Y "OPEN_FOLDER_ACTION_Y"
#define SAVE_IMAGE_ACTION_Y "SAVE_IMAGE_ACTION_Y"
#define OPEN_PREVIOUS_COMIC_ACTION_Y "OPEN_PREVIOUS_COMIC_ACTION_Y"
#define OPEN_NEXT_COMIC_ACTION_Y "OPEN_NEXT_COMIC_ACTION_Y"
#define PREV_ACTION_Y "PREV_ACTION_Y"
#define NEXT_ACTION_Y "NEXT_ACTION_Y"
#define ADJUST_HEIGHT_ACTION_Y "ADJUST_HEIGHT_Y"
#define ADJUST_WIDTH_ACTION_Y "ADJUST_WIDTH_Y"
#define LEFT_ROTATION_ACTION_Y "LEFT_ROTATION_ACTION_Y"
#define RIGHT_ROTATION_ACTION_Y "RIGHT_ROTATION_ACTION_Y"
#define DOUBLE_PAGE_ACTION_Y "DOUBLE_PAGE_ACTION_Y"
#define GO_TO_PAGE_ACTION_Y "GO_TO_PAGE_ACTION_Y"
#define OPTIONS_ACTION_Y "OPTIONS_ACTION_Y"
#define HELP_ABOUT_ACTION_Y "HELP_ABOUT_ACTION_Y"
#define SHOW_MAGNIFYING_GLASS_ACTION_Y "SHOW_MAGNIFYING_GLASS_ACTION_Y"
#define SET_BOOKMARK_ACTION_Y "SET_BOOKMARK_ACTION_Y"
#define SHOW_BOOKMARKS_ACTION_Y "SHOW_BOOKMARKS_ACTION_Y"
#define SHOW_SHORCUTS_ACTION_Y "SHOW_SHORCUTS_ACTION_Y"
#define SHOW_INFO_ACTION_Y "SHOW_INFO_ACTION_Y"
#define CLOSE_ACTION_Y "CLOSE_ACTION_Y"
#define SHOW_DICTIONARY_ACTION_Y "SHOW_DICTIONARY_ACTION_Y"
#define ALWAYS_ON_TOP_ACTION_Y "ALWAYS_ON_TOP_ACTION_Y"
#define ADJUST_TO_FULL_SIZE_ACTION_Y "ADJUST_TO_FULL_SIZE_ACTION_Y"
#define SHOW_FLOW_ACTION_Y "SHOW_FLOW_ACTION_Y"
#define SHOW_EDIT_SHORTCUTS_ACTION_Y "SHOW_EDIT_SHORTCUTS_ACTION_Y"
//COMMANDS YACReader
//main_viewer_window
#define TOGGLE_FULL_SCREEN_ACTION_Y "TOGGLE_FULL_SCREEN_ACTION_Y"
#define TOGGLE_TOOL_BARS_ACTION_Y "TOGGLE_TOOL_BARS_ACTION_Y"
#define CHANGE_FIT_ACTION_Y "CHANGE_FIT_ACTION_Y"
//viewer
#define AUTO_SCROLL_FORWARD_ACTION_Y "AUTO_SCROLL_FORWARD_ACTION_Y"
#define AUTO_SCROLL_BACKWARD_ACTION_Y "AUTO_SCROLL_BACKWARD_ACTION_Y"
#define MOVE_DOWN_ACTION_Y "MOVE_DOWN_ACTION_Y"
#define MOVE_UP_ACTION_Y "MOVE_UP_ACTION_Y"
#define MOVE_LEFT_ACTION_Y "MOVE_LEFT_ACTION_Y"
#define MOVE_RIGHT_ACTION_Y "MOVE_RIGHT_ACTION_Y"
#define GO_TO_FIRST_PAGE_ACTION_Y "GO_TO_FIRST_PAGE_ACTION_Y"
#define GO_TO_LAST_PAGE_ACTION_Y "GO_TO_LAST_PAGE_ACTION_Y"
//mglass
#define SIZE_UP_MGLASS_ACTION_Y "SIZE_UP_MGLASS_ACTION_Y"
#define SIZE_DOWN_MGLASS_ACTION_Y "SIZE_DOWN_MGLASS_ACTION_Y"
#define ZOOM_IN_MGLASS_ACTION_Y "ZOOM_IN_MGLASS_ACTION_Y"
#define ZOOM_OUT_MGLASS_ACTION_Y "ZOOM_OUT_MGLASS_ACTION_Y"
#endif // SHORTCUTS_MANAGER_H #endif // SHORTCUTS_MANAGER_H