MCPcopy Create free account
hub / github.com/TASEmulators/fceux / OpenHelpWindow

Method OpenHelpWindow

src/drivers/Qt/HelpPages.cpp:57–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55//#endif
56
57void consoleWin_t::OpenHelpWindow(std::string subpage)
58{
59 std::string helpFileName;
60
61 g_config->getOption ("SDL.HelpFilePath", &helpFileName );
62
63 if ( helpFileName.length() == 0 )
64 {
65 #ifdef WIN32
66 helpFileName = FCEUI_GetBaseDirectory();
67 helpFileName += "\\..\\doc\\fceux.chm";
68 #else
69 helpFileName = "/usr/share/fceux/fceux.qhc";
70 #endif
71
72 #ifdef __APPLE__
73 if ( !QFile( QString::fromStdString(helpFileName) ).exists() )
74 {
75 // Search for MacOSX DragNDrop Resources
76 helpFileName = QApplication::applicationDirPath().toStdString() + "/../Resources/fceux.qhc";
77 }
78 #endif
79 }
80
81 if ( !QFile( QString::fromStdString(helpFileName) ).exists() )
82 {
83 helpFileName = findHelpFile();
84 }
85
86 if ( helpFileName.length() == 0 )
87 {
88 return;
89 }
90
91#ifdef WIN32
92 if (subpage.length() > 0)
93 {
94 helpFileName = helpFileName + "::/" + subpage + ".htm";
95 }
96#else
97 // Subpage indexing is not supported by linux chm viewer
98#endif
99
100 //printf("Looking for HelpFile '%s'\n", helpFileName.c_str() );
101
102#ifdef WIN32
103 // Windows specific HtmlHelp library function
104 helpWin = HtmlHelp( HWND(winId()), helpFileName.c_str(), HH_DISPLAY_TOPIC, (DWORD)NULL);
105 if ( helpWin == NULL )
106 {
107 printf("Error: Failed to open help file '%s'\n", helpFileName.c_str() );
108 }
109#else
110 if ( helpWin > 0 )
111 {
112 printf("There is already a CHM Viewer open somewhere...\n");
113 return;
114 }

Callers

nothing calls this directly

Calls 3

FCEUI_GetBaseDirectoryFunction · 0.85
getOptionMethod · 0.80
showMethod · 0.80

Tested by

no test coverage detected