Esempio n. 1
0
//Worker Interaction
void MainUI::startSearch(){
  ui->listWidget->clear();
  stopSearch(); //just in case a search is still running
  if(ui->line_search->text().isEmpty()){ updateDefaultStatusTip(); return; } //nothing to search for
  
  //emit the proper signal for the worker
  if(!workthread->isRunning()){ workthread->start(); } //make sure the thread is running
  emit SearchTerm(ui->line_search->text(), ui->radio_apps->isChecked());
  ui->tool_stop->setVisible(true);
  ui->tool_configure->setVisible(false);
}
bool PlaylistFilter::filterAcceptsRow(int row, const QModelIndex &parent) const {
  QString filter = filterRegExp().pattern().toLower();

  uint hash = qHash(filter);
  if (hash != query_hash_) {
    // Parse the query
    query_cache_.clear();

    QStringList sections = filter.simplified().split(' ');
    foreach (const QString& section, sections) {
      QString key = section.section(':', 0, 0).toLower();
      if (section.contains(':') && column_names_.contains(key)) {
        // Specific column
        query_cache_ << SearchTerm(
            section.section(':', 1, -1).toLower(),
            column_names_[key],
            exact_columns_.contains(column_names_[key]));
      } else {
        query_cache_ << SearchTerm(section);
      }
    }