mirror of
https://github.com/YACReader/yacreader
synced 2025-07-22 23:15:14 -04:00
added shortcuts management to YACReader
added shortcuts management to keyPressEvent keys
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user