Add a warning in ToolTip if Max files reach in flat view mode Dir Tree.

This commit is contained in:
Phenom 2018-02-24 18:15:54 +01:00
parent 062e00d960
commit 51a43d00f7
4 changed files with 30 additions and 3 deletions

View file

@ -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.