PrefsDialog::PrefsDialog(QWidget *parent): QDialog(parent),ui(new Ui::PrefsDialog) { // map dropdown values to indices listMetadataWrite << METADATA_WRITE_NONE; listMetadataWrite << METADATA_WRITE_PREPEND; listMetadataWrite << METADATA_WRITE_APPEND; listMetadataWrite << METADATA_WRITE_OVERWRITE; // out of range for some fields listMetadataWriteKey << METADATA_WRITE_NONE; listMetadataWriteKey << METADATA_WRITE_OVERWRITE; listMetadataFormat << METADATA_FORMAT_KEYS; listMetadataFormat << METADATA_FORMAT_CUSTOM; listMetadataFormat << METADATA_FORMAT_BOTH; // UI ui->setupUi(this); this->setWindowFlags(Qt::WindowTitleHint | Qt::CustomizeWindowHint); // get values from preferences Preferences p; ui->writeToFilesAutomatically->setChecked(p.getWriteToFilesAutomatically()); ui->parallelBatchJobs->setChecked(p.getParallelBatchJobs()); ui->skipFilesWithExistingTags->setChecked(p.getSkipFilesWithExistingTags()); ui->applyFileExtensionFilter->setChecked(p.getApplyFileExtensionFilter()); ui->maxDuration->setValue(p.getMaxDuration()); ui->tagFormat->setCurrentIndex(listMetadataFormat.indexOf(p.getMetadataFormat())); ui->metadataWriteTitle->setCurrentIndex(listMetadataWrite.indexOf(p.getMetadataWriteTitle())); ui->metadataWriteArtist->setCurrentIndex(listMetadataWrite.indexOf(p.getMetadataWriteArtist())); ui->metadataWriteAlbum->setCurrentIndex(listMetadataWrite.indexOf(p.getMetadataWriteAlbum())); ui->metadataWriteComment->setCurrentIndex(listMetadataWrite.indexOf(p.getMetadataWriteComment())); ui->metadataWriteGrouping->setCurrentIndex(listMetadataWrite.indexOf(p.getMetadataWriteGrouping())); ui->metadataWriteKey->setCurrentIndex(listMetadataWriteKey.indexOf(p.getMetadataWriteKey())); ui->metadataWriteFilename->setCurrentIndex(listMetadataWrite.indexOf(p.getMetadataWriteFilename())); ui->metadataDelimiter->setText(p.getMetadataDelimiter()); ui->iTunesLibraryPath->setText(p.getITunesLibraryPath()); ui->traktorLibraryPath->setText(p.getTraktorLibraryPath()); ui->seratoLibraryPath->setText(p.getSeratoLibraryPath()); QStringList ckc = p.getCustomKeyCodes(); ui->majKey0->setText(ckc[0]); ui->minKey0->setText(ckc[1]); ui->majKey1->setText(ckc[2]); ui->minKey1->setText(ckc[3]); ui->majKey2->setText(ckc[4]); ui->minKey2->setText(ckc[5]); ui->majKey3->setText(ckc[6]); ui->minKey3->setText(ckc[7]); ui->majKey4->setText(ckc[8]); ui->minKey4->setText(ckc[9]); ui->majKey5->setText(ckc[10]); ui->minKey5->setText(ckc[11]); ui->majKey6->setText(ckc[12]); ui->minKey6->setText(ckc[13]); ui->majKey7->setText(ckc[14]); ui->minKey7->setText(ckc[15]); ui->majKey8->setText(ckc[16]); ui->minKey8->setText(ckc[17]); ui->majKey9->setText(ckc[18]); ui->minKey9->setText(ckc[19]); ui->majKey10->setText(ckc[20]); ui->minKey10->setText(ckc[21]); ui->majKey11->setText(ckc[22]); ui->minKey11->setText(ckc[23]); ui->silence->setText(ckc[24]); ui->filterFileExtensions->setText(p.getFilterFileExtensions().join(",")); // enable/disable fields as necessary metadataDelimiterEnabled(); applyFileExtensionFilterEnabled(); //relative sizing on Mac/Linux only #ifndef Q_OS_WIN QFont smallerFont; smallerFont.setPointSize(smallerFont.pointSize() - 2); for (int i=0; i<ui->gridLayoutKeyCodes->count(); i++) { if (!ui->gridLayoutKeyCodes->itemAt(i)->isEmpty() && ui->gridLayoutKeyCodes->itemAt(i)->widget()->inherits("QLabel")) { ui->gridLayoutKeyCodes->itemAt(i)->widget()->setFont(smallerFont); } } #endif // validation of file extension filtering QRegExp regex("^([a-z0-9]+,?)*$"); QValidator *validator = new QRegExpValidator(regex, this); ui->filterFileExtensions->setValidator(validator); }
PrefsDialog::PrefsDialog(QWidget *parent): QDialog(parent),ui(new Ui::PrefsDialog){ // map dropdown values to indices listTagFormat << TAG_FORMAT_KEYS; listTagFormat << TAG_FORMAT_CUSTOM; listTagFormat << TAG_FORMAT_BOTH; listStartingFreq << 27.5; listStartingFreq << 55; listStartingFreq << 110; listStartingFreq << 220; listStartingFreq << 440; listStartingFreq << 880; listHopSize << 128; listHopSize << 256; listHopSize << 512; listHopSize << 1024; listHopSize << 2048; listHopSize << 4096; listHopSize << 8192; listHopSize << 16384; listHopSize << 32768; listHopSize << 65536; listTemporalWindow << KeyFinder::WINDOW_BLACKMAN; listTemporalWindow << KeyFinder::WINDOW_HAMMING; listTemporalWindow << KeyFinder::WINDOW_HANN; listFftFrameSize << 512; listFftFrameSize << 1024; listFftFrameSize << 2048; listFftFrameSize << 4096; listFftFrameSize << 8192; listFftFrameSize << 16384; listFftFrameSize << 32768; listFftFrameSize << 65536; listFftFrameSize << 131072; listFftFrameSize << 262144; listTuningMethod << KeyFinder::TUNING_HARTE; listTuningMethod << KeyFinder::TUNING_BIN_ADAPTIVE; listSegmentation << KeyFinder::SEGMENTATION_NONE; listSegmentation << KeyFinder::SEGMENTATION_HARTE; listSegmentation << KeyFinder::SEGMENTATION_COSINE; listSegmentation << KeyFinder::SEGMENTATION_ARBITRARY; listToneProfile << KeyFinder::TONE_PROFILE_KRUMHANSL; listToneProfile << KeyFinder::TONE_PROFILE_TEMPERLEY; listToneProfile << KeyFinder::TONE_PROFILE_GOMEZ; listToneProfile << KeyFinder::TONE_PROFILE_SHAATH; listToneProfile << KeyFinder::TONE_PROFILE_CUSTOM; listSimilarityMeasure << KeyFinder::SIMILARITY_COSINE; listSimilarityMeasure << KeyFinder::SIMILARITY_CORRELATION; // UI ui->setupUi(this); this->setWindowFlags(Qt::WindowTitleHint | Qt::CustomizeWindowHint); // get values from preferences Preferences p; ui->writeToFilesAutomatically->setChecked(p.getWriteToFilesAutomatically()); ui->parallelBatchJobs->setChecked(p.getParallelBatchJobs()); ui->writeToTagComment->setChecked(p.getWriteToTagComment()); ui->writeToTagGrouping->setChecked(p.getWriteToTagGrouping()); ui->writeToTagKey->setChecked(p.getWriteToTagKey()); ui->writeToFilePrefix->setChecked(p.getWriteToFilePrefix()); ui->writeToFileSuffix->setChecked(p.getWriteToFileSuffix()); ui->filenameDelimiter->setText(p.getFilenameDelimiter()); ui->skipFilesWithExistingTags->setChecked(p.getSkipFilesWithExistingTags()); ui->temporalWindow->setCurrentIndex(listTemporalWindow.indexOf(p.getTemporalWindow())); ui->segmentation->setCurrentIndex(listSegmentation.indexOf(p.getSegmentation())); ui->similarityMeasure->setCurrentIndex(listSimilarityMeasure.indexOf(p.getSimilarityMeasure())); ui->tagFormat->setCurrentIndex(listTagFormat.indexOf(p.getTagFormat())); ui->hopSize->setCurrentIndex(listHopSize.indexOf(p.getHopSize())); ui->fftFrameSize->setCurrentIndex(listFftFrameSize.indexOf(p.getFftFrameSize())); ui->octaves->setValue(p.getOctaves()); ui->bps->setValue(p.getBpo()/12); ui->octaveOffset->setChecked(p.getOffsetToC()); ui->dFactor->setValue(p.getDFactor()); ui->toneProfile->setCurrentIndex(listToneProfile.indexOf(p.getToneProfile())); ui->hcdfPeakPickingNeighbours->setValue(p.getHcdfPeakPickingNeighbours()); ui->arbitrarySegments->setValue(p.getArbitrarySegments()); ui->hcdfGaussianSize->setValue(p.getHcdfGaussianSize()); ui->tuningMethod->setCurrentIndex(listTuningMethod.indexOf(p.getTuningMethod())); ui->hcdfGaussianSigma->setValue(p.getHcdfGaussianSigma()); ui->stFreq->setCurrentIndex(listStartingFreq.indexOf(p.getStartingFreqA())); ui->directSkStretch->setValue(p.getDirectSkStretch()); ui->detunedBandWeight->setValue(p.getDetunedBandWeight()); ui->iTunesLibraryPath->setText(p.getITunesLibraryPath()); ui->traktorLibraryPath->setText(p.getTraktorLibraryPath()); ui->seratoLibraryPath->setText(p.getSeratoLibraryPath()); std::vector<float> ctp = p.getCustomToneProfile(); ui->maj0->setValue(ctp[0]); ui->maj1->setValue(ctp[1]); ui->maj2->setValue(ctp[2]); ui->maj3->setValue(ctp[3]); ui->maj4->setValue(ctp[4]); ui->maj5->setValue(ctp[5]); ui->maj6->setValue(ctp[6]); ui->maj7->setValue(ctp[7]); ui->maj8->setValue(ctp[8]); ui->maj9->setValue(ctp[9]); ui->maj10->setValue(ctp[10]); ui->maj11->setValue(ctp[11]); ui->min0->setValue(ctp[12]); ui->min1->setValue(ctp[13]); ui->min2->setValue(ctp[14]); ui->min3->setValue(ctp[15]); ui->min4->setValue(ctp[16]); ui->min5->setValue(ctp[17]); ui->min6->setValue(ctp[18]); ui->min7->setValue(ctp[19]); ui->min8->setValue(ctp[20]); ui->min9->setValue(ctp[21]); ui->min10->setValue(ctp[22]); ui->min11->setValue(ctp[23]); QStringList ckc = p.getCustomKeyCodes(); ui->majKey0->setText(ckc[0]); ui->minKey0->setText(ckc[1]); ui->majKey1->setText(ckc[2]); ui->minKey1->setText(ckc[3]); ui->majKey2->setText(ckc[4]); ui->minKey2->setText(ckc[5]); ui->majKey3->setText(ckc[6]); ui->minKey3->setText(ckc[7]); ui->majKey4->setText(ckc[8]); ui->minKey4->setText(ckc[9]); ui->majKey5->setText(ckc[10]); ui->minKey5->setText(ckc[11]); ui->majKey6->setText(ckc[12]); ui->minKey6->setText(ckc[13]); ui->majKey7->setText(ckc[14]); ui->minKey7->setText(ckc[15]); ui->majKey8->setText(ckc[16]); ui->minKey8->setText(ckc[17]); ui->majKey9->setText(ckc[18]); ui->minKey9->setText(ckc[19]); ui->majKey10->setText(ckc[20]); ui->minKey10->setText(ckc[21]); ui->majKey11->setText(ckc[22]); ui->minKey11->setText(ckc[23]); ui->silence->setText(ckc[24]); // enable/disable fields as necessary tuningEnabled(); binAdaptiveTuningEnabled(); segmentationEnabled(); customProfileEnabled(); filenameDelimiterEnabled(); //relative sizing on Mac only #ifdef Q_OS_MAC QFont smallerFont; smallerFont.setPointSize(smallerFont.pointSize() - 2); for(int i=0; i<ui->gridLayoutKeyCodes->count(); i++) if(!ui->gridLayoutKeyCodes->itemAt(i)->isEmpty()) if(ui->gridLayoutKeyCodes->itemAt(i)->widget()->inherits("QLabel")) ui->gridLayoutKeyCodes->itemAt(i)->widget()->setFont(smallerFont); for(int i=0; i<ui->customMajor->count(); i++) if(!ui->customMajor->itemAt(i)->isEmpty()) if(ui->customMajor->itemAt(i)->widget()->inherits("QLabel")) ui->customMajor->itemAt(i)->widget()->setFont(smallerFont); for(int i=0; i<ui->customMinor->count(); i++) if(!ui->customMinor->itemAt(i)->isEmpty()) if(ui->customMinor->itemAt(i)->widget()->inherits("QLabel")) ui->customMinor->itemAt(i)->widget()->setFont(smallerFont); #endif }