MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / addOpenMenus

Method addOpenMenus

src/filetree.cpp:699–776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

697}
698
699void FileTree::addOpenMenus(QMenu& menu, const MOShared::FileEntry& file)
700{
701 using namespace spawn;
702
703 MenuItem openMenu, openHookedMenu;
704
705 const QFileInfo target(QString::fromStdWString(file.getFullPath()));
706
707 if (getFileExecutionType(target) == FileExecutionTypes::Executable) {
708 openMenu.caption(tr("&Execute"))
709 .callback([&] {
710 open();
711 })
712 .hint(tr("Launches this program"))
713 .disabledHint(tr("This file is in an archive"))
714 .enabled(!file.isFromArchive());
715
716 openHookedMenu.caption(tr("Execute with &VFS"))
717 .callback([&] {
718 openHooked();
719 })
720 .hint(tr("Launches this program hooked to the VFS"))
721 .disabledHint(tr("This file is in an archive"))
722 .enabled(!file.isFromArchive());
723 } else {
724 openMenu.caption(tr("&Open"))
725 .callback([&] {
726 open();
727 })
728 .hint(tr("Opens this file with its default handler"))
729 .disabledHint(tr("This file is in an archive"))
730 .enabled(!file.isFromArchive());
731
732 openHookedMenu.caption(tr("Open with &VFS"))
733 .callback([&] {
734 openHooked();
735 })
736 .hint(tr("Opens this file with its default handler hooked to the VFS"))
737 .disabledHint(tr("This file is in an archive"))
738 .enabled(!file.isFromArchive());
739 }
740
741 MenuItem previewMenu(tr("&Preview"));
742 previewMenu
743 .callback([&] {
744 preview();
745 })
746 .hint(tr("Previews this file within Mod Organizer"))
747 .disabledHint(tr("This file is in an archive or has no preview handler "
748 "associated with it"))
749 .enabled(canPreviewFile(m_plugins, file));
750
751 if (m_core.settings().interface().doubleClicksOpenPreviews()) {
752 previewMenu.addTo(menu);
753 openMenu.addTo(menu);
754 openHookedMenu.addTo(menu);
755 } else {
756 openMenu.addTo(menu);

Callers

nothing calls this directly

Calls 11

getFileExecutionTypeFunction · 0.85
getFullPathMethod · 0.80
enabledMethod · 0.80
addToMethod · 0.80
fontMethod · 0.80
canPreviewFileFunction · 0.70
isFromArchiveMethod · 0.45
settingsMethod · 0.45
sizeMethod · 0.45
isEnabledMethod · 0.45

Tested by

no test coverage detected