Made search bar in resource browser feel more responsive
This commit is contained in:
parent
678ca01fb1
commit
5ac292ebc5
|
@ -45,6 +45,7 @@ CResourceBrowser::CResourceBrowser(QWidget *pParent)
|
||||||
connect(mpUI->DirectoryTreeView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(OnDirectorySelectionChanged(QModelIndex,QModelIndex)));
|
connect(mpUI->DirectoryTreeView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(OnDirectorySelectionChanged(QModelIndex,QModelIndex)));
|
||||||
connect(mpUI->ResourceTableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(OnDoubleClickResource(QModelIndex)));
|
connect(mpUI->ResourceTableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(OnDoubleClickResource(QModelIndex)));
|
||||||
connect(pImportFromContentsTxtAction, SIGNAL(triggered()), this, SLOT(OnImportPakContentsTxt()));
|
connect(pImportFromContentsTxtAction, SIGNAL(triggered()), this, SLOT(OnImportPakContentsTxt()));
|
||||||
|
connect(&mUpdateFilterTimer, SIGNAL(timeout()), this, SLOT(UpdateFilter()));
|
||||||
}
|
}
|
||||||
|
|
||||||
CResourceBrowser::~CResourceBrowser()
|
CResourceBrowser::~CResourceBrowser()
|
||||||
|
@ -79,7 +80,8 @@ void CResourceBrowser::OnSortModeChanged(int Index)
|
||||||
|
|
||||||
void CResourceBrowser::OnSearchStringChanged()
|
void CResourceBrowser::OnSearchStringChanged()
|
||||||
{
|
{
|
||||||
mpProxyModel->SetSearchString( TO_TWIDESTRING(mpUI->SearchBar->text()) );
|
const int kUpdateWaitTime = 500;
|
||||||
|
mUpdateFilterTimer.start(kUpdateWaitTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CResourceBrowser::OnDirectorySelectionChanged(const QModelIndex& rkNewIndex, const QModelIndex& /*rkPrevIndex*/)
|
void CResourceBrowser::OnDirectorySelectionChanged(const QModelIndex& rkNewIndex, const QModelIndex& /*rkPrevIndex*/)
|
||||||
|
@ -139,3 +141,8 @@ void CResourceBrowser::OnImportPakContentsTxt()
|
||||||
|
|
||||||
RefreshResources();
|
RefreshResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CResourceBrowser::UpdateFilter()
|
||||||
|
{
|
||||||
|
mpProxyModel->SetSearchString( TO_TWIDESTRING(mpUI->SearchBar->text()) );
|
||||||
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ class CResourceBrowser : public QDialog
|
||||||
CResourceTableModel *mpModel;
|
CResourceTableModel *mpModel;
|
||||||
CResourceProxyModel *mpProxyModel;
|
CResourceProxyModel *mpProxyModel;
|
||||||
CVirtualDirectoryModel *mpDirectoryModel;
|
CVirtualDirectoryModel *mpDirectoryModel;
|
||||||
|
QTimer mUpdateFilterTimer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CResourceBrowser(QWidget *pParent = 0);
|
explicit CResourceBrowser(QWidget *pParent = 0);
|
||||||
|
@ -31,6 +32,7 @@ public slots:
|
||||||
void OnDirectorySelectionChanged(const QModelIndex& rkNewIndex, const QModelIndex& rkPrevIndex);
|
void OnDirectorySelectionChanged(const QModelIndex& rkNewIndex, const QModelIndex& rkPrevIndex);
|
||||||
void OnDoubleClickResource(QModelIndex Index);
|
void OnDoubleClickResource(QModelIndex Index);
|
||||||
void OnImportPakContentsTxt();
|
void OnImportPakContentsTxt();
|
||||||
|
void UpdateFilter();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CRESOURCEBROWSER_H
|
#endif // CRESOURCEBROWSER_H
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Resource Browser</string>
|
<string>Resource Browser</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="SidebarContainerWidget" native="true">
|
<widget class="QWidget" name="SidebarContainerWidget" native="true">
|
||||||
|
@ -134,6 +132,20 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="ImportNamesButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Import Names</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="ExportNamesButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Export Names</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -186,22 +198,6 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="ImportNamesButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Import Names</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="ExportNamesButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Export Names</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|
Loading…
Reference in New Issue