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

Method findHelpFile

src/drivers/Qt/HelpPages.cpp:147–215  ·  view source on GitHub ↗

void consoleWin_t::helpPageMaint(void) { ifdef WIN32 // Does any help page cleanup need to be done in windows? else if ( helpWin > 0 ) { // Calling waitpid is important to ensure that CHM viewer process is cleaned up // in the event that it exits. Otherwise zombie processes will be left. int pid, wstat=0; pid = waitpid( -1, &wstat, WNOHANG ); if ( pid == helpWin ) { //printf("Help CHM Viewer Clo

Source from the content-addressed store, hash-verified

145//#endif
146//}
147std::string consoleWin_t::findHelpFile(void)
148{
149 int ret, useNativeFileDialogVal;
150 QString filename;
151 std::string last;
152 std::string dir;
153 QFileDialog dialog(this, tr("Open Help File") );
154 QList<QUrl> urls;
155 //QDir d;
156
157 urls << QUrl::fromLocalFile( QDir::rootPath() );
158 urls << QUrl::fromLocalFile(QStandardPaths::standardLocations(QStandardPaths::HomeLocation).first());
159 urls << QUrl::fromLocalFile(QStandardPaths::standardLocations(QStandardPaths::DownloadLocation).first());
160 urls << QUrl::fromLocalFile( QDir( FCEUI_GetBaseDirectory() ).absolutePath() );
161
162 dialog.setFileMode(QFileDialog::ExistingFile);
163
164#ifdef WIN32
165 dialog.setNameFilter(tr("Compiled HTML Files (*.chm *.CHM) ;; All files (*)"));
166#else
167 dialog.setNameFilter(tr("QHelp Files (*.qhc *.QHC) ;; All files (*)"));
168#endif
169
170 dialog.setViewMode(QFileDialog::List);
171 dialog.setFilter( QDir::AllEntries | QDir::AllDirs | QDir::Hidden );
172 dialog.setLabelText( QFileDialog::Accept, tr("Open") );
173
174 g_config->getOption ("SDL.HelpFilePath", &last );
175
176 if ( last.size() > 0 )
177 {
178 getDirFromFile( last.c_str(), dir );
179
180 dialog.setDirectory( tr(dir.c_str()) );
181 }
182 else
183 {
184 dialog.setDirectory( QDir( FCEUI_GetBaseDirectory() ).absolutePath() );
185 }
186
187 // Check config option to use native file dialog or not
188 g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
189
190 dialog.setOption(QFileDialog::DontUseNativeDialog, !useNativeFileDialogVal);
191 dialog.setSidebarUrls(urls);
192
193 ret = dialog.exec();
194
195 if ( ret )
196 {
197 QStringList fileList;
198 fileList = dialog.selectedFiles();
199
200 if ( fileList.size() > 0 )
201 {
202 filename = fileList[0];
203 }
204 }

Callers

nothing calls this directly

Calls 7

FCEUI_GetBaseDirectoryFunction · 0.85
getDirFromFileFunction · 0.85
getOptionMethod · 0.80
setOptionMethod · 0.80
execMethod · 0.80
trFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected