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

Method saveStateAs

src/drivers/Qt/ConsoleWindow.cpp:2679–2768  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2677}
2678
2679void consoleWin_t::saveStateAs(void)
2680{
2681 int ret, useNativeFileDialogVal;
2682 QString filename;
2683 std::string last;
2684 std::string dir;
2685 const char *base;
2686 QFileDialog dialog(this, tr("Save State To File") );
2687 QList<QUrl> urls;
2688 QDir d;
2689
2690 base = FCEUI_GetBaseDirectory();
2691
2692 urls << QUrl::fromLocalFile( QDir::rootPath() );
2693 urls << QUrl::fromLocalFile(QStandardPaths::standardLocations(QStandardPaths::HomeLocation).first());
2694 urls << QUrl::fromLocalFile(QStandardPaths::standardLocations(QStandardPaths::DesktopLocation).first());
2695 urls << QUrl::fromLocalFile(QStandardPaths::standardLocations(QStandardPaths::DownloadLocation).first());
2696
2697 if ( base )
2698 {
2699 urls << QUrl::fromLocalFile( QDir( base ).absolutePath() );
2700
2701 d.setPath( QString(base) + "/fcs");
2702
2703 if ( d.exists() )
2704 {
2705 urls << QUrl::fromLocalFile( d.absolutePath() );
2706 }
2707
2708 d.setPath( QString(base) + "/sav");
2709
2710 if ( d.exists() )
2711 {
2712 urls << QUrl::fromLocalFile( d.absolutePath() );
2713 }
2714 }
2715
2716 dialog.setFileMode(QFileDialog::AnyFile);
2717
2718 dialog.setNameFilter(tr("SAV Files (*.sav *.SAV) ;; All files (*)"));
2719
2720 dialog.setViewMode(QFileDialog::List);
2721 dialog.setFilter( QDir::AllEntries | QDir::AllDirs | QDir::Hidden );
2722 dialog.setLabelText( QFileDialog::Accept, tr("Save") );
2723 dialog.setDefaultSuffix( tr(".sav") );
2724
2725 g_config->getOption ("SDL.LastSaveStateAs", &last );
2726
2727 if ( last.size() == 0 )
2728 {
2729 if ( base )
2730 {
2731 last = std::string(base) + "/sav";
2732 }
2733 }
2734 getDirFromFile( last.c_str(), dir );
2735
2736 dialog.setDirectory( tr(dir.c_str()) );

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected