moved SearchDialog into FileTransfer/

This commit is contained in:
csoler 2016-01-21 21:49:52 -05:00
parent 6a32da2420
commit 94b586846e
4 changed files with 3 additions and 3 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,173 @@
/****************************************************************
* RShare is distributed under the following license:
*
* Copyright (C) 2006, crypton
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _SEARCHDIALOG_H
#define _SEARCHDIALOG_H
#include <retroshare/rstypes.h>
#include "ui_SearchDialog.h"
#include "mainpage.h"
class AdvancedSearchDialog;
class Expression;
class RSTreeWidgetItemCompareRole;
#define FRIEND_SEARCH 1
#define ANONYMOUS_SEARCH 2
class SearchDialog : public MainPage
{
Q_OBJECT
Q_PROPERTY(QColor textColorLocal READ textColorLocal WRITE setTextColorLocal)
Q_PROPERTY(QColor textColorNoSources READ textColorNoSources WRITE setTextColorNoSources)
Q_PROPERTY(QColor textColorLowSources READ textColorLowSources WRITE setTextColorLowSources)
Q_PROPERTY(QColor textColorHighSources READ textColorHighSources WRITE setTextColorHighSources)
public:
/** Default Constructor */
SearchDialog(QWidget *parent = 0);
/** Default Destructor */
~SearchDialog();
void searchKeywords(const QString& keywords);
QColor textColorLocal() const { return mTextColorLocal; }
QColor textColorNoSources() const { return mTextColorNoSources; }
QColor textColorLowSources() const { return mTextColorLowSources; }
QColor textColorHighSources() const { return mTextColorHighSources; }
void setTextColorLocal(QColor color) { mTextColorLocal = color; }
void setTextColorNoSources(QColor color) { mTextColorNoSources = color; }
void setTextColorLowSources(QColor color) { mTextColorLowSources = color; }
void setTextColorHighSources(QColor color) { mTextColorHighSources = color; }
public slots:
void updateFiles(qulonglong request_id,FileDetail file) ;
private slots:
/** Create the context popup menu and it's submenus */
void searchResultWidgetCustomPopupMenu( QPoint point );
void processResultQueue();
void searchSummaryWidgetCustomPopupMenu( QPoint point );
void download();
void collCreate();
void collModif();
void collView();
void collOpen();
void broadcastonchannel();
void recommendtofriends();
void checkText(const QString&);
void copyResultLink();
void copySearchLink();
void openFolderSearch();
void searchAgain();
void searchRemove();
void searchRemoveAll();
void searchKeywords();
/** management of the adv search dialog object when switching search modes */
void toggleAdvancedSearchDialog(bool);
void hideEvent(QHideEvent * event);
/** raises (and if necessary instantiates) the advanced search dialog */
void showAdvSearchDialog(bool=true);
/** perform the advanced search */
void advancedSearch(Expression*);
void selectSearchResults(int index = -1);
void hideOrShowSearchResult(QTreeWidgetItem* resultItem, QString currentSearchId = QString(), int fileTypeIndex = -1);
void sendLinkTo();
void selectFileType(int index);
void filterItems();
private:
/** render the results to the tree widget display */
void initSearchResult(const QString& txt,qulonglong searchId, int fileType, bool advanced) ;
void resultsToTree(const QString& txt,qulonglong searchId, const std::list<DirDetails>&);
void insertFile(qulonglong searchId,const FileDetail &file, int searchType = ANONYMOUS_SEARCH) ;
void insertDirectory(const QString &txt, qulonglong searchId, const DirDetails &dir, QTreeWidgetItem *item);
void insertDirectory(const QString &txt, qulonglong searchId, const DirDetails &dir);
void setIconAndType(QTreeWidgetItem *item, const QString& filename);
void downloadDirectory(const QTreeWidgetItem *item, const QString &base);
void getSourceFriendsForHash(const RsFileHash &hash,std::list<RsPeerId> &srcIds);
/** the advanced search dialog instance */
AdvancedSearchDialog * advSearchDialog;
/** Contains the mapping of filetype combobox to filetype extensions */
static const int FILETYPE_IDX_ANY;
static const int FILETYPE_IDX_ARCHIVE;
static const int FILETYPE_IDX_AUDIO;
static const int FILETYPE_IDX_CDIMAGE;
static const int FILETYPE_IDX_DOCUMENT;
static const int FILETYPE_IDX_PICTURE;
static const int FILETYPE_IDX_PROGRAM;
static const int FILETYPE_IDX_VIDEO;
static const int FILETYPE_IDX_DIRECTORY;
static QMap<int, QString> * FileTypeExtensionMap;
static bool initialised;
void initialiseFileTypeMappings();
void processSettings(bool bLoad);
bool filterItem(QTreeWidgetItem *item, const QString &text, int filterColumn);
bool m_bProcessSettings;
int nextSearchId;
RSTreeWidgetItemCompareRole *compareSummaryRole;
RSTreeWidgetItemCompareRole *compareResultRole;
/* Color definitions (for standard see qss.default) */
QColor mTextColorLocal;
QColor mTextColorNoSources;
QColor mTextColorLowSources;
QColor mTextColorHighSources;
QAction *collCreateAct;
QAction *collModifAct;
QAction *collViewAct;
QAction *collOpenAct;
/** Qt Designer generated object */
Ui::SearchDialog ui;
bool _queueIsAlreadyTakenCareOf ;
std::vector<std::pair<qulonglong,FileDetail> > searchResultsQueue ;
};
#endif

View file

@ -0,0 +1,438 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SearchDialog</class>
<widget class="QWidget" name="SearchDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>758</width>
<height>339</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>1</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QFrame" name="titleBarFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="margin">
<number>2</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="searchLineFrame">
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
<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">
<string>Enter a keyword here (at least 3 char long)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonSearch">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Start Search</string>
</property>
<property name="text">
<string>Search</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="toggleAdvancedSearchBtn">
<property name="toolTip">
<string>Advanced Search</string>
</property>
<property name="text">
<string>Advanced</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="_friendListsearch_SB">
<property name="toolTip">
<string>Search inside &quot;browsable&quot; files of your friends</string>
</property>
<property name="text">
<string>Browsable files</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="_anonF2Fsearch_CB">
<property name="toolTip">
<string>Multi-hop search at distance 6 in the network
(always reports available files)</string>
</property>
<property name="text">
<string>Distant</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="_ownFiles_CB">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Include files from your own file list in the search result</string>
</property>
<property name="text">
<string>Own files</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cloaseallsearchresultsButton">
<property name="toolTip">
<string>Close all Search Results</string>
</property>
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QTreeWidget" name="searchSummaryWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>KeyWords</string>
</property>
</column>
<column>
<property name="text">
<string>Results</string>
</property>
</column>
<column>
<property name="text">
<string>Search Id</string>
</property>
</column>
</widget>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="SearchTreeWidget" name="searchResultWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::DragOnly</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Filename</string>
</property>
</column>
<column>
<property name="text">
<string>Size</string>
</property>
</column>
<column>
<property name="text">
<string>Sources</string>
</property>
</column>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
<column>
<property name="text">
<string>Age</string>
</property>
</column>
<column>
<property name="text">
<string>Hash</string>
</property>
</column>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Filter:</string>
</property>
</widget>
</item>
<item>
<widget class="LineEditClear" name="filterLineEdit">
<property name="toolTip">
<string>Filter Search Result</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Max results:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="_max_results_SB">
<property name="suffix">
<string/>
</property>
<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>
<widget class="QComboBox" name="FileTypeComboBox">
<item>
<property name="text">
<string>Any</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/FileTypeAny.png</normaloff>:/images/FileTypeAny.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Archive</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/FileTypeArchive.png</normaloff>:/images/FileTypeArchive.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Audio</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/FileTypeAudio.png</normaloff>:/images/FileTypeAudio.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>CD-Image</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/FileTypeCDImage.png</normaloff>:/images/FileTypeCDImage.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Document</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/FileTypeDocument.png</normaloff>:/images/FileTypeDocument.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Picture</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/FileTypePicture.png</normaloff>:/images/FileTypePicture.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Program</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/FileTypeProgram.png</normaloff>:/images/FileTypeProgram.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Video</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/FileTypeVideo.png</normaloff>:/images/FileTypeVideo.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Directory</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/folder16.png</normaloff>:/images/folder16.png</iconset>
</property>
</item>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonDownload">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>26</height>
</size>
</property>
<property name="toolTip">
<string>Download Selected</string>
</property>
<property name="text">
<string>Download selected</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/download16.png</normaloff>:/images/download16.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LineEditClear</class>
<extends>QLineEdit</extends>
<header>gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>SearchTreeWidget</class>
<extends>QTreeWidget</extends>
<header>gui/SearchTreeWidget.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="images.qrc"/>
</resources>
<connections/>
</ui>