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

Method showComicsContextMenu

YACReaderLibrary/library_window.cpp:1340–1440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1338}
1339
1340void LibraryWindow::showComicsContextMenu(const QPoint &point, bool showFullScreenAction)
1341{
1342 auto selection = this->getSelectedComics();
1343
1344 auto setNormalAction = new QAction();
1345 setNormalAction->setText(tr("comic"));
1346
1347 auto setMangaAction = new QAction();
1348 setMangaAction->setText(tr("manga"));
1349
1350 auto setWesternMangaAction = new QAction();
1351 setWesternMangaAction->setText(tr("western manga (left to right)"));
1352
1353 auto setWebComicAction = new QAction();
1354 setWebComicAction->setText(tr("web comic"));
1355
1356 auto setYonkomaAction = new QAction();
1357 setYonkomaAction->setText(tr("4koma (top to botom)"));
1358
1359 setNormalAction->setCheckable(true);
1360 setMangaAction->setCheckable(true);
1361 setWesternMangaAction->setCheckable(true);
1362 setWebComicAction->setCheckable(true);
1363 setYonkomaAction->setCheckable(true);
1364
1365 connect(setNormalAction, &QAction::triggered, actions.setNormalAction, &QAction::trigger);
1366 connect(setMangaAction, &QAction::triggered, actions.setMangaAction, &QAction::trigger);
1367 connect(setWesternMangaAction, &QAction::triggered, actions.setWesternMangaAction, &QAction::trigger);
1368 connect(setWebComicAction, &QAction::triggered, actions.setWebComicAction, &QAction::trigger);
1369 connect(setYonkomaAction, &QAction::triggered, actions.setYonkomaAction, &QAction::trigger);
1370
1371 auto setupActions = [=](FileType type) {
1372 switch (type) {
1373 case YACReader::FileType::Comic:
1374 setNormalAction->setChecked(true);
1375 break;
1376 case YACReader::FileType::Manga:
1377 setMangaAction->setChecked(true);
1378 break;
1379 case YACReader::FileType::WesternManga:
1380 setWesternMangaAction->setChecked(true);
1381 break;
1382 case YACReader::FileType::WebComic:
1383 setWebComicAction->setChecked(true);
1384 break;
1385 case YACReader::FileType::Yonkoma:
1386 setYonkomaAction->setChecked(true);
1387 break;
1388 }
1389 };
1390
1391 if (selection.size() == 1) {
1392 QModelIndex index = selection.at(0);
1393 auto type = index.data(ComicModel::TypeRole).value<YACReader::FileType>();
1394 setupActions(type);
1395 }
1396
1397 QMenu menu;

Callers

nothing calls this directly

Calls 5

getSelectedComicsMethod · 0.95
addActionMethod · 0.80
execMethod · 0.80
setTextMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected