# HG changeset patch # User Chris Cannam # Date 1270128411 -3600 # Node ID 94cdfacc4910d38621d172a10c80abb00accd599 # Parent ac956912fcdf0ad2f33cdfd124d2abb7812e1c5c * some track id stuff, widget test stuff diff -r ac956912fcdf -r 94cdfacc4910 utilities/track/track.cpp --- a/utilities/track/track.cpp Wed Mar 31 14:18:56 2010 +0100 +++ b/utilities/track/track.cpp Thu Apr 01 14:26:51 2010 +0100 @@ -529,11 +529,15 @@ confidentComposer = qobject_cast(guesses.begin()->entity()); } + QString bestTitle; + GuessSet workGuesses; if (tags["TITLE"] != "") { + bestTitle = tags["TITLE"]; guessWorkFromTitleTag(tags, "TITLE", 0.5, confidentComposer, workGuesses); } if (tags["TIT2"] != "") { + bestTitle = tags["TIT2"]; guessWorkFromTitleTag(tags, "TIT2", 0.5, confidentComposer, workGuesses); } if (workGuesses.empty()) { @@ -591,7 +595,7 @@ } } - cout << track << "|" << best << "|" << bc << "|" << best2 << "|" << bc2 << "|" << best3 << "|" << bc3 << "|" << work << endl; + cout << track << "|" << best << "|" << bc << "|" << best2 << "|" << bc2 << "|" << best3 << "|" << bc3 << "|" << work << "|" << bestTitle << endl; } int diff -r ac956912fcdf -r 94cdfacc4910 widgets/TypingSelectWidget.cpp --- a/widgets/TypingSelectWidget.cpp Wed Mar 31 14:18:56 2010 +0100 +++ b/widgets/TypingSelectWidget.cpp Thu Apr 01 14:26:51 2010 +0100 @@ -7,6 +7,7 @@ #include #include #include +#include #include "Matcher.h" @@ -28,7 +29,10 @@ connect(m_editor, SIGNAL(textEdited(const QString &)), this, SLOT(textEdited(const QString &))); - m_list = new QListWidget(); +// m_list = new QListWidget(); + m_list = new QFrame; + m_listLayout = new QGridLayout; + m_list->setLayout(m_listLayout); m_list->setWindowFlags(Qt::Window | Qt::Tool | Qt::FramelessWindowHint); m_list->hide(); } @@ -37,19 +41,27 @@ TypingSelectWidget::textEdited(const QString &s) { if (m_matchers.empty()) return; - + GuessList results = m_matchers[0]->match(s, 10); - m_list->clear(); + +// m_list->clear(); if (results.empty()) { m_list->hide(); return; } + foreach (QWidget *w, m_listEntries) delete w; + m_listEntries.clear(); + foreach (Guess g, results) { Composer *c = qobject_cast(g.entity()); if (!c) continue; - m_list->addItem(c->getSortName(true)); + QLabel *l = new QLabel; + l->setText(c->getSortName(true)); + m_listLayout->addWidget(l); + m_listEntries.push_back(l); + } m_list->show(); @@ -58,7 +70,6 @@ // m_list->setMinimumWidth((width()*3)/4); // m_list->setMinimumHeight(height() * 5); - std::cerr << std::endl; } diff -r ac956912fcdf -r 94cdfacc4910 widgets/TypingSelectWidget.h --- a/widgets/TypingSelectWidget.h Wed Mar 31 14:18:56 2010 +0100 +++ b/widgets/TypingSelectWidget.h Thu Apr 01 14:26:51 2010 +0100 @@ -8,6 +8,8 @@ class QLineEdit; class QListWidget; +class QGridLayout; +class QFrame; namespace ClassicalData { @@ -29,7 +31,9 @@ private: QList m_matchers; QLineEdit *m_editor; - QListWidget *m_list; + QFrame *m_list; + QGridLayout *m_listLayout; + QList m_listEntries; }; }