diff --git a/src/engine/sidechain/enginerecord.cpp b/src/engine/sidechain/enginerecord.cpp index b4f90cf7aa4..ac9937133c9 100644 --- a/src/engine/sidechain/enginerecord.cpp +++ b/src/engine/sidechain/enginerecord.cpp @@ -18,7 +18,9 @@ EngineRecord::EngineRecord(UserSettingsPointer pConfig) m_recordedDuration(0), m_iMetaDataLife(0), m_cueTrack(0), - m_bCueIsEnabled(false) { + m_bCueIsEnabled(false), + m_bCueUsesFileAnnotation(false) +{ m_pRecReady = new ControlProxy(RECORDING_PREF_KEY, "status", this); m_sampleRate = mixxx::audio::SampleRate::fromDouble(m_sampleRateControl.get()); } @@ -36,6 +38,7 @@ int EngineRecord::updateFromPreferences() { m_baAlbum = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "Album")); m_cueFileName = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "CuePath")); m_bCueIsEnabled = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "CueEnabled")).toInt(); + m_bCueUsesFileAnnotation = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "CueFileAnnotationEnabled")).toInt(); m_sampleRate = mixxx::audio::SampleRate::fromDouble(m_sampleRateControl.get()); // Delete m_pEncoder if it has been initialized (with maybe) different bitrate. @@ -248,9 +251,12 @@ void EngineRecord::writeCueLine() { m_cueFile.write(QString(" PERFORMER \"%1\"\n") .arg(m_pCurrentTrack->getArtist()) .toUtf8()); - m_cueFile.write(QString(" FILE \"%1\"\n") - .arg(m_pCurrentTrack->getLocation()) - .toUtf8()); + + if (m_bCueUsesFileAnnotation) { + m_cueFile.write(QString(" FILE \"%1\"\n") + .arg(m_pCurrentTrack->getLocation()) + .toUtf8()); + } // Woefully inaccurate (at the seconds level anyways). // We'd need a signal fired state tracker diff --git a/src/engine/sidechain/enginerecord.h b/src/engine/sidechain/enginerecord.h index 662a7b25d6e..b0fd93ef8b0 100644 --- a/src/engine/sidechain/enginerecord.h +++ b/src/engine/sidechain/enginerecord.h @@ -85,4 +85,5 @@ class EngineRecord : public QObject, public EncoderCallback, public SideChainWor QString m_cueFileName; quint64 m_cueTrack; bool m_bCueIsEnabled; + bool m_bCueUsesFileAnnotation; }; diff --git a/src/preferences/dialog/dlgprefrecord.cpp b/src/preferences/dialog/dlgprefrecord.cpp index d4e39dfcf1a..91a4008367b 100644 --- a/src/preferences/dialog/dlgprefrecord.cpp +++ b/src/preferences/dialog/dlgprefrecord.cpp @@ -76,6 +76,9 @@ DlgPrefRecord::DlgPrefRecord(QWidget* parent, UserSettingsPointer pConfig) CheckBoxRecordCueFile->setChecked(m_pConfig->getValue( ConfigKey(RECORDING_PREF_KEY, "CueEnabled"), kDefaultCueEnabled)); + CheckBoxUseCueFileAnnotation->setChecked(m_pConfig->getValue( + ConfigKey(RECORDING_PREF_KEY, "CueFileAnnotationEnabled"), false)); + // Setting split comboBoxSplitting->addItem(SPLIT_650MB); comboBoxSplitting->addItem(SPLIT_700MB); @@ -119,6 +122,11 @@ DlgPrefRecord::DlgPrefRecord(QWidget* parent, UserSettingsPointer pConfig) &QAbstractSlider::sliderReleased, this, &DlgPrefRecord::slotSliderCompression); + + connect(CheckBoxRecordCueFile, + &QCheckBox::stateChanged, + this, + &DlgPrefRecord::slotToggleCueEnabled); } DlgPrefRecord::~DlgPrefRecord() { @@ -144,6 +152,7 @@ void DlgPrefRecord::slotApply() { saveMetaData(); saveEncoding(); saveUseCueFile(); + saveUseCueFileAnnotation(); saveSplitSize(); } @@ -175,10 +184,12 @@ void DlgPrefRecord::slotUpdate() { loadMetaData(); - // Setting miscellaneous + // Setting miscellaneous CheckBoxRecordCueFile->setChecked(m_pConfig->getValue( ConfigKey(RECORDING_PREF_KEY, "CueEnabled"), kDefaultCueEnabled)); + updateCueEnabled(); + QString fileSizeStr = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "FileSize")); int index = comboBoxSplitting->findText(fileSizeStr); if (index >= 0) { @@ -201,7 +212,13 @@ void DlgPrefRecord::slotResetToDefaults() { // 4GB splitting is the default comboBoxSplitting->setCurrentIndex(4); + + // Sets 'Create a CUE file' checkbox value CheckBoxRecordCueFile->setChecked(kDefaultCueEnabled); + + // Sets 'Enable File Annotation in CUE file' checkbox value + CheckBoxUseCueFileAnnotation->setChecked(false); + } void DlgPrefRecord::slotBrowseRecordingsDir() { @@ -303,6 +320,17 @@ void DlgPrefRecord::slotSliderQuality() { // Settings are only stored when doing an apply so that "cancel" can actually cancel. } +// Set 'Enable File Annotation in CUE file' checkbox value depending on 'Create a CUE file' checkbox value +void DlgPrefRecord::updateCueEnabled() { + if (CheckBoxRecordCueFile->isChecked()) { + CheckBoxUseCueFileAnnotation->setEnabled(true); + } + else { + CheckBoxUseCueFileAnnotation->setEnabled(false); + CheckBoxUseCueFileAnnotation->setChecked(false); + } +} + void DlgPrefRecord::updateTextQuality() { EncoderRecordingSettingsPointer settings = EncoderFactory::getFactory().getEncoderRecordingSettings( @@ -429,11 +457,21 @@ void DlgPrefRecord::saveEncoding() { } } + +void DlgPrefRecord::slotToggleCueEnabled() { + updateCueEnabled(); +} + void DlgPrefRecord::saveUseCueFile() { m_pConfig->set(ConfigKey(RECORDING_PREF_KEY, "CueEnabled"), ConfigValue(CheckBoxRecordCueFile->isChecked())); } +void DlgPrefRecord::saveUseCueFileAnnotation() { + m_pConfig->set(ConfigKey(RECORDING_PREF_KEY, "CueFileAnnotationEnabled"), + ConfigValue(CheckBoxUseCueFileAnnotation->isChecked())); +} + void DlgPrefRecord::saveSplitSize() { m_pConfig->set(ConfigKey(RECORDING_PREF_KEY, "FileSize"), ConfigValue(comboBoxSplitting->currentText())); diff --git a/src/preferences/dialog/dlgprefrecord.h b/src/preferences/dialog/dlgprefrecord.h index 17c47a1ea57..bb086885d8a 100644 --- a/src/preferences/dialog/dlgprefrecord.h +++ b/src/preferences/dialog/dlgprefrecord.h @@ -32,6 +32,9 @@ class DlgPrefRecord : public DlgPreferencePage, public Ui::DlgPrefRecordDlg { void slotSliderCompression(); void slotGroupChanged(); + private slots: + void slotToggleCueEnabled(); + signals: void apply(const QString &); @@ -44,6 +47,8 @@ class DlgPrefRecord : public DlgPreferencePage, public Ui::DlgPrefRecordDlg { void saveMetaData(); void saveEncoding(); void saveUseCueFile(); + void saveUseCueFileAnnotation(); + void updateCueEnabled(); void saveSplitSize(); // Pointer to config object diff --git a/src/preferences/dialog/dlgprefrecorddlg.ui b/src/preferences/dialog/dlgprefrecorddlg.ui index 01a3808af0d..cffe8673c21 100644 --- a/src/preferences/dialog/dlgprefrecorddlg.ui +++ b/src/preferences/dialog/dlgprefrecorddlg.ui @@ -119,6 +119,20 @@ + + + + + This will include the filepath for each track in the CUE file. +This option makes the CUE file less portable and can reveal personal +information from filepaths (i.e. username) + + + Enable File Annotation in CUE file + + + + @@ -386,6 +400,7 @@ PushButtonBrowseRecordings comboBoxSplitting CheckBoxRecordCueFile + CheckBoxUseCueFileAnnotation SliderCompression SliderQuality LineEditTitle