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

Method saveFileAs

src/drivers/Qt/iNesHeaderEditor.cpp:837–888  ·  view source on GitHub ↗

----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

835}
836//----------------------------------------------------------------------------
837void iNesHeaderEditor_t::saveFileAs(void)
838{
839 int ret, useNativeFileDialogVal;
840 QString filename;
841 std::string last;
842 std::string dir;
843 QFileDialog dialog(this, tr("Save iNES File") );
844
845 dialog.setFileMode(QFileDialog::AnyFile);
846
847 dialog.setNameFilter(tr("NES Files (*.nes *.NES) ;; All files (*)"));
848
849 dialog.setViewMode(QFileDialog::List);
850 dialog.setFilter( QDir::AllEntries | QDir::AllDirs | QDir::Hidden );
851 dialog.setLabelText( QFileDialog::Accept, tr("Save") );
852 dialog.setDefaultSuffix( tr(".nes") );
853
854 getDirFromFile( LoadedRomFName, dir );
855
856 dialog.setDirectory( tr(dir.c_str()) );
857
858 // Check config option to use native file dialog or not
859 g_config->getOption ("SDL.UseNativeFileDialog", &useNativeFileDialogVal);
860
861 dialog.setOption(QFileDialog::DontUseNativeDialog, !useNativeFileDialogVal);
862
863 ret = dialog.exec();
864
865 if ( ret )
866 {
867 QStringList fileList;
868 fileList = dialog.selectedFiles();
869
870 if ( fileList.size() > 0 )
871 {
872 filename = fileList[0];
873 }
874 }
875
876 if ( filename.isNull() )
877 {
878 return;
879 }
880 qDebug() << "selected file path : " << filename.toUtf8();
881
882 WriteHeaderData( iNesHdr );
883
884 if ( SaveINESFile( filename.toStdString().c_str(), iNesHdr ) )
885 {
886 // Error
887 }
888}
889//----------------------------------------------------------------------------
890void iNesHeaderEditor_t::setHeaderData(iNES_HEADER* header)
891{

Callers

nothing calls this directly

Calls 8

getDirFromFileFunction · 0.85
WriteHeaderDataFunction · 0.85
SaveINESFileFunction · 0.85
getOptionMethod · 0.80
setOptionMethod · 0.80
execMethod · 0.80
trFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected