CWidgetSearchTemplate::CWidgetSearchTemplate(QString searchString, QWidget* parent) : QWidget(parent), ui(new Ui::CWidgetSearchTemplate) { ui->setupUi(this); searchMenu = new QMenu(this); searchMenu->addAction(ui->actionDownload); searchMenu->addSeparator(); searchMenu->addAction(ui->actionBanNode); searchMenu->addAction(ui->actionMarkAsJunk); searchMenu->addAction(ui->actionClearResults); searchMenu->addSeparator(); searchMenu->addAction(ui->actionViewReviews); searchMenu->addAction(ui->actionVirusTotalCheck); m_sSearchString = searchString; m_pSearch = 0; m_nFiles = 0; m_nHits = 0; m_nHubs = 0; m_nLeaves = 0; m_searchState = SearchState::Default; m_pSortModel = new QSortFilterProxyModel(this); m_pSearchModel = new SearchTreeModel(); m_pSortModel->setSourceModel(m_pSearchModel); ui->treeViewSearchResults->setModel(m_pSortModel); m_pSortModel->setDynamicSortFilter(false); connect(m_pSearchModel, SIGNAL(sort()), this, SLOT(Sort())); connect(m_pSearchModel, SIGNAL(updateStats()), this, SLOT(OnStatsUpdated())); loadHeaderState(); connect(ui->treeViewSearchResults->header(), SIGNAL(sectionMoved(int,int,int)), this, SLOT(saveHeaderState())); connect(ui->treeViewSearchResults->header(), SIGNAL(sectionResized(int,int,int)), this, SLOT(saveHeaderState())); connect(ui->treeViewSearchResults->header(), SIGNAL(sectionClicked(int)), this, SLOT(saveHeaderState())); setSkin(); }
void WidgetSearchTemplate::StartSearch(CQuery* pQuery) { if(m_pSearch && m_pSearch->m_pQuery != pQuery) { delete m_pSearch; m_pSearch = 0; } if(!m_pSearch) { m_pSearch = new CManagedSearch(pQuery); connect(m_pSearch, SIGNAL(OnHit(QueryHitSharedPtr)), searchModel, SLOT(addQueryHit(QueryHitSharedPtr))); connect(m_pSearch, SIGNAL(StatsUpdated()), this, SLOT(OnStatsUpdated())); } m_pSearch->Start(); searchState = SearchState::Searching; sSearchString = m_pSearch->m_pQuery->DescriptiveName(); }
WidgetSearchTemplate::WidgetSearchTemplate(QString searchString, QWidget* parent) : QWidget(parent), m_ui(new Ui::WidgetSearchTemplate) { m_ui->setupUi(this); sSearchString = searchString; m_pSearch = 0; nFiles = 0; nHits = 0; nHubs = 0; nLeaves = 0; searchState = SearchState::Stopped; QSortFilterProxyModel* sortModel = new QSortFilterProxyModel(this); searchModel = new SearchTreeModel(); sortModel->setSourceModel(searchModel); m_ui->treeViewSearchResults->setModel(sortModel); sortModel->setDynamicSortFilter(true); connect(searchModel, SIGNAL(updateStats()), this, SLOT(OnStatsUpdated())); }