This commit is contained in:
DavidXanatos 2023-09-30 14:20:20 +02:00
parent bab7db80dc
commit 9d03eaddc5
4 changed files with 25 additions and 9 deletions

View File

@ -9,8 +9,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [1.11.4 / 5.66.4] - 2023-10-
### Fixed
### Fixed
- fixed issue with unmounting protected images [#3347](https://github.com/sandboxie-plus/Sandboxie/issues/3347)
- fixed Unable to turn off highlight in Sbie Messages search results [#3338](https://github.com/sandboxie-plus/Sandboxie/issues/3338)

View File

@ -116,18 +116,18 @@ public:
QObject::connect(m_pFinder, SIGNAL(SetFilter(const QString&, int, int)), this, SLOT(SetFilter(const QString&, int, int)));
}
static void ApplyFilter(QTreeWidgetEx* pTree, QTreeWidgetItem* pItem, const QRegularExpression& Exp/*, bool bHighLight = false, int Col = -1*/)
static void ApplyFilter(QTreeWidgetEx* pTree, QTreeWidgetItem* pItem, const QRegularExpression* Exp/*, bool bHighLight = false, int Col = -1*/)
{
for (int j = 0; j < pTree->columnCount(); j++) {
pItem->setForeground(j, (m_DarkMode && Exp.isValid() && pItem->text(j).contains(Exp)) ? Qt::yellow : pTree->palette().color(QPalette::WindowText));
pItem->setBackground(j, (!m_DarkMode && Exp.isValid() && pItem->text(j).contains(Exp)) ? Qt::yellow : pTree->palette().color(QPalette::Base));
pItem->setForeground(j, (m_DarkMode && Exp && pItem->text(j).contains(*Exp)) ? Qt::yellow : pTree->palette().color(QPalette::WindowText));
pItem->setBackground(j, (!m_DarkMode && Exp && pItem->text(j).contains(*Exp)) ? Qt::yellow : pTree->palette().color(QPalette::Base));
}
for (int i = 0; i < pItem->childCount(); i++)
ApplyFilter(pTree, pItem->child(i), Exp/*, bHighLight, Col*/);
}
static void ApplyFilter(QTreeWidgetEx* pTree, const QRegularExpression& Exp/*, bool bHighLight = false, int Col = -1*/)
static void ApplyFilter(QTreeWidgetEx* pTree, const QRegularExpression* Exp/*, bool bHighLight = false, int Col = -1*/)
{
for (int i = 0; i < pTree->topLevelItemCount(); i++)
ApplyFilter(pTree, pTree->topLevelItem(i), Exp/*, bHighLight, Col*/);
@ -136,9 +136,12 @@ public:
private slots:
void SetFilter(const QString& Exp, int iOptions, int Col = -1) // -1 = any
{
QString ExpStr = ((iOptions & CFinder::eRegExp) == 0) ? Exp : (".*" + QRegularExpression::escape(Exp) + ".*");
QRegularExpression RegExp(ExpStr, (iOptions & CFinder::eCaseSens) != 0 ? QRegularExpression::NoPatternOption : QRegularExpression::CaseInsensitiveOption);
ApplyFilter(m_pTreeList, RegExp);
QScopedPointer<QRegularExpression> pRegExp;
if (!Exp.isEmpty()) {
QString ExpStr = ((iOptions & CFinder::eRegExp) == 0) ? Exp : (".*" + QRegularExpression::escape(Exp) + ".*");
pRegExp.reset(new QRegularExpression(ExpStr, (iOptions & CFinder::eCaseSens) != 0 ? QRegularExpression::NoPatternOption : QRegularExpression::CaseInsensitiveOption));
}
ApplyFilter(m_pTreeList, pRegExp.data());
}
private:

View File

@ -50,9 +50,20 @@ void CStackView::Invalidate()
}
}
void CStackView::SetFilter(const QRegularExpression& Exp, bool bHighLight, int Col)
{
CPanelWidgetEx::ApplyFilter(m_pStackList, Exp/*, bHighLight, Col*/);
CPanelWidgetEx::ApplyFilter(m_pStackList, &Exp/*, bHighLight, Col*/);
}
void CStackView::SetFilter(const QString& Exp, int iOptions, int Col) // -1 = any
{
QScopedPointer<QRegularExpression> pRegExp;
if (!Exp.isEmpty()) {
QString ExpStr = ((iOptions & CFinder::eRegExp) == 0) ? Exp : (".*" + QRegularExpression::escape(Exp) + ".*");
pRegExp.reset(new QRegularExpression(ExpStr, (iOptions & CFinder::eCaseSens) != 0 ? QRegularExpression::NoPatternOption : QRegularExpression::CaseInsensitiveOption));
}
CPanelWidgetEx::ApplyFilter(m_pStackList, pRegExp.data()/*, bHighLight, Col*/);
}
void CStackView::ShowStack(const QVector<quint64>& Stack, const CBoxedProcessPtr& pProcess)

View File

@ -25,6 +25,7 @@ public slots:
//void OnMenu(const QPoint &point);
void SetFilter(const QRegularExpression& Exp, bool bHighLight = false, int Col = -1); // -1 = any
void SetFilter(const QString& Exp, int iOptions = 0, int Col = -1); // -1 = any
protected:
//virtual void OnMenu(const QPoint& Point);