don't use QSortFilterProxyModel in TabDeckStorage and TabReplays unnecessarily

This commit is contained in:
Max-Wilhelm Bruker 2012-03-31 13:28:04 +02:00
parent 13b992cf12
commit ff632911f2
4 changed files with 11 additions and 25 deletions

View file

@ -1,6 +1,5 @@
#include <QTreeView>
#include <QFileSystemModel>
#include <QSortFilterProxyModel>
#include <QToolBar>
#include <QVBoxLayout>
#include <QHBoxLayout>
@ -31,18 +30,14 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor, AbstractClient *_c
{
localDirModel = new QFileSystemModel(this);
localDirModel->setRootPath(settingsCache->getDeckPath());
sortFilter = new QSortFilterProxyModel(this);
sortFilter->setSourceModel(localDirModel);
sortFilter->setDynamicSortFilter(true);
localDirModel->sort(0, Qt::AscendingOrder);
localDirView = new QTreeView;
localDirView->setModel(sortFilter);
localDirView->setModel(localDirModel);
localDirView->setColumnHidden(1, true);
localDirView->setRootIndex(sortFilter->mapFromSource(localDirModel->index(localDirModel->rootPath(), 0)));
localDirView->setRootIndex(localDirModel->index(localDirModel->rootPath(), 0));
localDirView->setSortingEnabled(true);
localDirView->header()->setResizeMode(QHeaderView::ResizeToContents);
sortFilter->sort(0, Qt::AscendingOrder);
localDirView->header()->setSortIndicator(0, Qt::AscendingOrder);
leftToolBar = new QToolBar;
@ -124,7 +119,7 @@ void TabDeckStorage::retranslateUi()
void TabDeckStorage::actOpenLocalDeck()
{
QModelIndex curLeft = sortFilter->mapToSource(localDirView->selectionModel()->currentIndex());
QModelIndex curLeft = localDirView->selectionModel()->currentIndex();
if (localDirModel->isDir(curLeft))
return;
QString filePath = localDirModel->filePath(curLeft);
@ -139,7 +134,7 @@ void TabDeckStorage::actOpenLocalDeck()
void TabDeckStorage::actUpload()
{
QModelIndex curLeft = sortFilter->mapToSource(localDirView->selectionModel()->currentIndex());
QModelIndex curLeft = localDirView->selectionModel()->currentIndex();
if (localDirModel->isDir(curLeft))
return;
QString filePath = localDirModel->filePath(curLeft);
@ -209,7 +204,7 @@ void TabDeckStorage::openRemoteDeckFinished(const Response &r)
void TabDeckStorage::actDownload()
{
QString filePath;
QModelIndex curLeft = sortFilter->mapToSource(localDirView->selectionModel()->currentIndex());
QModelIndex curLeft = localDirView->selectionModel()->currentIndex();
if (!curLeft.isValid())
filePath = localDirModel->rootPath();
else {