Sandboxie/SandboxiePlus/SandMan/Views/TraceView.h

162 lines
3.3 KiB
C
Raw Normal View History

2021-10-15 16:39:43 +01:00
#pragma once
#include "../../MiscHelpers/Common/PanelView.h"
#include "../../MiscHelpers/Common/TreeviewEx.h"
#include "../Models/SbieModel.h"
2022-03-26 09:09:24 +00:00
#include "../Models/TraceModel.h"
#include "../Models/MonitorModel.h"
2023-01-12 22:10:50 +00:00
#include "../../MiscHelpers/Common/SortFilterProxyModel.h"
2023-05-27 08:03:42 +01:00
#include "StackView.h"
2021-10-15 16:39:43 +01:00
2023-05-27 08:03:42 +01:00
class CTraceTree : public CPanelView
2022-03-26 09:09:24 +00:00
{
Q_OBJECT
public:
CTraceTree(QWidget* parent = 0);
~CTraceTree();
2023-05-27 08:03:42 +01:00
virtual QMenu* GetMenu() { return m_pMenu; }
virtual QTreeViewEx* GetTree() { return m_pTreeList; }
virtual QTreeView* GetView() { return m_pTreeList; }
virtual QAbstractItemModel* GetModel() { return m_pTreeList->model(); }
2022-03-26 09:09:24 +00:00
CTraceModel* m_pTraceModel;
public slots:
2023-01-12 22:10:50 +00:00
void SetFilter(const QString& Exp, int iOptions = 0, int Column = -1);
2022-03-26 09:09:24 +00:00
2023-05-27 08:03:42 +01:00
void ItemSelection(const QItemSelection& selected, const QItemSelection& deselected);
2022-03-26 09:09:24 +00:00
signals:
2023-01-12 22:10:50 +00:00
void FilterChanged();
protected:
friend class CTraceView;
QString GetFilterExp() const { return m_FilterExp; }
2023-05-27 08:03:42 +01:00
QVBoxLayout* m_pMainLayout;
QSplitter* m_pSplitter;
QTreeViewEx* m_pTreeList;
CStackView* m_pStackView;
2023-07-22 10:59:54 +01:00
QAction* m_pAutoScroll;
2023-01-12 22:10:50 +00:00
//QRegularExpression m_FilterExp;
QString m_FilterExp;
bool m_bHighLight;
//int m_FilterCol;
2022-03-26 09:09:24 +00:00
};
class CMonitorList : public CPanelWidget<QTreeViewEx>
{
public:
CMonitorList(QWidget* parent = 0);
~CMonitorList();
CSortFilterProxyModel* m_pSortProxy;
CMonitorModel* m_pMonitorModel;
};
class CTraceView : public QWidget
2021-10-15 16:39:43 +01:00
{
Q_OBJECT
public:
2022-07-09 10:46:07 +01:00
CTraceView(bool bStandAlone, QWidget* parent = 0);
2021-10-15 16:39:43 +01:00
~CTraceView();
2022-04-07 19:49:13 +01:00
void AddAction(QAction* pAction);
2023-05-27 08:03:42 +01:00
void SetEnabled(bool bSet);
2023-07-01 17:54:53 +01:00
static bool SaveToFile(QIODevice* pFile);
2021-10-15 16:39:43 +01:00
public slots:
2022-07-09 10:46:07 +01:00
void Refresh();
void Clear();
2021-10-15 16:39:43 +01:00
void OnSetTree();
2023-01-07 15:57:55 +00:00
void OnObjTree();
2022-03-26 09:09:24 +00:00
void OnSetMode();
2021-10-15 16:39:43 +01:00
void OnSetPidFilter();
void OnSetTidFilter();
void OnSetFilter();
2023-05-27 08:03:42 +01:00
void OnShowStack();
2021-10-15 16:39:43 +01:00
private slots:
void UpdateFilters();
2023-01-12 22:10:50 +00:00
void OnFilterChanged();
2021-10-15 16:39:43 +01:00
2021-10-16 17:24:16 +01:00
void SaveToFile();
2022-03-26 09:09:24 +00:00
protected:
2022-07-09 10:46:07 +01:00
void timerEvent(QTimerEvent* pEvent);
int m_uTimerID;
2023-07-01 17:54:53 +01:00
static void SaveToFileAsync(const CSbieProgressPtr& pProgress, QVector<CTraceEntryPtr> ResourceLog, QIODevice* pFile);
2022-03-26 09:09:24 +00:00
struct SProgInfo
{
QString Name;
QSet<quint32> Threads;
};
QMap<quint32, SProgInfo>m_PidMap;
quint64 m_LastID;
int m_LastCount;
bool m_bUpdatePending;
2023-01-07 15:57:55 +00:00
QVector<CTraceEntryPtr> m_TraceList;
2022-03-26 09:09:24 +00:00
QMap<QString, CMonitorEntryPtr> m_MonitorMap;
2021-10-15 16:39:43 +01:00
protected:
bool m_FullRefresh;
quint32 m_FilterPid;
quint32 m_FilterTid;
2021-10-30 08:46:49 +01:00
QList<quint32> m_FilterTypes;
2021-10-15 16:39:43 +01:00
quint32 m_FilterStatus;
void* m_pCurrentBox;
2022-03-26 09:09:24 +00:00
QVBoxLayout* m_pMainLayout;
CTraceTree* m_pTrace;
CMonitorList* m_pMonitor;
2021-10-15 16:39:43 +01:00
QToolBar* m_pTraceToolBar;
2022-03-26 09:09:24 +00:00
QAction* m_pMonitorMode;
2021-10-15 16:39:43 +01:00
QAction* m_pTraceTree;
2023-01-07 15:57:55 +00:00
QAction* m_pObjectTree;
2021-10-15 16:39:43 +01:00
QComboBox* m_pTracePid;
QComboBox* m_pTraceTid;
2021-10-30 08:46:49 +01:00
class QCheckList* m_pTraceType;
2021-10-15 16:39:43 +01:00
QComboBox* m_pTraceStatus;
2021-10-16 17:24:16 +01:00
QAction* m_pAllBoxes;
2023-05-27 08:03:42 +01:00
QAction* m_pShowStack;
2021-10-16 17:24:16 +01:00
QAction* m_pSaveToFile;
2021-10-15 16:39:43 +01:00
2022-03-26 09:09:24 +00:00
QWidget* m_pView;
QStackedLayout* m_pLayout;
2022-07-09 10:46:07 +01:00
};
2022-07-11 20:12:42 +01:00
////////////////////////////////////////////////////////////////////////////////////////
// CTraceWindow
2022-07-09 10:46:07 +01:00
class CTraceWindow : public QDialog
{
Q_OBJECT
public:
CTraceWindow(QWidget *parent = Q_NULLPTR);
~CTraceWindow();
signals:
void Closed();
protected:
void closeEvent(QCloseEvent *e);
};