Mercurial > hg > easaier-soundaccess
diff widgets/QueryResultsWidget.cpp @ 126:c26c73ca6d37
the result list is better now.
it's not the final version.
the final version.... is coming soon
author | benoitrigolleau |
---|---|
date | Tue, 23 Oct 2007 15:24:06 +0000 |
parents | 87495ac7710a |
children | f3dce7a985cf |
line wrap: on
line diff
--- a/widgets/QueryResultsWidget.cpp Mon Oct 22 13:59:27 2007 +0000 +++ b/widgets/QueryResultsWidget.cpp Tue Oct 23 15:24:06 2007 +0000 @@ -13,13 +13,13 @@ #include "QueryResultsWidget.h" -#include <QScrollArea> #include <QLabel> #include <QApplication> #include <iostream> #include "sv/main/MainWindow.h" +#include "widgets/ListResultGeneralItemWidget.h" QueryResultsWidget::QueryResultsWidget() : QWidget(), m_ndResults(0) @@ -29,12 +29,12 @@ QWidget *resultsWidget = new QWidget; resultsWidget->setLayout(m_resultsLayout); - QScrollArea * scrollArea = new QScrollArea; - scrollArea->setWidget(resultsWidget); - scrollArea->setWidgetResizable(true); + m_scrollArea = new QScrollArea; + m_scrollArea->setWidget(resultsWidget); + m_scrollArea->setWidgetResizable(true); QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->addWidget(scrollArea); + mainLayout->addWidget(m_scrollArea); setLayout(mainLayout); } @@ -70,10 +70,13 @@ { std::vector<Info>::iterator iter; - QLabel* result = new QLabel(); + QString author = ""; + QString title = ""; + QString uri = ""; - QString text; - QString uri = ""; + ListResultGeneralItemWidget *itemResult = new ListResultGeneralItemWidget(); + itemResult->setRank(m_ndResults); + itemResult->setType(0); for (iter = m_curResult.begin(); iter != m_curResult.end(); iter++) { @@ -88,29 +91,23 @@ { if ((*iter).name != "identification") { - text += "<br>" ; - text += (*iter).name; - text += " : " ; + if((*iter).name == "author"){ + author = (*iter).value; + } if ((*iter).name == "title") { - text += "<a href=\""; - text += uri; - text += "\">"; - text += (*iter).value; - text += "</a>"; - } else - { - text += (*iter).value; + title += (*iter).value; } - text += "</br>" ; } } - - connect(result, SIGNAL(linkActivated(QString)), MainWindow::instance(), SLOT(importEasaierFile(QString))); + itemResult->setTitleAndAuthorName(author,title,uri ); + itemResult->addConfidence(100,"contains"); - result->setText(text); + connect(itemResult, SIGNAL(linkActivated(QString)), MainWindow::instance(), SLOT(importEasaierFile(QString))); - m_resultsLayout->addWidget(result,m_ndResults,0); + + m_resultsLayout->addWidget(itemResult,m_ndResults,0); + m_resultsLayout->setSpacing(0); m_ndResults++; }