mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
added shortcuts management to YACReader
added shortcuts management to keyPressEvent keys
This commit is contained in:
parent
30a717c5d2
commit
07b2cbb7d0
@ -134,6 +134,7 @@ SOURCES += $$PWD/../common/comic.cpp \
|
||||
|
||||
include($$PWD/../custom_widgets/custom_widgets_yacreader.pri)
|
||||
include($$PWD/../compressed_archive/wrapper.pri)
|
||||
include($$PWD/../shortcuts_management/shortcuts_management.pri)
|
||||
|
||||
RESOURCES += $$PWD/yacreader_images.qrc \
|
||||
$$PWD/yacreader_files.qrc
|
||||
|
@ -6,7 +6,7 @@ TARGET = YACReader
|
||||
DEPENDPATH += . \
|
||||
release
|
||||
|
||||
DEFINES += NOMINMAX
|
||||
DEFINES += NOMINMAX YACREADER
|
||||
|
||||
unix:!macx{
|
||||
QMAKE_CXXFLAGS += -std=c++11
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "magnifying_glass.h"
|
||||
#include "viewer.h"
|
||||
#include "configuration.h"
|
||||
#include "shortcuts_manager.h"
|
||||
|
||||
#include <QScrollBar>
|
||||
|
||||
@ -244,26 +245,48 @@ void MagnifyingGlass::widthDown()
|
||||
void MagnifyingGlass::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
bool validKey = false;
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Plus:
|
||||
sizeUp();
|
||||
validKey = true;
|
||||
break;
|
||||
case Qt::Key_Minus:
|
||||
sizeDown();
|
||||
validKey = true;
|
||||
break;
|
||||
case Qt::Key_Underscore:
|
||||
zoomOut();
|
||||
validKey = true;
|
||||
break;
|
||||
case Qt::Key_Asterisk:
|
||||
zoomIn();
|
||||
validKey = true;
|
||||
break;
|
||||
}
|
||||
updateImage();
|
||||
|
||||
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))
|
||||
{
|
||||
sizeUp();
|
||||
validKey = true;
|
||||
}
|
||||
|
||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(SIZE_DOWN_MGLASS_ACTION_Y))
|
||||
{
|
||||
sizeDown();
|
||||
validKey = true;
|
||||
}
|
||||
|
||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_IN_MGLASS_ACTION_Y))
|
||||
{
|
||||
zoomIn();
|
||||
validKey = true;
|
||||
}
|
||||
|
||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_OUT_MGLASS_ACTION_Y))
|
||||
{
|
||||
zoomOut();
|
||||
validKey = true;
|
||||
}
|
||||
|
||||
if(validKey)
|
||||
{
|
||||
updateImage();
|
||||
event->setAccepted(true);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include "yacreader_local_client.h"
|
||||
|
||||
#include "yacreader_global.h"
|
||||
#include "edit_shortcuts_dialog.h"
|
||||
#include "shortcuts_manager.h"
|
||||
|
||||
#include <ctime>
|
||||
#include <algorithm>
|
||||
@ -87,19 +89,19 @@ MainWindowViewer::~MainWindowViewer()
|
||||
delete openNextComicAction;
|
||||
delete prevAction;
|
||||
delete nextAction;
|
||||
delete adjustHeight;
|
||||
delete adjustWidth;
|
||||
delete adjustHeightAction;
|
||||
delete adjustWidthAction;
|
||||
delete leftRotationAction;
|
||||
delete rightRotationAction;
|
||||
delete doublePageAction;
|
||||
delete goToPage;
|
||||
delete goToPageAction;
|
||||
delete optionsAction;
|
||||
delete helpAboutAction;
|
||||
delete showMagnifyingGlass;
|
||||
delete setBookmark;
|
||||
delete showBookmarks;
|
||||
delete showMagnifyingGlassAction;
|
||||
delete setBookmarkAction;
|
||||
delete showBookmarksAction;
|
||||
delete showShorcutsAction;
|
||||
delete showInfo;
|
||||
delete showInfoAction;
|
||||
delete closeAction;
|
||||
delete showDictionaryAction;
|
||||
delete alwaysOnTopAction;
|
||||
@ -163,8 +165,12 @@ void MainWindowViewer::setupUI()
|
||||
|
||||
optionsDialog->restoreOptions(settings);
|
||||
shortcutsDialog = new ShortcutsDialog(this);
|
||||
editShortcutsDialog = new EditShortcutsDialog(this);
|
||||
connect(optionsDialog,SIGNAL(editShortcuts()),editShortcutsDialog,SLOT(show()));
|
||||
|
||||
createActions();
|
||||
setUpShortcutsManagement();
|
||||
|
||||
createToolBars();
|
||||
|
||||
setWindowTitle("YACReader");
|
||||
@ -240,181 +246,216 @@ void MainWindowViewer::openFromArgv()
|
||||
|
||||
void MainWindowViewer::createActions()
|
||||
{
|
||||
openAction = new QAction(tr("&Open"),this);
|
||||
openAction->setShortcut(tr("O"));
|
||||
openAction->setIcon(QIcon(":/images/viewer_toolbar/open.png"));
|
||||
openAction->setToolTip(tr("Open a comic"));
|
||||
connect(openAction, SIGNAL(triggered()), this, SLOT(open()));
|
||||
openAction = new QAction(tr("&Open"),this);
|
||||
openAction->setIcon(QIcon(":/images/viewer_toolbar/open.png"));
|
||||
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()));
|
||||
|
||||
openFolderAction = new QAction(tr("Open Folder"),this);
|
||||
openFolderAction->setShortcut(tr("Ctrl+O"));
|
||||
openFolderAction->setIcon(QIcon(":/images/viewer_toolbar/openFolder.png"));
|
||||
openFolderAction->setToolTip(tr("Open image folder"));
|
||||
connect(openFolderAction, SIGNAL(triggered()), this, SLOT(openFolder()));
|
||||
openFolderAction = new QAction(tr("Open Folder"),this);
|
||||
openFolderAction->setIcon(QIcon(":/images/viewer_toolbar/openFolder.png"));
|
||||
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()));
|
||||
|
||||
saveImageAction = new QAction(tr("Save"),this);
|
||||
saveImageAction->setIcon(QIcon(":/images/viewer_toolbar/save.png"));
|
||||
saveImageAction->setToolTip(tr("Save current page"));
|
||||
saveImageAction->setDisabled(true);
|
||||
connect(saveImageAction,SIGNAL(triggered()),this,SLOT(saveImage()));
|
||||
saveImageAction = new QAction(tr("Save"),this);
|
||||
saveImageAction->setIcon(QIcon(":/images/viewer_toolbar/save.png"));
|
||||
saveImageAction->setToolTip(tr("Save current page"));
|
||||
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()));
|
||||
|
||||
openPreviousComicAction = new QAction(tr("Previous Comic"),this);
|
||||
openPreviousComicAction->setIcon(QIcon(":/images/viewer_toolbar/openPrevious.png"));
|
||||
openPreviousComicAction->setShortcut(Qt::CTRL + Qt::Key_Left);
|
||||
openPreviousComicAction->setToolTip(tr("Open previous comic"));
|
||||
openPreviousComicAction->setDisabled(true);
|
||||
connect(openPreviousComicAction,SIGNAL(triggered()),this,SLOT(openPreviousComic()));
|
||||
openPreviousComicAction = new QAction(tr("Previous Comic"),this);
|
||||
openPreviousComicAction->setIcon(QIcon(":/images/viewer_toolbar/openPrevious.png"));
|
||||
openPreviousComicAction->setToolTip(tr("Open previous comic"));
|
||||
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()));
|
||||
|
||||
openNextComicAction = new QAction(tr("Next Comic"),this);
|
||||
openNextComicAction->setIcon(QIcon(":/images/viewer_toolbar/openNext.png"));
|
||||
openNextComicAction->setShortcut(Qt::CTRL + Qt::Key_Right);
|
||||
openNextComicAction->setToolTip(tr("Open next comic"));
|
||||
openNextComicAction->setDisabled(true);
|
||||
connect(openNextComicAction,SIGNAL(triggered()),this,SLOT(openNextComic()));
|
||||
openNextComicAction = new QAction(tr("Next Comic"),this);
|
||||
openNextComicAction->setIcon(QIcon(":/images/viewer_toolbar/openNext.png"));
|
||||
openNextComicAction->setToolTip(tr("Open next comic"));
|
||||
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()));
|
||||
|
||||
prevAction = new QAction(tr("&Previous"),this);
|
||||
prevAction->setIcon(QIcon(":/images/viewer_toolbar/previous.png"));
|
||||
prevAction->setShortcut(Qt::Key_Left);
|
||||
prevAction->setShortcutContext(Qt::WidgetShortcut);
|
||||
prevAction->setToolTip(tr("Go to previous page"));
|
||||
prevAction->setDisabled(true);
|
||||
connect(prevAction, SIGNAL(triggered()),viewer,SLOT(prev()));
|
||||
prevAction = new QAction(tr("&Previous"),this);
|
||||
prevAction->setIcon(QIcon(":/images/viewer_toolbar/previous.png"));
|
||||
prevAction->setShortcutContext(Qt::WidgetShortcut);
|
||||
prevAction->setToolTip(tr("Go to previous page"));
|
||||
prevAction->setDisabled(true);
|
||||
prevAction->setData(PREV_ACTION_Y);
|
||||
prevAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(PREV_ACTION_Y));
|
||||
connect(prevAction, SIGNAL(triggered()),viewer,SLOT(prev()));
|
||||
|
||||
nextAction = new QAction(tr("&Next"),this);
|
||||
nextAction->setIcon(QIcon(":/images/viewer_toolbar/next.png"));
|
||||
nextAction->setShortcut(Qt::Key_Right);
|
||||
nextAction->setShortcutContext(Qt::WidgetShortcut);
|
||||
nextAction->setToolTip(tr("Go to next page"));
|
||||
nextAction = new QAction(tr("&Next"),this);
|
||||
nextAction->setIcon(QIcon(":/images/viewer_toolbar/next.png"));
|
||||
nextAction->setShortcutContext(Qt::WidgetShortcut);
|
||||
nextAction->setToolTip(tr("Go to next page"));
|
||||
nextAction->setDisabled(true);
|
||||
nextAction->setData(NEXT_ACTION_Y);
|
||||
nextAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(NEXT_ACTION_Y));
|
||||
connect(nextAction, SIGNAL(triggered()),viewer,SLOT(next()));
|
||||
|
||||
adjustHeight = new QAction(tr("Fit Height"),this);
|
||||
adjustHeight->setIcon(QIcon(":/images/viewer_toolbar/toHeight.png"));
|
||||
adjustHeightAction = new QAction(tr("Fit Height"),this);
|
||||
adjustHeightAction->setIcon(QIcon(":/images/viewer_toolbar/toHeight.png"));
|
||||
//adjustWidth->setCheckable(true);
|
||||
adjustHeight->setDisabled(true);
|
||||
adjustHeight->setChecked(Configuration::getConfiguration().getAdjustToWidth());
|
||||
adjustHeight->setToolTip(tr("Fit image to height"));
|
||||
adjustHeightAction->setDisabled(true);
|
||||
adjustHeightAction->setChecked(Configuration::getConfiguration().getAdjustToWidth());
|
||||
adjustHeightAction->setToolTip(tr("Fit image to height"));
|
||||
//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);
|
||||
adjustWidth->setIcon(QIcon(":/images/viewer_toolbar/toWidth.png"));
|
||||
adjustWidthAction = new QAction(tr("Fit Width"),this);
|
||||
adjustWidthAction->setIcon(QIcon(":/images/viewer_toolbar/toWidth.png"));
|
||||
//adjustWidth->setCheckable(true);
|
||||
adjustWidth->setDisabled(true);
|
||||
adjustWidth->setChecked(Configuration::getConfiguration().getAdjustToWidth());
|
||||
adjustWidth->setToolTip(tr("Fit image to width"));
|
||||
adjustWidthAction->setDisabled(true);
|
||||
adjustWidthAction->setChecked(Configuration::getConfiguration().getAdjustToWidth());
|
||||
adjustWidthAction->setToolTip(tr("Fit image to width"));
|
||||
//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->setShortcut(tr("L"));
|
||||
leftRotationAction->setIcon(QIcon(":/images/viewer_toolbar/rotateL.png"));
|
||||
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()));
|
||||
|
||||
rightRotationAction = new QAction(tr("Rotate image to the right"),this);
|
||||
rightRotationAction->setShortcut(tr("R"));
|
||||
rightRotationAction->setIcon(QIcon(":/images/viewer_toolbar/rotateR.png"));
|
||||
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()));
|
||||
|
||||
doublePageAction = new QAction(tr("Double page mode"),this);
|
||||
doublePageAction->setToolTip(tr("Switch to double page mode"));
|
||||
doublePageAction->setShortcut(tr("D"));
|
||||
doublePageAction->setIcon(QIcon(":/images/viewer_toolbar/doublePage.png"));
|
||||
doublePageAction->setDisabled(true);
|
||||
doublePageAction->setCheckable(true);
|
||||
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()));
|
||||
|
||||
goToPage = new QAction(tr("Go To"),this);
|
||||
goToPage->setShortcut(tr("G"));
|
||||
goToPage->setIcon(QIcon(":/images/viewer_toolbar/goto.png"));
|
||||
goToPage->setDisabled(true);
|
||||
goToPage->setToolTip(tr("Go to page ..."));
|
||||
connect(goToPage, SIGNAL(triggered()),viewer,SLOT(showGoToDialog()));
|
||||
goToPageAction = new QAction(tr("Go To"),this);
|
||||
goToPageAction->setIcon(QIcon(":/images/viewer_toolbar/goto.png"));
|
||||
goToPageAction->setDisabled(true);
|
||||
goToPageAction->setToolTip(tr("Go to page ..."));
|
||||
goToPageAction->setData(GO_TO_PAGE_ACTION_Y);
|
||||
goToPageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(GO_TO_PAGE_ACTION_Y));
|
||||
connect(goToPageAction, SIGNAL(triggered()),viewer,SLOT(showGoToDialog()));
|
||||
|
||||
optionsAction = new QAction(tr("Options"),this);
|
||||
optionsAction->setShortcut(tr("C"));
|
||||
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"));
|
||||
|
||||
connect(optionsAction, SIGNAL(triggered()),optionsDialog,SLOT(show()));
|
||||
|
||||
helpAboutAction = new QAction(tr("Help"),this);
|
||||
helpAboutAction->setToolTip(tr("Help, About YACReader"));
|
||||
helpAboutAction->setShortcut(Qt::Key_F1);
|
||||
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()));
|
||||
|
||||
showMagnifyingGlass = new QAction(tr("Magnifying glass"),this);
|
||||
showMagnifyingGlass->setToolTip(tr("Switch Magnifying glass"));
|
||||
showMagnifyingGlass->setShortcut(tr("Z"));
|
||||
showMagnifyingGlass->setIcon(QIcon(":/images/viewer_toolbar/magnifyingGlass.png"));
|
||||
showMagnifyingGlass->setDisabled(true);
|
||||
showMagnifyingGlass->setCheckable(true);
|
||||
connect(showMagnifyingGlass, SIGNAL(triggered()),viewer,SLOT(magnifyingGlassSwitch()));
|
||||
showMagnifyingGlassAction = new QAction(tr("Magnifying glass"),this);
|
||||
showMagnifyingGlassAction->setToolTip(tr("Switch Magnifying glass"));
|
||||
showMagnifyingGlassAction->setIcon(QIcon(":/images/viewer_toolbar/magnifyingGlass.png"));
|
||||
showMagnifyingGlassAction->setDisabled(true);
|
||||
showMagnifyingGlassAction->setCheckable(true);
|
||||
showMagnifyingGlassAction->setData(SHOW_MAGNIFYING_GLASS_ACTION_Y);
|
||||
showMagnifyingGlassAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_MAGNIFYING_GLASS_ACTION_Y));
|
||||
connect(showMagnifyingGlassAction, SIGNAL(triggered()),viewer,SLOT(magnifyingGlassSwitch()));
|
||||
|
||||
setBookmark = new QAction(tr("Set bookmark"),this);
|
||||
setBookmark->setToolTip(tr("Set a bookmark on the current page"));
|
||||
setBookmark->setShortcut(Qt::CTRL+Qt::Key_M);
|
||||
setBookmark->setIcon(QIcon(":/images/viewer_toolbar/bookmark.png"));
|
||||
setBookmark->setDisabled(true);
|
||||
setBookmark->setCheckable(true);
|
||||
connect(setBookmark,SIGNAL(triggered (bool)),viewer,SLOT(setBookmark(bool)));
|
||||
connect(viewer,SIGNAL(pageAvailable(bool)),setBookmark,SLOT(setEnabled(bool)));
|
||||
connect(viewer,SIGNAL(pageIsBookmark(bool)),setBookmark,SLOT(setChecked(bool)));
|
||||
setBookmarkAction = new QAction(tr("Set bookmark"),this);
|
||||
setBookmarkAction->setToolTip(tr("Set a bookmark on the current page"));
|
||||
setBookmarkAction->setIcon(QIcon(":/images/viewer_toolbar/bookmark.png"));
|
||||
setBookmarkAction->setDisabled(true);
|
||||
setBookmarkAction->setCheckable(true);
|
||||
setBookmarkAction->setData(SET_BOOKMARK_ACTION_Y);
|
||||
setBookmarkAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SET_BOOKMARK_ACTION_Y));
|
||||
connect(setBookmarkAction,SIGNAL(triggered (bool)),viewer,SLOT(setBookmarkAction(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);
|
||||
showBookmarks->setToolTip(tr("Show the bookmarks of the current comic"));
|
||||
showBookmarks->setShortcut(tr("M"));
|
||||
showBookmarks->setIcon(QIcon(":/images/viewer_toolbar/showBookmarks.png"));
|
||||
showBookmarks->setDisabled(true);
|
||||
connect(showBookmarks, SIGNAL(triggered()),viewer->getBookmarksDialog(),SLOT(show()));
|
||||
showBookmarksAction = new QAction(tr("Show bookmarks"),this);
|
||||
showBookmarksAction->setToolTip(tr("Show the bookmarks of the current comic"));
|
||||
showBookmarksAction->setIcon(QIcon(":/images/viewer_toolbar/showBookmarks.png"));
|
||||
showBookmarksAction->setDisabled(true);
|
||||
showBookmarksAction->setData(SHOW_BOOKMARKS_ACTION_Y);
|
||||
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->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()));
|
||||
|
||||
showInfo = new QAction(tr("Show Info"),this);
|
||||
showInfo->setShortcut(tr("I"));
|
||||
showInfo->setIcon(QIcon(":/images/viewer_toolbar/info.png"));
|
||||
showInfo->setDisabled(true);
|
||||
connect(showInfo, SIGNAL(triggered()),viewer,SLOT(informationSwitch()));
|
||||
showInfoAction = new QAction(tr("Show Info"),this);
|
||||
showInfoAction->setIcon(QIcon(":/images/viewer_toolbar/info.png"));
|
||||
showInfoAction->setDisabled(true);
|
||||
showInfoAction->setData(SHOW_INFO_ACTION_Y);
|
||||
showInfoAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_INFO_ACTION_Y));
|
||||
connect(showInfoAction, SIGNAL(triggered()),viewer,SLOT(informationSwitch()));
|
||||
|
||||
closeAction = new QAction(tr("Close"),this);
|
||||
closeAction->setShortcut(Qt::Key_Escape);
|
||||
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()));
|
||||
|
||||
showDictionaryAction = new QAction(tr("Show Dictionary"),this);
|
||||
showDictionaryAction->setShortcut(Qt::Key_T);
|
||||
showDictionaryAction->setIcon(QIcon(":/images/viewer_toolbar/translator.png"));
|
||||
//showDictionaryAction->setCheckable(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()));
|
||||
|
||||
//deprecated
|
||||
alwaysOnTopAction = new QAction(tr("Always on top"),this);
|
||||
alwaysOnTopAction->setShortcut(Qt::Key_Q);
|
||||
alwaysOnTopAction->setIcon(QIcon(":/images/alwaysOnTop.png"));
|
||||
alwaysOnTopAction->setCheckable(true);
|
||||
alwaysOnTopAction->setDisabled(true);
|
||||
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()));
|
||||
|
||||
adjustToFullSizeAction = new QAction(tr("Show full size"),this);
|
||||
adjustToFullSizeAction->setShortcut(Qt::Key_W);
|
||||
adjustToFullSizeAction->setIcon(QIcon(":/images/viewer_toolbar/full.png"));
|
||||
adjustToFullSizeAction->setCheckable(true);
|
||||
adjustToFullSizeAction->setDisabled(true);
|
||||
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()));
|
||||
|
||||
showFlowAction = new QAction(tr("Show go to flow"),this);
|
||||
showFlowAction->setShortcut(Qt::Key_S);
|
||||
showFlowAction->setIcon(QIcon(":/images/viewer_toolbar/flow.png"));
|
||||
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()));
|
||||
|
||||
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()
|
||||
@ -445,7 +486,7 @@ void MainWindowViewer::createToolBars()
|
||||
#endif
|
||||
comicToolBar->addAction(prevAction);
|
||||
comicToolBar->addAction(nextAction);
|
||||
comicToolBar->addAction(goToPage);
|
||||
comicToolBar->addAction(goToPageAction);
|
||||
|
||||
//#ifndef Q_OS_MAC
|
||||
// comicToolBar->addSeparator();
|
||||
@ -486,7 +527,7 @@ void MainWindowViewer::createToolBars()
|
||||
);
|
||||
menu->addAction(sliderAction);
|
||||
QToolButton * tb2 = new QToolButton();
|
||||
tb2->addAction(adjustWidth);
|
||||
tb2->addAction(adjustWidthAction);
|
||||
tb2->setMenu(menu);
|
||||
|
||||
connect(sliderAction,SIGNAL(fitToWidthRatioChanged(float)),viewer,SLOT(updateFitToWidthRatio(float)));
|
||||
@ -495,9 +536,9 @@ void MainWindowViewer::createToolBars()
|
||||
|
||||
//tb2->addAction();
|
||||
tb2->setPopupMode(QToolButton::MenuButtonPopup);
|
||||
tb2->setDefaultAction(adjustWidth);
|
||||
tb2->setDefaultAction(adjustWidthAction);
|
||||
comicToolBar->addWidget(tb2);
|
||||
comicToolBar->addAction(adjustHeight);
|
||||
comicToolBar->addAction(adjustHeightAction);
|
||||
comicToolBar->addAction(adjustToFullSizeAction);
|
||||
comicToolBar->addAction(leftRotationAction);
|
||||
comicToolBar->addAction(rightRotationAction);
|
||||
@ -508,15 +549,15 @@ void MainWindowViewer::createToolBars()
|
||||
#else
|
||||
comicToolBar->addSeparator();
|
||||
#endif
|
||||
comicToolBar->addAction(showMagnifyingGlass);
|
||||
comicToolBar->addAction(showMagnifyingGlassAction);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
comicToolBar->addWidget(new MacToolBarSeparator);
|
||||
#else
|
||||
comicToolBar->addSeparator();
|
||||
#endif
|
||||
comicToolBar->addAction(setBookmark);
|
||||
comicToolBar->addAction(showBookmarks);
|
||||
comicToolBar->addAction(setBookmarkAction);
|
||||
comicToolBar->addAction(showBookmarksAction);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
comicToolBar->addWidget(new MacToolBarSeparator);
|
||||
@ -525,7 +566,7 @@ void MainWindowViewer::createToolBars()
|
||||
#endif
|
||||
comicToolBar->addAction(showDictionaryAction);
|
||||
comicToolBar->addAction(showFlowAction);
|
||||
comicToolBar->addAction(showInfo);
|
||||
comicToolBar->addAction(showInfoAction);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
comicToolBar->addWidget(new MacToolBarSeparator);
|
||||
@ -551,27 +592,28 @@ void MainWindowViewer::createToolBars()
|
||||
|
||||
viewer->addAction(prevAction);
|
||||
viewer->addAction(nextAction);
|
||||
viewer->addAction(goToPage);
|
||||
viewer->addAction(adjustHeight);
|
||||
viewer->addAction(adjustWidth);
|
||||
viewer->addAction(goToPageAction);
|
||||
viewer->addAction(adjustHeightAction);
|
||||
viewer->addAction(adjustWidthAction);
|
||||
viewer->addAction(adjustToFullSizeAction);
|
||||
viewer->addAction(leftRotationAction);
|
||||
viewer->addAction(rightRotationAction);
|
||||
YACReader::addSperator(viewer);
|
||||
|
||||
viewer->addAction(showMagnifyingGlass);
|
||||
viewer->addAction(showMagnifyingGlassAction);
|
||||
YACReader::addSperator(viewer);
|
||||
|
||||
viewer->addAction(setBookmark);
|
||||
viewer->addAction(showBookmarks);
|
||||
viewer->addAction(setBookmarkAction);
|
||||
viewer->addAction(showBookmarksAction);
|
||||
YACReader::addSperator(viewer);
|
||||
|
||||
viewer->addAction(showDictionaryAction);
|
||||
viewer->addAction(showFlowAction);
|
||||
viewer->addAction(showInfo);
|
||||
viewer->addAction(showInfoAction);
|
||||
YACReader::addSperator(viewer);
|
||||
|
||||
viewer->addAction(showShorcutsAction);
|
||||
viewer->addAction(showEditShortcutsAction);
|
||||
viewer->addAction(optionsAction);
|
||||
viewer->addAction(helpAboutAction);
|
||||
YACReader::addSperator(viewer);
|
||||
@ -740,18 +782,18 @@ void MainWindowViewer::enableActions()
|
||||
saveImageAction->setDisabled(false);
|
||||
prevAction->setDisabled(false);
|
||||
nextAction->setDisabled(false);
|
||||
adjustHeight->setDisabled(false);
|
||||
adjustWidth->setDisabled(false);
|
||||
goToPage->setDisabled(false);
|
||||
adjustHeightAction->setDisabled(false);
|
||||
adjustWidthAction->setDisabled(false);
|
||||
goToPageAction->setDisabled(false);
|
||||
//alwaysOnTopAction->setDisabled(false);
|
||||
leftRotationAction->setDisabled(false);
|
||||
rightRotationAction->setDisabled(false);
|
||||
showMagnifyingGlass->setDisabled(false);
|
||||
showMagnifyingGlassAction->setDisabled(false);
|
||||
doublePageAction->setDisabled(false);
|
||||
adjustToFullSizeAction->setDisabled(false);
|
||||
//setBookmark->setDisabled(false);
|
||||
showBookmarks->setDisabled(false);
|
||||
showInfo->setDisabled(false); //TODO enable goTo and showInfo (or update) when numPages emited
|
||||
showBookmarksAction->setDisabled(false);
|
||||
showInfoAction->setDisabled(false); //TODO enable goTo and showInfo (or update) when numPages emited
|
||||
showDictionaryAction->setDisabled(false);
|
||||
showFlowAction->setDisabled(false);
|
||||
}
|
||||
@ -760,18 +802,18 @@ void MainWindowViewer::disableActions()
|
||||
saveImageAction->setDisabled(true);
|
||||
prevAction->setDisabled(true);
|
||||
nextAction->setDisabled(true);
|
||||
adjustHeight->setDisabled(true);
|
||||
adjustWidth->setDisabled(true);
|
||||
goToPage->setDisabled(true);
|
||||
adjustHeightAction->setDisabled(true);
|
||||
adjustWidthAction->setDisabled(true);
|
||||
goToPageAction->setDisabled(true);
|
||||
//alwaysOnTopAction->setDisabled(true);
|
||||
leftRotationAction->setDisabled(true);
|
||||
rightRotationAction->setDisabled(true);
|
||||
showMagnifyingGlass->setDisabled(true);
|
||||
showMagnifyingGlassAction->setDisabled(true);
|
||||
doublePageAction->setDisabled(true);
|
||||
adjustToFullSizeAction->setDisabled(true);
|
||||
setBookmark->setDisabled(true);
|
||||
showBookmarks->setDisabled(true);
|
||||
showInfo->setDisabled(true); //TODO enable goTo and showInfo (or update) when numPages emited
|
||||
setBookmarkAction->setDisabled(true);
|
||||
showBookmarksAction->setDisabled(true);
|
||||
showInfoAction->setDisabled(true); //TODO enable goTo and showInfo (or update) when numPages emited
|
||||
openPreviousComicAction->setDisabled(true);
|
||||
openNextComicAction->setDisabled(true);
|
||||
showDictionaryAction->setDisabled(true);
|
||||
@ -780,28 +822,38 @@ void MainWindowViewer::disableActions()
|
||||
|
||||
void MainWindowViewer::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
//TODO remove unused keys
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Escape:
|
||||
this->close();
|
||||
break;
|
||||
case Qt::Key_F:
|
||||
toggleFullScreen();
|
||||
break;
|
||||
case Qt::Key_H:
|
||||
toggleToolBars();
|
||||
break;
|
||||
case Qt::Key_O:
|
||||
open();
|
||||
break;
|
||||
case Qt::Key_A:
|
||||
changeFit();
|
||||
break;
|
||||
default:
|
||||
QWidget::keyPressEvent(event);
|
||||
break;
|
||||
}
|
||||
//TODO remove unused keys
|
||||
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))
|
||||
{
|
||||
toggleFullScreen();
|
||||
event->accept();
|
||||
}
|
||||
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 )
|
||||
@ -900,7 +952,7 @@ void MainWindowViewer::checkNewVersion()
|
||||
QTimer * tT = new QTimer;
|
||||
tT->setSingleShot(true);
|
||||
connect(tT, SIGNAL(timeout()), versionChecker, SLOT(get()));
|
||||
//versionChecker->get(); //TODÓ
|
||||
//versionChecker->get(); //TOD<EFBFBD>
|
||||
tT->start(100);
|
||||
|
||||
conf.setLastVersionCheck(current);
|
||||
@ -926,6 +978,131 @@ void MainWindowViewer::processReset()
|
||||
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()
|
||||
{
|
||||
Configuration & conf = Configuration::getConfiguration();
|
||||
|
@ -18,6 +18,7 @@ class HelpAboutDialog;
|
||||
class HttpVersionChecker;
|
||||
class ShortcutsDialog;
|
||||
class YACReaderSliderAction;
|
||||
class EditShortcutsDialog;
|
||||
|
||||
class MainWindowViewer : public QMainWindow
|
||||
{
|
||||
@ -51,6 +52,7 @@ class YACReaderSliderAction;
|
||||
void fitToHeight();
|
||||
void checkNewVersion();
|
||||
void processReset();
|
||||
void setUpShortcutsManagement();
|
||||
/*void viewComic();
|
||||
void prev();
|
||||
void next();
|
||||
@ -71,6 +73,7 @@ class YACReaderSliderAction;
|
||||
OptionsDialog * optionsDialog;
|
||||
HelpAboutDialog * had;
|
||||
ShortcutsDialog * shortcutsDialog;
|
||||
EditShortcutsDialog * editShortcutsDialog;
|
||||
|
||||
//! ToolBars
|
||||
QToolBar *comicToolBar;
|
||||
@ -83,17 +86,17 @@ class YACReaderSliderAction;
|
||||
QAction *openNextComicAction;
|
||||
QAction *nextAction;
|
||||
QAction *prevAction;
|
||||
QAction *adjustWidth;
|
||||
QAction *adjustHeight;
|
||||
QAction *goToPage;
|
||||
QAction *adjustWidthAction;
|
||||
QAction *adjustHeightAction;
|
||||
QAction *goToPageAction;
|
||||
QAction *optionsAction;
|
||||
QAction *helpAboutAction;
|
||||
QAction *showMagnifyingGlass;
|
||||
QAction *setBookmark;
|
||||
QAction *showBookmarks;
|
||||
QAction *showMagnifyingGlassAction;
|
||||
QAction *setBookmarkAction;
|
||||
QAction *showBookmarksAction;
|
||||
QAction *leftRotationAction;
|
||||
QAction *rightRotationAction;
|
||||
QAction *showInfo;
|
||||
QAction *showInfoAction;
|
||||
QAction *closeAction;
|
||||
QAction *doublePageAction;
|
||||
QAction *showShorcutsAction;
|
||||
@ -102,6 +105,8 @@ class YACReaderSliderAction;
|
||||
QAction *adjustToFullSizeAction;
|
||||
QAction *showFlowAction;
|
||||
|
||||
QAction *showEditShortcutsAction;
|
||||
|
||||
YACReaderSliderAction * sliderAction;
|
||||
|
||||
HttpVersionChecker * versionChecker;
|
||||
@ -115,8 +120,8 @@ class YACReaderSliderAction;
|
||||
void getSiblingComics(QString path,QString currentComic);
|
||||
|
||||
//! Manejadores de evento:
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
//void resizeEvent(QResizeEvent * event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
//void resizeEvent(QResizeEvent * event);
|
||||
void mouseDoubleClickEvent ( QMouseEvent * event );
|
||||
void dropEvent(QDropEvent *event);
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
|
@ -113,6 +113,7 @@ OptionsDialog::OptionsDialog(QWidget * parent)
|
||||
layoutGeneral->addWidget(slideSizeBox);
|
||||
layoutGeneral->addWidget(fitBox);
|
||||
layoutGeneral->addWidget(colorBox);
|
||||
layoutGeneral->addWidget(shortcutsBox);
|
||||
layoutGeneral->addStretch();
|
||||
layoutFlow->addWidget(sw);
|
||||
layoutFlow->addWidget(gl);
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "page_label_widget.h"
|
||||
#include "notifications_label_widget.h"
|
||||
#include "comic_db.h"
|
||||
#include "shortcuts_manager.h"
|
||||
|
||||
#include <QFile>
|
||||
|
||||
|
||||
@ -367,62 +369,72 @@ void Viewer::scrollUp()
|
||||
|
||||
void Viewer::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if(render->hasLoadedComic())
|
||||
{
|
||||
if(goToFlow->isVisible() && event->key()!=Qt::Key_S)
|
||||
QCoreApplication::sendEvent(goToFlow,event);
|
||||
else
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Space:
|
||||
posByStep = height()/numScrollSteps;
|
||||
nextPos=verticalScrollBar()->sliderPosition()+static_cast<int>((height()*0.80));
|
||||
scrollDown();
|
||||
break;
|
||||
case Qt::Key_B:
|
||||
posByStep = height()/numScrollSteps;
|
||||
nextPos=verticalScrollBar()->sliderPosition()-static_cast<int>((height()*0.80));
|
||||
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())
|
||||
{
|
||||
case Qt::Key_Plus: case Qt::Key_Minus: case Qt::Key_Underscore: case Qt::Key_Asterisk:
|
||||
QCoreApplication::sendEvent(mglass,event);
|
||||
}
|
||||
}
|
||||
else
|
||||
QAbstractScrollArea::keyPressEvent(event);
|
||||
if(render->hasLoadedComic())
|
||||
{
|
||||
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);
|
||||
else*/
|
||||
|
||||
if (key == ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_FORWARD_ACTION_Y))
|
||||
{
|
||||
posByStep = height()/numScrollSteps;
|
||||
nextPos=verticalScrollBar()->sliderPosition()+static_cast<int>((height()*0.80));
|
||||
scrollDown();
|
||||
}
|
||||
|
||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_BACKWARD_ACTION_Y))
|
||||
{
|
||||
posByStep = height()/numScrollSteps;
|
||||
nextPos=verticalScrollBar()->sliderPosition()-static_cast<int>((height()*0.80));
|
||||
scrollUp();
|
||||
}
|
||||
|
||||
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)))
|
||||
{
|
||||
QCoreApplication::sendEvent(mglass,event);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
QAbstractScrollArea::keyPressEvent(event);
|
||||
}
|
||||
|
||||
void Viewer::wheelEvent(QWheelEvent * event)
|
||||
|
@ -73,5 +73,7 @@
|
||||
<file>../images/dropDownArrow.png</file>
|
||||
<file>../images/translatorSearch.png</file>
|
||||
<file>../images/speaker.png</file>
|
||||
<file>../images/clear_shortcut.png</file>
|
||||
<file>../images/accept_shortcut.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -13,7 +13,7 @@ INCLUDEPATH += ../common \
|
||||
./comic_vine \
|
||||
./comic_vine/model
|
||||
|
||||
DEFINES += SERVER_RELEASE NOMINMAX
|
||||
DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY
|
||||
|
||||
win32 {
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,8 +12,6 @@ class OptionsDialog : public YACReaderOptionsDialog
|
||||
Q_OBJECT
|
||||
public:
|
||||
OptionsDialog(QWidget * parent = 0);
|
||||
signals:
|
||||
void editShortcuts();
|
||||
};
|
||||
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <QRadioButton>
|
||||
#include <QSlider>
|
||||
#include <QSettings>
|
||||
#include <QGroupBox>
|
||||
|
||||
YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent)
|
||||
:QDialog(parent)
|
||||
@ -23,6 +24,16 @@ YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent)
|
||||
|
||||
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(cancel,SIGNAL(clicked()),this,SLOT(restoreOptions())); //TODO fix this
|
||||
connect(cancel,SIGNAL(clicked()),this,SLOT(close()));
|
||||
|
@ -8,6 +8,7 @@ class YACReaderGLFlowConfigWidget;
|
||||
class QCheckBox;
|
||||
class QPushButton;
|
||||
class QSettings;
|
||||
class QGroupBox;
|
||||
|
||||
class YACReaderOptionsDialog : public QDialog
|
||||
{
|
||||
@ -20,6 +21,8 @@ protected:
|
||||
QPushButton * accept;
|
||||
QPushButton * cancel;
|
||||
|
||||
QGroupBox * shortcutsBox;
|
||||
|
||||
QSettings * settings;
|
||||
QSettings * previousSettings;
|
||||
|
||||
@ -56,6 +59,7 @@ protected slots:
|
||||
|
||||
signals:
|
||||
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 |
@ -1,4 +1,4 @@
|
||||
#include "shortcuts_dialog.h"
|
||||
#include "edit_shortcuts_dialog.h"
|
||||
|
||||
#include "actions_groups_model.h"
|
||||
#include "actions_shortcuts_model.h"
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
#include "QsLog.h"
|
||||
|
||||
ShortcutsDialog::ShortcutsDialog(QWidget *parent) :
|
||||
EditShortcutsDialog::EditShortcutsDialog(QWidget *parent) :
|
||||
QDialog(parent)
|
||||
{
|
||||
QPushButton * resetButton = new QPushButton(tr("Restore defaults"),this);
|
||||
@ -64,19 +64,19 @@ ShortcutsDialog::ShortcutsDialog(QWidget *parent) :
|
||||
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
|
||||
//groups model add
|
||||
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));
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
#ifndef SHORTCUTS_DIALOG_H
|
||||
#define SHORTCUTS_DIALOG_H
|
||||
#ifndef EDIT_SHORTCUTS_DIALOG_H
|
||||
#define EDIT_SHORTCUTS_DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QModelIndex>
|
||||
@ -10,11 +10,11 @@ class QTableView;
|
||||
class ActionsGroupsModel;
|
||||
class ActionsShortcutsModel;
|
||||
|
||||
class ShortcutsDialog : public QDialog
|
||||
class EditShortcutsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ShortcutsDialog(QWidget * parent = 0);
|
||||
explicit EditShortcutsDialog(QWidget * parent = 0);
|
||||
void addActionsGroup(const QString & name, const QIcon & ico, QList<QAction *> & group);
|
||||
signals:
|
||||
|
||||
@ -29,4 +29,4 @@ protected:
|
||||
ActionsShortcutsModel * actionsModel;
|
||||
};
|
||||
|
||||
#endif // SHORTCUTS_DIALOG_H
|
||||
#endif // EDIT_SHORTCUTS_DIALOG_H
|
@ -2,14 +2,14 @@ INCLUDEPATH += $$PWD
|
||||
DEPENDPATH += $$PWD
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/shortcuts_dialog.h \
|
||||
$$PWD/edit_shortcuts_dialog.h \
|
||||
$$PWD/actions_groups_model.h \
|
||||
$$PWD/actions_shortcuts_model.h \
|
||||
$$PWD/edit_shortcut_item_delegate.h \
|
||||
$$PWD/shortcuts_manager.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/shortcuts_dialog.cpp \
|
||||
$$PWD/edit_shortcuts_dialog.cpp \
|
||||
$$PWD/actions_groups_model.cpp \
|
||||
$$PWD/actions_shortcuts_model.cpp \
|
||||
$$PWD/edit_shortcut_item_delegate.cpp \
|
||||
|
@ -11,6 +11,8 @@ ShortcutsManager::ShortcutsManager()
|
||||
|
||||
void ShortcutsManager::initDefaultShorcuts()
|
||||
{
|
||||
#ifdef YACREADER_LIBRARY
|
||||
//ACTIONS
|
||||
defaultShorcuts.insert(CREATE_LIBRARY_ACTION_YL,Qt::Key_A);
|
||||
defaultShorcuts.insert(OPEN_LIBRARY_ACTION_YL,Qt::Key_O);
|
||||
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(SERVER_CONFIG_ACTION_YL,Qt::Key_S);
|
||||
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()
|
||||
|
@ -67,7 +67,57 @@ public:
|
||||
#define DELETE_COMICS_ACTION_YL "DELETE_COMICS_ACTION_YL"
|
||||
#define HIDE_COMIC_VIEW_ACTION_YL "HIDE_COMIC_VIEW_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
|
||||
|
Loading…
x
Reference in New Issue
Block a user