void KNMusicSearch::onActionSearch(const QString &text) { //Use the engin to parse the search box text, save the result to the list. m_searchBlockList=m_engine->parseSearch(text); //Ask to search the data. emit requireSearch(); }
KNMusicPlaylistDisplay::KNMusicPlaylistDisplay(QWidget *parent) : QWidget(parent) { //Set properties. setContentsMargins(0,0,0,0); //Add layout. QBoxLayout *displayLayout=new QBoxLayout(QBoxLayout::TopToBottom, this); displayLayout->setContentsMargins(0,0,0,0); displayLayout->setSpacing(0); setLayout(displayLayout); //Initial the labels. initialLabels(); initialTreeView(); initialControls(); //Initial information container. KNMouseSenseWidget *infoContainer=new KNMouseSenseWidget(this); infoContainer->setContentsMargins(20,12,0,8); QBoxLayout *infoLayout=new QBoxLayout(QBoxLayout::TopToBottom, infoContainer); infoLayout->setContentsMargins(0,0,0,0); infoLayout->setSpacing(0); infoContainer->setLayout(infoLayout); displayLayout->addWidget(infoContainer); //Initial the information label. infoLayout->addWidget(m_playlistTitle); QBoxLayout *detailLayout=new QBoxLayout(QBoxLayout::LeftToRight, infoLayout->widget()); detailLayout->setContentsMargins(0,0,0,0); detailLayout->setSpacing(5); detailLayout->addWidget(m_playlistDetail); detailLayout->addWidget(m_playPlaylist); detailLayout->addWidget(m_addToPlaylist); detailLayout->addStretch(); infoLayout->addLayout(detailLayout); displayLayout->addWidget(m_playlistTreeView, 1); //Initial playlist connection handler. m_modelSignalHandler=new KNConnectionHandler(this); //Initial the shadow. m_leftShadow=new KNSideShadowWidget(LeftShadow, this); //Connect search signal. connect(KNMusicGlobal::musicSearch(), SIGNAL(requireSearch(QString)), this, SLOT(updatePlaylistTitle())); //Connect retranslate signal. connect(KNGlobal::instance(), &KNGlobal::requireRetranslate, this, &KNMusicPlaylistDisplay::retranslate); //Do retranslate. retranslate(); }
void KNMusicSearch::search(const QList<KNMusicSearchBlock> &blocks) { //Save the new blocks. m_searchBlockList=blocks; //Block the signal of the search box. m_searchBox->blockSignals(true); //Set the search text to search box. m_searchBox->setText(m_engine->generateSearchText(m_searchBlockList)); //Release the signal block. m_searchBox->blockSignals(false); //Ask to search the data. emit requireSearch(); }
void KNMusicSearch::clear() { //Clear up the search block list. m_searchBlockList.clear(); //Block the signal of the search box. m_searchBox->blockSignals(true); //Set the search text to search box. m_searchBox->clear(); //Release the signal block. m_searchBox->blockSignals(false); //Ask to search the data. emit requireSearch(); }