mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
added shortcuts management support
TODO: integrate it in YACReader TODO: add icons for groups TODO: add conflicts detection TODO: fix any shortcut used in keyPressEvent TODO: choose new default shortcuts (F5 update, F11 fullscreen, etc...)
This commit is contained in:
parent
3c18599496
commit
50c8eca7c4
@ -174,6 +174,7 @@ include(../custom_widgets/custom_widgets_yacreaderlibrary.pri)
|
|||||||
include(../compressed_archive/wrapper.pri)
|
include(../compressed_archive/wrapper.pri)
|
||||||
include(./comic_vine/comic_vine.pri)
|
include(./comic_vine/comic_vine.pri)
|
||||||
include(../QsLog/QsLog.pri)
|
include(../QsLog/QsLog.pri)
|
||||||
|
include(../shortcuts_management/shortcuts_management.pri)
|
||||||
|
|
||||||
RESOURCES += images.qrc files.qrc
|
RESOURCES += images.qrc files.qrc
|
||||||
win32:RESOURCES += images_win.qrc
|
win32:RESOURCES += images_win.qrc
|
||||||
|
@ -100,6 +100,8 @@
|
|||||||
<file>../images/comic_vine/downArrow.png</file>
|
<file>../images/comic_vine/downArrow.png</file>
|
||||||
<file>../images/comic_vine/upArrow.png</file>
|
<file>../images/comic_vine/upArrow.png</file>
|
||||||
<file>../images/find_folder.png</file>
|
<file>../images/find_folder.png</file>
|
||||||
|
<file>../images/clear_shortcut.png</file>
|
||||||
|
<file>../images/accept_shortcut.png</file>
|
||||||
<!--<file>../images/busy_background.png</file>-->
|
<!--<file>../images/busy_background.png</file>-->
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -65,6 +65,9 @@
|
|||||||
#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 "shortcuts_manager.h"
|
||||||
|
|
||||||
#include "QsLog.h"
|
#include "QsLog.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
@ -270,6 +273,9 @@ void LibraryWindow::doDialogs()
|
|||||||
optionsDialog = new OptionsDialog(this);
|
optionsDialog = new OptionsDialog(this);
|
||||||
optionsDialog->restoreOptions(settings);
|
optionsDialog->restoreOptions(settings);
|
||||||
|
|
||||||
|
shortcutsDialog = new ShortcutsDialog(this);
|
||||||
|
setUpShortcutsManagement();
|
||||||
|
|
||||||
#ifdef SERVER_RELEASE
|
#ifdef SERVER_RELEASE
|
||||||
serverConfigDialog = new ServerConfigDialog(this);
|
serverConfigDialog = new ServerConfigDialog(this);
|
||||||
#endif
|
#endif
|
||||||
@ -289,6 +295,61 @@ void LibraryWindow::doDialogs()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::setUpShortcutsManagement()
|
||||||
|
{
|
||||||
|
shortcutsDialog->addActionsGroup("Comics",QIcon(":/images/openInYACReader.png"),
|
||||||
|
QList<QAction *>()
|
||||||
|
<< openComicAction
|
||||||
|
<< setAsReadAction
|
||||||
|
<< setAsNonReadAction
|
||||||
|
<< openContainingFolderComicAction
|
||||||
|
<< resetComicRatingAction
|
||||||
|
<< selectAllComicsAction
|
||||||
|
<< editSelectedComicsAction
|
||||||
|
<< asignOrderAction
|
||||||
|
<< deleteComicsAction
|
||||||
|
<< getInfoAction);
|
||||||
|
|
||||||
|
shortcutsDialog->addActionsGroup("Folders",QIcon(),
|
||||||
|
QList<QAction *>()
|
||||||
|
<< setRootIndexAction
|
||||||
|
<< expandAllNodesAction
|
||||||
|
<< colapseAllNodesAction
|
||||||
|
<< openContainingFolderAction
|
||||||
|
<< setFolderAsNotCompletedAction
|
||||||
|
<< setFolderAsCompletedAction
|
||||||
|
<< setFolderAsReadAction
|
||||||
|
<< setFolderAsUnreadAction);
|
||||||
|
|
||||||
|
shortcutsDialog->addActionsGroup("General",QIcon(),
|
||||||
|
QList<QAction *>()
|
||||||
|
<< backAction
|
||||||
|
<< forwardAction
|
||||||
|
<< helpAboutAction
|
||||||
|
<< optionsAction
|
||||||
|
<< serverConfigAction);
|
||||||
|
|
||||||
|
shortcutsDialog->addActionsGroup("Libraries",QIcon(),
|
||||||
|
QList<QAction *>()
|
||||||
|
<< createLibraryAction
|
||||||
|
<< openLibraryAction
|
||||||
|
<< exportComicsInfoAction
|
||||||
|
<< importComicsInfoAction
|
||||||
|
<< exportLibraryAction
|
||||||
|
<< importLibraryAction
|
||||||
|
<< updateLibraryAction
|
||||||
|
<< renameLibraryAction
|
||||||
|
<< removeLibraryAction);
|
||||||
|
|
||||||
|
shortcutsDialog->addActionsGroup("Visualization",QIcon(),
|
||||||
|
QList<QAction *>()
|
||||||
|
<< showHideMarksAction
|
||||||
|
<< toggleFullScreenAction
|
||||||
|
<< toggleComicsViewAction
|
||||||
|
<< hideComicViewAction);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void LibraryWindow::doModels()
|
void LibraryWindow::doModels()
|
||||||
{
|
{
|
||||||
//folders
|
//folders
|
||||||
@ -323,67 +384,90 @@ void LibraryWindow::createActions()
|
|||||||
QIcon icoBackButton;
|
QIcon icoBackButton;
|
||||||
icoBackButton.addPixmap(QPixmap(":/images/main_toolbar/back.png"), QIcon::Normal);
|
icoBackButton.addPixmap(QPixmap(":/images/main_toolbar/back.png"), QIcon::Normal);
|
||||||
//icoBackButton.addPixmap(QPixmap(":/images/main_toolbar/back_disabled.png"), QIcon::Disabled);
|
//icoBackButton.addPixmap(QPixmap(":/images/main_toolbar/back_disabled.png"), QIcon::Disabled);
|
||||||
backAction->setIcon(icoBackButton);
|
backAction->setData(BACK_ACTION_YL);
|
||||||
|
backAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(BACK_ACTION_YL));
|
||||||
|
backAction->setIcon(icoBackButton);
|
||||||
backAction->setDisabled(true);
|
backAction->setDisabled(true);
|
||||||
|
|
||||||
forwardAction = new QAction(this);
|
forwardAction = new QAction(this);
|
||||||
QIcon icoFordwardButton;
|
QIcon icoFordwardButton;
|
||||||
icoFordwardButton.addPixmap(QPixmap(":/images/main_toolbar/forward.png"), QIcon::Normal);
|
icoFordwardButton.addPixmap(QPixmap(":/images/main_toolbar/forward.png"), QIcon::Normal);
|
||||||
//icoFordwardButton.addPixmap(QPixmap(":/images/main_toolbar/forward_disabled.png"), QIcon::Disabled);
|
//icoFordwardButton.addPixmap(QPixmap(":/images/main_toolbar/forward_disabled.png"), QIcon::Disabled);
|
||||||
|
forwardAction->setData(FORWARD_ACTION_YL);
|
||||||
|
forwardAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(FORWARD_ACTION_YL));
|
||||||
forwardAction->setIcon(icoFordwardButton);
|
forwardAction->setIcon(icoFordwardButton);
|
||||||
forwardAction->setDisabled(true);
|
forwardAction->setDisabled(true);
|
||||||
|
|
||||||
createLibraryAction = new QAction(this);
|
createLibraryAction = new QAction(this);
|
||||||
createLibraryAction->setToolTip(tr("Create a new library"));
|
createLibraryAction->setToolTip(tr("Create a new library"));
|
||||||
createLibraryAction->setShortcut(Qt::Key_A);
|
createLibraryAction->setData(CREATE_LIBRARY_ACTION_YL);
|
||||||
|
createLibraryAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(CREATE_LIBRARY_ACTION_YL));
|
||||||
createLibraryAction->setIcon(QIcon(":/images/newLibraryIcon.png"));
|
createLibraryAction->setIcon(QIcon(":/images/newLibraryIcon.png"));
|
||||||
|
|
||||||
openLibraryAction = new QAction(this);
|
openLibraryAction = new QAction(this);
|
||||||
openLibraryAction->setToolTip(tr("Open an existing library"));
|
openLibraryAction->setToolTip(tr("Open an existing library"));
|
||||||
openLibraryAction->setShortcut(Qt::Key_O);
|
openLibraryAction->setData(OPEN_LIBRARY_ACTION_YL);
|
||||||
|
openLibraryAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_LIBRARY_ACTION_YL));
|
||||||
openLibraryAction->setIcon(QIcon(":/images/openLibraryIcon.png"));
|
openLibraryAction->setIcon(QIcon(":/images/openLibraryIcon.png"));
|
||||||
|
|
||||||
exportComicsInfo = new QAction(tr("Export comics info"),this);
|
exportComicsInfoAction = new QAction(tr("Export comics info"),this);
|
||||||
exportComicsInfo->setToolTip(tr("Export comics info"));
|
exportComicsInfoAction->setToolTip(tr("Export comics info"));
|
||||||
exportComicsInfo->setIcon(QIcon(":/images/exportComicsInfoIcon.png"));
|
exportComicsInfoAction->setData(EXPORT_COMICS_INFO_YL);
|
||||||
|
exportComicsInfoAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(EXPORT_COMICS_INFO_YL));
|
||||||
|
exportComicsInfoAction->setIcon(QIcon(":/images/exportComicsInfoIcon.png"));
|
||||||
|
|
||||||
importComicsInfo = new QAction(tr("Import comics info"),this);
|
importComicsInfoAction = new QAction(tr("Import comics info"),this);
|
||||||
importComicsInfo->setToolTip(tr("Import comics info"));
|
importComicsInfoAction->setToolTip(tr("Import comics info"));
|
||||||
importComicsInfo->setIcon(QIcon(":/images/importComicsInfoIcon.png"));
|
importComicsInfoAction->setData(IMPORT_COMICS_INFO_YL);
|
||||||
|
importComicsInfoAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(IMPORT_COMICS_INFO_YL));
|
||||||
|
importComicsInfoAction->setIcon(QIcon(":/images/importComicsInfoIcon.png"));
|
||||||
|
|
||||||
exportLibraryAction = new QAction(tr("Pack covers"),this);
|
exportLibraryAction = new QAction(tr("Pack covers"),this);
|
||||||
exportLibraryAction->setToolTip(tr("Pack the covers of the selected library"));
|
exportLibraryAction->setToolTip(tr("Pack the covers of the selected library"));
|
||||||
|
exportLibraryAction->setData(EXPORT_LIBRARY_ACTION_YL);
|
||||||
|
exportLibraryAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(EXPORT_LIBRARY_ACTION_YL));
|
||||||
exportLibraryAction->setIcon(QIcon(":/images/exportLibraryIcon.png"));
|
exportLibraryAction->setIcon(QIcon(":/images/exportLibraryIcon.png"));
|
||||||
|
|
||||||
importLibraryAction = new QAction(tr("Unpack covers"),this);
|
importLibraryAction = new QAction(tr("Unpack covers"),this);
|
||||||
importLibraryAction->setToolTip(tr("Unpack a catalog"));
|
importLibraryAction->setToolTip(tr("Unpack a catalog"));
|
||||||
|
importLibraryAction->setData(IMPORT_LIBRARY_ACTION_YL);
|
||||||
|
importLibraryAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(IMPORT_LIBRARY_ACTION_YL));
|
||||||
importLibraryAction->setIcon(QIcon(":/images/importLibraryIcon.png"));
|
importLibraryAction->setIcon(QIcon(":/images/importLibraryIcon.png"));
|
||||||
|
|
||||||
updateLibraryAction = new QAction(tr("Update library"),this);
|
updateLibraryAction = new QAction(tr("Update library"),this);
|
||||||
updateLibraryAction->setToolTip(tr("Update current library"));
|
updateLibraryAction->setToolTip(tr("Update current library"));
|
||||||
updateLibraryAction->setShortcut(Qt::Key_U);
|
updateLibraryAction->setData(UPDATE_LIBRARY_ACTION_YL);
|
||||||
|
updateLibraryAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(UPDATE_LIBRARY_ACTION_YL));
|
||||||
updateLibraryAction->setIcon(QIcon(":/images/updateLibraryIcon.png"));
|
updateLibraryAction->setIcon(QIcon(":/images/updateLibraryIcon.png"));
|
||||||
|
|
||||||
renameLibraryAction = new QAction(tr("Rename library"),this);
|
renameLibraryAction = new QAction(tr("Rename library"),this);
|
||||||
renameLibraryAction->setToolTip(tr("Rename current library"));
|
renameLibraryAction->setToolTip(tr("Rename current library"));
|
||||||
renameLibraryAction->setShortcut(Qt::Key_R);
|
renameLibraryAction->setData(RENAME_LIBRARY_ACTION_YL);
|
||||||
|
renameLibraryAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(RENAME_LIBRARY_ACTION_YL));
|
||||||
renameLibraryAction->setIcon(QIcon(":/images/editIcon.png"));
|
renameLibraryAction->setIcon(QIcon(":/images/editIcon.png"));
|
||||||
|
|
||||||
removeLibraryAction = new QAction(tr("Remove library"),this);
|
removeLibraryAction = new QAction(tr("Remove library"),this);
|
||||||
removeLibraryAction->setToolTip(tr("Remove current library from your collection"));
|
removeLibraryAction->setToolTip(tr("Remove current library from your collection"));
|
||||||
|
removeLibraryAction->setData(REMOVE_LIBRARY_ACTION_YL);
|
||||||
|
removeLibraryAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(REMOVE_LIBRARY_ACTION_YL));
|
||||||
removeLibraryAction->setIcon(QIcon(":/images/removeLibraryIcon.png"));
|
removeLibraryAction->setIcon(QIcon(":/images/removeLibraryIcon.png"));
|
||||||
|
|
||||||
openComicAction = new QAction(tr("Open current comic"),this);
|
openComicAction = new QAction(tr("Open current comic"),this);
|
||||||
openComicAction->setToolTip(tr("Open current comic on YACReader"));
|
openComicAction->setToolTip(tr("Open current comic on YACReader"));
|
||||||
openComicAction->setShortcut(Qt::Key_Return);
|
openComicAction->setData(OPEN_COMIC_ACTION_YL);
|
||||||
|
openComicAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_COMIC_ACTION_YL));
|
||||||
openComicAction->setIcon(QIcon(":/images/openInYACReader.png"));
|
openComicAction->setIcon(QIcon(":/images/openInYACReader.png"));
|
||||||
|
|
||||||
setAsReadAction = new QAction(tr("Set as read"),this);
|
setAsReadAction = new QAction(tr("Set as read"),this);
|
||||||
setAsReadAction->setToolTip(tr("Set comic as read"));
|
setAsReadAction->setToolTip(tr("Set comic as read"));
|
||||||
|
setAsReadAction->setData(SET_AS_READ_ACTION_YL);
|
||||||
|
setAsReadAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SET_AS_READ_ACTION_YL));
|
||||||
setAsReadAction->setIcon(QIcon(":/images/setReadButton.png"));
|
setAsReadAction->setIcon(QIcon(":/images/setReadButton.png"));
|
||||||
|
|
||||||
setAsNonReadAction = new QAction(tr("Set as unread"),this);
|
setAsNonReadAction = new QAction(tr("Set as unread"),this);
|
||||||
setAsNonReadAction->setToolTip(tr("Set comic as unread"));
|
setAsNonReadAction->setToolTip(tr("Set comic as unread"));
|
||||||
|
setAsNonReadAction->setData(SET_AS_NON_READ_ACTION_YL);
|
||||||
|
setAsNonReadAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SET_AS_NON_READ_ACTION_YL));
|
||||||
setAsNonReadAction->setIcon(QIcon(":/images/setUnread.png"));
|
setAsNonReadAction->setIcon(QIcon(":/images/setUnread.png"));
|
||||||
|
|
||||||
/*setAllAsReadAction = new QAction(tr("Set all as read"),this);
|
/*setAllAsReadAction = new QAction(tr("Set all as read"),this);
|
||||||
@ -396,120 +480,157 @@ void LibraryWindow::createActions()
|
|||||||
|
|
||||||
showHideMarksAction = new QAction(tr("Show/Hide marks"),this);
|
showHideMarksAction = new QAction(tr("Show/Hide marks"),this);
|
||||||
showHideMarksAction->setToolTip(tr("Show or hide readed marks"));
|
showHideMarksAction->setToolTip(tr("Show or hide readed marks"));
|
||||||
showHideMarksAction->setShortcut(Qt::Key_M);
|
showHideMarksAction->setData(SHOW_HIDE_MARKS_ACTION_YL);
|
||||||
|
showHideMarksAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_HIDE_MARKS_ACTION_YL));
|
||||||
showHideMarksAction->setCheckable(true);
|
showHideMarksAction->setCheckable(true);
|
||||||
showHideMarksAction->setIcon(QIcon(":/images/showMarks.png"));
|
showHideMarksAction->setIcon(QIcon(":/images/showMarks.png"));
|
||||||
showHideMarksAction->setChecked(true);
|
showHideMarksAction->setChecked(true);
|
||||||
|
|
||||||
toggleFullScreenAction = new QAction(tr("Fullscreen mode on/off"),this);
|
toggleFullScreenAction = new QAction(tr("Fullscreen mode on/off"),this);
|
||||||
toggleFullScreenAction->setToolTip(tr("Fullscreen mode on/off (F)"));
|
toggleFullScreenAction->setToolTip(tr("Fullscreen mode on/off"));
|
||||||
toggleFullScreenAction->setShortcut(Qt::Key_F);
|
toggleFullScreenAction->setData(TOGGLE_FULL_SCREEN_ACTION_YL);
|
||||||
|
toggleFullScreenAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(TOGGLE_FULL_SCREEN_ACTION_YL));
|
||||||
QIcon icoFullscreenButton;
|
QIcon icoFullscreenButton;
|
||||||
icoFullscreenButton.addPixmap(QPixmap(":/images/main_toolbar/fullscreen.png"), QIcon::Normal);
|
icoFullscreenButton.addPixmap(QPixmap(":/images/main_toolbar/fullscreen.png"), QIcon::Normal);
|
||||||
toggleFullScreenAction->setIcon(icoFullscreenButton);
|
toggleFullScreenAction->setIcon(icoFullscreenButton);
|
||||||
|
|
||||||
helpAboutAction = new QAction(this);
|
helpAboutAction = new QAction(this);
|
||||||
helpAboutAction->setToolTip(tr("Help, About YACReader"));
|
helpAboutAction->setToolTip(tr("Help, About YACReader"));
|
||||||
helpAboutAction->setShortcut(Qt::Key_F1);
|
helpAboutAction->setData(HELP_ABOUT_ACTION_YL);
|
||||||
|
helpAboutAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(HELP_ABOUT_ACTION_YL));
|
||||||
QIcon icoHelpButton;
|
QIcon icoHelpButton;
|
||||||
icoHelpButton.addPixmap(QPixmap(":/images/main_toolbar/help.png"), QIcon::Normal);
|
icoHelpButton.addPixmap(QPixmap(":/images/main_toolbar/help.png"), QIcon::Normal);
|
||||||
helpAboutAction->setIcon(icoHelpButton);
|
helpAboutAction->setIcon(icoHelpButton);
|
||||||
|
|
||||||
setRootIndexAction = new QAction(this);
|
setRootIndexAction = new QAction(this);
|
||||||
setRootIndexAction->setShortcut(Qt::Key_0);
|
setRootIndexAction->setData(SET_ROOT_INDEX_ACTION_YL);
|
||||||
|
setRootIndexAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SET_ROOT_INDEX_ACTION_YL));
|
||||||
setRootIndexAction->setToolTip(tr("Select root node"));
|
setRootIndexAction->setToolTip(tr("Select root node"));
|
||||||
setRootIndexAction->setIcon(QIcon(":/images/setRoot.png"));
|
setRootIndexAction->setIcon(QIcon(":/images/setRoot.png"));
|
||||||
|
|
||||||
expandAllNodesAction = new QAction(this);
|
expandAllNodesAction = new QAction(this);
|
||||||
expandAllNodesAction->setShortcut(tr("+"));
|
|
||||||
expandAllNodesAction->setToolTip(tr("Expand all nodes"));
|
expandAllNodesAction->setToolTip(tr("Expand all nodes"));
|
||||||
|
expandAllNodesAction->setData(EXPAND_ALL_NODES_ACTION_YL);
|
||||||
|
expandAllNodesAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(EXPAND_ALL_NODES_ACTION_YL));
|
||||||
expandAllNodesAction->setIcon(QIcon(":/images/expand.png"));
|
expandAllNodesAction->setIcon(QIcon(":/images/expand.png"));
|
||||||
|
|
||||||
colapseAllNodesAction = new QAction(this);
|
colapseAllNodesAction = new QAction(this);
|
||||||
colapseAllNodesAction->setShortcut(tr("-"));
|
|
||||||
colapseAllNodesAction->setToolTip(tr("Colapse all nodes"));
|
colapseAllNodesAction->setToolTip(tr("Colapse all nodes"));
|
||||||
|
colapseAllNodesAction->setData(COLAPSE_ALL_NODES_ACTION_YL);
|
||||||
|
colapseAllNodesAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(COLAPSE_ALL_NODES_ACTION_YL));
|
||||||
colapseAllNodesAction->setIcon(QIcon(":/images/colapse.png"));
|
colapseAllNodesAction->setIcon(QIcon(":/images/colapse.png"));
|
||||||
|
|
||||||
optionsAction = new QAction(this);
|
optionsAction = new QAction(this);
|
||||||
optionsAction->setShortcut(Qt::Key_C);
|
|
||||||
optionsAction->setToolTip(tr("Show options dialog"));
|
optionsAction->setToolTip(tr("Show options dialog"));
|
||||||
|
optionsAction->setData(OPTIONS_ACTION_YL);
|
||||||
|
optionsAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPTIONS_ACTION_YL));
|
||||||
QIcon icoSettingsButton;
|
QIcon icoSettingsButton;
|
||||||
icoSettingsButton.addPixmap(QPixmap(":/images/main_toolbar/settings.png"), QIcon::Normal);
|
icoSettingsButton.addPixmap(QPixmap(":/images/main_toolbar/settings.png"), QIcon::Normal);
|
||||||
optionsAction->setIcon(icoSettingsButton);
|
optionsAction->setIcon(icoSettingsButton);
|
||||||
|
|
||||||
serverConfigAction = new QAction(this);
|
serverConfigAction = new QAction(this);
|
||||||
serverConfigAction->setShortcut(Qt::Key_S);
|
|
||||||
serverConfigAction->setToolTip(tr("Show comics server options dialog"));
|
serverConfigAction->setToolTip(tr("Show comics server options dialog"));
|
||||||
|
serverConfigAction->setData(SERVER_CONFIG_ACTION_YL);
|
||||||
|
serverConfigAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SERVER_CONFIG_ACTION_YL));
|
||||||
QIcon icoServerButton;
|
QIcon icoServerButton;
|
||||||
icoServerButton.addPixmap(QPixmap(":/images/main_toolbar/server.png"), QIcon::Normal);
|
icoServerButton.addPixmap(QPixmap(":/images/main_toolbar/server.png"), QIcon::Normal);
|
||||||
serverConfigAction->setIcon(icoServerButton);
|
serverConfigAction->setIcon(icoServerButton);
|
||||||
|
|
||||||
toggleComicsViewAction = new QAction(tr("Change between comics views"),this);
|
toggleComicsViewAction = new QAction(tr("Change between comics views"),this);
|
||||||
toggleComicsViewAction->setShortcut(Qt::Key_V);
|
|
||||||
toggleComicsViewAction->setToolTip(tr("Change between comics views"));
|
toggleComicsViewAction->setToolTip(tr("Change between comics views"));
|
||||||
QIcon icoViewsButton;
|
QIcon icoViewsButton;
|
||||||
if(!settings->contains(COMICS_VIEW_STATUS) || settings->value(COMICS_VIEW_STATUS) == Flow)
|
if(!settings->contains(COMICS_VIEW_STATUS) || settings->value(COMICS_VIEW_STATUS) == Flow)
|
||||||
icoViewsButton.addPixmap(QPixmap(":/images/main_toolbar/grid.png"), QIcon::Normal);
|
icoViewsButton.addPixmap(QPixmap(":/images/main_toolbar/grid.png"), QIcon::Normal);
|
||||||
else
|
else
|
||||||
icoViewsButton.addPixmap(QPixmap(":/images/main_toolbar/flow.png"), QIcon::Normal);
|
icoViewsButton.addPixmap(QPixmap(":/images/main_toolbar/flow.png"), QIcon::Normal);
|
||||||
|
toggleComicsViewAction->setData(TOGGLE_COMICS_VIEW_ACTION_YL);
|
||||||
|
toggleComicsViewAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(TOGGLE_COMICS_VIEW_ACTION_YL));
|
||||||
toggleComicsViewAction->setIcon(icoViewsButton);
|
toggleComicsViewAction->setIcon(icoViewsButton);
|
||||||
//socialAction = new QAction(this);
|
//socialAction = new QAction(this);
|
||||||
|
|
||||||
openContainingFolderAction = new QAction(this);
|
openContainingFolderAction = new QAction(this);
|
||||||
openContainingFolderAction->setText(tr("Open folder..."));
|
openContainingFolderAction->setText(tr("Open folder..."));
|
||||||
|
openContainingFolderAction->setData(OPEN_CONTAINING_FOLDER_ACTION_YL);
|
||||||
|
openContainingFolderAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_CONTAINING_FOLDER_ACTION_YL));
|
||||||
openContainingFolderAction->setIcon(QIcon(":/images/open.png"));
|
openContainingFolderAction->setIcon(QIcon(":/images/open.png"));
|
||||||
|
|
||||||
setFolderAsNotCompletedAction = new QAction(this);
|
setFolderAsNotCompletedAction = new QAction(this);
|
||||||
setFolderAsNotCompletedAction->setText(tr("Set as uncompleted"));
|
setFolderAsNotCompletedAction->setText(tr("Set as uncompleted"));
|
||||||
setFolderAsNotCompletedAction->setVisible(false);
|
setFolderAsNotCompletedAction->setVisible(false);
|
||||||
|
setFolderAsNotCompletedAction->setData(SET_FOLDER_AS_NOT_COMPLETED_ACTION_YL);
|
||||||
|
setFolderAsNotCompletedAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SET_FOLDER_AS_NOT_COMPLETED_ACTION_YL));
|
||||||
|
|
||||||
setFolderAsCompletedAction = new QAction(this);
|
setFolderAsCompletedAction = new QAction(this);
|
||||||
setFolderAsCompletedAction->setText(tr("Set as completed"));
|
setFolderAsCompletedAction->setText(tr("Set as completed"));
|
||||||
setFolderAsCompletedAction->setVisible(false);
|
setFolderAsCompletedAction->setVisible(false);
|
||||||
|
setFolderAsCompletedAction->setData(SET_FOLDER_AS_COMPLETED_ACTION_YL);
|
||||||
|
setFolderAsCompletedAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SET_FOLDER_AS_COMPLETED_ACTION_YL));
|
||||||
|
|
||||||
setFolderAsFinishedAction = new QAction(this);
|
setFolderAsReadAction = new QAction(this);
|
||||||
setFolderAsFinishedAction->setText(tr("Set as read"));
|
setFolderAsReadAction->setText(tr("Set as read"));
|
||||||
setFolderAsFinishedAction->setVisible(false);
|
setFolderAsReadAction->setVisible(false);
|
||||||
|
setFolderAsReadAction->setData(SET_FOLDER_AS_READ_ACTION_YL);
|
||||||
|
setFolderAsReadAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SET_FOLDER_AS_READ_ACTION_YL));
|
||||||
|
|
||||||
setFolderAsNotFinishedAction = new QAction(this);
|
setFolderAsUnreadAction = new QAction(this);
|
||||||
setFolderAsNotFinishedAction->setText(tr("Set as unread"));
|
setFolderAsUnreadAction->setText(tr("Set as unread"));
|
||||||
setFolderAsNotFinishedAction->setVisible(false);
|
setFolderAsUnreadAction->setVisible(false);
|
||||||
|
setFolderAsUnreadAction->setData(SET_FOLDER_AS_UNREAD_ACTION_YL);
|
||||||
|
setFolderAsUnreadAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SET_FOLDER_AS_UNREAD_ACTION_YL));
|
||||||
|
|
||||||
openContainingFolderComicAction = new QAction(this);
|
openContainingFolderComicAction = new QAction(this);
|
||||||
openContainingFolderComicAction->setText(tr("Open containing folder..."));
|
openContainingFolderComicAction->setText(tr("Open containing folder..."));
|
||||||
|
openContainingFolderComicAction->setData(OPEN_CONTAINING_FOLDER_COMIC_ACTION_YL);
|
||||||
|
openContainingFolderComicAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_CONTAINING_FOLDER_COMIC_ACTION_YL));
|
||||||
openContainingFolderComicAction->setIcon(QIcon(":/images/open.png"));
|
openContainingFolderComicAction->setIcon(QIcon(":/images/open.png"));
|
||||||
|
|
||||||
resetComicRatingAction = new QAction(this);
|
resetComicRatingAction = new QAction(this);
|
||||||
resetComicRatingAction->setText(tr("Reset comic rating"));
|
resetComicRatingAction->setText(tr("Reset comic rating"));
|
||||||
|
resetComicRatingAction->setData(RESET_COMIC_RATING_ACTION_YL);
|
||||||
|
resetComicRatingAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(RESET_COMIC_RATING_ACTION_YL));
|
||||||
|
|
||||||
//Edit comics actions------------------------------------------------------
|
//Edit comics actions------------------------------------------------------
|
||||||
selectAllComicsAction = new QAction(this);
|
selectAllComicsAction = new QAction(this);
|
||||||
selectAllComicsAction->setText(tr("Select all comics"));
|
selectAllComicsAction->setText(tr("Select all comics"));
|
||||||
selectAllComicsAction->setIcon(QIcon(":/images/selectAll.png"));
|
selectAllComicsAction->setData(SELECT_ALL_COMICS_ACTION_YL);
|
||||||
|
selectAllComicsAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SELECT_ALL_COMICS_ACTION_YL));
|
||||||
|
selectAllComicsAction->setIcon(QIcon(":/images/selectAll.png"));
|
||||||
|
|
||||||
editSelectedComicsAction = new QAction(this);
|
editSelectedComicsAction = new QAction(this);
|
||||||
editSelectedComicsAction->setText(tr("Edit"));
|
editSelectedComicsAction->setText(tr("Edit"));
|
||||||
|
editSelectedComicsAction->setData(EDIT_SELECTED_COMICS_ACTION_YL);
|
||||||
|
editSelectedComicsAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(EDIT_SELECTED_COMICS_ACTION_YL));
|
||||||
editSelectedComicsAction->setIcon(QIcon(":/images/editComic.png"));
|
editSelectedComicsAction->setIcon(QIcon(":/images/editComic.png"));
|
||||||
|
|
||||||
asignOrderAction = new QAction(this);
|
asignOrderAction = new QAction(this);
|
||||||
asignOrderAction->setText(tr("Asign current order to comics"));
|
asignOrderAction->setText(tr("Asign current order to comics"));
|
||||||
|
asignOrderAction->setData(ASIGN_ORDER_ACTION_YL);
|
||||||
|
asignOrderAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ASIGN_ORDER_ACTION_YL));
|
||||||
asignOrderAction->setIcon(QIcon(":/images/asignNumber.png"));
|
asignOrderAction->setIcon(QIcon(":/images/asignNumber.png"));
|
||||||
|
|
||||||
forceConverExtractedAction = new QAction(this);
|
forceCoverExtractedAction = new QAction(this);
|
||||||
forceConverExtractedAction->setText(tr("Update cover"));
|
forceCoverExtractedAction->setText(tr("Update cover"));
|
||||||
forceConverExtractedAction->setIcon(QIcon(":/images/importCover.png"));
|
forceCoverExtractedAction->setData(FORCE_COVER_EXTRACTED_ACTION_YL);
|
||||||
|
forceCoverExtractedAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(FORCE_COVER_EXTRACTED_ACTION_YL));
|
||||||
|
forceCoverExtractedAction->setIcon(QIcon(":/images/importCover.png"));
|
||||||
|
|
||||||
deleteComicsAction = new QAction(this);
|
deleteComicsAction = new QAction(this);
|
||||||
deleteComicsAction->setText(tr("Delete selected comics"));
|
deleteComicsAction->setText(tr("Delete selected comics"));
|
||||||
|
deleteComicsAction->setData(DELETE_COMICS_ACTION_YL);
|
||||||
|
deleteComicsAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(DELETE_COMICS_ACTION_YL));
|
||||||
deleteComicsAction->setIcon(QIcon(":/images/trash.png"));
|
deleteComicsAction->setIcon(QIcon(":/images/trash.png"));
|
||||||
|
|
||||||
hideComicViewAction = new QAction(this);
|
hideComicViewAction = new QAction(this);
|
||||||
hideComicViewAction->setText(tr("Hide comic flow"));
|
hideComicViewAction->setText(tr("Hide comic flow"));
|
||||||
|
hideComicViewAction->setData(HIDE_COMIC_VIEW_ACTION_YL);
|
||||||
|
hideComicViewAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(HIDE_COMIC_VIEW_ACTION_YL));
|
||||||
hideComicViewAction->setIcon(QIcon(":/images/hideComicFlow.png"));
|
hideComicViewAction->setIcon(QIcon(":/images/hideComicFlow.png"));
|
||||||
hideComicViewAction->setCheckable(true);
|
hideComicViewAction->setCheckable(true);
|
||||||
hideComicViewAction->setChecked(false);
|
hideComicViewAction->setChecked(false);
|
||||||
|
|
||||||
getInfoAction = new QAction(this);
|
getInfoAction = new QAction(this);
|
||||||
|
getInfoAction->setData(GET_INFO_ACTION_YL);
|
||||||
|
getInfoAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(GET_INFO_ACTION_YL));
|
||||||
getInfoAction->setText(tr("Download tags from Comic Vine"));
|
getInfoAction->setText(tr("Download tags from Comic Vine"));
|
||||||
getInfoAction->setIcon(QIcon(":/images/getInfo.png"));
|
getInfoAction->setIcon(QIcon(":/images/getInfo.png"));
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -545,8 +666,8 @@ void LibraryWindow::disableLibrariesActions(bool disabled)
|
|||||||
updateLibraryAction->setDisabled(disabled);
|
updateLibraryAction->setDisabled(disabled);
|
||||||
renameLibraryAction->setDisabled(disabled);
|
renameLibraryAction->setDisabled(disabled);
|
||||||
removeLibraryAction->setDisabled(disabled);
|
removeLibraryAction->setDisabled(disabled);
|
||||||
exportComicsInfo->setDisabled(disabled);
|
exportComicsInfoAction->setDisabled(disabled);
|
||||||
importComicsInfo->setDisabled(disabled);
|
importComicsInfoAction->setDisabled(disabled);
|
||||||
exportLibraryAction->setDisabled(disabled);
|
exportLibraryAction->setDisabled(disabled);
|
||||||
//importLibraryAction->setDisabled(disabled);
|
//importLibraryAction->setDisabled(disabled);
|
||||||
}
|
}
|
||||||
@ -554,8 +675,8 @@ void LibraryWindow::disableLibrariesActions(bool disabled)
|
|||||||
void LibraryWindow::disableNoUpdatedLibrariesActions(bool disabled)
|
void LibraryWindow::disableNoUpdatedLibrariesActions(bool disabled)
|
||||||
{
|
{
|
||||||
updateLibraryAction->setDisabled(disabled);
|
updateLibraryAction->setDisabled(disabled);
|
||||||
exportComicsInfo->setDisabled(disabled);
|
exportComicsInfoAction->setDisabled(disabled);
|
||||||
importComicsInfo->setDisabled(disabled);
|
importComicsInfoAction->setDisabled(disabled);
|
||||||
exportLibraryAction->setDisabled(disabled);
|
exportLibraryAction->setDisabled(disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -571,8 +692,8 @@ void LibraryWindow::disableFoldersActions(bool disabled)
|
|||||||
{
|
{
|
||||||
setFolderAsNotCompletedAction->setVisible(false);
|
setFolderAsNotCompletedAction->setVisible(false);
|
||||||
setFolderAsCompletedAction->setVisible(false);
|
setFolderAsCompletedAction->setVisible(false);
|
||||||
setFolderAsFinishedAction->setVisible(false);
|
setFolderAsReadAction->setVisible(false);
|
||||||
setFolderAsNotFinishedAction->setVisible(false);
|
setFolderAsUnreadAction->setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -699,16 +820,16 @@ void LibraryWindow::createMenus()
|
|||||||
foldersView->addAction(setFolderAsCompletedAction);
|
foldersView->addAction(setFolderAsCompletedAction);
|
||||||
YACReader::addSperator(foldersView);
|
YACReader::addSperator(foldersView);
|
||||||
|
|
||||||
foldersView->addAction(setFolderAsFinishedAction);
|
foldersView->addAction(setFolderAsReadAction);
|
||||||
foldersView->addAction(setFolderAsNotFinishedAction);
|
foldersView->addAction(setFolderAsUnreadAction);
|
||||||
|
|
||||||
selectedLibrary->addAction(updateLibraryAction);
|
selectedLibrary->addAction(updateLibraryAction);
|
||||||
selectedLibrary->addAction(renameLibraryAction);
|
selectedLibrary->addAction(renameLibraryAction);
|
||||||
selectedLibrary->addAction(removeLibraryAction);
|
selectedLibrary->addAction(removeLibraryAction);
|
||||||
YACReader::addSperator(selectedLibrary);
|
YACReader::addSperator(selectedLibrary);
|
||||||
|
|
||||||
selectedLibrary->addAction(exportComicsInfo);
|
selectedLibrary->addAction(exportComicsInfoAction);
|
||||||
selectedLibrary->addAction(importComicsInfo);
|
selectedLibrary->addAction(importComicsInfoAction);
|
||||||
YACReader::addSperator(selectedLibrary);
|
YACReader::addSperator(selectedLibrary);
|
||||||
|
|
||||||
selectedLibrary->addAction(exportLibraryAction);
|
selectedLibrary->addAction(exportLibraryAction);
|
||||||
@ -827,8 +948,8 @@ void LibraryWindow::createConnections()
|
|||||||
|
|
||||||
|
|
||||||
//comicsInfoManagement
|
//comicsInfoManagement
|
||||||
connect(exportComicsInfo,SIGNAL(triggered()),this,SLOT(showExportComicsInfo()));
|
connect(exportComicsInfoAction,SIGNAL(triggered()),this,SLOT(showExportComicsInfo()));
|
||||||
connect(importComicsInfo,SIGNAL(triggered()),this,SLOT(showImportComicsInfo()));
|
connect(importComicsInfoAction,SIGNAL(triggered()),this,SLOT(showImportComicsInfo()));
|
||||||
|
|
||||||
//properties & config
|
//properties & config
|
||||||
connect(propertiesDialog,SIGNAL(accepted()),this,SLOT(reloadCovers()));
|
connect(propertiesDialog,SIGNAL(accepted()),this,SLOT(reloadCovers()));
|
||||||
@ -852,6 +973,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()));
|
||||||
|
|
||||||
//Folders filter
|
//Folders filter
|
||||||
//connect(clearFoldersFilter,SIGNAL(clicked()),foldersFilter,SLOT(clear()));
|
//connect(clearFoldersFilter,SIGNAL(clicked()),foldersFilter,SLOT(clear()));
|
||||||
@ -862,8 +984,8 @@ void LibraryWindow::createConnections()
|
|||||||
connect(openContainingFolderComicAction,SIGNAL(triggered()),this,SLOT(openContainingFolderComic()));
|
connect(openContainingFolderComicAction,SIGNAL(triggered()),this,SLOT(openContainingFolderComic()));
|
||||||
connect(setFolderAsNotCompletedAction,SIGNAL(triggered()),this,SLOT(setFolderAsNotCompleted()));
|
connect(setFolderAsNotCompletedAction,SIGNAL(triggered()),this,SLOT(setFolderAsNotCompleted()));
|
||||||
connect(setFolderAsCompletedAction,SIGNAL(triggered()),this,SLOT(setFolderAsCompleted()));
|
connect(setFolderAsCompletedAction,SIGNAL(triggered()),this,SLOT(setFolderAsCompleted()));
|
||||||
connect(setFolderAsFinishedAction,SIGNAL(triggered()),this,SLOT(setFolderAsFinished()));
|
connect(setFolderAsReadAction,SIGNAL(triggered()),this,SLOT(setFolderAsRead()));
|
||||||
connect(setFolderAsNotFinishedAction,SIGNAL(triggered()),this,SLOT(setFolderAsNotFinished()));
|
connect(setFolderAsUnreadAction,SIGNAL(triggered()),this,SLOT(setFolderAsUnread()));
|
||||||
connect(openContainingFolderAction,SIGNAL(triggered()),this,SLOT(openContainingFolder()));
|
connect(openContainingFolderAction,SIGNAL(triggered()),this,SLOT(openContainingFolder()));
|
||||||
connect(resetComicRatingAction,SIGNAL(triggered()),this,SLOT(resetComicRating()));
|
connect(resetComicRatingAction,SIGNAL(triggered()),this,SLOT(resetComicRating()));
|
||||||
|
|
||||||
@ -1387,8 +1509,8 @@ void LibraryWindow::setRootIndex()
|
|||||||
|
|
||||||
setFolderAsNotCompletedAction->setVisible(false);
|
setFolderAsNotCompletedAction->setVisible(false);
|
||||||
setFolderAsCompletedAction->setVisible(false);
|
setFolderAsCompletedAction->setVisible(false);
|
||||||
setFolderAsFinishedAction->setVisible(false);
|
setFolderAsReadAction->setVisible(false);
|
||||||
setFolderAsNotFinishedAction->setVisible(false);
|
setFolderAsUnreadAction->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1650,12 +1772,12 @@ void LibraryWindow::setFolderAsCompleted()
|
|||||||
dm->updateFolderCompletedStatus(foldersView->selectionModel()->selectedRows(),true);
|
dm->updateFolderCompletedStatus(foldersView->selectionModel()->selectedRows(),true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::setFolderAsFinished()
|
void LibraryWindow::setFolderAsRead()
|
||||||
{
|
{
|
||||||
dm->updateFolderFinishedStatus(foldersView->selectionModel()->selectedRows(),true);
|
dm->updateFolderFinishedStatus(foldersView->selectionModel()->selectedRows(),true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::setFolderAsNotFinished()
|
void LibraryWindow::setFolderAsUnread()
|
||||||
{
|
{
|
||||||
dm->updateFolderFinishedStatus(foldersView->selectionModel()->selectedRows(),false);
|
dm->updateFolderFinishedStatus(foldersView->selectionModel()->selectedRows(),false);
|
||||||
}
|
}
|
||||||
@ -1907,8 +2029,8 @@ void LibraryWindow::updateFoldersViewConextMenu(const QModelIndex &mi)
|
|||||||
bool isFinished = item->data(TreeModel::Finished).toBool();
|
bool isFinished = item->data(TreeModel::Finished).toBool();
|
||||||
bool isCompleted = item->data(TreeModel::Completed).toBool();
|
bool isCompleted = item->data(TreeModel::Completed).toBool();
|
||||||
|
|
||||||
setFolderAsFinishedAction->setVisible(!isFinished);
|
setFolderAsReadAction->setVisible(!isFinished);
|
||||||
setFolderAsNotFinishedAction->setVisible(isFinished);
|
setFolderAsUnreadAction->setVisible(isFinished);
|
||||||
|
|
||||||
setFolderAsCompletedAction->setVisible(!isCompleted);
|
setFolderAsCompletedAction->setVisible(!isCompleted);
|
||||||
setFolderAsNotCompletedAction->setVisible(isCompleted);
|
setFolderAsNotCompletedAction->setVisible(isCompleted);
|
||||||
|
@ -54,6 +54,7 @@ class ClassicComicsView;
|
|||||||
class GridComicsView;
|
class GridComicsView;
|
||||||
class ComicsViewTransition;
|
class ComicsViewTransition;
|
||||||
class EmptyFolderWidget;
|
class EmptyFolderWidget;
|
||||||
|
class ShortcutsDialog;
|
||||||
|
|
||||||
#include "comic_db.h"
|
#include "comic_db.h"
|
||||||
|
|
||||||
@ -76,6 +77,7 @@ private:
|
|||||||
RenameLibraryDialog * renameLibraryDialog;
|
RenameLibraryDialog * renameLibraryDialog;
|
||||||
PropertiesDialog * propertiesDialog;
|
PropertiesDialog * propertiesDialog;
|
||||||
ComicVineDialog * comicVineDialog;
|
ComicVineDialog * comicVineDialog;
|
||||||
|
ShortcutsDialog * shortcutsDialog;
|
||||||
//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)
|
||||||
@ -125,8 +127,8 @@ private:
|
|||||||
QAction * createLibraryAction;
|
QAction * createLibraryAction;
|
||||||
QAction * openLibraryAction;
|
QAction * openLibraryAction;
|
||||||
|
|
||||||
QAction * exportComicsInfo;
|
QAction * exportComicsInfoAction;
|
||||||
QAction * importComicsInfo;
|
QAction * importComicsInfoAction;
|
||||||
|
|
||||||
QAction * exportLibraryAction;
|
QAction * exportLibraryAction;
|
||||||
QAction * importLibraryAction;
|
QAction * importLibraryAction;
|
||||||
@ -151,8 +153,8 @@ private:
|
|||||||
QAction * setFolderAsNotCompletedAction;
|
QAction * setFolderAsNotCompletedAction;
|
||||||
QAction * setFolderAsCompletedAction;
|
QAction * setFolderAsCompletedAction;
|
||||||
//--
|
//--
|
||||||
QAction * setFolderAsFinishedAction;
|
QAction * setFolderAsReadAction;
|
||||||
QAction * setFolderAsNotFinishedAction;
|
QAction * setFolderAsUnreadAction;
|
||||||
|
|
||||||
QAction * openContainingFolderComicAction;
|
QAction * openContainingFolderComicAction;
|
||||||
QAction * setAsReadAction;
|
QAction * setAsReadAction;
|
||||||
@ -167,7 +169,7 @@ private:
|
|||||||
QAction * selectAllComicsAction;
|
QAction * selectAllComicsAction;
|
||||||
QAction * editSelectedComicsAction;
|
QAction * editSelectedComicsAction;
|
||||||
QAction * asignOrderAction;
|
QAction * asignOrderAction;
|
||||||
QAction * forceConverExtractedAction;
|
QAction * forceCoverExtractedAction;
|
||||||
QAction * deleteComicsAction;
|
QAction * deleteComicsAction;
|
||||||
QAction * hideComicViewAction;
|
QAction * hideComicViewAction;
|
||||||
|
|
||||||
@ -204,6 +206,7 @@ private:
|
|||||||
void createConnections();
|
void createConnections();
|
||||||
void doLayout();
|
void doLayout();
|
||||||
void doDialogs();
|
void doDialogs();
|
||||||
|
void setUpShortcutsManagement();
|
||||||
void doModels();
|
void doModels();
|
||||||
void disconnectComicsViewConnections(ComicsView * widget);
|
void disconnectComicsViewConnections(ComicsView * widget);
|
||||||
void doComicsViewConnections();
|
void doComicsViewConnections();
|
||||||
@ -258,8 +261,8 @@ public slots:
|
|||||||
void openContainingFolder();
|
void openContainingFolder();
|
||||||
void setFolderAsNotCompleted();
|
void setFolderAsNotCompleted();
|
||||||
void setFolderAsCompleted();
|
void setFolderAsCompleted();
|
||||||
void setFolderAsFinished();
|
void setFolderAsRead();
|
||||||
void setFolderAsNotFinished();
|
void setFolderAsUnread();
|
||||||
void openContainingFolderComic();
|
void openContainingFolderComic();
|
||||||
void deleteCurrentLibrary();
|
void deleteCurrentLibrary();
|
||||||
void removeLibrary();
|
void removeLibrary();
|
||||||
|
@ -20,33 +20,59 @@ FlowType flowType = Strip;
|
|||||||
OptionsDialog::OptionsDialog(QWidget * parent)
|
OptionsDialog::OptionsDialog(QWidget * parent)
|
||||||
:YACReaderOptionsDialog(parent)
|
:YACReaderOptionsDialog(parent)
|
||||||
{
|
{
|
||||||
QVBoxLayout * layout = new QVBoxLayout;
|
QTabWidget * tabWidget = new QTabWidget();
|
||||||
|
|
||||||
QHBoxLayout * switchFlowType = new QHBoxLayout;
|
QVBoxLayout * layout = new QVBoxLayout(this);
|
||||||
switchFlowType->addStretch();
|
|
||||||
switchFlowType->addWidget(useGL);
|
QVBoxLayout * flowLayout = new QVBoxLayout;
|
||||||
|
QVBoxLayout * generalLayout = new QVBoxLayout();
|
||||||
|
|
||||||
|
QHBoxLayout * switchFlowType = new QHBoxLayout;
|
||||||
|
switchFlowType->addStretch();
|
||||||
|
switchFlowType->addWidget(useGL);
|
||||||
|
|
||||||
|
QHBoxLayout * buttons = new QHBoxLayout();
|
||||||
|
buttons->addStretch();
|
||||||
|
buttons->addWidget(accept);
|
||||||
|
buttons->addWidget(cancel);
|
||||||
|
|
||||||
|
flowLayout->addWidget(sw);
|
||||||
|
flowLayout->addWidget(gl);
|
||||||
|
flowLayout->addLayout(switchFlowType);
|
||||||
|
|
||||||
|
QVBoxLayout * shortcutsLayout = new QVBoxLayout();
|
||||||
|
QPushButton * shortcutsButton = new QPushButton(tr("Edit shortcuts"));
|
||||||
|
shortcutsLayout->addWidget(shortcutsButton);
|
||||||
|
|
||||||
|
|
||||||
|
sw->hide();
|
||||||
|
|
||||||
QHBoxLayout * buttons = new QHBoxLayout();
|
QWidget * comicFlowW = new QWidget;
|
||||||
buttons->addStretch();
|
comicFlowW->setLayout(flowLayout);
|
||||||
buttons->addWidget(accept);
|
|
||||||
buttons->addWidget(cancel);
|
|
||||||
|
|
||||||
layout->addWidget(sw);
|
QGroupBox *generalBox = new QGroupBox(tr("Shortcuts"));
|
||||||
layout->addWidget(gl);
|
generalBox->setLayout(shortcutsLayout);
|
||||||
layout->addLayout(switchFlowType);
|
generalLayout->addWidget(generalBox);
|
||||||
layout->addLayout(buttons);
|
generalLayout->addStretch();
|
||||||
|
|
||||||
sw->hide();
|
QWidget * generalW = new QWidget;
|
||||||
|
generalW->setLayout(generalLayout);
|
||||||
|
|
||||||
setLayout(layout);
|
tabWidget->addTab(comicFlowW,tr("Comic Flow"));
|
||||||
//restoreOptions(settings); //load options
|
tabWidget->addTab(generalW,tr("General"));
|
||||||
//resize(200,0);
|
|
||||||
setModal (true);
|
|
||||||
setWindowTitle(tr("Options"));
|
|
||||||
|
|
||||||
this->layout()->setSizeConstraint(QLayout::SetFixedSize);
|
layout->addWidget(tabWidget);
|
||||||
|
layout->addLayout(buttons);
|
||||||
|
setLayout(layout);
|
||||||
|
//restoreOptions(settings); //load options
|
||||||
|
//resize(200,0);
|
||||||
|
setModal (true);
|
||||||
|
setWindowTitle(tr("Options"));
|
||||||
|
|
||||||
|
this->layout()->setSizeConstraint(QLayout::SetFixedSize);
|
||||||
|
|
||||||
|
connect(shortcutsButton,SIGNAL(clicked()),this,SIGNAL(editShortcuts()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,6 +12,8 @@ class OptionsDialog : public YACReaderOptionsDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
OptionsDialog(QWidget * parent = 0);
|
OptionsDialog(QWidget * parent = 0);
|
||||||
|
signals:
|
||||||
|
void editShortcuts();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
BIN
images/accept_shortcut.png
Normal file
BIN
images/accept_shortcut.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 239 B |
BIN
images/clear_shortcut.png
Normal file
BIN
images/clear_shortcut.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 201 B |
80
shortcuts_management/actions_groups_model.cpp
Normal file
80
shortcuts_management/actions_groups_model.cpp
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
#include "actions_groups_model.h"
|
||||||
|
|
||||||
|
ActionsGroupsModel::ActionsGroupsModel(QObject *parent) :
|
||||||
|
QAbstractItemModel(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int ActionsGroupsModel::rowCount(const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
return groups.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
int ActionsGroupsModel::columnCount(const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
QModelIndex ActionsGroupsModel::index(int row, int column, const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
if (!hasIndex(row, column, parent))
|
||||||
|
return QModelIndex();
|
||||||
|
|
||||||
|
return createIndex(row, column, &groups.at(row).getActions());
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant ActionsGroupsModel::data(const QModelIndex &index, int role) const
|
||||||
|
{
|
||||||
|
if (!index.isValid())
|
||||||
|
return QVariant();
|
||||||
|
|
||||||
|
if (role == Qt::DecorationRole)
|
||||||
|
return QVariant(groups.at(index.row()).getIcon());
|
||||||
|
|
||||||
|
if (role != Qt::DisplayRole)
|
||||||
|
return QVariant();
|
||||||
|
|
||||||
|
return QVariant(groups[index.row()].getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
QModelIndex ActionsGroupsModel::parent(const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActionsGroupsModel::addActionsGroup(const ActionsGroup &group)
|
||||||
|
{
|
||||||
|
beginInsertRows(QModelIndex(),groups.length()-1,groups.length());
|
||||||
|
groups.push_back(group);
|
||||||
|
endInsertRows();
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QAction *> ActionsGroupsModel::getActions(const QModelIndex &mi)
|
||||||
|
{
|
||||||
|
if(mi.isValid())
|
||||||
|
return groups[mi.row()].getActions();
|
||||||
|
return QList<QAction *>();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
|
ActionsGroup::ActionsGroup(const QString &name, const QIcon &icon, QList<QAction *> &actions)
|
||||||
|
:name(name), icon(icon), actions(actions)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ActionsGroup::getName() const
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
QIcon ActionsGroup::getIcon() const
|
||||||
|
{
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QAction *> ActionsGroup::getActions() const
|
||||||
|
{
|
||||||
|
return actions;
|
||||||
|
}
|
44
shortcuts_management/actions_groups_model.h
Normal file
44
shortcuts_management/actions_groups_model.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#ifndef ACTIONS_GROUPS_MODEL_H
|
||||||
|
#define ACTIONS_GROUPS_MODEL_H
|
||||||
|
|
||||||
|
#include <QAbstractItemModel>
|
||||||
|
#include <QIcon>
|
||||||
|
|
||||||
|
class QAction;
|
||||||
|
|
||||||
|
class ActionsGroup
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ActionsGroup(const QString & name, const QIcon & icon, QList<QAction *> & actions);
|
||||||
|
QString getName() const;
|
||||||
|
QIcon getIcon() const;
|
||||||
|
QList<QAction *> getActions() const;
|
||||||
|
protected:
|
||||||
|
QString name;
|
||||||
|
QIcon icon;
|
||||||
|
QList<QAction *> actions;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ActionsGroupsModel : public QAbstractItemModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit ActionsGroupsModel(QObject *parent = 0);
|
||||||
|
|
||||||
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
|
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
|
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
|
||||||
|
QVariant data(const QModelIndex &index, int role) const;
|
||||||
|
QModelIndex parent(const QModelIndex &index) const;
|
||||||
|
|
||||||
|
void addActionsGroup(const ActionsGroup & group);
|
||||||
|
QList<QAction *> getActions(const QModelIndex & mi);
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QList<ActionsGroup> groups;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ACTIONS_GROUPS_MODEL_H
|
92
shortcuts_management/actions_shortcuts_model.cpp
Normal file
92
shortcuts_management/actions_shortcuts_model.cpp
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
#include "actions_shortcuts_model.h"
|
||||||
|
#include "shortcuts_manager.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
ActionsShortcutsModel::ActionsShortcutsModel(QObject *parent) :
|
||||||
|
QAbstractItemModel(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int ActionsShortcutsModel::rowCount(const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
return actions.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
int ActionsShortcutsModel::columnCount(const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
QModelIndex ActionsShortcutsModel::index(int row, int column, const QModelIndex &parent) const
|
||||||
|
{
|
||||||
|
if (!hasIndex(row, column, parent))
|
||||||
|
return QModelIndex();
|
||||||
|
|
||||||
|
return createIndex(row, column, actions[row]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Qt::ItemFlags ActionsShortcutsModel::flags(const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
if (!index.isValid())
|
||||||
|
return 0;
|
||||||
|
if(index.column() == KEYS)
|
||||||
|
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
|
||||||
|
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant ActionsShortcutsModel::data(const QModelIndex &index, int role) const
|
||||||
|
{
|
||||||
|
if (!index.isValid())
|
||||||
|
return QVariant();
|
||||||
|
|
||||||
|
if (role == Qt::DecorationRole && index.column() == ICON)
|
||||||
|
return QVariant(actions[index.row()]->icon());
|
||||||
|
|
||||||
|
if (role == Qt::TextAlignmentRole)
|
||||||
|
{
|
||||||
|
switch(index.column())
|
||||||
|
{
|
||||||
|
case ICON:
|
||||||
|
return QVariant(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
case NAME:
|
||||||
|
return QVariant(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
|
case KEYS:
|
||||||
|
return QVariant(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (role != Qt::DisplayRole)
|
||||||
|
return QVariant();
|
||||||
|
|
||||||
|
if (index.column() == NAME)
|
||||||
|
return QVariant(actions[index.row()]->toolTip());
|
||||||
|
if (index.column() == KEYS)
|
||||||
|
return QVariant(actions[index.row()]->shortcut().toString());
|
||||||
|
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ActionsShortcutsModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||||
|
{
|
||||||
|
if(index.column() == KEYS)
|
||||||
|
{
|
||||||
|
actions[index.row()]->setShortcut(value.toString());
|
||||||
|
ShortcutsManager::getShortcutsManager().saveShortcut(actions[index.row()]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QModelIndex ActionsShortcutsModel::parent(const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActionsShortcutsModel::addActions(const QList<QAction *> actions)
|
||||||
|
{
|
||||||
|
beginResetModel();
|
||||||
|
this->actions = actions;
|
||||||
|
endResetModel();
|
||||||
|
}
|
38
shortcuts_management/actions_shortcuts_model.h
Normal file
38
shortcuts_management/actions_shortcuts_model.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#ifndef ACTIONS_SHORTCUTS_MODEL_H
|
||||||
|
#define ACTIONS_SHORTCUTS_MODEL_H
|
||||||
|
|
||||||
|
#include <QAbstractItemModel>
|
||||||
|
|
||||||
|
class QAction;
|
||||||
|
|
||||||
|
class ActionsShortcutsModel : public QAbstractItemModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit ActionsShortcutsModel(QObject *parent = 0);
|
||||||
|
|
||||||
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
|
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
|
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
|
||||||
|
QVariant data(const QModelIndex &index, int role) const;
|
||||||
|
bool setData(const QModelIndex &index, const QVariant &value, int role);
|
||||||
|
QModelIndex parent(const QModelIndex &index) const;
|
||||||
|
|
||||||
|
void addActions(const QList<QAction *> actions);
|
||||||
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||||
|
|
||||||
|
|
||||||
|
enum Columns {
|
||||||
|
ICON = 0,
|
||||||
|
NAME,
|
||||||
|
KEYS
|
||||||
|
};
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QList<QAction *> actions;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ACTIONS_SHORTCUTS_MODEL_H
|
145
shortcuts_management/edit_shortcut_item_delegate.cpp
Normal file
145
shortcuts_management/edit_shortcut_item_delegate.cpp
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
#include "edit_shortcut_item_delegate.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
EditShortcutItemDelegate::EditShortcutItemDelegate(QObject *parent) :
|
||||||
|
QItemDelegate(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *EditShortcutItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
KeySequenceLineEdit * editor = new KeySequenceLineEdit(parent);
|
||||||
|
connect(editor,SIGNAL(editingFinished()),this,SLOT(closeShortcutEditor()));
|
||||||
|
return editor;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditShortcutItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
QString value = index.model()->data(index, Qt::DisplayRole).toString();
|
||||||
|
|
||||||
|
KeySequenceLineEdit * lineEdit = static_cast<KeySequenceLineEdit*>(editor);
|
||||||
|
lineEdit->setText(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditShortcutItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
KeySequenceLineEdit *lineEdit = static_cast<KeySequenceLineEdit*>(editor);
|
||||||
|
|
||||||
|
model->setData(index, lineEdit->text(), Qt::EditRole);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditShortcutItemDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &mi) const
|
||||||
|
{
|
||||||
|
editor->setGeometry(option.rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EditShortcutItemDelegate::eventFilter(QObject* editor, QEvent* event)
|
||||||
|
{
|
||||||
|
if(event->type()==QEvent::KeyPress)
|
||||||
|
return false;
|
||||||
|
return QItemDelegate::eventFilter(editor, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditShortcutItemDelegate::closeShortcutEditor()
|
||||||
|
{
|
||||||
|
emit commitData(static_cast<QWidget *>(sender()));
|
||||||
|
emit closeEditor(static_cast<QWidget *>(sender()),QAbstractItemDelegate::NoHint);
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO uncoment commented code for enabling concatenated shortcuts
|
||||||
|
KeySequenceLineEdit::KeySequenceLineEdit(QWidget *parent)
|
||||||
|
:QLineEdit(parent)//,numKeys(0)
|
||||||
|
{
|
||||||
|
//keys[0] = keys[1] = keys[2] = keys[3] = 0;
|
||||||
|
setAlignment(Qt::AlignRight);
|
||||||
|
|
||||||
|
QPixmap clearPixmap(":/images/clear_shortcut.png");
|
||||||
|
QPixmap acceptPixmap(":/images/accept_shortcut.png");
|
||||||
|
|
||||||
|
clearButton = new QToolButton(this);
|
||||||
|
acceptButton = new QToolButton(this);
|
||||||
|
QString buttonsStyle = "QToolButton { border: none; padding: 0px; }";
|
||||||
|
|
||||||
|
clearButton->setIcon(QIcon(clearPixmap));
|
||||||
|
clearButton->setIconSize(clearPixmap.size());
|
||||||
|
clearButton->setCursor(Qt::ArrowCursor);
|
||||||
|
clearButton->setStyleSheet(buttonsStyle);
|
||||||
|
|
||||||
|
acceptButton->setIcon(QIcon(acceptPixmap));
|
||||||
|
acceptButton->setIconSize(acceptPixmap.size());
|
||||||
|
acceptButton->setCursor(Qt::ArrowCursor);
|
||||||
|
acceptButton->setStyleSheet(buttonsStyle);
|
||||||
|
|
||||||
|
connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
|
||||||
|
connect(acceptButton, SIGNAL(clicked()), this, SIGNAL(editingFinished()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void KeySequenceLineEdit::resizeEvent(QResizeEvent *)
|
||||||
|
{
|
||||||
|
QSize szClear = clearButton->sizeHint();
|
||||||
|
//int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||||
|
int leftMargin = style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
|
||||||
|
int topMargin = style()->pixelMetric(QStyle::PM_LayoutTopMargin);
|
||||||
|
clearButton->move(0 + leftMargin,topMargin-4);
|
||||||
|
|
||||||
|
acceptButton->move( leftMargin + szClear.width(),topMargin-4);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void KeySequenceLineEdit::keyPressEvent(QKeyEvent * e)
|
||||||
|
{
|
||||||
|
int key = e->key();
|
||||||
|
|
||||||
|
|
||||||
|
//if ( numKeys > 3 ||
|
||||||
|
if ( key == Qt::Key_Control ||
|
||||||
|
key == Qt::Key_Shift ||
|
||||||
|
key == Qt::Key_Meta ||
|
||||||
|
key == Qt::Key_Alt )
|
||||||
|
return;
|
||||||
|
|
||||||
|
key |= translateModifiers(e->modifiers(), e->text());
|
||||||
|
|
||||||
|
/*switch (numKeys) {
|
||||||
|
case 0:
|
||||||
|
keys[0] = nextKey;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
keys[1] = nextKey;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
keys[2] = nextKey;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
keys[3] = nextKey;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}*/
|
||||||
|
//numKeys++;
|
||||||
|
QKeySequence keySequence = QKeySequence(key);
|
||||||
|
setText(keySequence.toString(QKeySequence::NativeText));
|
||||||
|
e->accept();
|
||||||
|
}
|
||||||
|
|
||||||
|
int KeySequenceLineEdit::translateModifiers(Qt::KeyboardModifiers state,
|
||||||
|
const QString &text)
|
||||||
|
{
|
||||||
|
int result = 0;
|
||||||
|
// The shift modifier only counts when it is not used to type a symbol
|
||||||
|
// that is only reachable using the shift key anyway
|
||||||
|
if ((state & Qt::ShiftModifier) && (text.size() == 0
|
||||||
|
|| !text.at(0).isPrint()
|
||||||
|
|| text.at(0).isLetterOrNumber()
|
||||||
|
|| text.at(0).isSpace()))
|
||||||
|
result |= Qt::SHIFT;
|
||||||
|
if (state & Qt::ControlModifier)
|
||||||
|
result |= Qt::CTRL;
|
||||||
|
if (state & Qt::MetaModifier)
|
||||||
|
result |= Qt::META;
|
||||||
|
if (state & Qt::AltModifier)
|
||||||
|
result |= Qt::ALT;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
48
shortcuts_management/edit_shortcut_item_delegate.h
Normal file
48
shortcuts_management/edit_shortcut_item_delegate.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#ifndef EDIT_SHORTCUT_ITEM_DELEGATE_H
|
||||||
|
#define EDIT_SHORTCUT_ITEM_DELEGATE_H
|
||||||
|
|
||||||
|
#include <QItemDelegate>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QKeyEvent>
|
||||||
|
#include <QKeySequence>
|
||||||
|
#include <QToolButton>
|
||||||
|
|
||||||
|
class KeySequenceLineEdit : public QLineEdit
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit KeySequenceLineEdit(QWidget *parent = 0);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//int numKeys;
|
||||||
|
//int keys[4];
|
||||||
|
void keyPressEvent(QKeyEvent *);
|
||||||
|
int translateModifiers(Qt::KeyboardModifiers state, const QString &text);
|
||||||
|
void resizeEvent(QResizeEvent *);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QToolButton *clearButton;
|
||||||
|
QToolButton *acceptButton;
|
||||||
|
};
|
||||||
|
|
||||||
|
class EditShortcutItemDelegate : public QItemDelegate
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit EditShortcutItemDelegate(QObject *parent = 0);
|
||||||
|
|
||||||
|
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
||||||
|
const QModelIndex &index) const;
|
||||||
|
void setEditorData(QWidget *editor, const QModelIndex &index) const;
|
||||||
|
void setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||||
|
const QModelIndex &index) const;
|
||||||
|
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex & mi) const;
|
||||||
|
bool eventFilter(QObject *editor, QEvent *event);
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void closeShortcutEditor();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // EDIT_SHORTCUT_ITEM_DELEGATE_H
|
82
shortcuts_management/shortcuts_dialog.cpp
Normal file
82
shortcuts_management/shortcuts_dialog.cpp
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
#include "shortcuts_dialog.h"
|
||||||
|
|
||||||
|
#include "actions_groups_model.h"
|
||||||
|
#include "actions_shortcuts_model.h"
|
||||||
|
#include "edit_shortcut_item_delegate.h"
|
||||||
|
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QSplitter>
|
||||||
|
#include <QListView>
|
||||||
|
#include <QTableView>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QHeaderView>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
|
#include "QsLog.h"
|
||||||
|
|
||||||
|
ShortcutsDialog::ShortcutsDialog(QWidget *parent) :
|
||||||
|
QDialog(parent)
|
||||||
|
{
|
||||||
|
QPushButton * resetButton = new QPushButton(tr("Restore defaults"),this);
|
||||||
|
QLabel * infoLabel = new QLabel(tr("To change a shortcut, select it, click in the key combination and type the new keys."));
|
||||||
|
QVBoxLayout * layout = new QVBoxLayout(this);
|
||||||
|
QSplitter * splitter = new QSplitter(this);
|
||||||
|
actionsGroupsListView = new QListView(this);
|
||||||
|
|
||||||
|
actionsTableView = new QTableView(this);
|
||||||
|
actionsTableView->verticalHeader()->setHidden(true);
|
||||||
|
actionsTableView->horizontalHeader()->setHidden(true);
|
||||||
|
splitter->addWidget(actionsGroupsListView);
|
||||||
|
splitter->addWidget(actionsTableView);
|
||||||
|
splitter->setStretchFactor(1,1);
|
||||||
|
splitter->setSizes(QList<int>() << 200 << 400);
|
||||||
|
|
||||||
|
layout->addWidget(infoLabel,0);
|
||||||
|
layout->addWidget(splitter,1);
|
||||||
|
layout->addWidget(resetButton,0,Qt::AlignRight);
|
||||||
|
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
|
groupsModel = new ActionsGroupsModel();
|
||||||
|
actionsModel = new ActionsShortcutsModel();
|
||||||
|
actionsGroupsListView->setModel(groupsModel);
|
||||||
|
actionsTableView->setModel(actionsModel);
|
||||||
|
actionsTableView->setColumnWidth(0,30);
|
||||||
|
actionsTableView->setColumnWidth(1,270);
|
||||||
|
actionsTableView->horizontalHeader()->setStretchLastSection(true);
|
||||||
|
actionsTableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
|
actionsTableView->setShowGrid(false);
|
||||||
|
actionsTableView->setItemDelegateForColumn(ActionsShortcutsModel::KEYS,new EditShortcutItemDelegate(this));
|
||||||
|
actionsTableView->installEventFilter(this);
|
||||||
|
/*actionsTableView->setStyleSheet("QTableView {outline: 0px;}"
|
||||||
|
"QTableView::item {outline: 0px;}");
|
||||||
|
"QTableView {border:0px;}"
|
||||||
|
"QTableView::item:selected {outline: 0px; border: 0px;}"
|
||||||
|
"");*/
|
||||||
|
|
||||||
|
|
||||||
|
connect(resetButton,SIGNAL(clicked()),this,SLOT(resetToDefaults()));
|
||||||
|
connect(actionsGroupsListView->selectionModel(),SIGNAL(currentChanged(QModelIndex,QModelIndex)),this,SLOT(loadShortcuts(QModelIndex,QModelIndex))); //clicked(QModelIndex) doesn't work :S
|
||||||
|
|
||||||
|
setFixedSize(640,480);
|
||||||
|
setWindowTitle(tr("Shortcuts settings"));
|
||||||
|
|
||||||
|
setModal(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShortcutsDialog::addActionsGroup(const QString &name, const QIcon &ico, QList<QAction *> &group)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
//groups model add
|
||||||
|
groupsModel->addActionsGroup(ActionsGroup(name,ico,group));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShortcutsDialog::resetToDefaults()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShortcutsDialog::loadShortcuts(const QModelIndex &mi,const QModelIndex &mi2)
|
||||||
|
{
|
||||||
|
actionsModel->addActions(groupsModel->getActions(mi));
|
||||||
|
}
|
32
shortcuts_management/shortcuts_dialog.h
Normal file
32
shortcuts_management/shortcuts_dialog.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#ifndef SHORTCUTS_DIALOG_H
|
||||||
|
#define SHORTCUTS_DIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QModelIndex>
|
||||||
|
|
||||||
|
class QListView;
|
||||||
|
class QTableView;
|
||||||
|
|
||||||
|
class ActionsGroupsModel;
|
||||||
|
class ActionsShortcutsModel;
|
||||||
|
|
||||||
|
class ShortcutsDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit ShortcutsDialog(QWidget * parent = 0);
|
||||||
|
void addActionsGroup(const QString & name, const QIcon & ico, QList<QAction *> & group);
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void resetToDefaults();
|
||||||
|
void loadShortcuts(const QModelIndex & mi,const QModelIndex &mi2);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QListView * actionsGroupsListView;
|
||||||
|
QTableView * actionsTableView;
|
||||||
|
ActionsGroupsModel * groupsModel;
|
||||||
|
ActionsShortcutsModel * actionsModel;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SHORTCUTS_DIALOG_H
|
16
shortcuts_management/shortcuts_management.pri
Normal file
16
shortcuts_management/shortcuts_management.pri
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
INCLUDEPATH += $$PWD
|
||||||
|
DEPENDPATH += $$PWD
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
$$PWD/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/actions_groups_model.cpp \
|
||||||
|
$$PWD/actions_shortcuts_model.cpp \
|
||||||
|
$$PWD/edit_shortcut_item_delegate.cpp \
|
||||||
|
$$PWD/shortcuts_manager.cpp
|
49
shortcuts_management/shortcuts_manager.cpp
Normal file
49
shortcuts_management/shortcuts_manager.cpp
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#include "shortcuts_manager.h"
|
||||||
|
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QAction>
|
||||||
|
#include "yacreader_global.h"
|
||||||
|
|
||||||
|
ShortcutsManager::ShortcutsManager()
|
||||||
|
{
|
||||||
|
initDefaultShorcuts();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShortcutsManager::initDefaultShorcuts()
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
defaultShorcuts.insert(RENAME_LIBRARY_ACTION_YL,Qt::Key_R);
|
||||||
|
defaultShorcuts.insert(OPEN_COMIC_ACTION_YL,Qt::Key_Return);
|
||||||
|
defaultShorcuts.insert(SHOW_HIDE_MARKS_ACTION_YL,Qt::Key_M);
|
||||||
|
defaultShorcuts.insert(TOGGLE_FULL_SCREEN_ACTION_YL,Qt::Key_F);
|
||||||
|
defaultShorcuts.insert(HELP_ABOUT_ACTION_YL,Qt::Key_F1);
|
||||||
|
defaultShorcuts.insert(SET_ROOT_INDEX_ACTION_YL,Qt::Key_0);
|
||||||
|
defaultShorcuts.insert(EXPAND_ALL_NODES_ACTION_YL,Qt::Key_Plus);
|
||||||
|
defaultShorcuts.insert(COLAPSE_ALL_NODES_ACTION_YL,Qt::Key_Minus);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShortcutsManager::resetToDefaults()
|
||||||
|
{
|
||||||
|
//TODO reset to defaults
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShortcutsManager::getShortcut(const QString &name)
|
||||||
|
{
|
||||||
|
QSettings s(YACReader::getSettingsPath()+"/YACReaderLibrary.ini",QSettings::IniFormat);
|
||||||
|
s.beginGroup("shortcuts");
|
||||||
|
|
||||||
|
return s.value(name,defaultShorcuts.value(name)).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShortcutsManager::saveShortcut(QAction *action)
|
||||||
|
{
|
||||||
|
QSettings s(YACReader::getSettingsPath()+"/YACReaderLibrary.ini",QSettings::IniFormat);
|
||||||
|
s.beginGroup("shortcuts");
|
||||||
|
|
||||||
|
return s.setValue(action->data().toString() , action->shortcut().toString());
|
||||||
|
}
|
73
shortcuts_management/shortcuts_manager.h
Normal file
73
shortcuts_management/shortcuts_manager.h
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
#ifndef SHORTCUTS_MANAGER_H
|
||||||
|
#define SHORTCUTS_MANAGER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QKeySequence>
|
||||||
|
#include <QString>
|
||||||
|
#include <QMap>
|
||||||
|
|
||||||
|
|
||||||
|
class QAction;
|
||||||
|
|
||||||
|
//QAction: used setData() and data() for storing (userData) an identifier for each QAction. This value is ussed in QSettings
|
||||||
|
|
||||||
|
class ShortcutsManager
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
ShortcutsManager();
|
||||||
|
QMap<QString,QKeySequence> defaultShorcuts;
|
||||||
|
void initDefaultShorcuts();
|
||||||
|
public:
|
||||||
|
static ShortcutsManager & getShortcutsManager()
|
||||||
|
{
|
||||||
|
static ShortcutsManager manager;
|
||||||
|
return manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
void resetToDefaults();
|
||||||
|
QString getShortcut(const QString & name);
|
||||||
|
void saveShortcut(QAction * action);
|
||||||
|
};
|
||||||
|
|
||||||
|
//ACTION NAMES YACReaderLibrary
|
||||||
|
#define BACK_ACTION_YL "BACK_ACTION_YL"
|
||||||
|
#define FORWARD_ACTION_YL "FORWARD_ACTION_YL"
|
||||||
|
#define CREATE_LIBRARY_ACTION_YL "CREATE_LIBRARY_ACTION_YL"
|
||||||
|
#define OPEN_LIBRARY_ACTION_YL "OPEN_LIBRARY_ACTION_YL"
|
||||||
|
#define EXPORT_COMICS_INFO_YL "EXPORT_COMICS_INFO_YL"
|
||||||
|
#define IMPORT_COMICS_INFO_YL "IMPORT_COMICS_INFO_YL"
|
||||||
|
#define EXPORT_LIBRARY_ACTION_YL "EXPORT_LIBRARY_ACTION_YL"
|
||||||
|
#define IMPORT_LIBRARY_ACTION_YL "IMPORT_LIBRARY_ACTION_YL"
|
||||||
|
#define UPDATE_LIBRARY_ACTION_YL "UPDATE_LIBRARY_ACTION_YL"
|
||||||
|
#define RENAME_LIBRARY_ACTION_YL "RENAME_LIBRARY_ACTION_YL"
|
||||||
|
#define REMOVE_LIBRARY_ACTION_YL "REMOVE_LIBRARY_ACTION_YL"
|
||||||
|
#define OPEN_COMIC_ACTION_YL "OPEN_COMIC_ACTION_YL"
|
||||||
|
#define SET_AS_READ_ACTION_YL "SET_AS_READ_ACTION_YL"
|
||||||
|
#define SET_AS_NON_READ_ACTION_YL "SET_AS_NON_READ_ACTION_YL"
|
||||||
|
#define SHOW_HIDE_MARKS_ACTION_YL "SHOW_HIDE_MARKS_ACTION_YL"
|
||||||
|
#define TOGGLE_FULL_SCREEN_ACTION_YL "TOGGLE_FULL_SCREEN_ACTION_YL"
|
||||||
|
#define HELP_ABOUT_ACTION_YL "HELP_ABOUT_ACTION_YL"
|
||||||
|
#define SET_ROOT_INDEX_ACTION_YL "SET_ROOT_INDEX_ACTION_YL"
|
||||||
|
#define EXPAND_ALL_NODES_ACTION_YL "EXPAND_ALL_NODES_ACTION_YL"
|
||||||
|
#define COLAPSE_ALL_NODES_ACTION_YL "COLAPSE_ALL_NODES_ACTION_YL"
|
||||||
|
#define OPTIONS_ACTION_YL "OPTIONS_ACTION_YL"
|
||||||
|
#define SERVER_CONFIG_ACTION_YL "SERVER_CONFIG_ACTION_YL"
|
||||||
|
#define TOGGLE_COMICS_VIEW_ACTION_YL "TOGGLE_COMICS_VIEW_ACTION_YL"
|
||||||
|
#define OPEN_CONTAINING_FOLDER_ACTION_YL "OPEN_CONTAINING_FOLDER_ACTION_YL"
|
||||||
|
#define SET_FOLDER_AS_NOT_COMPLETED_ACTION_YL "SET_FOLDER_AS_NOT_COMPLETED_ACTION_YL"
|
||||||
|
#define SET_FOLDER_AS_COMPLETED_ACTION_YL "SET_FOLDER_AS_COMPLETED_ACTION_YL"
|
||||||
|
#define SET_FOLDER_AS_READ_ACTION_YL "SET_FOLDER_AS_READ_ACTION_YL"
|
||||||
|
#define SET_FOLDER_AS_UNREAD_ACTION_YL "SET_FOLDER_AS_UNREAD_ACTION_YL"
|
||||||
|
#define OPEN_CONTAINING_FOLDER_COMIC_ACTION_YL "OPEN_CONTAINING_FOLDER_COMIC_ACTION_YL"
|
||||||
|
#define RESET_COMIC_RATING_ACTION_YL "RESET_COMIC_RATING_ACTION_YL"
|
||||||
|
#define SELECT_ALL_COMICS_ACTION_YL "SELECT_ALL_COMICS_ACTION_YL"
|
||||||
|
#define EDIT_SELECTED_COMICS_ACTION_YL "EDIT_SELECTED_COMICS_ACTION_YL"
|
||||||
|
#define ASIGN_ORDER_ACTION_YL "ASIGN_ORDER_ACTION_YL"
|
||||||
|
#define FORCE_COVER_EXTRACTED_ACTION_YL "FORCE_COVER_EXTRACTED_ACTION_YL"
|
||||||
|
#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"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // SHORTCUTS_MANAGER_H
|
Loading…
x
Reference in New Issue
Block a user