mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-06 17:15:35 +00:00
Add a search function to the "Datafiles" tab of the OpenMW launcher
This commit is contained in:
parent
288911c2d9
commit
6e397e4008
4 changed files with 37 additions and 3 deletions
|
@ -28,6 +28,7 @@
|
||||||
Bug #5441: Enemies can't push a player character when in critical strike stance
|
Bug #5441: Enemies can't push a player character when in critical strike stance
|
||||||
Bug #5451: Magic projectiles don't disappear with the caster
|
Bug #5451: Magic projectiles don't disappear with the caster
|
||||||
Bug #5452: Autowalk is being included in savegames
|
Bug #5452: Autowalk is being included in savegames
|
||||||
|
Feature #5297: Add a search function to the "Datafiles" tab of the OpenMW launcher
|
||||||
Feature #5362: Show the soul gems' trapped soul in count dialog
|
Feature #5362: Show the soul gems' trapped soul in count dialog
|
||||||
Feature #5445: Handle NiLines
|
Feature #5445: Handle NiLines
|
||||||
|
|
||||||
|
|
|
@ -40,16 +40,37 @@ void ContentSelectorView::ContentSelector::buildGameFileView()
|
||||||
ui.gameFileView->setCurrentIndex(0);
|
ui.gameFileView->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AddOnProxyModel : public QSortFilterProxyModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit AddOnProxyModel(QObject* parent = nullptr) :
|
||||||
|
QSortFilterProxyModel(parent)
|
||||||
|
{}
|
||||||
|
|
||||||
|
bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override
|
||||||
|
{
|
||||||
|
static const QString ContentTypeAddon = QString::number((int)ContentSelectorModel::ContentType_Addon);
|
||||||
|
|
||||||
|
QModelIndex nameIndex = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||||
|
const QString userRole = sourceModel()->data(nameIndex, Qt::UserRole).toString();
|
||||||
|
|
||||||
|
return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent) && userRole == ContentTypeAddon;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::buildAddonView()
|
void ContentSelectorView::ContentSelector::buildAddonView()
|
||||||
{
|
{
|
||||||
ui.addonView->setVisible (true);
|
ui.addonView->setVisible (true);
|
||||||
|
|
||||||
mAddonProxyModel = new QSortFilterProxyModel(this);
|
mAddonProxyModel = new AddOnProxyModel(this);
|
||||||
mAddonProxyModel->setFilterRegExp (QString::number((int)ContentSelectorModel::ContentType_Addon));
|
mAddonProxyModel->setFilterRegExp(searchFilter()->text());
|
||||||
mAddonProxyModel->setFilterRole (Qt::UserRole);
|
mAddonProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||||
mAddonProxyModel->setDynamicSortFilter (true);
|
mAddonProxyModel->setDynamicSortFilter (true);
|
||||||
mAddonProxyModel->setSourceModel (mContentModel);
|
mAddonProxyModel->setSourceModel (mContentModel);
|
||||||
|
|
||||||
|
connect(ui.searchFilter, SIGNAL(textEdited(QString)), mAddonProxyModel, SLOT(setFilterWildcard(QString)));
|
||||||
|
connect(ui.searchFilter, SIGNAL(textEdited(QString)), this, SLOT(slotSearchFilterTextChanged(QString)));
|
||||||
|
|
||||||
ui.addonView->setModel(mAddonProxyModel);
|
ui.addonView->setModel(mAddonProxyModel);
|
||||||
|
|
||||||
connect(ui.addonView, SIGNAL(activated(const QModelIndex&)), this, SLOT(slotAddonTableItemActivated(const QModelIndex&)));
|
connect(ui.addonView, SIGNAL(activated(const QModelIndex&)), this, SLOT(slotAddonTableItemActivated(const QModelIndex&)));
|
||||||
|
@ -261,3 +282,8 @@ void ContentSelectorView::ContentSelector::slotCopySelectedItemsPaths()
|
||||||
clipboard->setText(filepaths);
|
clipboard->setText(filepaths);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContentSelectorView::ContentSelector::slotSearchFilterTextChanged(const QString& newText)
|
||||||
|
{
|
||||||
|
ui.addonView->setDragEnabled(newText.isEmpty());
|
||||||
|
}
|
||||||
|
|
|
@ -48,6 +48,9 @@ namespace ContentSelectorView
|
||||||
QToolButton *refreshButton() const
|
QToolButton *refreshButton() const
|
||||||
{ return ui.refreshButton; }
|
{ return ui.refreshButton; }
|
||||||
|
|
||||||
|
QLineEdit *searchFilter() const
|
||||||
|
{ return ui.searchFilter; }
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -74,6 +77,7 @@ namespace ContentSelectorView
|
||||||
void slotCheckMultiSelectedItems();
|
void slotCheckMultiSelectedItems();
|
||||||
void slotUncheckMultiSelectedItems();
|
void slotUncheckMultiSelectedItems();
|
||||||
void slotCopySelectedItemsPaths();
|
void slotCopySelectedItemsPaths();
|
||||||
|
void slotSearchFilterTextChanged(const QString& newText);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,9 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="searchFilter"/>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="refreshButton">
|
<widget class="QToolButton" name="refreshButton">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
|
|
Loading…
Reference in a new issue