added a spinbox to limit the number of search results (too many results may hang the gui)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2432 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-02-26 12:38:29 +00:00
parent d3c6e49ce4
commit 15a28b1d2e
2 changed files with 33 additions and 0 deletions

View File

@ -653,6 +653,16 @@ void SearchDialog::searchKeywords()
void SearchDialog::updateFiles(qulonglong search_id,FileDetail file)
{
static std::map<qulonglong,uint32_t> nb_results ;
if(nb_results.find(search_id) == nb_results.end())
nb_results[search_id] = 0 ;
if(nb_results[search_id] >= ui._max_results_SB->value())
return ;
else
++nb_results[search_id] ;
/* which extensions do we use? */
std::string txt = ui.lineEdit->text().toStdString();
#ifdef DEBUG

View File

@ -1099,6 +1099,29 @@ border-image: url(:/images/btn_26_pressed.png) 4;
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Limit number of results to :</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="_max_results_SB">
<property name="minimum">
<number>100</number>
</property>
<property name="maximum">
<number>5000</number>
</property>
<property name="singleStep">
<number>100</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">