Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default file names and extensions to Save dialogs #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions pv/toolbars/mainbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,6 @@ void MainBar::export_file(shared_ptr<OutputFormat> format, bool selection_only,
session_.stop_capture();

QSettings settings;
const QString dir = settings.value(SettingSaveDirectory).toString();

pair<uint64_t, uint64_t> sample_range;

Expand Down Expand Up @@ -680,8 +679,12 @@ void MainBar::export_file(shared_ptr<OutputFormat> format, bool selection_only,
tr("All Files"));

// Show the file dialog
if (file_name.isEmpty())
if (file_name.isEmpty()) {
QString dir = settings.value(SettingSaveDirectory).toString() + tr("/new_session");
if (!exts.empty())
dir += "." + QString::fromStdString(exts[0]);
file_name = QFileDialog::getSaveFileName(this, tr("Save File"), dir, filter);
}

if (file_name.isEmpty())
return;
Expand Down Expand Up @@ -855,7 +858,7 @@ void MainBar::on_actionSaveSelectionAs_triggered()
void MainBar::on_actionSaveSetup_triggered()
{
QSettings settings;
const QString dir = settings.value(SettingSaveDirectory).toString();
const QString dir = settings.value(SettingSaveDirectory).toString() + tr("/new_session_setup.pvs");

const QString file_name = QFileDialog::getSaveFileName(
this, tr("Save File"), dir, tr(
Expand Down