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

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>758</width>
<height>339</height>
<width>1531</width>
<height>889</height>
</rect>
</property>
<property name="sizePolicy">
@ -32,7 +32,16 @@
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="margin">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
@ -55,15 +64,24 @@
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>1</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="LineEditClear" name="lineEdit">
<property name="toolTip">
@ -99,6 +117,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="_channels_CB">
<property name="text">
<string>Channels</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="_friendListsearch_SB">
<property name="toolTip">
@ -307,7 +332,7 @@
<string>Any</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<iconset resource="../images.qrc">
<normaloff>:/images/FileTypeAny.png</normaloff>:/images/FileTypeAny.png</iconset>
</property>
</item>
@ -316,7 +341,7 @@
<string>Archive</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<iconset resource="../images.qrc">
<normaloff>:/images/FileTypeArchive.png</normaloff>:/images/FileTypeArchive.png</iconset>
</property>
</item>
@ -325,7 +350,7 @@
<string>Audio</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<iconset resource="../images.qrc">
<normaloff>:/images/FileTypeAudio.png</normaloff>:/images/FileTypeAudio.png</iconset>
</property>
</item>
@ -334,7 +359,7 @@
<string>CD-Image</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<iconset resource="../images.qrc">
<normaloff>:/images/FileTypeCDImage.png</normaloff>:/images/FileTypeCDImage.png</iconset>
</property>
</item>
@ -343,7 +368,7 @@
<string>Document</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<iconset resource="../images.qrc">
<normaloff>:/images/FileTypeDocument.png</normaloff>:/images/FileTypeDocument.png</iconset>
</property>
</item>
@ -352,7 +377,7 @@
<string>Picture</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<iconset resource="../images.qrc">
<normaloff>:/images/FileTypePicture.png</normaloff>:/images/FileTypePicture.png</iconset>
</property>
</item>
@ -361,7 +386,7 @@
<string>Program</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<iconset resource="../images.qrc">
<normaloff>:/images/FileTypeProgram.png</normaloff>:/images/FileTypeProgram.png</iconset>
</property>
</item>
@ -370,7 +395,7 @@
<string>Video</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<iconset resource="../images.qrc">
<normaloff>:/images/FileTypeVideo.png</normaloff>:/images/FileTypeVideo.png</iconset>
</property>
</item>
@ -379,7 +404,7 @@
<string>Directory</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<iconset resource="../images.qrc">
<normaloff>:/images/folder16.png</normaloff>:/images/folder16.png</iconset>
</property>
</item>
@ -406,7 +431,7 @@
<string>Download selected</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<iconset resource="../images.qrc">
<normaloff>:/images/download16.png</normaloff>:/images/download16.png</iconset>
</property>
</widget>
@ -432,7 +457,7 @@
</customwidget>
</customwidgets>
<resources>
<include location="images.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>