MCPcopy Create free account
hub / github.com/YACReader/yacreader / setUpShortcutsManagement

Method setUpShortcutsManagement

YACReader/main_window_viewer.cpp:1299–1472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1297}
1298
1299void MainWindowViewer::setUpShortcutsManagement()
1300{
1301 // Set up icon mapping for theme changes
1302 QMap<QString, std::function<QIcon(const Theme &)>> iconMapping;
1303 iconMapping[tr("Comics")] = [](const Theme &t) { return t.shortcutsIcons.comicsIcon; };
1304 iconMapping[tr("General")] = [](const Theme &t) { return t.shortcutsIcons.generalIcon; };
1305 iconMapping[tr("Magnifiying glass")] = [](const Theme &t) { return t.shortcutsIcons.magnifyingGlassIcon; };
1306 iconMapping[tr("Page adjustement")] = [](const Theme &t) { return t.shortcutsIcons.pageIcon; };
1307 iconMapping[tr("Reading")] = [](const Theme &t) { return t.shortcutsIcons.readingIcon; };
1308 editShortcutsDialog->setGroupIconMapping(iconMapping);
1309
1310 QList<QAction *> allActions;
1311 QList<QAction *> tmpList;
1312
1313 // Get current theme for initial icons
1314 const auto &theme = ThemeManager::instance().getCurrentTheme();
1315
1316 editShortcutsDialog->addActionsGroup(tr("Comics"), theme.shortcutsIcons.comicsIcon,
1317 tmpList = { openAction,
1318 openLatestComicAction,
1319 openFolderAction,
1320 saveImageAction,
1321 extractPagesAction,
1322 openComicOnTheLeftAction,
1323 openComicOnTheRightAction });
1324
1325 allActions << tmpList;
1326
1327 auto *const toggleFullScreenAction = addActionWithShortcut(tr("Toggle fullscreen mode"), TOGGLE_FULL_SCREEN_ACTION_Y);
1328 connect(toggleFullScreenAction, &QAction::triggered, this, &MainWindowViewer::toggleFullScreen);
1329
1330 auto *const toggleToolbarsAction = addActionWithShortcut(tr("Hide/show toolbar"), TOGGLE_TOOL_BARS_ACTION_Y);
1331 connect(toggleToolbarsAction, &QAction::triggered, this, &MainWindowViewer::toggleToolBars);
1332
1333 editShortcutsDialog->addActionsGroup(tr("General"), theme.shortcutsIcons.generalIcon,
1334 tmpList = QList<QAction *>()
1335 << optionsAction
1336 << helpAboutAction
1337 << showShorcutsAction
1338 << showInfoAction
1339 << closeAction
1340 << showDictionaryAction
1341 << showFlowAction
1342 << toggleFullScreenAction
1343 << toggleToolbarsAction
1344 << showEditShortcutsAction
1345#ifdef Q_OS_MACOS
1346 << newInstanceAction
1347#endif
1348 );
1349
1350 allActions << tmpList;
1351
1352 auto *const sizeUpMglassAction = addActionWithShortcut(tr("Size up magnifying glass"), SIZE_UP_MGLASS_ACTION_Y);
1353 connect(sizeUpMglassAction, &QAction::triggered, viewer, &Viewer::magnifyingGlassSizeUp);
1354
1355 auto *const sizeDownMglassAction = addActionWithShortcut(tr("Size down magnifying glass"), SIZE_DOWN_MGLASS_ACTION_Y);
1356 connect(sizeDownMglassAction, &QAction::triggered, viewer, &Viewer::magnifyingGlassSizeDown);

Callers

nothing calls this directly

Calls 4

setGroupIconMappingMethod · 0.80
moveViewMethod · 0.80
registerActionsMethod · 0.80
addActionsGroupMethod · 0.45

Tested by

no test coverage detected