void FilenamePin::saveSettings( QSettings &pSettings ) const { QString FileName = ( mPin->direction() == PIN_INPUT ? mPin->value().toString() : mValues.first() ); if( !FileName.isEmpty() ) { QFileInfo FileInfo( pSettings.fileName() ); QDir FileDir( FileInfo.absolutePath() ); FileName = FileDir.relativeFilePath( FileName ); pSettings.setValue( "filename", FileName ); } }
void FilenamePin::loadSettings( QSettings &pSettings ) { QString FileName = ( mPin->direction() == PIN_INPUT ? mPin->value().toString() : mValues.first() ); FileName = pSettings.value( "filename", FileName ).toString(); if( !FileName.isEmpty() ) { QFileInfo FileInfo( pSettings.fileName() ); QDir FileDir( FileInfo.absolutePath() ); QFileInfo DestInfo( FileDir.absoluteFilePath( FileName ) ); FileName = DestInfo.exists() ? DestInfo.canonicalFilePath() : FileName; if( mPin->direction() == PIN_INPUT ) { mPin->setValue( FileName ); } else { mValues[ 0 ] = FileName; } } }
char* menu_romselector() { char *rom_filename = NULL; int romcount = 0; bool8_32 exit_loop = false; uint8 *keyssnes = 0; //Read ROM-Directory romcount = FileDir("./roms", "sfc,smc"); Scale_org = Scale; highres_current=Settings.SupportHiRes; Scale = false; Settings.SupportHiRes=FALSE; S9xDeinitDisplay(); S9xInitDisplay(0, 0); loadmenu_dispupdate(romcount); sys_sleep(100000); SDL_Event event; do { loadmenu_dispupdate(romcount); sys_sleep(100); while(SDL_PollEvent(&event)==1) { //PANDORA & DINGOO & WIN32 ----------------------------------------------------- keyssnes = SDL_GetKeyState(NULL); switch(event.type) { case SDL_KEYDOWN: keyssnes = SDL_GetKeyState(NULL); //UP if(keyssnes[sfc_key[UP_1]] == SDL_PRESSED) loadcursor--; //DOWN else if(keyssnes[sfc_key[DOWN_1]] == SDL_PRESSED) loadcursor++; // //LS // else if(keyssnes[sfc_key[L_1]] == SDL_PRESSED) // loadcursor=loadcursor-10; // //RS // else if(keyssnes[sfc_key[R_1]] == SDL_PRESSED) // loadcursor=loadcursor+10; //QUIT Emulator : press ESCAPE KEY else if (keyssnes[sfc_key[SELECT_1]] == SDL_PRESSED) S9xExit(); else if( (keyssnes[sfc_key[B_1]] == SDL_PRESSED) ) { switch(loadcursor) { default: if ((keyssnes[sfc_key[B_1]] == SDL_PRESSED)) { if ((loadcursor>=0) && (loadcursor<(romcount))) { rom_filename=namelist[loadcursor]->d_name; exit_loop = TRUE; } } break; } } break; } if(loadcursor==-1) { loadcursor=romcount-1; } else if(loadcursor==romcount) { loadcursor=0; } break; } } while( exit_loop!=TRUE && keyssnes[sfc_key[B_1]] != SDL_PRESSED ); // TODO: ///free(). namelist Scale = Scale_org; Settings.SupportHiRes=highres_current; S9xDeinitDisplay(); S9xInitDisplay(0, 0); return (rom_filename); }
CTFileName CTFileName::NoExt() const { return FileDir()+FileName(); }
// ----------------------------------------------------------------------- // The the listview with found AddIns void FillAddinsList(void) { int i = 0; CStr AddInName; HMODULE AddInLib = 0; FARPROC AddInDesc = 0; FARPROC AddInAuth = 0; FARPROC AddInLoad = 0; FARPROC AddInUnload = 0; FARPROC AddInMenu = 0; CStr Description; CStr Auth; long PosInIniFile = 0; CStr LoadedInIniFile; long AddInIcon = 0; CStr RunningInIniFile; CStr BufString; AddInName = FileDir(&((CStr) Dirs[DIR_ADDINS] + (CStr) "\\*.dll")); LocalAddInsFiles.Erase(); while(AddInName.Len() != 0) { BufString = Dirs[DIR_ADDINS] + (CStr) "\\" + (CStr) AddInName; AddInLib = LoadLibrary(BufString.Get_String()); if(AddInLib != 0) { AddInDesc = GetProcAddress(AddInLib, "AddInDescription"); AddInAuth = GetProcAddress(AddInLib, "AddInAuthor"); AddInLoad = GetProcAddress(AddInLib, "AddInLoad"); AddInUnload = GetProcAddress(AddInLib, "AddInUnLoad"); AddInMenu = GetProcAddress(AddInLib, "AddInMenu"); // Must have all procedures if(AddInDesc != 0 && AddInAuth != 0 && AddInLoad != 0 && AddInUnload != 0 && AddInMenu != 0) { Description = GetDLLDescription(AddInName, AddInDesc); Auth = GetDLLAuthor(AddInAuth); AddInIcon = ICON_ADDINR; PosInIniFile = CheckAddInIniList(AddInName); if(PosInIniFile != -1) { // Check if it is running if found in ini file RunningInIniFile = IniReadKey("AddIns", "Running" + (CStr) StringNumberComplement(PosInIniFile, 3).Get_String(), MainIniFile); if(_strcmpi(RunningInIniFile.Get_String(), "1") == 0) AddInIcon = ICON_ADDINS; } ListViewAddItem(FRMAddInsListView, Description, i, AddInIcon); ListViewSetSubItem(FRMAddInsListView, Auth, i, 1); // Check in the ini file if it's been already loaded PosInIniFile = CheckAddInIniList(AddInName); if(PosInIniFile != -1) { LoadedInIniFile = IniReadKey("AddIns", "Loaded" + (CStr) StringNumberComplement(PosInIniFile, 3).Get_String(), MainIniFile); if(LoadedInIniFile.Len() != 0) { if(_strcmpi(LoadedInIniFile.Get_String(), "1") == 0) { ListViewSetItemCheckbox(FRMAddInsListView, i, 1); } else { ListViewSetItemCheckbox(FRMAddInsListView, i, 0); } } else { ListViewSetItemCheckbox(FRMAddInsListView, i, 0); } } LocalAddInsFiles.Add(AddInName.Get_String()); i++; } FreeLibrary(AddInLib); // Dlg_Filters.cpp for more infos #ifndef _DEBUG CloseHandle(AddInLib); #endif } AddInName = FileDir(); } }