From f84769da673616ea3147249dd0b5d708c6d49c17 Mon Sep 17 00:00:00 2001 From: ZDisket <30500847+ZDisket@users.noreply.github.com> Date: Tue, 22 Jun 2021 04:36:29 -0300 Subject: [PATCH] Make program remember last directory and filename for exporting --- mainwindow.cpp | 11 +++++++++-- mainwindow.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 104007d..f9e7fd9 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -140,6 +140,7 @@ MainWindow::MainWindow(QWidget *parent) DenBatchSize = 0; DenDone = 0; + LastExportDir = QCoreApplication::applicationDirPath() + "/Utt.wav"; @@ -982,7 +983,7 @@ void MainWindow::on_btnExportSel_clicked() } - QString ofname = QFileDialog::getSaveFileName(FwParent, tr("Export WAV file"), "Utt", tr("WAV, float32 PCM (*.wav)")); + QString ofname = QFileDialog::getSaveFileName(FwParent, tr("Export WAV file"), LastExportDir, tr("WAV, float32 PCM (*.wav)")); if (!ofname.size()) return; @@ -990,6 +991,8 @@ void MainWindow::on_btnExportSel_clicked() QByteArray& AuBuff = AudBuffs[(size_t)ui->lstUtts->currentRow()]->buffer(); ExportAudBuffer(ofname,AuBuff,CommonSampleRate); + LastExportDir = ofname; + } @@ -1028,7 +1031,7 @@ void MainWindow::on_btnExReport_clicked() if (AltExport) ExTitle += "s (separately)"; - QString ofname = QFileDialog::getSaveFileName(FwParent,ExTitle, "Utt", tr("WAV, float32 PCM (*.wav)")); + QString ofname = QFileDialog::getSaveFileName(FwParent,ExTitle,LastExportDir, tr("WAV, float32 PCM (*.wav)")); if (!ofname.size()) return; @@ -1053,6 +1056,8 @@ void MainWindow::on_btnExReport_clicked() ResetLogiLedIn(8); + LastExportDir = ofname; + return; @@ -1071,6 +1076,8 @@ void MainWindow::on_btnExReport_clicked() LogiLedFlashLighting(0,50,100,5000,500); + LastExportDir = ofname; + ResetLogiLedIn(8); diff --git a/mainwindow.h b/mainwindow.h index 5b94282..f5d96a6 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -92,6 +92,7 @@ class MainWindow : public QMainWindow bool DoUpdateSplitAuto; InferIDTrueID* FindByFirst(uint32_t inGetID); + QString LastExportDir;