Skip to content

Commit 1d20895

Browse files
committed
TRACE date search filter
1 parent f2afcf8 commit 1d20895

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/library/searchquery.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,15 +902,19 @@ DateAddedFilterNode::DateAddedFilterNode(const QString& argument)
902902
QDateTime DateAddedFilterNode::parseDate(const QString& dateStr) const {
903903
// Try ISO format first (YYYY-MM-DD)
904904
// This is used by the "New" filter of the Analyze feature
905+
qWarning() << "--> parse date" << dateStr;
905906
QDate date = QDate::fromString(dateStr, Qt::ISODate);
906907

907908
if (!date.isValid()) {
908909
// Try user date format set in library preferences
909910
const QString dateFormat = BaseTrackTableModel::dateFormat();
911+
qWarning() << "--> invalid, try Lib format" << dateFormat;
910912
date = QDate::fromString(dateStr, dateFormat);
911913
}
912914

913915
if (!date.isValid()) {
916+
qWarning() << "--> invalid, try locale format"
917+
<< QLocale().dateFormat(QLocale::ShortFormat);
914918
// Maybe custom user format is too esoteric, or user picked
915919
// their locale's format.
916920
// Fall back to locale-specific short format
@@ -927,8 +931,10 @@ QDateTime DateAddedFilterNode::parseDate(const QString& dateStr) const {
927931
#endif
928932
}
929933
if (!date.isValid()) {
934+
qWarning() << "--> invalid, return";
930935
return {};
931936
}
937+
qWarning() << "--> valid date:" << date;
932938

933939
return QDateTime(date, QTime(0, 0)).toUTC();
934940
}

src/preferences/dialog/dlgpreflibrary.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ void DlgPrefLibrary::slotUpdate() {
344344
m_dateFormat = m_pConfig->getValue(
345345
kDateFormatConfigKey,
346346
BaseTrackTableModel::kDateFormatDefault);
347+
qWarning() << "slotUpdate, dateformat:" << m_dateFormat;
347348

348349
// Determine the matching preset or custom
349350
BaseTrackTableModel::DateFormat preset = BaseTrackTableModel::DateFormat::Custom;
@@ -357,16 +358,19 @@ void DlgPrefLibrary::slotUpdate() {
357358
preset = BaseTrackTableModel::DateFormat::RegionalLong;
358359
} else {
359360
m_lastCustomDateFormat = m_dateFormat;
361+
qWarning() << "-> type: Custom";
362+
qWarning() << "-> store last custom format:" << m_lastCustomDateFormat;
360363
}
361364

362365
int dateIndex = comboBox_dateFormat->findData(QVariant::fromValue(preset));
366+
qWarning() << "-> idx:" << dateIndex;
363367
if (dateIndex != -1) {
368+
qWarning() << "-> setCurrIdx";
364369
const QSignalBlocker signalBlocker(comboBox_dateFormat);
365370
comboBox_dateFormat->setCurrentIndex(dateIndex);
366371
slotDateFormatIndexChanged(dateIndex);
367372
}
368373

369-
370374
// Ensure the format is applied to the library view on startup/load
371375
BaseTrackTableModel::setDateFormat(m_dateFormat);
372376
updateDateFormatPreview();
@@ -781,14 +785,17 @@ void DlgPrefLibrary::setSeratoMetadataEnabled(bool shouldSyncTrackMetadata) {
781785
}
782786

783787
void DlgPrefLibrary::slotDateFormatIndexChanged(int index) {
788+
qWarning() << " slotDateFormatIndexChanged" << index;
784789
auto type = comboBox_dateFormat->itemData(index)
785790
.value<BaseTrackTableModel::DateFormat>();
786791
QString format;
787792
if (type == BaseTrackTableModel::DateFormat::Custom) {
793+
qWarning() << " -> Custom, format:" << m_lastCustomDateFormat;
788794
// Enable editing for Custom and set the custom format string
789795
comboBox_dateFormat->setEditable(true);
790796
comboBox_dateFormat->setEditText(m_lastCustomDateFormat);
791797
format = m_lastCustomDateFormat;
798+
qWarning() << " -> box text: " << comboBox_dateFormat->currentText();
792799
} else {
793800
// Disable editing for Presets
794801
comboBox_dateFormat->setEditable(false);
@@ -815,6 +822,7 @@ void DlgPrefLibrary::slotDateFormatIndexChanged(int index) {
815822
}
816823

817824
void DlgPrefLibrary::slotDateFormatChanged(const QString& text) {
825+
qWarning() << " slotDateFormatChanged, text:" << text;
818826
m_dateFormat = text;
819827
// If not editable, we are in a Preset mode, but 'text' might be the Item
820828
// Label (e.g. "Native ...") depending on how this was called. However, our

0 commit comments

Comments
 (0)