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,192 +13,188 @@
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Resource Browser</string>
|
<string>Resource Browser</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<widget class="QWidget" name="SidebarContainerWidget" native="true">
|
||||||
<item>
|
<property name="sizePolicy">
|
||||||
<widget class="QWidget" name="SidebarContainerWidget" native="true">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<property name="sizePolicy">
|
<horstretch>1</horstretch>
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<verstretch>0</verstretch>
|
||||||
<horstretch>1</horstretch>
|
</sizepolicy>
|
||||||
<verstretch>0</verstretch>
|
</property>
|
||||||
</sizepolicy>
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
</property>
|
<property name="leftMargin">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<number>0</number>
|
||||||
<property name="leftMargin">
|
</property>
|
||||||
<number>0</number>
|
<property name="topMargin">
|
||||||
</property>
|
<number>0</number>
|
||||||
<property name="topMargin">
|
</property>
|
||||||
<number>0</number>
|
<property name="rightMargin">
|
||||||
</property>
|
<number>0</number>
|
||||||
<property name="rightMargin">
|
</property>
|
||||||
<number>0</number>
|
<property name="bottomMargin">
|
||||||
</property>
|
<number>0</number>
|
||||||
<property name="bottomMargin">
|
</property>
|
||||||
<number>0</number>
|
<item>
|
||||||
</property>
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<widget class="QLabel" name="StoreLabel">
|
||||||
<item>
|
<property name="text">
|
||||||
<widget class="QLabel" name="StoreLabel">
|
<string>Store:</string>
|
||||||
<property name="text">
|
|
||||||
<string>Store:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="StoreComboBox">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>1</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Project</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Editor</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="SearchBar">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>5</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="placeholderText">
|
|
||||||
<string>Search</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="SortComboBox">
|
<widget class="QComboBox" name="StoreComboBox">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>5</horstretch>
|
<horstretch>1</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Sort by Name</string>
|
<string>Project</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Sort by Size</string>
|
<string>Editor</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QTreeView" name="DirectoryTreeView">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>10</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="editTriggers">
|
|
||||||
<set>QAbstractItemView::NoEditTriggers</set>
|
|
||||||
</property>
|
|
||||||
<property name="alternatingRowColors">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="selectionMode">
|
|
||||||
<enum>QAbstractItemView::SingleSelection</enum>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>16</width>
|
|
||||||
<height>16</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="verticalScrollMode">
|
|
||||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="indentation">
|
|
||||||
<number>12</number>
|
|
||||||
</property>
|
|
||||||
<attribute name="headerVisible">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</item>
|
||||||
</item>
|
<item>
|
||||||
<item>
|
<widget class="QLineEdit" name="SearchBar">
|
||||||
<widget class="QTableView" name="ResourceTableView">
|
<property name="sizePolicy">
|
||||||
<property name="sizePolicy">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<horstretch>5</horstretch>
|
||||||
<horstretch>3</horstretch>
|
<verstretch>0</verstretch>
|
||||||
<verstretch>0</verstretch>
|
</sizepolicy>
|
||||||
</sizepolicy>
|
</property>
|
||||||
</property>
|
<property name="placeholderText">
|
||||||
<property name="font">
|
<string>Search</string>
|
||||||
<font>
|
</property>
|
||||||
<pointsize>10</pointsize>
|
</widget>
|
||||||
</font>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
<property name="editTriggers">
|
<widget class="QComboBox" name="SortComboBox">
|
||||||
<set>QAbstractItemView::NoEditTriggers</set>
|
<property name="sizePolicy">
|
||||||
</property>
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<property name="alternatingRowColors">
|
<horstretch>5</horstretch>
|
||||||
<bool>true</bool>
|
<verstretch>0</verstretch>
|
||||||
</property>
|
</sizepolicy>
|
||||||
<property name="selectionMode">
|
</property>
|
||||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
<item>
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="selectionBehavior">
|
<string>Sort by Name</string>
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
</property>
|
||||||
</property>
|
</item>
|
||||||
<property name="verticalScrollMode">
|
<item>
|
||||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
<property name="text">
|
||||||
</property>
|
<string>Sort by Size</string>
|
||||||
<property name="horizontalScrollMode">
|
</property>
|
||||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
</item>
|
||||||
</property>
|
</widget>
|
||||||
<property name="sortingEnabled">
|
</item>
|
||||||
<bool>true</bool>
|
<item>
|
||||||
</property>
|
<widget class="QTreeView" name="DirectoryTreeView">
|
||||||
<attribute name="horizontalHeaderVisible">
|
<property name="font">
|
||||||
<bool>false</bool>
|
<font>
|
||||||
</attribute>
|
<pointsize>10</pointsize>
|
||||||
<attribute name="verticalHeaderVisible">
|
</font>
|
||||||
<bool>false</bool>
|
</property>
|
||||||
</attribute>
|
<property name="editTriggers">
|
||||||
<attribute name="verticalHeaderDefaultSectionSize">
|
<set>QAbstractItemView::NoEditTriggers</set>
|
||||||
<number>21</number>
|
</property>
|
||||||
</attribute>
|
<property name="alternatingRowColors">
|
||||||
<attribute name="verticalHeaderMinimumSectionSize">
|
<bool>true</bool>
|
||||||
<number>21</number>
|
</property>
|
||||||
</attribute>
|
<property name="selectionMode">
|
||||||
</widget>
|
<enum>QAbstractItemView::SingleSelection</enum>
|
||||||
</item>
|
</property>
|
||||||
</layout>
|
<property name="iconSize">
|
||||||
</item>
|
<size>
|
||||||
<item>
|
<width>16</width>
|
||||||
<widget class="QPushButton" name="ImportNamesButton">
|
<height>16</height>
|
||||||
<property name="text">
|
</size>
|
||||||
<string>Import Names</string>
|
</property>
|
||||||
</property>
|
<property name="verticalScrollMode">
|
||||||
|
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="indentation">
|
||||||
|
<number>12</number>
|
||||||
|
</property>
|
||||||
|
<attribute name="headerVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</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>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="ExportNamesButton">
|
<widget class="QTableView" name="ResourceTableView">
|
||||||
<property name="text">
|
<property name="sizePolicy">
|
||||||
<string>Export Names</string>
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>3</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="editTriggers">
|
||||||
|
<set>QAbstractItemView::NoEditTriggers</set>
|
||||||
|
</property>
|
||||||
|
<property name="alternatingRowColors">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||||
|
</property>
|
||||||
|
<property name="selectionBehavior">
|
||||||
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
|
</property>
|
||||||
|
<property name="verticalScrollMode">
|
||||||
|
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalScrollMode">
|
||||||
|
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sortingEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="horizontalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderDefaultSectionSize">
|
||||||
|
<number>21</number>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderMinimumSectionSize">
|
||||||
|
<number>21</number>
|
||||||
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
Loading…
Reference in New Issue