| 2677 | } |
| 2678 | |
| 2679 | void 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()) ); |
nothing calls this directly
no test coverage detected