added quick and dirty turtle search for channels in Files search tab

This commit is contained in:
csoler 2018-06-13 22:46:27 +02:00
parent be1e127a93
commit 7a135c5c43
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
10 changed files with 86 additions and 44 deletions

View file

@ -38,6 +38,7 @@
#include "gui/common/RSTreeWidgetItem.h"
#include "util/QtVersion.h"
#include "retroshare/rsgxschannels.h"
#include <retroshare/rsfiles.h>
#include <retroshare/rsturtle.h>
#include <retroshare/rsexpr.h>
@ -165,8 +166,10 @@ SearchDialog::SearchDialog(QWidget *parent)
QHeaderView_setSectionResizeModeColumn(_smheader, SS_KEYWORDS_COL, QHeaderView::Interactive);
QHeaderView_setSectionResizeModeColumn(_smheader, SS_RESULTS_COL, QHeaderView::Interactive);
_smheader->resizeSection ( SS_KEYWORDS_COL, 160 );
_smheader->resizeSection ( SS_RESULTS_COL, 50 );
float f = QFontMetricsF(font()).height()/14.0 ;
_smheader->resizeSection ( SS_KEYWORDS_COL, 160*f );
_smheader->resizeSection ( SS_RESULTS_COL, 50*f );
ui.searchResultWidget->setColumnCount(SR_COL_COUNT);
_smheader = ui.searchResultWidget->header () ;
@ -174,12 +177,12 @@ SearchDialog::SearchDialog(QWidget *parent)
QHeaderView_setSectionResizeModeColumn(_smheader, SR_SIZE_COL, QHeaderView::Interactive);
QHeaderView_setSectionResizeModeColumn(_smheader, SR_SOURCES_COL, QHeaderView::Interactive);
_smheader->resizeSection ( SR_NAME_COL, 240 );
_smheader->resizeSection ( SR_SIZE_COL, 75 );
_smheader->resizeSection ( SR_SOURCES_COL, 75 );
_smheader->resizeSection ( SR_TYPE_COL, 75 );
_smheader->resizeSection ( SR_AGE_COL, 90 );
_smheader->resizeSection ( SR_HASH_COL, 240 );
_smheader->resizeSection ( SR_NAME_COL, 240*f );
_smheader->resizeSection ( SR_SIZE_COL, 75*f );
_smheader->resizeSection ( SR_SOURCES_COL, 75*f );
_smheader->resizeSection ( SR_TYPE_COL, 75*f );
_smheader->resizeSection ( SR_AGE_COL, 90*f );
_smheader->resizeSection ( SR_HASH_COL, 240*f );
// set header text aligment
QTreeWidgetItem * headerItem = ui.searchResultWidget->headerItem();
@ -201,10 +204,11 @@ SearchDialog::SearchDialog(QWidget *parent)
// load settings
processSettings(true);
ui._ownFiles_CB->setMinimumWidth(20);
ui._friendListsearch_SB->setMinimumWidth(20);
ui._anonF2Fsearch_CB->setMinimumWidth(20);
ui.label->setMinimumWidth(20);
ui._channels_CB->setMinimumWidth(20 * f);
ui._ownFiles_CB->setMinimumWidth(20*f);
ui._friendListsearch_SB->setMinimumWidth(20*f);
ui._anonF2Fsearch_CB->setMinimumWidth(20*f);
ui.label->setMinimumWidth(20*f);
// workaround for Qt bug, be solved in next Qt release 4.7.0
// https://bugreports.qt-project.org/browse/QTBUG-8270
@ -862,6 +866,13 @@ void SearchDialog::searchKeywords(const QString& keywords)
else
req_id = rsFiles->turtleSearch(lin_exp) ;
}
else if(ui._channels_CB->isChecked())
{
if(n==1)
req_id = rsGxsChannels->turtleSearchRequest(words.front()) ;
else
QMessageBox::critical(this,"Cannot search multiple words yet.","Search for multiple words is not implemented yet.") ;
}
else
req_id = RSRandom::random_u32() ; // generate a random 32 bits request id