Build 0.9.8
This commit is contained in:
parent
39a431e007
commit
0472a1afc8
|
@ -17,6 +17,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||
- added uninstall cleanup of extra files for the Plus installer (by mpheath) [#1235](https://github.com/sandboxie-plus/Sandboxie/pull/1235)
|
||||
- added set language for Sandman for the Plus installer (by mpheath) [#1241](https://github.com/sandboxie-plus/Sandboxie/issues/1241)
|
||||
- added EventLog messages with SbieMsg.dll for the Plus installer (by mpheath)
|
||||
- group expansion state is now saved
|
||||
- added additional filters to the trace tab
|
||||
|
||||
### Changed
|
||||
- reworked and extended RPC logging
|
||||
|
@ -28,6 +30,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||
- fixed inability to delete read-only files from sandboxed explorer [#1237](https://github.com/sandboxie-plus/Sandboxie/issues/1237)
|
||||
- fixed wrong recovery target in Plus UI [#1274](https://github.com/sandboxie-plus/Sandboxie/issues/1274)
|
||||
- fixed SBIE2101 issue introduced with 0.9.7a [#1279](https://github.com/sandboxie-plus/Sandboxie/issues/1279)
|
||||
- fixed inability to delete read only files from sandboxed explorer [#1237](https://github.com/sandboxie-plus/Sandboxie/issues/1237)
|
||||
- fixed wrong recovery target in plus ui [#1274](https://github.com/sandboxie-plus/Sandboxie/issues/1274)
|
||||
- fixed sorting in the box picker window [#1269](https://github.com/sandboxie-plus/Sandboxie/issues/1269)
|
||||
- fixed tray refresh issue [#1250](https://github.com/sandboxie-plus/Sandboxie/issues/1250)
|
||||
- fixed tray activity display [#1221](https://github.com/sandboxie-plus/Sandboxie/issues/1221)
|
||||
|
@ -38,6 +42,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||
- fixed issue with git.exe from MinGW freezing [#1238](https://github.com/sandboxie-plus/Sandboxie/issues/1238)
|
||||
- fixed issue with search highlighting when using in dark mode
|
||||
|
||||
### Removed
|
||||
- removed the ability to sort the trace log as it took to much CPU
|
||||
|
||||
|
||||
## [0.9.7e / 5.52.5] - 2021-10-09
|
||||
|
|
|
@ -42,10 +42,16 @@ CFinder::CFinder(QObject* pFilterTarget, QWidget *parent, bool HighLightOption)
|
|||
m_pSearchLayout->addWidget(m_pRegExp);
|
||||
connect(m_pRegExp, SIGNAL(stateChanged(int)), this, SLOT(OnUpdate()));
|
||||
|
||||
m_pSortProxy = qobject_cast<QSortFilterProxyModel*>(pFilterTarget);
|
||||
|
||||
if (m_pSortProxy) {
|
||||
m_pColumn = new QComboBox();
|
||||
m_pSearchLayout->addWidget(m_pColumn);
|
||||
connect(m_pColumn, SIGNAL(currentIndexChanged(int)), this, SLOT(OnUpdate()));
|
||||
m_pColumn->setVisible(false);
|
||||
}
|
||||
else
|
||||
m_pColumn = NULL;
|
||||
|
||||
if (HighLightOption)
|
||||
{
|
||||
|
@ -85,7 +91,6 @@ CFinder::CFinder(QObject* pFilterTarget, QWidget *parent, bool HighLightOption)
|
|||
QObject::connect(pFind, SIGNAL(triggered()), this, SLOT(Open()));
|
||||
}
|
||||
|
||||
m_pSortProxy = qobject_cast<QSortFilterProxyModel*>(pFilterTarget);
|
||||
if (pFilterTarget) {
|
||||
QObject::connect(this, SIGNAL(SetFilter(const QRegExp&, bool, int)), pFilterTarget, SLOT(SetFilter(const QRegExp&, bool, int)));
|
||||
QObject::connect(this, SIGNAL(SelectNext()), pFilterTarget, SLOT(SelectNext()));
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
|
||||
QRegExp GetRegExp() const;
|
||||
bool GetHighLight() const { return m_pHighLight ? m_pHighLight->isChecked() : false; }
|
||||
int GetColumn() const { return m_pColumn->currentData().toInt(); }
|
||||
int GetColumn() const { return m_pColumn ? m_pColumn->currentData().toInt() : -1; }
|
||||
|
||||
signals:
|
||||
void SetFilter(const QRegExp& Exp, bool bHighLight = false, int Column = -1);
|
||||
|
|
|
@ -96,26 +96,32 @@ CTraceEntry::CTraceEntry(quint32 ProcessId, quint32 ThreadId, quint32 Type, cons
|
|||
}
|
||||
}
|
||||
|
||||
QString CTraceEntry::GetTypeStr(quint32 Type)
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
case MONITOR_APICALL: return "ApiCall"; break;
|
||||
case MONITOR_SYSCALL: return "SysCall"; break;
|
||||
case MONITOR_PIPE: return "Pipe"; break;
|
||||
case MONITOR_IPC: return "Ipc"; break;
|
||||
case MONITOR_WINCLASS: return "WinClass"; break;
|
||||
case MONITOR_DRIVE: return "Drive"; break;
|
||||
case MONITOR_COMCLASS: return "ComClass"; break;
|
||||
case MONITOR_RTCLASS: return "RtClass"; break;
|
||||
case MONITOR_IGNORE: return "Ignore"; break;
|
||||
case MONITOR_IMAGE: return "Image"; break;
|
||||
case MONITOR_FILE: return "File"; break;
|
||||
case MONITOR_KEY: return "Key"; break;
|
||||
case MONITOR_OTHER: return "Debug"; break;
|
||||
default: return QString();
|
||||
}
|
||||
}
|
||||
|
||||
QString CTraceEntry::GetTypeStr() const
|
||||
{
|
||||
QString Type;
|
||||
switch (m_Type.Type)
|
||||
{
|
||||
case MONITOR_APICALL: Type = "ApiCall"; break;
|
||||
case MONITOR_SYSCALL: Type = "SysCall"; break;
|
||||
case MONITOR_PIPE: Type = "Pipe"; break;
|
||||
case MONITOR_IPC: Type = "Ipc"; break;
|
||||
case MONITOR_WINCLASS: Type = "WinClass"; break;
|
||||
case MONITOR_DRIVE: Type = "Drive"; break;
|
||||
case MONITOR_COMCLASS: Type = "ComClass"; break;
|
||||
case MONITOR_RTCLASS: Type = "RtClass"; break;
|
||||
case MONITOR_IGNORE: Type = "Ignore"; break;
|
||||
case MONITOR_IMAGE: Type = "Image"; break;
|
||||
case MONITOR_FILE: Type = "File"; break;
|
||||
case MONITOR_KEY: Type = "Key"; break;
|
||||
case MONITOR_OTHER: Type = "Debug"; break;
|
||||
default: Type = "Unknown: " + QString::number(m_Type.Type);
|
||||
}
|
||||
QString Type = GetTypeStr(m_Type.Type);
|
||||
if(Type.isEmpty())
|
||||
Type = "Unknown: " + QString::number(m_Type.Type);
|
||||
|
||||
if (m_Type.User)
|
||||
Type.append(" (U)");
|
||||
|
@ -125,15 +131,30 @@ QString CTraceEntry::GetTypeStr() const
|
|||
return Type;
|
||||
}
|
||||
|
||||
bool CTraceEntry::IsOpen() const
|
||||
{
|
||||
return (m_Type.Flags & MONITOR_DISPOSITION_MASK) == MONITOR_OPEN;
|
||||
}
|
||||
|
||||
bool CTraceEntry::IsClosed() const
|
||||
{
|
||||
return (m_Type.Flags & MONITOR_DISPOSITION_MASK) == MONITOR_DENY;
|
||||
}
|
||||
|
||||
bool CTraceEntry::IsTrace() const
|
||||
{
|
||||
return m_Type.Trace;
|
||||
}
|
||||
|
||||
QString CTraceEntry::GetStautsStr() const
|
||||
{
|
||||
QString Status;
|
||||
if ((m_Type.Flags & MONITOR_DISPOSITION_MASK) == MONITOR_OPEN)
|
||||
if (IsOpen())
|
||||
Status.append("Open ");
|
||||
if ((m_Type.Flags & MONITOR_DISPOSITION_MASK) == MONITOR_DENY)
|
||||
if (IsClosed())
|
||||
Status.append("Closed ");
|
||||
|
||||
if (m_Type.Trace)
|
||||
if (IsTrace())
|
||||
Status.append("Trace ");
|
||||
|
||||
if (m_Counter > 1)
|
||||
|
|
|
@ -35,6 +35,7 @@ public:
|
|||
virtual QDateTime GetTimeStamp() const { return m_TimeStamp; }
|
||||
|
||||
virtual quint16 GetType() const { return m_Type.Flags; }
|
||||
static QString GetTypeStr(quint32 Type);
|
||||
virtual QString GetTypeStr() const;
|
||||
virtual QString GetStautsStr() const;
|
||||
|
||||
|
@ -54,6 +55,10 @@ public:
|
|||
m_Counter++; this->m_Type.Flags |= pOther->m_Type.Flags;
|
||||
}
|
||||
|
||||
virtual bool IsOpen() const;
|
||||
virtual bool IsClosed() const;
|
||||
virtual bool IsTrace() const;
|
||||
|
||||
quint64 GetUID() const { return m_uid; }
|
||||
|
||||
protected:
|
||||
|
|
|
@ -11,7 +11,6 @@ CTraceModel::CTraceModel(QObject* parent)
|
|||
m_Root = MkNode(QVariant());
|
||||
|
||||
m_LastCount = 0;
|
||||
m_LastBoxPtr = NULL;
|
||||
}
|
||||
|
||||
CTraceModel::~CTraceModel()
|
||||
|
@ -48,7 +47,7 @@ bool CTraceModel::TestPath(const QList<QVariant>& Path, const CTraceEntryPtr& pE
|
|||
return Path.size() == Index;
|
||||
}*/
|
||||
|
||||
QList<QVariant> CTraceModel::Sync(const QVector<CTraceEntryPtr>& EntryList, void* BoxPtr)
|
||||
QList<QVariant> CTraceModel::Sync(const QVector<CTraceEntryPtr>& EntryList, int (*Filter)(const CTraceEntryPtr&, void*), void* params)
|
||||
{
|
||||
QList<QVariant> Added;
|
||||
QMap<QList<QVariant>, QList<STreeNode*> > New;
|
||||
|
@ -57,7 +56,7 @@ QList<QVariant> CTraceModel::Sync(const QVector<CTraceEntryPtr>& EntryList, void
|
|||
// Note: since this is a log and we ever always only add entries we save cpu time by always skipping the already know portion of the list
|
||||
|
||||
int i = 0;
|
||||
if (EntryList.count() >= m_LastCount && m_LastCount > 0 && m_LastBoxPtr == BoxPtr)
|
||||
if (EntryList.count() >= m_LastCount && m_LastCount > 0)
|
||||
{
|
||||
i = m_LastCount - 1;
|
||||
if (m_LastID == EntryList.at(i)->GetUID())
|
||||
|
@ -68,13 +67,13 @@ QList<QVariant> CTraceModel::Sync(const QVector<CTraceEntryPtr>& EntryList, void
|
|||
else
|
||||
i = 0;
|
||||
}
|
||||
m_LastBoxPtr = BoxPtr;
|
||||
|
||||
for (; i < EntryList.count(); i++)
|
||||
{
|
||||
CTraceEntryPtr pEntry = EntryList.at(i);
|
||||
|
||||
if (BoxPtr && pEntry->GetBoxPtr() != BoxPtr)
|
||||
int iFilter = Filter(pEntry, params);
|
||||
if (!iFilter)
|
||||
continue;
|
||||
|
||||
quint64 ID = pEntry->GetUID();
|
||||
|
@ -110,15 +109,11 @@ QList<QVariant> CTraceModel::Sync(const QVector<CTraceEntryPtr>& EntryList, void
|
|||
bool State = false;
|
||||
int Changed = 0;
|
||||
|
||||
// Note: icons are loaded asynchroniusly
|
||||
/*if (m_bUseIcons && !pNode->Icon.isValid() && m_Columns.contains(eHandle))
|
||||
{
|
||||
QPixmap Icon = pNode->pEntry->GetFileIcon();
|
||||
if (!Icon.isNull()) {
|
||||
Changed = true; // set change for first column
|
||||
pNode->Icon = Icon;
|
||||
if (pNode->bHighLight != (iFilter == 2)) {
|
||||
pNode->bHighLight = (iFilter == 2);
|
||||
pNode->Color = pNode->bHighLight ? Qt::yellow : QColor();
|
||||
Changed = -1;
|
||||
}
|
||||
}*/
|
||||
|
||||
for (int section = 0; section < columnCount(); section++)
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@ public:
|
|||
CTraceModel(QObject* parent = 0);
|
||||
~CTraceModel();
|
||||
|
||||
QList<QVariant> Sync(const QVector<CTraceEntryPtr>& EntryList, void* BoxPtr);
|
||||
QList<QVariant> Sync(const QVector<CTraceEntryPtr>& EntryList, int (*Filter)(const CTraceEntryPtr&, void*), void* params);
|
||||
|
||||
CTraceEntryPtr GetEntry(const QModelIndex& index) const;
|
||||
|
||||
|
@ -45,14 +45,14 @@ signals:
|
|||
protected:
|
||||
struct STraceNode : STreeNode
|
||||
{
|
||||
STraceNode(const QVariant& Id) : STreeNode(Id) {}
|
||||
STraceNode(const QVariant& Id) : STreeNode(Id) { bHighLight = false; }
|
||||
|
||||
CTraceEntryPtr pEntry;
|
||||
bool bHighLight;
|
||||
};
|
||||
|
||||
QVariant m_LastID;
|
||||
int m_LastCount;
|
||||
void* m_LastBoxPtr;
|
||||
|
||||
virtual STreeNode* MkNode(const QVariant& Id) { return new STraceNode(Id); }
|
||||
virtual STreeNode* MkVirtualNode(const QVariant& Id, STreeNode* pParent);
|
||||
|
|
|
@ -534,6 +534,9 @@ void CSandMan::closeEvent(QCloseEvent *e)
|
|||
}
|
||||
}
|
||||
|
||||
if(theAPI->IsConnected())
|
||||
m_pBoxView->SaveUserConfig();
|
||||
|
||||
if (IsFullyPortable() && theAPI->IsConnected())
|
||||
{
|
||||
int PortableStop = theConf->GetInt("Options/PortableStop", -1);
|
||||
|
@ -1615,7 +1618,7 @@ void CSandMan::OnReloadIni()
|
|||
|
||||
void CSandMan::OnIniReloaded()
|
||||
{
|
||||
m_pBoxView->ReloadGroups();
|
||||
m_pBoxView->ReloadUserConfig();
|
||||
m_pPopUpWindow->ReloadHiddenMessages();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ CSbieView::CSbieView(QWidget* parent) : CPanelView(parent)
|
|||
m_pMainLayout->setMargin(0);
|
||||
this->setLayout(m_pMainLayout);
|
||||
|
||||
m_UserConfigChanged = false;
|
||||
|
||||
m_pSbieModel = new CSbieModel();
|
||||
m_pSbieModel->SetTree(true);
|
||||
m_pSbieModel->SetUseIcons(true);
|
||||
|
@ -56,6 +58,8 @@ CSbieView::CSbieView(QWidget* parent) : CPanelView(parent)
|
|||
connect(m_pSbieTree, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OnMenu(const QPoint &)));
|
||||
connect(m_pSbieTree, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(OnDoubleClicked(const QModelIndex&)));
|
||||
connect(m_pSbieTree->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SLOT(ProcessSelection(QItemSelection, QItemSelection)));
|
||||
connect(m_pSbieTree, SIGNAL(expanded(const QModelIndex &)), this, SLOT(OnExpanded(const QModelIndex &)));
|
||||
connect(m_pSbieTree, SIGNAL(collapsed(const QModelIndex &)), this, SLOT(OnCollapsed(const QModelIndex &)));
|
||||
|
||||
//connect(theGUI, SIGNAL(ReloadPanels()), m_pSbieModel, SLOT(Clear()));
|
||||
|
||||
|
@ -220,7 +224,22 @@ void CSbieView::Refresh()
|
|||
{
|
||||
QTimer::singleShot(100, this, [this, Added]() {
|
||||
foreach(const QVariant ID, Added) {
|
||||
m_pSbieTree->expand(m_pSortProxy->mapFromSource(m_pSbieModel->FindIndex(ID)));
|
||||
|
||||
QModelIndex ModelIndex = m_pSbieModel->FindIndex(ID);
|
||||
|
||||
if (m_pSbieModel->GetType(ModelIndex) == CSbieModel::eProcess)
|
||||
m_pSbieTree->expand(m_pSortProxy->mapFromSource(ModelIndex));
|
||||
else
|
||||
{
|
||||
QString Name;
|
||||
if (m_pSbieModel->GetType(ModelIndex) == CSbieModel::eGroup)
|
||||
Name = m_pSbieModel->GetID(ModelIndex).toString();
|
||||
else if (m_pSbieModel->GetType(ModelIndex) == CSbieModel::eBox)
|
||||
Name = m_pSbieModel->GetSandBox(ModelIndex)->GetName();
|
||||
|
||||
if (!m_Collapsed.contains(Name))
|
||||
m_pSbieTree->expand(m_pSortProxy->mapFromSource(ModelIndex));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -351,6 +370,10 @@ void CSbieView::UpdateMenu()
|
|||
m_pMenuOptions->setEnabled(iSandBoxeCount == 1);
|
||||
m_pMenuSnapshots->setEnabled(iSandBoxeCount == 1);
|
||||
|
||||
m_pMenuMoveUp->setEnabled(m_pSortProxy->sortRole() == Qt::InitialSortOrderRole);
|
||||
m_pMenuMoveDown->setEnabled(m_pSortProxy->sortRole() == Qt::InitialSortOrderRole);
|
||||
//m_pMenuMoveBy->setEnabled(m_pSortProxy->sortRole() == Qt::InitialSortOrderRole);
|
||||
|
||||
for (int i = m_iMenuBox; i < m_iMenuProc; i++)
|
||||
MenuActions[i]->setVisible(iProcessCount != 0 && iSandBoxeCount == 0);
|
||||
|
||||
|
@ -435,17 +458,6 @@ int CSbieView__ParseGroup(const QString& Grouping, QMap<QString, QStringList>& m
|
|||
return Index;
|
||||
}
|
||||
|
||||
void CSbieView::ReloadGroups()
|
||||
{
|
||||
m_Groups.clear();
|
||||
|
||||
QString Grouping = theAPI->GetUserSettings()->GetText("BoxDisplayOrder");
|
||||
|
||||
CSbieView__ParseGroup(Grouping, m_Groups);
|
||||
|
||||
UpdateGroupMenu();
|
||||
}
|
||||
|
||||
void CSbieView::UpdateGroupMenu()
|
||||
{
|
||||
// update move to menu
|
||||
|
@ -655,8 +667,7 @@ void CSbieView::OnGroupAction()
|
|||
m_pSbieModel->Clear(); //todo improve that
|
||||
}
|
||||
|
||||
QString Grouping = CSbieView__SerializeGroup(m_Groups);
|
||||
theAPI->GetUserSettings()->SetText("BoxDisplayOrder", Grouping);
|
||||
m_UserConfigChanged = true;
|
||||
UpdateGroupMenu();
|
||||
}
|
||||
|
||||
|
@ -689,8 +700,8 @@ QString CSbieView::AddNewGroup()
|
|||
|
||||
m_Groups[Parent].append(Name);
|
||||
|
||||
QString Grouping = CSbieView__SerializeGroup(m_Groups);
|
||||
theAPI->GetUserSettings()->SetText("BoxDisplayOrder", Grouping);
|
||||
|
||||
m_UserConfigChanged = true;
|
||||
UpdateGroupMenu();
|
||||
|
||||
return Name;
|
||||
|
@ -1261,3 +1272,48 @@ void CSbieView::ShowOptions(const QString& Name)
|
|||
|
||||
OnDoubleClicked(ModelIndex);
|
||||
}
|
||||
|
||||
void CSbieView::ChangeExpand(const QModelIndex& index, bool bExpand)
|
||||
{
|
||||
QModelIndex ModelIndex = m_pSortProxy->mapToSource(index);
|
||||
|
||||
if (m_pSbieModel->GetType(ModelIndex) == CSbieModel::eProcess)
|
||||
return;
|
||||
|
||||
QString Name;
|
||||
if (m_pSbieModel->GetType(ModelIndex) == CSbieModel::eGroup)
|
||||
Name = m_pSbieModel->GetID(ModelIndex).toString();
|
||||
else if (m_pSbieModel->GetType(ModelIndex) == CSbieModel::eBox)
|
||||
Name = m_pSbieModel->GetSandBox(ModelIndex)->GetName();
|
||||
|
||||
m_UserConfigChanged = true;
|
||||
if(bExpand)
|
||||
m_Collapsed.remove(Name);
|
||||
else
|
||||
m_Collapsed.insert(Name);
|
||||
}
|
||||
|
||||
void CSbieView::ReloadUserConfig()
|
||||
{
|
||||
m_Groups.clear();
|
||||
|
||||
QString Grouping = theAPI->GetUserSettings()->GetText("BoxDisplayOrder");
|
||||
|
||||
CSbieView__ParseGroup(Grouping, m_Groups);
|
||||
|
||||
UpdateGroupMenu();
|
||||
|
||||
m_Collapsed = SplitStr(theAPI->GetUserSettings()->GetText("BoxCollapsedView"), ",").toSet();
|
||||
}
|
||||
|
||||
void CSbieView::SaveUserConfig()
|
||||
{
|
||||
if (!m_UserConfigChanged)
|
||||
return;
|
||||
m_UserConfigChanged = false;
|
||||
|
||||
QString Grouping = CSbieView__SerializeGroup(m_Groups);
|
||||
theAPI->GetUserSettings()->SetText("BoxDisplayOrder", Grouping);
|
||||
|
||||
theAPI->GetUserSettings()->SetText("BoxCollapsedView", m_Collapsed.toList().join(","));
|
||||
}
|
|
@ -31,7 +31,8 @@ public:
|
|||
public slots:
|
||||
void Clear();
|
||||
void Refresh();
|
||||
void ReloadGroups();
|
||||
void ReloadUserConfig();
|
||||
void SaveUserConfig();
|
||||
|
||||
private slots:
|
||||
void OnToolTipCallback(const QVariant& ID, QString& ToolTip);
|
||||
|
@ -46,6 +47,9 @@ private slots:
|
|||
void OnSandBoxAction(QAction* pAction);
|
||||
void OnProcessAction();
|
||||
|
||||
void OnExpanded(const QModelIndex& index) { ChangeExpand(index, true); }
|
||||
void OnCollapsed(const QModelIndex& index) { ChangeExpand(index, false); }
|
||||
|
||||
protected:
|
||||
virtual void OnMenu(const QPoint& Point);
|
||||
virtual QTreeView* GetView() { return m_pSbieTree; }
|
||||
|
@ -54,6 +58,8 @@ protected:
|
|||
virtual void UpdateRunMenu(const CSandBoxPtr& pBox);
|
||||
|
||||
QMap<QString, QStringList> m_Groups;
|
||||
QSet<QString> m_Collapsed;
|
||||
bool m_UserConfigChanged;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -64,6 +70,8 @@ private:
|
|||
QString FindParent(const QString& Name);
|
||||
bool IsParentOf(const QString& Name, const QString& Group);
|
||||
|
||||
void ChangeExpand(const QModelIndex& index, bool bExpand);
|
||||
|
||||
QVBoxLayout* m_pMainLayout;
|
||||
|
||||
QTreeViewEx* m_pSbieTree;
|
||||
|
|
|
@ -6,48 +6,57 @@
|
|||
#include "..\..\MiscHelpers\Common\Common.h"
|
||||
#include "SbieView.h"
|
||||
|
||||
class CTraceFilterProxyModel : public CSortFilterProxyModel
|
||||
{
|
||||
public:
|
||||
CTraceFilterProxyModel(QObject* parrent = 0) : CSortFilterProxyModel(false, parrent)
|
||||
{
|
||||
m_FilterPid = 0;
|
||||
m_FilterTid = 0;
|
||||
}
|
||||
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
|
||||
{
|
||||
CTraceModel* pTraceModel = (CTraceModel*)sourceModel();
|
||||
|
||||
QModelIndex index = pTraceModel->index(source_row, 0, source_parent);
|
||||
//CTraceEntryPtr pEntry = pTraceModel->GetEntry(index);
|
||||
//if (pEntry.data() == NULL)
|
||||
{
|
||||
QVariant Id = pTraceModel->GetItemID(index);
|
||||
StrPair typeId = Split2(Id.toString(), "_");
|
||||
|
||||
if (m_FilterPid != 0 && typeId.first == "pid") {
|
||||
if (m_FilterPid != typeId.second.toUInt())
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_FilterTid != 0 && typeId.first == "tid") {
|
||||
if (m_FilterTid != typeId.second.toUInt())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return CSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
|
||||
}
|
||||
|
||||
quint32 m_FilterPid;
|
||||
quint32 m_FilterTid;
|
||||
};
|
||||
//class CTraceFilterProxyModel : public CSortFilterProxyModel
|
||||
//{
|
||||
//public:
|
||||
// CTraceFilterProxyModel(QObject* parrent = 0) : CSortFilterProxyModel(false, parrent)
|
||||
// {
|
||||
// m_FilterPid = 0;
|
||||
// m_FilterTid = 0;
|
||||
// }
|
||||
//
|
||||
// bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
|
||||
// {
|
||||
// CTraceModel* pTraceModel = (CTraceModel*)sourceModel();
|
||||
//
|
||||
// QModelIndex index = pTraceModel->index(source_row, 0, source_parent);
|
||||
// //CTraceEntryPtr pEntry = pTraceModel->GetEntry(index);
|
||||
// //if (pEntry.data() == NULL)
|
||||
// {
|
||||
// QVariant Id = pTraceModel->GetItemID(index);
|
||||
// StrPair typeId = Split2(Id.toString(), "_");
|
||||
//
|
||||
// if (m_FilterPid != 0 && typeId.first == "pid") {
|
||||
// if (m_FilterPid != typeId.second.toUInt())
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (m_FilterTid != 0 && typeId.first == "tid") {
|
||||
// if (m_FilterTid != typeId.second.toUInt())
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return CSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
|
||||
// }
|
||||
//
|
||||
// quint32 m_FilterPid;
|
||||
// quint32 m_FilterTid;
|
||||
//};
|
||||
|
||||
CTraceView::CTraceView(QWidget* parent) : CPanelWidget<QTreeViewEx>(parent)
|
||||
{
|
||||
//m_pTreeList->setItemDelegate(theGUI->GetItemDelegate());
|
||||
|
||||
m_FullRefresh = true;
|
||||
|
||||
m_bHighLight = false;
|
||||
//m_FilterCol = -1;
|
||||
m_FilterPid = 0;
|
||||
m_FilterTid = 0;
|
||||
m_FilterType = 0;
|
||||
m_FilterStatus = 0;
|
||||
|
||||
m_pTreeList->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
|
||||
m_pTraceToolBar = new QToolBar();
|
||||
|
@ -56,23 +65,47 @@ CTraceView::CTraceView(QWidget* parent) : CPanelWidget<QTreeViewEx>(parent)
|
|||
m_pTraceTree->setChecked(theConf->GetBool("Options/UseLogTree"));
|
||||
m_pTraceToolBar->addSeparator();
|
||||
m_pTraceToolBar->layout()->setSpacing(3);
|
||||
m_pTraceToolBar->addWidget(new QLabel(tr("PID:")));
|
||||
|
||||
m_pTraceToolBar->addWidget(new QLabel(tr("PID:")));
|
||||
m_pTracePid = new QComboBox();
|
||||
m_pTracePid->addItem(tr("[All]"), 0);
|
||||
m_pTracePid->setMinimumWidth(225);
|
||||
connect(m_pTracePid, SIGNAL(currentIndexChanged(int)), this, SLOT(OnSetPidFilter()));
|
||||
m_pTraceToolBar->addWidget(m_pTracePid);
|
||||
m_pTraceToolBar->addWidget(new QLabel(tr("TID:")));
|
||||
|
||||
m_pTraceToolBar->addWidget(new QLabel(tr("TID:")));
|
||||
m_pTraceTid = new QComboBox();
|
||||
m_pTraceTid->addItem(tr("[All]"), 0);
|
||||
m_pTraceTid->setMinimumWidth(75);
|
||||
connect(m_pTraceTid, SIGNAL(currentIndexChanged(int)), this, SLOT(OnSetTidFilter()));
|
||||
m_pTraceToolBar->addWidget(m_pTraceTid);
|
||||
|
||||
m_pOnlyCurrent = new QCheckBox(tr("Filter selected box only"));
|
||||
m_pTraceToolBar->addWidget(m_pOnlyCurrent);
|
||||
m_pTraceToolBar->addWidget(new QLabel(tr("Type:")));
|
||||
m_pTraceType = new QComboBox();
|
||||
m_pTraceType->addItem(tr("[All]"), 0);
|
||||
for (quint32 i = 0; i < 0xff; i++) {
|
||||
QString TypeStr = CTraceEntry::GetTypeStr(i);
|
||||
if(!TypeStr.isEmpty())
|
||||
m_pTraceType->addItem(TypeStr, i);
|
||||
}
|
||||
m_pTraceType->setMinimumWidth(75);
|
||||
connect(m_pTraceType, SIGNAL(currentIndexChanged(int)), this, SLOT(OnSetFilter()));
|
||||
m_pTraceToolBar->addWidget(m_pTraceType);
|
||||
|
||||
m_pTraceToolBar->addWidget(new QLabel(tr("Status:")));
|
||||
m_pTraceStatus = new QComboBox();
|
||||
m_pTraceStatus->addItem(tr("[All]"), 0);
|
||||
m_pTraceStatus->addItem(tr("Open"), 1);
|
||||
m_pTraceStatus->addItem(tr("Closed"), 2);
|
||||
m_pTraceStatus->addItem(tr("Trace"), 3);
|
||||
m_pTraceStatus->addItem(tr("Other"), 4);
|
||||
m_pTraceStatus->setMinimumWidth(75);
|
||||
connect(m_pTraceStatus, SIGNAL(currentIndexChanged(int)), this, SLOT(OnSetFilter()));
|
||||
m_pTraceToolBar->addWidget(m_pTraceStatus);
|
||||
|
||||
m_pAllBoxes = new QCheckBox(tr("Show All Boxes"));
|
||||
connect(m_pAllBoxes, SIGNAL(stateChanged(int)), this, SLOT(OnSetFilter()));
|
||||
m_pTraceToolBar->addWidget(m_pAllBoxes);
|
||||
|
||||
m_pMainLayout->setSpacing(0);
|
||||
|
||||
|
@ -82,13 +115,15 @@ CTraceView::CTraceView(QWidget* parent) : CPanelWidget<QTreeViewEx>(parent)
|
|||
m_pTraceModel->SetTree(m_pTraceTree->isChecked());
|
||||
connect(m_pTraceModel, SIGNAL(NewBranche()), this, SLOT(UpdateFilters()));
|
||||
|
||||
m_pSortProxy = new CTraceFilterProxyModel(this);
|
||||
m_pSortProxy->setSortRole(Qt::EditRole);
|
||||
m_pSortProxy->setSourceModel(m_pTraceModel);
|
||||
m_pSortProxy->setDynamicSortFilter(true);
|
||||
//m_pSortProxy = new CTraceFilterProxyModel(this);
|
||||
//m_pSortProxy->setSortRole(Qt::EditRole);
|
||||
//m_pSortProxy->setSourceModel(m_pTraceModel);
|
||||
//m_pSortProxy->setDynamicSortFilter(true);
|
||||
|
||||
m_pTreeList->setModel(m_pSortProxy);
|
||||
m_pSortProxy->setView(m_pTreeList);
|
||||
//m_pTreeList->setModel(m_pSortProxy);
|
||||
//m_pSortProxy->setView(m_pTreeList);
|
||||
|
||||
m_pTreeList->setModel(m_pTraceModel);
|
||||
|
||||
|
||||
m_pTreeList->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
|
@ -97,7 +132,7 @@ CTraceView::CTraceView(QWidget* parent) : CPanelWidget<QTreeViewEx>(parent)
|
|||
m_pTreeList->setStyle(pStyle);
|
||||
#endif
|
||||
m_pTreeList->setExpandsOnDoubleClick(false);
|
||||
m_pTreeList->setSortingEnabled(true);
|
||||
//m_pTreeList->setSortingEnabled(true);
|
||||
|
||||
m_pTreeList->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(m_pTreeList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OnMenu(const QPoint&)));
|
||||
|
@ -106,7 +141,8 @@ CTraceView::CTraceView(QWidget* parent) : CPanelWidget<QTreeViewEx>(parent)
|
|||
//connect(m_pTreeList, SIGNAL(ResetColumns()), m_pTreeList, SLOT(OnResetColumns()));
|
||||
//connect(m_pBoxTree, SIGNAL(ColumnChanged(int, bool)), this, SLOT(OnColumnsChanged()));
|
||||
|
||||
m_pMainLayout->addWidget(CFinder::AddFinder(m_pTreeList, m_pSortProxy));
|
||||
//m_pMainLayout->addWidget(CFinder::AddFinder(m_pTreeList, m_pSortProxy));
|
||||
m_pMainLayout->addWidget(CFinder::AddFinder(m_pTreeList, this));
|
||||
|
||||
|
||||
QByteArray Columns = theConf->GetBlob("MainWindow/TraceLog_Columns");
|
||||
|
@ -121,22 +157,74 @@ CTraceView::~CTraceView()
|
|||
theConf->SetBlob("MainWindow/TraceLog_Columns", GetView()->header()->saveState());
|
||||
}
|
||||
|
||||
int CTraceView__Filter(const CTraceEntryPtr& pEntry, void* params)
|
||||
{
|
||||
CTraceView* This = (CTraceView*)params;
|
||||
|
||||
int True = This->m_bHighLight ? 2 : 1;
|
||||
int False = This->m_bHighLight ? 1 : 0;
|
||||
|
||||
if (This->m_pCurrentBox != NULL && This->m_pCurrentBox != pEntry->GetBoxPtr())
|
||||
return False;
|
||||
|
||||
if (This->m_FilterExp.isValid()) {
|
||||
if (!pEntry->GetMessage().contains(This->m_FilterExp)
|
||||
//&& !pEntry->GetTypeStr().contains(This->m_FilterExp)
|
||||
//&& !pEntry->GetStautsStr().contains(This->m_FilterExp)
|
||||
&& !pEntry->GetProcessName().contains(This->m_FilterExp))
|
||||
return False;
|
||||
}
|
||||
|
||||
if (This->m_FilterPid != 0 && This->m_FilterPid != pEntry->GetProcessId())
|
||||
return False;
|
||||
|
||||
if (This->m_FilterTid != 0 && This->m_FilterTid != pEntry->GetThreadId())
|
||||
return False;
|
||||
|
||||
if (This->m_FilterType != 0 && This->m_FilterType != pEntry->GetType())
|
||||
return False;
|
||||
|
||||
if (This->m_FilterStatus != 0) {
|
||||
if (pEntry->IsOpen()) {
|
||||
if(This->m_FilterStatus == 1) return True;
|
||||
} else if (pEntry->IsClosed()) {
|
||||
if (This->m_FilterStatus == 2) return True;
|
||||
} else if (pEntry->IsTrace()) {
|
||||
if(This->m_FilterStatus == 3) return True;
|
||||
} else
|
||||
if(This->m_FilterStatus == 4) return True;
|
||||
return False;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
void CTraceView::Refresh()
|
||||
{
|
||||
QList<CSandBoxPtr>Boxes;
|
||||
if(m_pOnlyCurrent->isChecked())
|
||||
if(!m_pAllBoxes->isChecked())
|
||||
Boxes = theGUI->GetBoxView()->GetSelectedBoxes();
|
||||
|
||||
if (m_pCurrentBox != (Boxes.count() == 1 ? Boxes.first().data() : NULL)) {
|
||||
m_pCurrentBox = Boxes.count() == 1 ? Boxes.first().data() : NULL;
|
||||
m_FullRefresh = true;
|
||||
}
|
||||
|
||||
if (m_FullRefresh) {
|
||||
m_pTraceModel->Clear();
|
||||
m_FullRefresh = false;
|
||||
}
|
||||
|
||||
QVector<CTraceEntryPtr> ResourceLog = theAPI->GetTrace();
|
||||
//m_pTraceModel->Sync(ResourceLog, Pids);
|
||||
QList<QVariant> Added = m_pTraceModel->Sync(ResourceLog, Boxes.count() == 1 ? Boxes.first().data() : NULL);
|
||||
QList<QVariant> Added = m_pTraceModel->Sync(ResourceLog, CTraceView__Filter, this);
|
||||
|
||||
if (m_pTraceModel->IsTree())
|
||||
{
|
||||
QTimer::singleShot(100, this, [this, Added]() {
|
||||
CSortFilterProxyModel* pSortProxy = (CSortFilterProxyModel*)GetModel();
|
||||
//CSortFilterProxyModel* pSortProxy = (CSortFilterProxyModel*)GetModel();
|
||||
foreach(const QVariant ID, Added) {
|
||||
m_pTreeList->expand(pSortProxy->mapFromSource(m_pTraceModel->FindIndex(ID)));
|
||||
// m_pTreeList->expand(pSortProxy->mapFromSource(m_pTraceModel->FindIndex(ID)));
|
||||
m_pTreeList->expand(m_pTraceModel->FindIndex(ID));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -182,10 +270,26 @@ void CTraceView::UpdateFilters()
|
|||
}
|
||||
}
|
||||
|
||||
void CTraceView::SetFilter(const QRegExp& Exp, bool bHighLight, int Col)
|
||||
{
|
||||
|
||||
m_FilterExp = Exp;
|
||||
m_bHighLight = bHighLight;
|
||||
//m_FilterCol = Col;
|
||||
|
||||
m_FullRefresh = true;
|
||||
}
|
||||
|
||||
void CTraceView::SelectNext()
|
||||
{
|
||||
}
|
||||
|
||||
void CTraceView::OnSetPidFilter()
|
||||
{
|
||||
m_pSortProxy->m_FilterPid = m_pTracePid->currentData().toUInt();
|
||||
m_pSortProxy->m_FilterTid = 0;
|
||||
m_FilterPid = m_pTracePid->currentData().toUInt();
|
||||
m_FilterTid = 0;
|
||||
//m_pSortProxy->m_FilterPid = m_pTracePid->currentData().toUInt();
|
||||
//m_pSortProxy->m_FilterTid = 0;
|
||||
|
||||
QTimer::singleShot(100, this, [this]() {
|
||||
|
||||
|
@ -195,14 +299,29 @@ void CTraceView::OnSetPidFilter()
|
|||
UpdateFilters();
|
||||
});
|
||||
|
||||
m_pSortProxy->setFilterKeyColumn(m_pSortProxy->filterKeyColumn());
|
||||
//m_pSortProxy->setFilterKeyColumn(m_pSortProxy->filterKeyColumn());
|
||||
m_FullRefresh = true;
|
||||
m_pTreeList->expandAll();
|
||||
}
|
||||
|
||||
void CTraceView::OnSetTidFilter()
|
||||
{
|
||||
m_pSortProxy->m_FilterTid = m_pTraceTid->currentData().toUInt();
|
||||
m_FilterTid = m_pTraceTid->currentData().toUInt();
|
||||
//m_pSortProxy->m_FilterTid = m_pTraceTid->currentData().toUInt();
|
||||
|
||||
m_pSortProxy->setFilterKeyColumn(m_pSortProxy->filterKeyColumn());
|
||||
//m_pSortProxy->setFilterKeyColumn(m_pSortProxy->filterKeyColumn());
|
||||
m_FullRefresh = true;
|
||||
m_pTreeList->expandAll();
|
||||
}
|
||||
|
||||
|
||||
void CTraceView::OnSetFilter()
|
||||
{
|
||||
m_FilterType = m_pTraceType->currentData().toUInt();
|
||||
m_FilterStatus = m_pTraceStatus->currentData().toUInt();
|
||||
|
||||
m_FullRefresh = true;
|
||||
m_pTreeList->expandAll();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,18 +21,34 @@ public slots:
|
|||
void OnSetTree();
|
||||
void OnSetPidFilter();
|
||||
void OnSetTidFilter();
|
||||
void OnSetFilter();
|
||||
|
||||
private slots:
|
||||
void UpdateFilters();
|
||||
void SetFilter(const QRegExp& Exp, bool bHighLight = false, int Col = -1); // -1 = any
|
||||
void SelectNext();
|
||||
|
||||
protected:
|
||||
friend int CTraceView__Filter(const CTraceEntryPtr& pEntry, void* params);
|
||||
CTraceModel* m_pTraceModel;
|
||||
CTraceFilterProxyModel* m_pSortProxy;
|
||||
//CTraceFilterProxyModel* m_pSortProxy;
|
||||
bool m_FullRefresh;
|
||||
|
||||
QRegExp m_FilterExp;
|
||||
bool m_bHighLight;
|
||||
//int m_FilterCol;
|
||||
quint32 m_FilterPid;
|
||||
quint32 m_FilterTid;
|
||||
quint32 m_FilterType;
|
||||
quint32 m_FilterStatus;
|
||||
void* m_pCurrentBox;
|
||||
|
||||
QToolBar* m_pTraceToolBar;
|
||||
QAction* m_pTraceTree;
|
||||
QCheckBox* m_pOnlyCurrent;
|
||||
QCheckBox* m_pAllBoxes;
|
||||
QComboBox* m_pTracePid;
|
||||
QComboBox* m_pTraceTid;
|
||||
QComboBox* m_pTraceType;
|
||||
QComboBox* m_pTraceStatus;
|
||||
|
||||
};
|
Loading…
Reference in New Issue