@@ -111,6 +111,21 @@ DlgPrefLibrary::DlgPrefLibrary(
111111
112112 updateSearchLineEditHistoryOptions ();
113113
114+ comboBox_dateFormat->addItem (tr (" Native (System Default)" ),
115+ static_cast <int >(mixxx::DateFormat::Native));
116+ comboBox_dateFormat->addItem (tr (" YYYY-MM-DD" ),
117+ static_cast <int >(mixxx::DateFormat::ISO8601 ));
118+ comboBox_dateFormat->addItem (tr (" DD/MM/YYYY" ),
119+ static_cast <int >(mixxx::DateFormat::DayMonthYear));
120+ comboBox_dateFormat->addItem (tr (" MM/DD/YYYY" ),
121+ static_cast <int >(mixxx::DateFormat::MonthDayYear));
122+ comboBox_dateFormat->addItem (tr (" YYYY/MM/DD" ),
123+ static_cast <int >(mixxx::DateFormat::YearMonthDay));
124+ connect (comboBox_dateFormat,
125+ QOverload<int >::of (&QComboBox::currentIndexChanged),
126+ this ,
127+ &DlgPrefLibrary::slotDateFormatChanged);
128+
114129 connect (btn_library_font, &QAbstractButton::clicked, this , &DlgPrefLibrary::slotSelectFont);
115130
116131 // TODO(XXX) this string should be extracted from the soundsources
@@ -184,11 +199,12 @@ void DlgPrefLibrary::slotHide() {
184199 QMessageBox msgBox;
185200 msgBox.setIcon (QMessageBox::Warning);
186201 msgBox.setWindowTitle (tr (" Music Directory Added" ));
187- msgBox.setText (tr (" You added one or more music directories. The tracks in "
188- " these directories won't be available until you rescan "
189- " your library. Would you like to rescan now?" ));
202+ msgBox.setText (tr (
203+ " You added one or more music directories. The tracks in "
204+ " these directories won't be available until you rescan "
205+ " your library. Would you like to rescan now?" ));
190206 QPushButton* scanButton = msgBox.addButton (
191- tr (" Scan" ), QMessageBox::AcceptRole);
207+ tr (" Scan" ), QMessageBox::AcceptRole);
192208 msgBox.addButton (QMessageBox::Cancel);
193209 msgBox.setDefaultButton (scanButton);
194210 msgBox.exec ();
@@ -231,7 +247,7 @@ void DlgPrefLibrary::populateDirList() {
231247 dirList->setModel (&m_dirListModel);
232248 dirList->setCurrentIndex (m_dirListModel.index (0 , 0 ));
233249 // reselect index if it still exists
234- for (int i= 0 ; i< m_dirListModel.rowCount () ; ++i) {
250+ for (int i = 0 ; i < m_dirListModel.rowCount (); ++i) {
235251 const QModelIndex index = m_dirListModel.index (i, 0 );
236252 if (index.data ().toString () == selected) {
237253 dirList->setCurrentIndex (index);
@@ -267,6 +283,12 @@ void DlgPrefLibrary::slotResetToDefaults() {
267283 comboBox_search_bpm_fuzzy_range->setCurrentIndex (
268284 comboBox_search_bpm_fuzzy_range->findData (kDefaultFuzzyRateRangePercent ));
269285
286+ int defaultDateFormat = static_cast <int >(BaseTrackTableModel::kDateFormatDefault );
287+ int dateIndex = comboBox_dateFormat->findData (defaultDateFormat);
288+ if (dateIndex != -1 ) {
289+ comboBox_dateFormat->setCurrentIndex (dateIndex);
290+ }
291+
270292 checkBox_show_rhythmbox->setChecked (true );
271293 checkBox_show_banshee->setChecked (true );
272294 checkBox_show_itunes->setChecked (true );
@@ -297,18 +319,28 @@ void DlgPrefLibrary::slotUpdate() {
297319 kUseRelativePathOnExportConfigKey , false ));
298320
299321 checkBox_show_rhythmbox->setChecked (m_pConfig->getValue (
300- ConfigKey (" [Library]" ," ShowRhythmboxLibrary" ), true ));
322+ ConfigKey (" [Library]" , " ShowRhythmboxLibrary" ), true ));
301323 checkBox_show_banshee->setChecked (m_pConfig->getValue (
302- ConfigKey (" [Library]" ," ShowBansheeLibrary" ), true ));
324+ ConfigKey (" [Library]" , " ShowBansheeLibrary" ), true ));
303325 checkBox_show_itunes->setChecked (m_pConfig->getValue (
304- ConfigKey (" [Library]" ," ShowITunesLibrary" ), true ));
326+ ConfigKey (" [Library]" , " ShowITunesLibrary" ), true ));
305327 checkBox_show_traktor->setChecked (m_pConfig->getValue (
306- ConfigKey (" [Library]" ," ShowTraktorLibrary" ), true ));
328+ ConfigKey (" [Library]" , " ShowTraktorLibrary" ), true ));
307329 checkBox_show_rekordbox->setChecked (m_pConfig->getValue (
308- ConfigKey (" [Library]" ," ShowRekordboxLibrary" ), true ));
330+ ConfigKey (" [Library]" , " ShowRekordboxLibrary" ), true ));
309331 checkBox_show_serato->setChecked (m_pConfig->getValue (
310332 ConfigKey (" [Library]" , " ShowSeratoLibrary" ), true ));
311333
334+ int dateFormat = m_pConfig->getValue (
335+ kDateFormatConfigKey ,
336+ static_cast <int >(BaseTrackTableModel::kDateFormatDefault ));
337+ int dateIndex = comboBox_dateFormat->findData (dateFormat);
338+ if (dateIndex != -1 ) {
339+ comboBox_dateFormat->setCurrentIndex (dateIndex);
340+ }
341+ // Ensure the static member is updated on startup/load
342+ BaseTrackTableModel::setDateFormat (static_cast <mixxx::DateFormat>(dateFormat));
343+
312344 switch (m_pConfig->getValue <int >(
313345 kTrackDoubleClickActionConfigKey ,
314346 static_cast <int >(TrackDoubleClickAction::LoadToDeck))) {
@@ -403,9 +435,9 @@ void DlgPrefLibrary::resetLibraryFont() {
403435}
404436
405437void DlgPrefLibrary::slotAddDir () {
406- QString fd = QFileDialog::getExistingDirectory (
407- this , tr (" Choose a music directory" ),
408- QStandardPaths::writableLocation (QStandardPaths::MusicLocation));
438+ QString fd = QFileDialog::getExistingDirectory (this ,
439+ tr (" Choose a music directory" ),
440+ QStandardPaths::writableLocation (QStandardPaths::MusicLocation));
409441 if (!fd.isEmpty ()) {
410442 if (m_pLibrary->requestAddDir (fd)) {
411443 populateDirList ();
@@ -423,29 +455,29 @@ void DlgPrefLibrary::slotRemoveDir() {
423455 removeMsgBox.setWindowTitle (tr (" Confirm Directory Removal" ));
424456
425457 removeMsgBox.setText (tr (
426- " Mixxx will no longer watch this directory for new tracks. "
427- " What would you like to do with the tracks from this directory and "
428- " subdirectories?"
429- " <ul>"
430- " <li>Hide all tracks from this directory and subdirectories.</li>"
431- " <li>Delete all metadata for these tracks from Mixxx permanently.</li>"
432- " <li>Leave the tracks unchanged in your library.</li>"
433- " </ul>"
434- " Hiding tracks saves their metadata in case you re-add them in the "
435- " future." ));
458+ " Mixxx will no longer watch this directory for new tracks. "
459+ " What would you like to do with the tracks from this directory and "
460+ " subdirectories?"
461+ " <ul>"
462+ " <li>Hide all tracks from this directory and subdirectories.</li>"
463+ " <li>Delete all metadata for these tracks from Mixxx permanently.</li>"
464+ " <li>Leave the tracks unchanged in your library.</li>"
465+ " </ul>"
466+ " Hiding tracks saves their metadata in case you re-add them in the "
467+ " future." ));
436468 removeMsgBox.setInformativeText (tr (
437- " Metadata means all track details (artist, title, playcount, etc.) as "
438- " well as beatgrids, hotcues, and loops. This choice only affects the "
439- " Mixxx library. No files on disk will be changed or deleted." ));
469+ " Metadata means all track details (artist, title, playcount, etc.) as "
470+ " well as beatgrids, hotcues, and loops. This choice only affects the "
471+ " Mixxx library. No files on disk will be changed or deleted." ));
440472
441473 QPushButton* cancelButton =
442474 removeMsgBox.addButton (QMessageBox::Cancel);
443475 QPushButton* hideAllButton = removeMsgBox.addButton (
444- tr (" Hide Tracks" ), QMessageBox::AcceptRole);
476+ tr (" Hide Tracks" ), QMessageBox::AcceptRole);
445477 QPushButton* deleteAllButton = removeMsgBox.addButton (
446- tr (" Delete Track Metadata" ), QMessageBox::AcceptRole);
478+ tr (" Delete Track Metadata" ), QMessageBox::AcceptRole);
447479 QPushButton* leaveUnchangedButton = removeMsgBox.addButton (
448- tr (" Leave Tracks Unchanged" ), QMessageBox::AcceptRole);
480+ tr (" Leave Tracks Unchanged" ), QMessageBox::AcceptRole);
449481 Q_UNUSED (leaveUnchangedButton); // Only used in DEBUG_ASSERT
450482 removeMsgBox.setDefaultButton (cancelButton);
451483 removeMsgBox.exec ();
@@ -487,7 +519,7 @@ void DlgPrefLibrary::slotRelocateDir() {
487519 }
488520
489521 QString fd = QFileDialog::getExistingDirectory (
490- this , tr (" Relink music directory to new location" ), startDir);
522+ this , tr (" Relink music directory to new location" ), startDir);
491523
492524 if (!fd.isEmpty () && m_pLibrary->requestRelocateDir (currentFd, fd)) {
493525 populateDirList ();
@@ -541,16 +573,16 @@ void DlgPrefLibrary::slotApply() {
541573 ConfigValue (checkBox_enable_search_history_shortcuts->isChecked ()));
542574 updateSearchLineEditHistoryOptions ();
543575
544- m_pConfig->set (ConfigKey (" [Library]" ," ShowRhythmboxLibrary" ),
545- ConfigValue ((int )checkBox_show_rhythmbox->isChecked ()));
546- m_pConfig->set (ConfigKey (" [Library]" ," ShowBansheeLibrary" ),
547- ConfigValue ((int )checkBox_show_banshee->isChecked ()));
548- m_pConfig->set (ConfigKey (" [Library]" ," ShowITunesLibrary" ),
549- ConfigValue ((int )checkBox_show_itunes->isChecked ()));
550- m_pConfig->set (ConfigKey (" [Library]" ," ShowTraktorLibrary" ),
551- ConfigValue ((int )checkBox_show_traktor->isChecked ()));
552- m_pConfig->set (ConfigKey (" [Library]" ," ShowRekordboxLibrary" ),
553- ConfigValue ((int )checkBox_show_rekordbox->isChecked ()));
576+ m_pConfig->set (ConfigKey (" [Library]" , " ShowRhythmboxLibrary" ),
577+ ConfigValue ((int )checkBox_show_rhythmbox->isChecked ()));
578+ m_pConfig->set (ConfigKey (" [Library]" , " ShowBansheeLibrary" ),
579+ ConfigValue ((int )checkBox_show_banshee->isChecked ()));
580+ m_pConfig->set (ConfigKey (" [Library]" , " ShowITunesLibrary" ),
581+ ConfigValue ((int )checkBox_show_itunes->isChecked ()));
582+ m_pConfig->set (ConfigKey (" [Library]" , " ShowTraktorLibrary" ),
583+ ConfigValue ((int )checkBox_show_traktor->isChecked ()));
584+ m_pConfig->set (ConfigKey (" [Library]" , " ShowRekordboxLibrary" ),
585+ ConfigValue ((int )checkBox_show_rekordbox->isChecked ()));
554586 m_pConfig->set (ConfigKey (" [Library]" , " ShowSeratoLibrary" ),
555587 ConfigValue ((int )checkBox_show_serato->isChecked ()));
556588
@@ -587,14 +619,14 @@ void DlgPrefLibrary::slotApply() {
587619 QFont font = m_pLibrary->getTrackTableFont ();
588620 if (m_originalTrackTableFont != font) {
589621 m_pConfig->set (ConfigKey (" [Library]" , " Font" ),
590- ConfigValue (font.toString ()));
622+ ConfigValue (font.toString ()));
591623 m_originalTrackTableFont = font;
592624 }
593625
594626 int rowHeight = spinBox_row_height->value ();
595627 if (m_iOriginalTrackTableRowHeight != rowHeight) {
596- m_pConfig->set (ConfigKey (" [Library]" ," RowHeight" ),
597- ConfigValue (rowHeight));
628+ m_pConfig->set (ConfigKey (" [Library]" , " RowHeight" ),
629+ ConfigValue (rowHeight));
598630 m_iOriginalTrackTableRowHeight = rowHeight;
599631 }
600632
@@ -660,8 +692,10 @@ void DlgPrefLibrary::setLibraryFont(const QFont& font) {
660692void DlgPrefLibrary::slotSelectFont () {
661693 // False if the user cancels font selection.
662694 bool ok = false ;
663- QFont font = QFontDialog::getFont (&ok, m_pLibrary->getTrackTableFont (),
664- this , tr (" Select Library Font" ));
695+ QFont font = QFontDialog::getFont (&ok,
696+ m_pLibrary->getTrackTableFont (),
697+ this ,
698+ tr (" Select Library Font" ));
665699 if (ok) {
666700 setLibraryFont (font);
667701 }
@@ -712,3 +746,10 @@ void DlgPrefLibrary::setSeratoMetadataEnabled(bool shouldSyncTrackMetadata) {
712746 checkBox_serato_metadata_export->setChecked (false );
713747 }
714748}
749+
750+ void DlgPrefLibrary::slotDateFormatChanged (int index) {
751+ int formatInt = comboBox_dateFormat->itemData (index).toInt ();
752+ mixxx::DateFormat format = static_cast <mixxx::DateFormat>(formatInt);
753+ m_pConfig->setValue (kDateFormatConfigKey , formatInt);
754+ BaseTrackTableModel::setDateFormat (format);
755+ }
0 commit comments