From 3a14d3b43475cdf019aa6518b086c955af911097 Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Sat, 29 Apr 2017 15:50:31 +0200 Subject: [PATCH] Only show relevant widgets on the export dialog Only show widgets on the export dialog that are relevant to the selected file format (Wave/Ogg): * Sample rate is always shown. * Bit depth settings are only shown when Wave is selected. * Bit rate settings are only shown when Ogg is selected. Remove the label that informs the user that not all settings apply to all export formats as it is not needed anymore. The english text of that label was: "Please note that not all of the parameters above apply for all file formats." --- include/ExportProjectDialog.h | 2 + src/gui/ExportProjectDialog.cpp | 28 +++++++ src/gui/dialogs/export_project.ui | 131 +++++++++++++++--------------- 3 files changed, 95 insertions(+), 66 deletions(-) diff --git a/include/ExportProjectDialog.h b/include/ExportProjectDialog.h index 5ac70bb8f..d7159780f 100644 --- a/include/ExportProjectDialog.h +++ b/include/ExportProjectDialog.h @@ -53,6 +53,8 @@ private slots: void accept(); void startExport(); + void onFileFormatChanged(int); + private: QString m_fileName; QString m_dirName; diff --git a/src/gui/ExportProjectDialog.cpp b/src/gui/ExportProjectDialog.cpp index 3f8c36abb..8c55e382f 100644 --- a/src/gui/ExportProjectDialog.cpp +++ b/src/gui/ExportProjectDialog.cpp @@ -171,7 +171,35 @@ void ExportProjectDialog::startExport() } +ProjectRenderer::ExportFileFormats convertIndexToExportFileFormat(int index) +{ + switch (index) + { + case 0: + return ProjectRenderer::WaveFile; + case 1: + return ProjectRenderer::OggFile; + default: + Q_ASSERT(false); + break; + } + return ProjectRenderer::NumFileFormats; +} + + +void ExportProjectDialog::onFileFormatChanged(int index) +{ + ProjectRenderer::ExportFileFormats exportFormat = + convertIndexToExportFileFormat(index); + + bool bitRateControlsEnabled = exportFormat == ProjectRenderer::OggFile; + bool bitDepthControlEnabled = exportFormat == ProjectRenderer::WaveFile; + + bitrateWidget->setVisible(bitRateControlsEnabled); + + depthWidget->setVisible(bitDepthControlEnabled); +} void ExportProjectDialog::startBtnClicked() { diff --git a/src/gui/dialogs/export_project.ui b/src/gui/dialogs/export_project.ui index 4384993af..2225a6495 100644 --- a/src/gui/dialogs/export_project.ui +++ b/src/gui/dialogs/export_project.ui @@ -6,8 +6,8 @@ 0 0 - 519 - 412 + 715 + 447 @@ -80,6 +80,47 @@ + + + + + 0 + 20 + + + + + 0 + + + + + Depth: + + + + + + + + 16 Bit Integer + + + + + 24 Bit Float + + + + + 32 Bit Float + + + + + + + @@ -90,7 +131,7 @@ 0 - + Bitrate: @@ -136,67 +177,6 @@ - - - - - 0 - - - - - Depth: - - - - - - - - 16 Bit Integer - - - - - 24 Bit Float - - - - - 32 Bit Float - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 1 - 10 - - - - - - - - Please note that not all of the parameters above apply for all file formats. - - - true - - - @@ -368,8 +348,8 @@ reject() - 357 - 293 + 511 + 372 202 @@ -377,5 +357,24 @@ + + fileFormatCB + currentIndexChanged(int) + ExportProjectDialog + onFileFormatChanged(int) + + + 111 + 85 + + + 518 + 212 + + + + + onFileFormatChanged(int) +