mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-12 00:00:44 -04:00
fixed crazy cost of search in file list tree/flat mode using filterProxyModel instrinsic filter system
This commit is contained in:
parent
63359e0801
commit
1e6e9dfd12
4 changed files with 198 additions and 141 deletions
|
@ -39,6 +39,7 @@
|
|||
#define COLUMN_FRIEND_ACCESS 4
|
||||
#define COLUMN_WN_VISU_DIR 5
|
||||
#define COLUMN_COUNT 6
|
||||
#define RETROSHARE_DIR_MODEL_FILTER_STRING "filtered"
|
||||
|
||||
class DirDetails;
|
||||
|
||||
|
@ -60,7 +61,7 @@ class RetroshareDirModel : public QAbstractItemModel
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Roles{ FileNameRole = Qt::UserRole+1, SortRole = Qt::UserRole+2 };
|
||||
enum Roles{ FileNameRole = Qt::UserRole+1, SortRole = Qt::UserRole+2, FilterRole = Qt::UserRole+3 };
|
||||
|
||||
RetroshareDirModel(bool mode, QObject *parent = 0);
|
||||
virtual ~RetroshareDirModel() {}
|
||||
|
@ -94,7 +95,8 @@ class RetroshareDirModel : public QAbstractItemModel
|
|||
|
||||
virtual QMenu* getContextMenu(QMenu* contextMenu) {return contextMenu;}
|
||||
|
||||
public:
|
||||
void filterItems(const std::list<std::string>& keywords, uint32_t& found) ;
|
||||
|
||||
//Overloaded from QAbstractItemModel
|
||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
virtual QStringList mimeTypes () const;
|
||||
|
@ -118,6 +120,7 @@ class RetroshareDirModel : public QAbstractItemModel
|
|||
virtual QVariant sortRole(const QModelIndex&,const DirDetails&,int) const =0;
|
||||
|
||||
QVariant decorationRole(const DirDetails&,int) const ;
|
||||
QVariant filterRole(const DirDetails& details,int coln) const;
|
||||
|
||||
uint32_t ageIndicator;
|
||||
|
||||
|
@ -172,6 +175,8 @@ class RetroshareDirModel : public QAbstractItemModel
|
|||
mutable time_t mLastReq;
|
||||
|
||||
bool mUpdating ;
|
||||
|
||||
std::set<void*> mFilteredPointers ;
|
||||
};
|
||||
|
||||
// This class shows the classical hierarchical directory view of shared files
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue