void RecordingManager::setRecordingDir() { QDir recordDir(m_pConfig->getValueString( ConfigKey(RECORDING_PREF_KEY, "Directory"))); // Note: the default ConfigKey for recordDir is set in DlgPrefRecord::DlgPrefRecord if (!recordDir.exists()) { if (recordDir.mkpath(recordDir.absolutePath())) { qDebug() << "Created folder" << recordDir.absolutePath() << "for recordings"; } else { qDebug() << "Failed to create folder" << recordDir.absolutePath() << "for recordings"; } } m_recordingDir = recordDir.absolutePath(); qDebug() << "Recordings folder set to" << m_recordingDir; }
DlgPrefRecord::DlgPrefRecord(QWidget* parent, UserSettingsPointer pConfig) : DlgPreferencePage(parent), m_pConfig(pConfig), m_bConfirmOverwrite(false), m_pRadioOgg(NULL), m_pRadioMp3(NULL), m_pRadioAiff(NULL), m_pRadioFlac(NULL), m_pRadioWav(NULL) { setupUi(this); // See RECORD_* #defines in defs_recording.h m_pRecordControl = new ControlObjectSlave( RECORDING_PREF_KEY, "status", this); m_pRadioOgg = new QRadioButton("Ogg Vorbis"); m_pRadioMp3 = new QRadioButton(ENCODING_MP3); // Setting recordings path. QString recordingsPath = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "Directory")); if (recordingsPath == "") { // Initialize recordings path in config to old default path. // Do it here so we show current value in UI correctly. QString musicDir = QDesktopServices::storageLocation(QDesktopServices::MusicLocation); QDir recordDir(musicDir + "/Mixxx/Recordings"); recordingsPath = recordDir.absolutePath(); } LineEditRecordings->setText(recordingsPath); connect(PushButtonBrowseRecordings, SIGNAL(clicked()), this, SLOT(slotBrowseRecordingsDir())); connect(LineEditRecordings, SIGNAL(returnPressed()), this, SLOT(slotApply())); connect(m_pRadioOgg, SIGNAL(clicked()), this, SLOT(slotApply())); connect(m_pRadioMp3, SIGNAL(clicked()), this, SLOT(slotApply())); horizontalLayout->addWidget(m_pRadioOgg); horizontalLayout->addWidget(m_pRadioMp3); // AIFF and WAVE are supported by default. m_pRadioWav = new QRadioButton(ENCODING_WAVE); connect(m_pRadioWav, SIGNAL(clicked()), this, SLOT(slotApply())); horizontalLayout->addWidget(m_pRadioWav); m_pRadioAiff = new QRadioButton(ENCODING_AIFF); connect(m_pRadioAiff, SIGNAL(clicked()), this, SLOT(slotApply())); horizontalLayout->addWidget(m_pRadioAiff); #ifdef SF_FORMAT_FLAC m_pRadioFlac = new QRadioButton(ENCODING_FLAC); connect(m_pRadioFlac, SIGNAL(clicked()), this, SLOT(slotApply())); horizontalLayout->addWidget(m_pRadioFlac); #endif // Read config and check radio button. QString format = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "Encoding")); if (format == ENCODING_WAVE) { m_pRadioWav->setChecked(true); } else if (format == ENCODING_OGG) { m_pRadioOgg->setChecked(true); } else if (format == ENCODING_MP3) { m_pRadioMp3->setChecked(true); } else if (format == ENCODING_AIFF) { m_pRadioAiff->setChecked(true); #ifdef SF_FORMAT_FLAC } else if (format == ENCODING_FLAC) { m_pRadioFlac->setChecked(true); #endif } else { // Invalid, so set default and save. // If no config was available, set to WAVE as default. m_pRadioWav->setChecked(true); m_pConfig->set(ConfigKey(RECORDING_PREF_KEY, "Encoding"), ConfigValue(ENCODING_WAVE)); } loadMetaData(); connect(SliderQuality, SIGNAL(valueChanged(int)), this, SLOT(slotSliderQuality())); connect(SliderQuality, SIGNAL(sliderMoved(int)), this, SLOT(slotSliderQuality())); connect(SliderQuality, SIGNAL(sliderReleased()), this, SLOT(slotSliderQuality())); connect(CheckBoxRecordCueFile, SIGNAL(stateChanged(int)), this, SLOT(slotEnableCueFile(int))); connect(comboBoxSplitting, SIGNAL(activated(int)), this, SLOT(slotChangeSplitSize())); slotApply(); // Make sure a corrupt config file won't cause us to record constantly. m_pRecordControl->set(RECORD_OFF); comboBoxSplitting->addItem(SPLIT_650MB); comboBoxSplitting->addItem(SPLIT_700MB); comboBoxSplitting->addItem(SPLIT_1024MB); comboBoxSplitting->addItem(SPLIT_2048MB); comboBoxSplitting->addItem(SPLIT_4096MB); QString fileSizeStr = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "FileSize")); int index = comboBoxSplitting->findText(fileSizeStr); if (index > 0) { // Set file split size comboBoxSplitting->setCurrentIndex(index); } // Otherwise 650 MB will be default file split size. // Read CUEfile info CheckBoxRecordCueFile->setChecked( (bool) m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "CueEnabled")).toInt()); }