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

Method createActions

YACReader/main_window_viewer.cpp:327–592  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325}
326
327void MainWindowViewer::createActions()
328{
329 openAction = new QAction(tr("&Open"), this);
330 openAction->setToolTip(tr("Open a comic"));
331 openAction->setData(OPEN_ACTION_Y);
332 openAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_ACTION_Y));
333 connect(openAction, &QAction::triggered, this, QOverload<>::of(&MainWindowViewer::open));
334
335#ifdef Q_OS_MACOS
336 newInstanceAction = new QAction(tr("New instance"), this);
337 newInstanceAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(NEW_INSTANCE_ACTION_Y));
338 connect(newInstanceAction, &QAction::triggered,
339 [=]() {
340 QStringList possiblePaths { QDir::cleanPath(QCoreApplication::applicationDirPath() + "/../../../") };
341 possiblePaths += QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation);
342
343 for (auto &&ypath : possiblePaths) {
344 QString yacreaderPath = QDir::cleanPath(ypath + "/YACReader.app");
345 if (QFileInfo(yacreaderPath).exists()) {
346 QStringList parameters { "-n", "-a", yacreaderPath };
347 QProcess::startDetached("open", parameters);
348 break;
349 }
350 }
351 });
352 newInstanceAction->setData(NEW_INSTANCE_ACTION_Y);
353#endif
354
355 openFolderAction = new QAction(tr("Open Folder"), this);
356 openFolderAction->setToolTip(tr("Open image folder"));
357 openFolderAction->setData(OPEN_FOLDER_ACTION_Y);
358 openFolderAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_FOLDER_ACTION_Y));
359 connect(openFolderAction, &QAction::triggered, this, &MainWindowViewer::openFolder);
360
361 openLatestComicAction = addActionWithShortcut(tr("Open latest comic"), OPEN_LATEST_COMIC_Y);
362 openLatestComicAction->setToolTip(tr("Open the latest comic opened in the previous reading session"));
363 connect(openLatestComicAction, &QAction::triggered, this, &MainWindowViewer::openLatestComic);
364
365 QAction *recentFileAction = nullptr;
366 // TODO: Replace limit with a configurable value
367 for (int i = 0; i < Configuration::getConfiguration().getOpenRecentSize(); i++) {
368 recentFileAction = new QAction(this);
369 recentFileAction->setVisible(false);
370 QObject::connect(recentFileAction, &QAction::triggered, this, &MainWindowViewer::openRecent);
371 recentFilesActionList.append(recentFileAction);
372 }
373
374 clearRecentFilesAction = new QAction(tr("Clear"), this);
375 clearRecentFilesAction->setToolTip(tr("Clear open recent list"));
376 connect(clearRecentFilesAction, &QAction::triggered, this, &MainWindowViewer::clearRecentFiles);
377
378 saveImageAction = new QAction(tr("Save"), this);
379 saveImageAction->setToolTip(tr("Save current page"));
380 saveImageAction->setData(SAVE_IMAGE_ACTION_Y);
381 saveImageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SAVE_IMAGE_ACTION_Y));
382 connect(saveImageAction, &QAction::triggered, this, &MainWindowViewer::saveImage);
383
384 extractPagesAction = new QAction(tr("Extract page(s)"), this);

Callers

nothing calls this directly

Calls 9

getShortcutMethod · 0.80
getOpenRecentSizeMethod · 0.80
getContinuousScrollMethod · 0.80
addActionMethod · 0.80
getFitModeMethod · 0.80
getDoublePageMethod · 0.80
getDoubleMangaPageMethod · 0.80
getBookmarksDialogMethod · 0.80
setDataMethod · 0.45

Tested by

no test coverage detected