Mercurial > hg > easaier-soundaccess
diff widgets/QueryResultsWidget.cpp @ 280:8bdfbd9ad418
return to the old result list.
author | benoitrigolleau |
---|---|
date | Fri, 31 Oct 2008 10:01:25 +0000 |
parents | a9af42a93073 |
children |
line wrap: on
line diff
--- a/widgets/QueryResultsWidget.cpp Tue Oct 21 15:17:16 2008 +0000 +++ b/widgets/QueryResultsWidget.cpp Fri Oct 31 10:01:25 2008 +0000 @@ -21,11 +21,8 @@ #include "sv/main/MainWindow.h" -#include <windows.h> - int rank = 1; - QueryResultsWidget::QueryResultsWidget() : QWidget(), m_currentRow(0) { @@ -44,8 +41,6 @@ mainLayout->addWidget(m_scrollArea); setLayout(mainLayout); - - connect(this,SIGNAL(pleaseAddResult(QString,QString,QString,int,QString)),this,SLOT(addResultWidget(QString,QString,QString,int,QString))); } QueryResultsWidget::~QueryResultsWidget() @@ -111,55 +106,66 @@ void QueryResultsWidget::saveCurResult() { - //m_currentRow = 0; - int type = 0; + m_allresults.push_back(m_curResult); + m_curResult = new std::vector<Info>; - std::vector<Info>::iterator iterOnInfo; - QString author = ""; - QString title = ""; - QString uri = ""; - QString confidence = "1"; - - for (iterOnInfo = (*m_curResult).begin(); iterOnInfo != (*m_curResult).end(); iterOnInfo++) - { - if ((*iterOnInfo).name == "signal") - { - uri = (*iterOnInfo).value; - //uri = uri.right(uri.length() - uri.lastIndexOf("#") - 1); - } - } - - for (iterOnInfo = (*m_curResult).begin(); iterOnInfo != (*m_curResult).end(); iterOnInfo++) - { - if ((*iterOnInfo).name != "signal") - { - //if((*iterOnInfo).name == "composer"){ - if((*iterOnInfo).name == "author"){ - author = (*iterOnInfo).value; - } - //if ((*iterOnInfo).name == "performance_title") - if ((*iterOnInfo).name == "title") - { - title += (*iterOnInfo).value; - } - if ((*iterOnInfo).name == "confidence") - { - confidence = (*iterOnInfo).value; - } - } - } - - //Sleep(5000); - //emit pleaseAddResult(author,title,uri,type,confidence); - addResultWidget(author,title,uri,type,confidence); - - m_currentRow=m_currentRow+3; - rank++; - m_curResult = new std::vector<Info>; } void QueryResultsWidget::displayResult() { + m_currentRow = 0; + rank = 1; + addTop(); + int type = 0; + + std::vector<std::vector<Info>*>::iterator iterOnResults; + int size = m_allresults.size(); + + for (iterOnResults = m_allresults.begin(); iterOnResults != m_allresults.end();iterOnResults++) + { + std::vector<Info>* onInfo = *iterOnResults; + std::vector<Info>::iterator iterOnInfo; + QString author = ""; + QString title = ""; + QString uri = ""; + QString confidence = "1"; + + for (iterOnInfo = (*onInfo).begin(); iterOnInfo != (*onInfo).end(); iterOnInfo++) + { + if ((*iterOnInfo).name == "signal") + { + uri = (*iterOnInfo).value; + //uri = uri.right(uri.length() - uri.lastIndexOf("#") - 1); + } + } + + for (iterOnInfo = (*onInfo).begin(); iterOnInfo != (*onInfo).end(); iterOnInfo++) + { + if ((*iterOnInfo).name != "signal") + { + //if((*iterOnInfo).name == "composer"){ + if((*iterOnInfo).name == "author"){ + author = (*iterOnInfo).value; + } + //if ((*iterOnInfo).name == "performance_title") + if ((*iterOnInfo).name == "title") + { + title += (*iterOnInfo).value; + } + if ((*iterOnInfo).name == "confidence") + { + confidence = (*iterOnInfo).value; + } + } + } + if (author == "Django") + type = 2; + addResultWidget(author,title,uri,type,confidence); + m_currentRow=m_currentRow+3; + rank++; + + } + addFoot(); } @@ -174,7 +180,7 @@ //add the type QLabel *labelIcon = new QLabel(); labelIcon->setMaximumWidth(25); - labelIcon->setMinimumWidth(25);// + labelIcon->setMinimumWidth(25); QString pixmapName; switch(type){ case 0: @@ -268,7 +274,6 @@ hLine->setMinimumHeight(1); m_resultsLayout->setRowMinimumHeight(m_currentRow+2,1); m_resultsLayout->addWidget(hLine,m_currentRow+2,1,1,12); - }