mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-28 08:59:37 -05:00
Add a warning in ToolTip if Max files reach in flat view mode Dir Tree.
This commit is contained in:
parent
062e00d960
commit
51a43d00f7
@ -163,6 +163,7 @@ SharedFilesDialog::SharedFilesDialog(RetroshareDirModel *_tree_model,RetroshareD
|
||||
|
||||
tree_model = _tree_model ;
|
||||
flat_model = _flat_model ;
|
||||
connect(flat_model, SIGNAL(layoutChanged()), this, SLOT(updateDirTreeView()) );
|
||||
|
||||
tree_proxyModel = new SFDSortFilterProxyModel(tree_model, this);
|
||||
tree_proxyModel->setSourceModel(tree_model);
|
||||
@ -1344,6 +1345,21 @@ void SharedFilesDialog::startFilter()
|
||||
FilterItems();
|
||||
}
|
||||
|
||||
void SharedFilesDialog::updateDirTreeView()
|
||||
{
|
||||
if (model == flat_model)
|
||||
{
|
||||
size_t maxSize = 0;
|
||||
FlatStyle_RDM* flat = dynamic_cast<FlatStyle_RDM*>(flat_model);
|
||||
if (flat && flat->isMaxRefsTableSize(&maxSize))
|
||||
{
|
||||
ui.dirTreeView->setToolTip(tr("Warning: You reach max (%1) files in flat list. No more will be added.").arg(maxSize));
|
||||
return;
|
||||
}
|
||||
}
|
||||
ui.dirTreeView->setToolTip("");
|
||||
}
|
||||
|
||||
// This macro make the search expand all items that contain the searched text.
|
||||
// A bug however, makes RS expand everything when nothing is selected, which is a pain.
|
||||
|
||||
|
@ -77,6 +77,8 @@ private slots:
|
||||
void clearFilter();
|
||||
void startFilter();
|
||||
|
||||
void updateDirTreeView();
|
||||
|
||||
public slots:
|
||||
void changeCurrentViewModel(int viewTypeIndex);
|
||||
signals:
|
||||
|
@ -46,7 +46,7 @@
|
||||
****/
|
||||
|
||||
static const uint32_t FLAT_VIEW_MAX_REFS_PER_SECOND = 2000 ;
|
||||
static const uint32_t FLAT_VIEW_MAX_REFS_TABLE_SIZE = 10000 ; //
|
||||
static const size_t FLAT_VIEW_MAX_REFS_TABLE_SIZE = 10000 ; //
|
||||
static const uint32_t FLAT_VIEW_MIN_DELAY_BETWEEN_UPDATES = 120 ; // dont rebuild ref list more than every 2 mins.
|
||||
|
||||
RetroshareDirModel::RetroshareDirModel(bool mode, QObject *parent)
|
||||
@ -516,6 +516,13 @@ void FlatStyle_RDM::update()
|
||||
}
|
||||
}
|
||||
|
||||
bool FlatStyle_RDM::isMaxRefsTableSize(size_t *maxSize/*=NULL*/)
|
||||
{
|
||||
if (maxSize)
|
||||
*maxSize = FLAT_VIEW_MAX_REFS_TABLE_SIZE;
|
||||
|
||||
return (_ref_entries.size() >= FLAT_VIEW_MAX_REFS_TABLE_SIZE);
|
||||
}
|
||||
QString FlatStyle_RDM::computeDirectoryPath(const DirDetails& details) const
|
||||
{
|
||||
QString dir ;
|
||||
@ -1515,7 +1522,7 @@ void FlatStyle_RDM::updateRefs()
|
||||
{
|
||||
RS_STACK_MUTEX(_ref_mutex) ;
|
||||
|
||||
while(!_ref_stack.empty())
|
||||
while( !_ref_stack.empty() && (_ref_entries.size() <= FLAT_VIEW_MAX_REFS_TABLE_SIZE) )
|
||||
{
|
||||
void *ref = _ref_stack.back() ;
|
||||
#ifdef RDM_DEBUG
|
||||
@ -1539,7 +1546,7 @@ void FlatStyle_RDM::updateRefs()
|
||||
// Limit the size of the table to display, otherwise it becomes impossible to Qt.
|
||||
|
||||
if(_ref_entries.size() > FLAT_VIEW_MAX_REFS_TABLE_SIZE)
|
||||
return ;
|
||||
continue;
|
||||
|
||||
if(++nb_treated_refs > FLAT_VIEW_MAX_REFS_PER_SECOND) // we've done enough, let's give back hand to
|
||||
{ // the user and setup a timer to finish the job later.
|
||||
|
@ -217,6 +217,8 @@ class FlatStyle_RDM: public RetroshareDirModel
|
||||
|
||||
virtual void update() ;
|
||||
|
||||
bool isMaxRefsTableSize(size_t* maxSize = NULL);
|
||||
|
||||
protected slots:
|
||||
void updateRefs() ;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user