Normalize line endings
This commit is contained in:
parent
b83f4726f3
commit
0d79918a00
|
@ -1,183 +1,183 @@
|
|||
/*
|
||||
*
|
||||
* Copyright (c) 2020, David Xanatos
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include <QDebug>
|
||||
#include <QStandardPaths>
|
||||
#include "SbieTrace.h"
|
||||
|
||||
#include <ntstatus.h>
|
||||
#define WIN32_NO_STATUS
|
||||
typedef long NTSTATUS;
|
||||
|
||||
#include <windows.h>
|
||||
#include "SbieDefs.h"
|
||||
|
||||
#include "..\..\Sandboxie\common\win32_ntddk.h"
|
||||
|
||||
#include "..\..\Sandboxie\core\drv\api_defs.h"
|
||||
|
||||
#include "..\..\Sandboxie\core\svc\msgids.h"
|
||||
#include "..\..\Sandboxie\core\svc\ProcessWire.h"
|
||||
#include "..\..\Sandboxie\core\svc\sbieiniwire.h"
|
||||
#include "..\..\Sandboxie\core\svc\QueueWire.h"
|
||||
#include "..\..\Sandboxie\core\svc\InteractiveWire.h"
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
||||
QString ErrorString(qint32 err)
|
||||
{
|
||||
QString Error;
|
||||
HMODULE handle = NULL; //err < 0 ? GetModuleHandle(L"NTDLL.DLL") : NULL;
|
||||
DWORD flags = 0; //err < 0 ? FORMAT_MESSAGE_FROM_HMODULE : 0;
|
||||
LPTSTR s;
|
||||
if (::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | flags, handle, err, 0, (LPTSTR)&s, 0, NULL) > 0)
|
||||
{
|
||||
LPTSTR p = wcschr(s, L'\r');
|
||||
if (p != NULL) *p = L'\0';
|
||||
Error = QString::fromWCharArray(s);
|
||||
::LocalFree(s);
|
||||
}
|
||||
return Error;
|
||||
}
|
||||
|
||||
CTraceEntry::CTraceEntry(quint32 ProcessId, quint32 ThreadId, quint32 Type, const QString& Message)
|
||||
{
|
||||
m_ProcessId = ProcessId;
|
||||
m_ThreadId = ThreadId;
|
||||
m_Message = Message;
|
||||
m_Type.Flags = Type;
|
||||
|
||||
m_TimeStamp = QDateTime::currentDateTime(); // ms resolution
|
||||
|
||||
m_BoxPtr = 0;
|
||||
|
||||
static atomic<quint64> uid = 0;
|
||||
m_uid = uid.fetch_add(1);
|
||||
|
||||
m_Counter = 0;
|
||||
|
||||
m_Message = m_Message.replace("\r", "").replace("\n", " ");
|
||||
|
||||
// if this is a set error, then get the actual error string
|
||||
if (m_Type.Type == MONITOR_OTHER && Message.indexOf("SetError:") == 0)
|
||||
{
|
||||
auto tmp = Message.split(":");
|
||||
if (tmp.length() >= 2)
|
||||
{
|
||||
QString temp = tmp[1].trimmed();
|
||||
int endPos = temp.indexOf(QRegExp("[ \r\n]"));
|
||||
if (endPos != -1)
|
||||
temp.truncate(endPos);
|
||||
|
||||
qint32 errCode = temp.toInt();
|
||||
QString Error = ErrorString(errCode);
|
||||
if (!Error.isEmpty())
|
||||
m_Message += " (" + Error + ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 = GetTypeStr(m_Type.Type);
|
||||
if(Type.isEmpty())
|
||||
Type = "Unknown: " + QString::number(m_Type.Type);
|
||||
|
||||
if (m_Type.User)
|
||||
Type.append(" (U)");
|
||||
else
|
||||
Type.append(" (D)");
|
||||
|
||||
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 (IsOpen())
|
||||
Status.append("Open ");
|
||||
if (IsClosed())
|
||||
Status.append("Closed ");
|
||||
|
||||
if (IsTrace())
|
||||
Status.append("Trace ");
|
||||
|
||||
if (m_Counter > 1)
|
||||
Status.append(QString("(%1) ").arg(m_Counter));
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
||||
QString GetLastErrorAsString()
|
||||
{
|
||||
DWORD errorMessageID = ::GetLastError();
|
||||
if (errorMessageID == 0)
|
||||
return QString();
|
||||
|
||||
char* messageBuffer = NULL;
|
||||
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, errorMessageID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL);
|
||||
|
||||
QString message(messageBuffer);
|
||||
LocalFree(messageBuffer);
|
||||
return message;
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2020, David Xanatos
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include <QDebug>
|
||||
#include <QStandardPaths>
|
||||
#include "SbieTrace.h"
|
||||
|
||||
#include <ntstatus.h>
|
||||
#define WIN32_NO_STATUS
|
||||
typedef long NTSTATUS;
|
||||
|
||||
#include <windows.h>
|
||||
#include "SbieDefs.h"
|
||||
|
||||
#include "..\..\Sandboxie\common\win32_ntddk.h"
|
||||
|
||||
#include "..\..\Sandboxie\core\drv\api_defs.h"
|
||||
|
||||
#include "..\..\Sandboxie\core\svc\msgids.h"
|
||||
#include "..\..\Sandboxie\core\svc\ProcessWire.h"
|
||||
#include "..\..\Sandboxie\core\svc\sbieiniwire.h"
|
||||
#include "..\..\Sandboxie\core\svc\QueueWire.h"
|
||||
#include "..\..\Sandboxie\core\svc\InteractiveWire.h"
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
||||
QString ErrorString(qint32 err)
|
||||
{
|
||||
QString Error;
|
||||
HMODULE handle = NULL; //err < 0 ? GetModuleHandle(L"NTDLL.DLL") : NULL;
|
||||
DWORD flags = 0; //err < 0 ? FORMAT_MESSAGE_FROM_HMODULE : 0;
|
||||
LPTSTR s;
|
||||
if (::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | flags, handle, err, 0, (LPTSTR)&s, 0, NULL) > 0)
|
||||
{
|
||||
LPTSTR p = wcschr(s, L'\r');
|
||||
if (p != NULL) *p = L'\0';
|
||||
Error = QString::fromWCharArray(s);
|
||||
::LocalFree(s);
|
||||
}
|
||||
return Error;
|
||||
}
|
||||
|
||||
CTraceEntry::CTraceEntry(quint32 ProcessId, quint32 ThreadId, quint32 Type, const QString& Message)
|
||||
{
|
||||
m_ProcessId = ProcessId;
|
||||
m_ThreadId = ThreadId;
|
||||
m_Message = Message;
|
||||
m_Type.Flags = Type;
|
||||
|
||||
m_TimeStamp = QDateTime::currentDateTime(); // ms resolution
|
||||
|
||||
m_BoxPtr = 0;
|
||||
|
||||
static atomic<quint64> uid = 0;
|
||||
m_uid = uid.fetch_add(1);
|
||||
|
||||
m_Counter = 0;
|
||||
|
||||
m_Message = m_Message.replace("\r", "").replace("\n", " ");
|
||||
|
||||
// if this is a set error, then get the actual error string
|
||||
if (m_Type.Type == MONITOR_OTHER && Message.indexOf("SetError:") == 0)
|
||||
{
|
||||
auto tmp = Message.split(":");
|
||||
if (tmp.length() >= 2)
|
||||
{
|
||||
QString temp = tmp[1].trimmed();
|
||||
int endPos = temp.indexOf(QRegExp("[ \r\n]"));
|
||||
if (endPos != -1)
|
||||
temp.truncate(endPos);
|
||||
|
||||
qint32 errCode = temp.toInt();
|
||||
QString Error = ErrorString(errCode);
|
||||
if (!Error.isEmpty())
|
||||
m_Message += " (" + Error + ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 = GetTypeStr(m_Type.Type);
|
||||
if(Type.isEmpty())
|
||||
Type = "Unknown: " + QString::number(m_Type.Type);
|
||||
|
||||
if (m_Type.User)
|
||||
Type.append(" (U)");
|
||||
else
|
||||
Type.append(" (D)");
|
||||
|
||||
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 (IsOpen())
|
||||
Status.append("Open ");
|
||||
if (IsClosed())
|
||||
Status.append("Closed ");
|
||||
|
||||
if (IsTrace())
|
||||
Status.append("Trace ");
|
||||
|
||||
if (m_Counter > 1)
|
||||
Status.append(QString("(%1) ").arg(m_Counter));
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
||||
QString GetLastErrorAsString()
|
||||
{
|
||||
DWORD errorMessageID = ::GetLastError();
|
||||
if (errorMessageID == 0)
|
||||
return QString();
|
||||
|
||||
char* messageBuffer = NULL;
|
||||
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, errorMessageID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL);
|
||||
|
||||
QString message(messageBuffer);
|
||||
LocalFree(messageBuffer);
|
||||
return message;
|
||||
}
|
|
@ -1,99 +1,99 @@
|
|||
/*
|
||||
*
|
||||
* Copyright (c) 2020, David Xanatos
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QThread>
|
||||
|
||||
#include "qsbieapi_global.h"
|
||||
|
||||
#include "SbieStatus.h"
|
||||
|
||||
|
||||
class QSBIEAPI_EXPORT CTraceEntry : public QSharedData
|
||||
{
|
||||
public:
|
||||
CTraceEntry(quint32 ProcessId, quint32 ThreadId, quint32 Type, const QString& Message);
|
||||
|
||||
virtual QString GetMessage() const { return m_Message; }
|
||||
virtual quint32 GetProcessId() const { return m_ProcessId; }
|
||||
virtual quint32 GetThreadId() const { return m_ThreadId; }
|
||||
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;
|
||||
|
||||
virtual void SetProcessName(const QString& name) { m_ProcessName = name; }
|
||||
virtual QString GetProcessName() const { return m_ProcessName; }
|
||||
|
||||
virtual void SetBoxPtr(void* ptr) { m_BoxPtr = ptr; }
|
||||
virtual void* GetBoxPtr() const { return m_BoxPtr; }
|
||||
|
||||
virtual int GetCount() const { return m_Counter; }
|
||||
|
||||
virtual bool Equals(const QSharedDataPointer<CTraceEntry>& pOther) const {
|
||||
return pOther->m_ProcessId == this->m_ProcessId && pOther->m_ThreadId == this->m_ThreadId
|
||||
&& pOther->m_Message == this->m_Message;
|
||||
}
|
||||
virtual void Merge(const QSharedDataPointer<CTraceEntry>& pOther) {
|
||||
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:
|
||||
QString m_Message;
|
||||
quint32 m_ProcessId;
|
||||
quint32 m_ThreadId;
|
||||
QDateTime m_TimeStamp;
|
||||
QString m_ProcessName;
|
||||
void* m_BoxPtr;
|
||||
|
||||
union
|
||||
{
|
||||
quint32 Flags;
|
||||
struct
|
||||
{
|
||||
quint32
|
||||
Type : 8,
|
||||
|
||||
SubType : 8,
|
||||
|
||||
Disposition : 4,
|
||||
Allowed : 1,
|
||||
Denided : 1,
|
||||
Success : 1,
|
||||
Failed : 1,
|
||||
|
||||
Reserved : 6,
|
||||
Trace : 1,
|
||||
User : 1;
|
||||
};
|
||||
} m_Type;
|
||||
|
||||
quint64 m_uid;
|
||||
|
||||
int m_Counter;
|
||||
};
|
||||
|
||||
typedef QSharedDataPointer<CTraceEntry> CTraceEntryPtr;
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2020, David Xanatos
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QThread>
|
||||
|
||||
#include "qsbieapi_global.h"
|
||||
|
||||
#include "SbieStatus.h"
|
||||
|
||||
|
||||
class QSBIEAPI_EXPORT CTraceEntry : public QSharedData
|
||||
{
|
||||
public:
|
||||
CTraceEntry(quint32 ProcessId, quint32 ThreadId, quint32 Type, const QString& Message);
|
||||
|
||||
virtual QString GetMessage() const { return m_Message; }
|
||||
virtual quint32 GetProcessId() const { return m_ProcessId; }
|
||||
virtual quint32 GetThreadId() const { return m_ThreadId; }
|
||||
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;
|
||||
|
||||
virtual void SetProcessName(const QString& name) { m_ProcessName = name; }
|
||||
virtual QString GetProcessName() const { return m_ProcessName; }
|
||||
|
||||
virtual void SetBoxPtr(void* ptr) { m_BoxPtr = ptr; }
|
||||
virtual void* GetBoxPtr() const { return m_BoxPtr; }
|
||||
|
||||
virtual int GetCount() const { return m_Counter; }
|
||||
|
||||
virtual bool Equals(const QSharedDataPointer<CTraceEntry>& pOther) const {
|
||||
return pOther->m_ProcessId == this->m_ProcessId && pOther->m_ThreadId == this->m_ThreadId
|
||||
&& pOther->m_Message == this->m_Message;
|
||||
}
|
||||
virtual void Merge(const QSharedDataPointer<CTraceEntry>& pOther) {
|
||||
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:
|
||||
QString m_Message;
|
||||
quint32 m_ProcessId;
|
||||
quint32 m_ThreadId;
|
||||
QDateTime m_TimeStamp;
|
||||
QString m_ProcessName;
|
||||
void* m_BoxPtr;
|
||||
|
||||
union
|
||||
{
|
||||
quint32 Flags;
|
||||
struct
|
||||
{
|
||||
quint32
|
||||
Type : 8,
|
||||
|
||||
SubType : 8,
|
||||
|
||||
Disposition : 4,
|
||||
Allowed : 1,
|
||||
Denided : 1,
|
||||
Success : 1,
|
||||
Failed : 1,
|
||||
|
||||
Reserved : 6,
|
||||
Trace : 1,
|
||||
User : 1;
|
||||
};
|
||||
} m_Type;
|
||||
|
||||
quint64 m_uid;
|
||||
|
||||
int m_Counter;
|
||||
};
|
||||
|
||||
typedef QSharedDataPointer<CTraceEntry> CTraceEntryPtr;
|
||||
|
|
|
@ -1,288 +1,288 @@
|
|||
#include "stdafx.h"
|
||||
#include "TraceModel.h"
|
||||
#include "../MiscHelpers/Common/Common.h"
|
||||
#include "../SbiePlusAPI.h"
|
||||
|
||||
|
||||
|
||||
CTraceModel::CTraceModel(QObject* parent)
|
||||
:CTreeItemModel(parent)
|
||||
{
|
||||
m_Root = MkNode(QVariant());
|
||||
|
||||
m_LastCount = 0;
|
||||
}
|
||||
|
||||
CTraceModel::~CTraceModel()
|
||||
{
|
||||
}
|
||||
|
||||
/*QList<QVariant> CTraceModel::MakePath(const CTraceEntryPtr& pEntry, const QList<CTraceEntryPtr>& EntryList)
|
||||
{
|
||||
quint64 ParentID = pEntry->GetParentWnd();
|
||||
CTraceEntryPtr pParent = EntryList.value(ParentID);
|
||||
|
||||
QList<QVariant> Path;
|
||||
if (!pParent.isNull() && ParentID != pEntry->GetHWnd())
|
||||
{
|
||||
Path = MakeWndPath(pParent, EntryList);
|
||||
Path.append(ParentID);
|
||||
}
|
||||
return Path;
|
||||
}
|
||||
|
||||
bool CTraceModel::TestPath(const QList<QVariant>& Path, const CTraceEntryPtr& pEntry, const QList<CTraceEntryPtr>& EntryList, int Index)
|
||||
{
|
||||
quint64 ParentID = pEntry->GetParentWnd();
|
||||
CTraceEntryPtr pParent = EntryList.value(ParentID);
|
||||
|
||||
if (!pParent.isNull() && ParentID != pEntry->GetHWnd())
|
||||
{
|
||||
if (Index >= Path.size() || Path[Path.size() - Index - 1] != ParentID)
|
||||
return false;
|
||||
|
||||
return TestWndPath(Path, pParent, EntryList, Index + 1);
|
||||
}
|
||||
|
||||
return Path.size() == Index;
|
||||
}*/
|
||||
|
||||
QList<QVariant> CTraceModel::Sync(const QVector<CTraceEntryPtr>& EntryList, int (*Filter)(const CTraceEntryPtr&, void*), void* params)
|
||||
{
|
||||
QList<QVariant> Added;
|
||||
QMap<QList<QVariant>, QList<STreeNode*> > New;
|
||||
QHash<QVariant, STreeNode*> Old = m_Map;
|
||||
|
||||
// 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)
|
||||
{
|
||||
i = m_LastCount - 1;
|
||||
if (m_LastID == EntryList.at(i)->GetUID())
|
||||
{
|
||||
i++;
|
||||
Old.clear();
|
||||
}
|
||||
else
|
||||
i = 0;
|
||||
}
|
||||
|
||||
for (; i < EntryList.count(); i++)
|
||||
{
|
||||
CTraceEntryPtr pEntry = EntryList.at(i);
|
||||
|
||||
int iFilter = Filter(pEntry, params);
|
||||
if (!iFilter)
|
||||
continue;
|
||||
|
||||
quint64 ID = pEntry->GetUID();
|
||||
|
||||
QModelIndex Index;
|
||||
|
||||
QHash<QVariant, STreeNode*>::iterator I = Old.find(ID);
|
||||
STraceNode* pNode = I != Old.end() ? static_cast<STraceNode*>(I.value()) : NULL;
|
||||
if (!pNode /*|| (m_bTree ? !TestPath(pNode->Path, pEntry, EntryList) : !pNode->Path.isEmpty())*/)
|
||||
{
|
||||
pNode = static_cast<STraceNode*>(MkNode(ID));
|
||||
pNode->Values.resize(columnCount());
|
||||
if (m_bTree) {
|
||||
pNode->Path.append(QString("pid_%1").arg(pEntry->GetProcessId()));
|
||||
pNode->Path.append(QString("tid_%1").arg(pEntry->GetThreadId()));
|
||||
//pNode->Path = MakePath(pEntry, EntryList);
|
||||
}
|
||||
pNode->pEntry = pEntry;
|
||||
New[pNode->Path].append(pNode);
|
||||
//Added.append(ID);
|
||||
SetProcessName(pEntry->GetProcessName(), pEntry->GetProcessId(), pEntry->GetThreadId());
|
||||
}
|
||||
else
|
||||
{
|
||||
I.value() = NULL;
|
||||
Index = Find(m_Root, pNode);
|
||||
}
|
||||
|
||||
//if(Index.isValid()) // this is to slow, be more precise
|
||||
// emit dataChanged(createIndex(Index.row(), 0, pNode), createIndex(Index.row(), columnCount()-1, pNode));
|
||||
|
||||
int Col = 0;
|
||||
bool State = false;
|
||||
int Changed = 0;
|
||||
|
||||
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++)
|
||||
{
|
||||
if (!m_Columns.contains(section))
|
||||
continue; // ignore columns which are hidden
|
||||
|
||||
QVariant Value;
|
||||
switch (section)
|
||||
{
|
||||
//case eProcess: Value = pEntry->GetProcessId(); break;
|
||||
//case eTimeStamp: Value = pEntry->GetUID(); break;
|
||||
case eProcess: Value = pEntry->GetUID(); break;
|
||||
case eType: Value = pEntry->GetTypeStr(); break;
|
||||
case eStatus: Value = pEntry->GetStautsStr(); break;
|
||||
case eValue: Value = pEntry->GetMessage(); break;
|
||||
}
|
||||
|
||||
STraceNode::SValue& ColValue = pNode->Values[section];
|
||||
|
||||
if (ColValue.Raw != Value)
|
||||
{
|
||||
if (Changed == 0)
|
||||
Changed = 1;
|
||||
ColValue.Raw = Value;
|
||||
|
||||
switch (section)
|
||||
{
|
||||
/*case eProcess:
|
||||
{
|
||||
CBoxedProcessPtr pProcess = theAPI->GetProcessById(pEntry->GetProcessId());
|
||||
ColValue.Formated = QString("%1 (%2, %3)").arg(pProcess.isNull() ? tr("Unknown") : pProcess->GetProcessName()).arg(pEntry->GetProcessId()).arg(pEntry->GetThreadId());
|
||||
break;
|
||||
}
|
||||
case eTimeStamp: ColValue.Formated = pEntry->GetTimeStamp().toString("hh:mm:ss.zzz"); break;*/
|
||||
case eProcess:
|
||||
if(!m_bTree) {
|
||||
QString Name = pEntry->GetProcessName();
|
||||
ColValue.Formated = QString("%1 (%2, %3) - %4").arg(Name.isEmpty() ? tr("Unknown") : Name)
|
||||
.arg(pEntry->GetProcessId()).arg(pEntry->GetThreadId()).arg(pEntry->GetTimeStamp().toString("hh:mm:ss.zzz"));
|
||||
} else
|
||||
ColValue.Formated = pEntry->GetTimeStamp().toString("hh:mm:ss.zzz");
|
||||
break;
|
||||
//case eType: ColValue.Formated = ; break;
|
||||
//case eValue: ColValue.Formated = ; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (State != (Changed != 0))
|
||||
{
|
||||
if (State && Index.isValid())
|
||||
emit dataChanged(createIndex(Index.row(), Col, pNode), createIndex(Index.row(), section - 1, pNode));
|
||||
State = (Changed != 0);
|
||||
Col = section;
|
||||
}
|
||||
if (Changed == 1)
|
||||
Changed = 0;
|
||||
}
|
||||
if (State && Index.isValid())
|
||||
emit dataChanged(createIndex(Index.row(), Col, pNode), createIndex(Index.row(), columnCount() - 1, pNode));
|
||||
|
||||
}
|
||||
|
||||
m_LastCount = EntryList.count();
|
||||
if(m_LastCount)
|
||||
m_LastID = EntryList.last()->GetUID();
|
||||
|
||||
CTreeItemModel::Sync(New, Old, &Added);
|
||||
|
||||
return Added;
|
||||
}
|
||||
|
||||
void CTraceModel::Clear()
|
||||
{
|
||||
m_LastCount = 0;
|
||||
m_LastID.clear();
|
||||
|
||||
foreach(quint32 pid, m_PidMap.uniqueKeys()) {
|
||||
SProgInfo& Info = m_PidMap[pid];
|
||||
Info.Dirty = true;
|
||||
Info.Threads.clear();
|
||||
}
|
||||
m_PidMap.clear();
|
||||
CTreeItemModel::Clear();
|
||||
}
|
||||
|
||||
void CTraceModel::SetProcessName(const QString& Name, quint32 pid, quint32 tid)
|
||||
{
|
||||
SProgInfo& Info = m_PidMap[pid];
|
||||
Info.Name = Name;
|
||||
if (!Info.Threads.contains(tid)) {
|
||||
Info.Threads.insert(tid);
|
||||
Info.Dirty = true;
|
||||
}
|
||||
if (Info.Dirty) {
|
||||
Info.Dirty = false;
|
||||
emit NewBranche();
|
||||
}
|
||||
}
|
||||
|
||||
QString CTraceModel::GetProcessName(quint32 pid)
|
||||
{
|
||||
SProgInfo& Info = m_PidMap[pid];
|
||||
return Info.Name;
|
||||
}
|
||||
|
||||
void CTraceModel::LogThreadId(quint32 pid, quint32 tid)
|
||||
{
|
||||
SProgInfo& Info = m_PidMap[pid];
|
||||
if (!Info.Threads.contains(tid)) {
|
||||
Info.Threads.insert(tid);
|
||||
emit NewBranche();
|
||||
}
|
||||
}
|
||||
|
||||
CTraceModel::STreeNode* CTraceModel::MkVirtualNode(const QVariant& Id, STreeNode* pParent)
|
||||
{
|
||||
STreeNode* pNode = CTreeItemModel::MkVirtualNode(Id, pParent);
|
||||
|
||||
StrPair typeId = Split2(Id.toString(), "_");
|
||||
if (typeId.first == "pid")
|
||||
{
|
||||
quint32 pid = typeId.second.toUInt();
|
||||
QString Name = GetProcessName(pid);
|
||||
pNode->Values[0].Raw = pid;
|
||||
if(!Name.isEmpty())
|
||||
pNode->Values[0].Formated = tr("%1 (%2)").arg(Name).arg(pid);
|
||||
else
|
||||
pNode->Values[0].Formated = tr("Process %1").arg(pid);
|
||||
}
|
||||
else // if (typeId.first == "tid")
|
||||
{
|
||||
quint32 tid = typeId.second.toUInt();
|
||||
quint32 pid = Split2(pParent->ID.toString(), "_").second.toUInt();
|
||||
LogThreadId(pid, tid);
|
||||
pNode->Values[0].Raw = tid;
|
||||
pNode->Values[0].Formated = tr("Thread %1").arg(tid);
|
||||
}
|
||||
|
||||
return pNode;
|
||||
}
|
||||
|
||||
CTraceEntryPtr CTraceModel::GetEntry(const QModelIndex& index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return CTraceEntryPtr();
|
||||
|
||||
STraceNode* pNode = static_cast<STraceNode*>(index.internalPointer());
|
||||
ASSERT(pNode);
|
||||
|
||||
return pNode->pEntry;
|
||||
}
|
||||
|
||||
int CTraceModel::columnCount(const QModelIndex& parent) const
|
||||
{
|
||||
return eCount;
|
||||
}
|
||||
|
||||
QVariant CTraceModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
|
||||
{
|
||||
switch (section)
|
||||
{
|
||||
case eProcess: return tr("Process");
|
||||
//case eTimeStamp: return tr("Time Stamp");
|
||||
case eType: return tr("Type");
|
||||
case eStatus: return tr("Status");
|
||||
case eValue: return tr("Value");
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
#include "stdafx.h"
|
||||
#include "TraceModel.h"
|
||||
#include "../MiscHelpers/Common/Common.h"
|
||||
#include "../SbiePlusAPI.h"
|
||||
|
||||
|
||||
|
||||
CTraceModel::CTraceModel(QObject* parent)
|
||||
:CTreeItemModel(parent)
|
||||
{
|
||||
m_Root = MkNode(QVariant());
|
||||
|
||||
m_LastCount = 0;
|
||||
}
|
||||
|
||||
CTraceModel::~CTraceModel()
|
||||
{
|
||||
}
|
||||
|
||||
/*QList<QVariant> CTraceModel::MakePath(const CTraceEntryPtr& pEntry, const QList<CTraceEntryPtr>& EntryList)
|
||||
{
|
||||
quint64 ParentID = pEntry->GetParentWnd();
|
||||
CTraceEntryPtr pParent = EntryList.value(ParentID);
|
||||
|
||||
QList<QVariant> Path;
|
||||
if (!pParent.isNull() && ParentID != pEntry->GetHWnd())
|
||||
{
|
||||
Path = MakeWndPath(pParent, EntryList);
|
||||
Path.append(ParentID);
|
||||
}
|
||||
return Path;
|
||||
}
|
||||
|
||||
bool CTraceModel::TestPath(const QList<QVariant>& Path, const CTraceEntryPtr& pEntry, const QList<CTraceEntryPtr>& EntryList, int Index)
|
||||
{
|
||||
quint64 ParentID = pEntry->GetParentWnd();
|
||||
CTraceEntryPtr pParent = EntryList.value(ParentID);
|
||||
|
||||
if (!pParent.isNull() && ParentID != pEntry->GetHWnd())
|
||||
{
|
||||
if (Index >= Path.size() || Path[Path.size() - Index - 1] != ParentID)
|
||||
return false;
|
||||
|
||||
return TestWndPath(Path, pParent, EntryList, Index + 1);
|
||||
}
|
||||
|
||||
return Path.size() == Index;
|
||||
}*/
|
||||
|
||||
QList<QVariant> CTraceModel::Sync(const QVector<CTraceEntryPtr>& EntryList, int (*Filter)(const CTraceEntryPtr&, void*), void* params)
|
||||
{
|
||||
QList<QVariant> Added;
|
||||
QMap<QList<QVariant>, QList<STreeNode*> > New;
|
||||
QHash<QVariant, STreeNode*> Old = m_Map;
|
||||
|
||||
// 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)
|
||||
{
|
||||
i = m_LastCount - 1;
|
||||
if (m_LastID == EntryList.at(i)->GetUID())
|
||||
{
|
||||
i++;
|
||||
Old.clear();
|
||||
}
|
||||
else
|
||||
i = 0;
|
||||
}
|
||||
|
||||
for (; i < EntryList.count(); i++)
|
||||
{
|
||||
CTraceEntryPtr pEntry = EntryList.at(i);
|
||||
|
||||
int iFilter = Filter(pEntry, params);
|
||||
if (!iFilter)
|
||||
continue;
|
||||
|
||||
quint64 ID = pEntry->GetUID();
|
||||
|
||||
QModelIndex Index;
|
||||
|
||||
QHash<QVariant, STreeNode*>::iterator I = Old.find(ID);
|
||||
STraceNode* pNode = I != Old.end() ? static_cast<STraceNode*>(I.value()) : NULL;
|
||||
if (!pNode /*|| (m_bTree ? !TestPath(pNode->Path, pEntry, EntryList) : !pNode->Path.isEmpty())*/)
|
||||
{
|
||||
pNode = static_cast<STraceNode*>(MkNode(ID));
|
||||
pNode->Values.resize(columnCount());
|
||||
if (m_bTree) {
|
||||
pNode->Path.append(QString("pid_%1").arg(pEntry->GetProcessId()));
|
||||
pNode->Path.append(QString("tid_%1").arg(pEntry->GetThreadId()));
|
||||
//pNode->Path = MakePath(pEntry, EntryList);
|
||||
}
|
||||
pNode->pEntry = pEntry;
|
||||
New[pNode->Path].append(pNode);
|
||||
//Added.append(ID);
|
||||
SetProcessName(pEntry->GetProcessName(), pEntry->GetProcessId(), pEntry->GetThreadId());
|
||||
}
|
||||
else
|
||||
{
|
||||
I.value() = NULL;
|
||||
Index = Find(m_Root, pNode);
|
||||
}
|
||||
|
||||
//if(Index.isValid()) // this is to slow, be more precise
|
||||
// emit dataChanged(createIndex(Index.row(), 0, pNode), createIndex(Index.row(), columnCount()-1, pNode));
|
||||
|
||||
int Col = 0;
|
||||
bool State = false;
|
||||
int Changed = 0;
|
||||
|
||||
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++)
|
||||
{
|
||||
if (!m_Columns.contains(section))
|
||||
continue; // ignore columns which are hidden
|
||||
|
||||
QVariant Value;
|
||||
switch (section)
|
||||
{
|
||||
//case eProcess: Value = pEntry->GetProcessId(); break;
|
||||
//case eTimeStamp: Value = pEntry->GetUID(); break;
|
||||
case eProcess: Value = pEntry->GetUID(); break;
|
||||
case eType: Value = pEntry->GetTypeStr(); break;
|
||||
case eStatus: Value = pEntry->GetStautsStr(); break;
|
||||
case eValue: Value = pEntry->GetMessage(); break;
|
||||
}
|
||||
|
||||
STraceNode::SValue& ColValue = pNode->Values[section];
|
||||
|
||||
if (ColValue.Raw != Value)
|
||||
{
|
||||
if (Changed == 0)
|
||||
Changed = 1;
|
||||
ColValue.Raw = Value;
|
||||
|
||||
switch (section)
|
||||
{
|
||||
/*case eProcess:
|
||||
{
|
||||
CBoxedProcessPtr pProcess = theAPI->GetProcessById(pEntry->GetProcessId());
|
||||
ColValue.Formated = QString("%1 (%2, %3)").arg(pProcess.isNull() ? tr("Unknown") : pProcess->GetProcessName()).arg(pEntry->GetProcessId()).arg(pEntry->GetThreadId());
|
||||
break;
|
||||
}
|
||||
case eTimeStamp: ColValue.Formated = pEntry->GetTimeStamp().toString("hh:mm:ss.zzz"); break;*/
|
||||
case eProcess:
|
||||
if(!m_bTree) {
|
||||
QString Name = pEntry->GetProcessName();
|
||||
ColValue.Formated = QString("%1 (%2, %3) - %4").arg(Name.isEmpty() ? tr("Unknown") : Name)
|
||||
.arg(pEntry->GetProcessId()).arg(pEntry->GetThreadId()).arg(pEntry->GetTimeStamp().toString("hh:mm:ss.zzz"));
|
||||
} else
|
||||
ColValue.Formated = pEntry->GetTimeStamp().toString("hh:mm:ss.zzz");
|
||||
break;
|
||||
//case eType: ColValue.Formated = ; break;
|
||||
//case eValue: ColValue.Formated = ; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (State != (Changed != 0))
|
||||
{
|
||||
if (State && Index.isValid())
|
||||
emit dataChanged(createIndex(Index.row(), Col, pNode), createIndex(Index.row(), section - 1, pNode));
|
||||
State = (Changed != 0);
|
||||
Col = section;
|
||||
}
|
||||
if (Changed == 1)
|
||||
Changed = 0;
|
||||
}
|
||||
if (State && Index.isValid())
|
||||
emit dataChanged(createIndex(Index.row(), Col, pNode), createIndex(Index.row(), columnCount() - 1, pNode));
|
||||
|
||||
}
|
||||
|
||||
m_LastCount = EntryList.count();
|
||||
if(m_LastCount)
|
||||
m_LastID = EntryList.last()->GetUID();
|
||||
|
||||
CTreeItemModel::Sync(New, Old, &Added);
|
||||
|
||||
return Added;
|
||||
}
|
||||
|
||||
void CTraceModel::Clear()
|
||||
{
|
||||
m_LastCount = 0;
|
||||
m_LastID.clear();
|
||||
|
||||
foreach(quint32 pid, m_PidMap.uniqueKeys()) {
|
||||
SProgInfo& Info = m_PidMap[pid];
|
||||
Info.Dirty = true;
|
||||
Info.Threads.clear();
|
||||
}
|
||||
m_PidMap.clear();
|
||||
CTreeItemModel::Clear();
|
||||
}
|
||||
|
||||
void CTraceModel::SetProcessName(const QString& Name, quint32 pid, quint32 tid)
|
||||
{
|
||||
SProgInfo& Info = m_PidMap[pid];
|
||||
Info.Name = Name;
|
||||
if (!Info.Threads.contains(tid)) {
|
||||
Info.Threads.insert(tid);
|
||||
Info.Dirty = true;
|
||||
}
|
||||
if (Info.Dirty) {
|
||||
Info.Dirty = false;
|
||||
emit NewBranche();
|
||||
}
|
||||
}
|
||||
|
||||
QString CTraceModel::GetProcessName(quint32 pid)
|
||||
{
|
||||
SProgInfo& Info = m_PidMap[pid];
|
||||
return Info.Name;
|
||||
}
|
||||
|
||||
void CTraceModel::LogThreadId(quint32 pid, quint32 tid)
|
||||
{
|
||||
SProgInfo& Info = m_PidMap[pid];
|
||||
if (!Info.Threads.contains(tid)) {
|
||||
Info.Threads.insert(tid);
|
||||
emit NewBranche();
|
||||
}
|
||||
}
|
||||
|
||||
CTraceModel::STreeNode* CTraceModel::MkVirtualNode(const QVariant& Id, STreeNode* pParent)
|
||||
{
|
||||
STreeNode* pNode = CTreeItemModel::MkVirtualNode(Id, pParent);
|
||||
|
||||
StrPair typeId = Split2(Id.toString(), "_");
|
||||
if (typeId.first == "pid")
|
||||
{
|
||||
quint32 pid = typeId.second.toUInt();
|
||||
QString Name = GetProcessName(pid);
|
||||
pNode->Values[0].Raw = pid;
|
||||
if(!Name.isEmpty())
|
||||
pNode->Values[0].Formated = tr("%1 (%2)").arg(Name).arg(pid);
|
||||
else
|
||||
pNode->Values[0].Formated = tr("Process %1").arg(pid);
|
||||
}
|
||||
else // if (typeId.first == "tid")
|
||||
{
|
||||
quint32 tid = typeId.second.toUInt();
|
||||
quint32 pid = Split2(pParent->ID.toString(), "_").second.toUInt();
|
||||
LogThreadId(pid, tid);
|
||||
pNode->Values[0].Raw = tid;
|
||||
pNode->Values[0].Formated = tr("Thread %1").arg(tid);
|
||||
}
|
||||
|
||||
return pNode;
|
||||
}
|
||||
|
||||
CTraceEntryPtr CTraceModel::GetEntry(const QModelIndex& index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return CTraceEntryPtr();
|
||||
|
||||
STraceNode* pNode = static_cast<STraceNode*>(index.internalPointer());
|
||||
ASSERT(pNode);
|
||||
|
||||
return pNode->pEntry;
|
||||
}
|
||||
|
||||
int CTraceModel::columnCount(const QModelIndex& parent) const
|
||||
{
|
||||
return eCount;
|
||||
}
|
||||
|
||||
QVariant CTraceModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
|
||||
{
|
||||
switch (section)
|
||||
{
|
||||
case eProcess: return tr("Process");
|
||||
//case eTimeStamp: return tr("Time Stamp");
|
||||
case eType: return tr("Type");
|
||||
case eStatus: return tr("Status");
|
||||
case eValue: return tr("Value");
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
|
@ -1,67 +1,67 @@
|
|||
#pragma once
|
||||
#include <qwidget.h>
|
||||
#include "../../QSbieAPI/SbieAPI.h"
|
||||
#include "../../MiscHelpers/Common/TreeItemModel.h"
|
||||
|
||||
class CTraceModel : public CTreeItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CTraceModel(QObject* parent = 0);
|
||||
~CTraceModel();
|
||||
|
||||
QList<QVariant> Sync(const QVector<CTraceEntryPtr>& EntryList, int (*Filter)(const CTraceEntryPtr&, void*), void* params);
|
||||
|
||||
CTraceEntryPtr GetEntry(const QModelIndex& index) const;
|
||||
|
||||
int columnCount(const QModelIndex& parent = QModelIndex()) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||
|
||||
void Clear();
|
||||
|
||||
enum EColumns
|
||||
{
|
||||
eProcess = 0,
|
||||
//eTimeStamp,
|
||||
eType,
|
||||
eStatus,
|
||||
eValue,
|
||||
eCount
|
||||
};
|
||||
|
||||
struct SProgInfo
|
||||
{
|
||||
SProgInfo() { Dirty = true; }
|
||||
QString Name;
|
||||
bool Dirty;
|
||||
QSet<quint32> Threads;
|
||||
};
|
||||
QMap<quint32, SProgInfo>GetPids() { return m_PidMap; }
|
||||
|
||||
signals:
|
||||
void NewBranche();
|
||||
|
||||
protected:
|
||||
struct STraceNode : STreeNode
|
||||
{
|
||||
STraceNode(const QVariant& Id) : STreeNode(Id) { bHighLight = false; }
|
||||
|
||||
CTraceEntryPtr pEntry;
|
||||
bool bHighLight;
|
||||
};
|
||||
|
||||
QVariant m_LastID;
|
||||
int m_LastCount;
|
||||
|
||||
virtual STreeNode* MkNode(const QVariant& Id) { return new STraceNode(Id); }
|
||||
virtual STreeNode* MkVirtualNode(const QVariant& Id, STreeNode* pParent);
|
||||
|
||||
/*QList<QVariant> MakePath(const CTraceEntryPtr& pEntry, const QList<CTraceEntryPtr>& EntryList);
|
||||
bool TestPath(const QList<QVariant>& Path, const CTraceEntryPtr& pEntry, const QList<CTraceEntryPtr>& EntryList, int Index = 0);*/
|
||||
|
||||
void SetProcessName(const QString& Name, quint32 pid, quint32 tid);
|
||||
QString GetProcessName(quint32 pid);
|
||||
void LogThreadId(quint32 pid, quint32 tid);
|
||||
QMap<quint32, SProgInfo>m_PidMap;
|
||||
};
|
||||
#pragma once
|
||||
#include <qwidget.h>
|
||||
#include "../../QSbieAPI/SbieAPI.h"
|
||||
#include "../../MiscHelpers/Common/TreeItemModel.h"
|
||||
|
||||
class CTraceModel : public CTreeItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CTraceModel(QObject* parent = 0);
|
||||
~CTraceModel();
|
||||
|
||||
QList<QVariant> Sync(const QVector<CTraceEntryPtr>& EntryList, int (*Filter)(const CTraceEntryPtr&, void*), void* params);
|
||||
|
||||
CTraceEntryPtr GetEntry(const QModelIndex& index) const;
|
||||
|
||||
int columnCount(const QModelIndex& parent = QModelIndex()) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||
|
||||
void Clear();
|
||||
|
||||
enum EColumns
|
||||
{
|
||||
eProcess = 0,
|
||||
//eTimeStamp,
|
||||
eType,
|
||||
eStatus,
|
||||
eValue,
|
||||
eCount
|
||||
};
|
||||
|
||||
struct SProgInfo
|
||||
{
|
||||
SProgInfo() { Dirty = true; }
|
||||
QString Name;
|
||||
bool Dirty;
|
||||
QSet<quint32> Threads;
|
||||
};
|
||||
QMap<quint32, SProgInfo>GetPids() { return m_PidMap; }
|
||||
|
||||
signals:
|
||||
void NewBranche();
|
||||
|
||||
protected:
|
||||
struct STraceNode : STreeNode
|
||||
{
|
||||
STraceNode(const QVariant& Id) : STreeNode(Id) { bHighLight = false; }
|
||||
|
||||
CTraceEntryPtr pEntry;
|
||||
bool bHighLight;
|
||||
};
|
||||
|
||||
QVariant m_LastID;
|
||||
int m_LastCount;
|
||||
|
||||
virtual STreeNode* MkNode(const QVariant& Id) { return new STraceNode(Id); }
|
||||
virtual STreeNode* MkVirtualNode(const QVariant& Id, STreeNode* pParent);
|
||||
|
||||
/*QList<QVariant> MakePath(const CTraceEntryPtr& pEntry, const QList<CTraceEntryPtr>& EntryList);
|
||||
bool TestPath(const QList<QVariant>& Path, const CTraceEntryPtr& pEntry, const QList<CTraceEntryPtr>& EntryList, int Index = 0);*/
|
||||
|
||||
void SetProcessName(const QString& Name, quint32 pid, quint32 tid);
|
||||
QString GetProcessName(quint32 pid);
|
||||
void LogThreadId(quint32 pid, quint32 tid);
|
||||
QMap<quint32, SProgInfo>m_PidMap;
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,141 +1,141 @@
|
|||
#pragma once
|
||||
|
||||
#include "../../MiscHelpers/Common/PanelView.h"
|
||||
#include "../../MiscHelpers/Common/TreeviewEx.h"
|
||||
#include "../Models/SbieModel.h"
|
||||
|
||||
class CSbieView : public CPanelView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSbieView(QWidget* parent = 0);
|
||||
virtual ~CSbieView();
|
||||
|
||||
virtual QTreeViewEx* GetTree() { return m_pSbieTree; }
|
||||
|
||||
virtual QList<CSandBoxPtr> GetSelectedBoxes();
|
||||
virtual QList<CBoxedProcessPtr> GetSelectedProcesses();
|
||||
virtual QStringList GetSelectedGroups(bool bAndBoxes = false);
|
||||
|
||||
//virtual void UpdateRunMenu();
|
||||
|
||||
virtual QString AddNewBox();
|
||||
virtual QString AddNewGroup();
|
||||
virtual void SelectBox(const QString& Name);
|
||||
|
||||
virtual void PopUpMenu(const QString& Name);
|
||||
virtual void ShowOptions(const QString& Name);
|
||||
|
||||
QMap<QString, QStringList> GetGroups() { return m_Groups; }
|
||||
|
||||
public slots:
|
||||
void Clear();
|
||||
void Refresh();
|
||||
void ReloadUserConfig();
|
||||
void SaveUserConfig();
|
||||
|
||||
private slots:
|
||||
void OnToolTipCallback(const QVariant& ID, QString& ToolTip);
|
||||
|
||||
void OnCustomSortByColumn(int column);
|
||||
|
||||
void OnDoubleClicked(const QModelIndex& index);
|
||||
void ProcessSelection(const QItemSelection& selected, const QItemSelection& deselected);
|
||||
|
||||
void OnGroupAction();
|
||||
void OnSandBoxAction();
|
||||
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; }
|
||||
virtual QAbstractItemModel* GetModel() { return m_pSortProxy; }
|
||||
|
||||
virtual void UpdateRunMenu(const CSandBoxPtr& pBox);
|
||||
|
||||
QMap<QString, QStringList> m_Groups;
|
||||
QSet<QString> m_Collapsed;
|
||||
bool m_UserConfigChanged;
|
||||
|
||||
private:
|
||||
|
||||
void UpdateMenu();
|
||||
void UpdateGroupMenu();
|
||||
void RenameGroup(const QString OldName, const QString NewName);
|
||||
|
||||
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;
|
||||
CSbieModel* m_pSbieModel;
|
||||
QSortFilterProxyModel* m_pSortProxy;
|
||||
|
||||
QMenu* m_pMenu2;
|
||||
|
||||
QAction* m_pNewBox;
|
||||
QAction* m_pAddGroupe;
|
||||
QAction* m_pRenGroupe;
|
||||
QAction* m_pDelGroupe;
|
||||
int m_iMenuTop;
|
||||
QMenu* m_pMenuRun;
|
||||
QAction* m_pMenuRunAny;
|
||||
QAction* m_pMenuRunMenu;
|
||||
QAction* m_pMenuRunBrowser;
|
||||
QAction* m_pMenuRunMailer;
|
||||
QMenu* m_pMenuRunTools;
|
||||
QAction* m_pMenuRunExplorer;
|
||||
QAction* m_pMenuRunRegEdit;
|
||||
QAction* m_pMenuRunAppWiz;
|
||||
QAction* m_pMenuAutoRun;
|
||||
QAction* m_pMenuRunCmd;
|
||||
QAction* m_pMenuRunCmdAdmin;
|
||||
QAction* m_pMenuRunCmd32;
|
||||
QAction* m_pMenuMkLink;
|
||||
QMenu* m_pMenuPresets;
|
||||
QActionGroup* m_pMenuPresetsAdmin;
|
||||
QAction* m_pMenuPresetsShowUAC;
|
||||
QAction* m_pMenuPresetsNoAdmin;
|
||||
QAction* m_pMenuPresetsFakeAdmin;
|
||||
QAction* m_pMenuPresetsINet;
|
||||
QAction* m_pMenuPresetsShares;
|
||||
QAction* m_pMenuOptions;
|
||||
QAction* m_pMenuSnapshots;
|
||||
QAction* m_pMenuEmptyBox;
|
||||
QMenu* m_pMenuContent;
|
||||
QAction* m_pMenuExplore;
|
||||
QAction* m_pMenuBrowse;
|
||||
QAction* m_pMenuRegEdit;
|
||||
QAction* m_pMenuRecover;
|
||||
QAction* m_pMenuCleanUp;
|
||||
QAction* m_pMenuRemove;
|
||||
QAction* m_pMenuMoveUp;
|
||||
//QAction* m_pMenuMoveBy;
|
||||
QAction* m_pMenuMoveDown;
|
||||
QMenu* m_pMenuMoveTo;
|
||||
int m_iMoveTo;
|
||||
QAction* m_pMenuRename;
|
||||
int m_iMenuBox;
|
||||
|
||||
QAction* m_pMenuTerminate;
|
||||
QAction* m_pMenuLinkTo;
|
||||
QMenu* m_pMenuPreset;
|
||||
QAction* m_pMenuBlackList;
|
||||
QAction* m_pMenuAllowInternet;
|
||||
QAction* m_pMenuMarkForced;
|
||||
QAction* m_pMenuMarkLinger;
|
||||
QAction* m_pMenuMarkLeader;
|
||||
QAction* m_pMenuPinToRun;
|
||||
//QAction* m_pMenuSuspend;
|
||||
//QAction* m_pMenuResume;
|
||||
int m_iMenuProc;
|
||||
|
||||
int m_iMenuRun;
|
||||
#pragma once
|
||||
|
||||
#include "../../MiscHelpers/Common/PanelView.h"
|
||||
#include "../../MiscHelpers/Common/TreeviewEx.h"
|
||||
#include "../Models/SbieModel.h"
|
||||
|
||||
class CSbieView : public CPanelView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSbieView(QWidget* parent = 0);
|
||||
virtual ~CSbieView();
|
||||
|
||||
virtual QTreeViewEx* GetTree() { return m_pSbieTree; }
|
||||
|
||||
virtual QList<CSandBoxPtr> GetSelectedBoxes();
|
||||
virtual QList<CBoxedProcessPtr> GetSelectedProcesses();
|
||||
virtual QStringList GetSelectedGroups(bool bAndBoxes = false);
|
||||
|
||||
//virtual void UpdateRunMenu();
|
||||
|
||||
virtual QString AddNewBox();
|
||||
virtual QString AddNewGroup();
|
||||
virtual void SelectBox(const QString& Name);
|
||||
|
||||
virtual void PopUpMenu(const QString& Name);
|
||||
virtual void ShowOptions(const QString& Name);
|
||||
|
||||
QMap<QString, QStringList> GetGroups() { return m_Groups; }
|
||||
|
||||
public slots:
|
||||
void Clear();
|
||||
void Refresh();
|
||||
void ReloadUserConfig();
|
||||
void SaveUserConfig();
|
||||
|
||||
private slots:
|
||||
void OnToolTipCallback(const QVariant& ID, QString& ToolTip);
|
||||
|
||||
void OnCustomSortByColumn(int column);
|
||||
|
||||
void OnDoubleClicked(const QModelIndex& index);
|
||||
void ProcessSelection(const QItemSelection& selected, const QItemSelection& deselected);
|
||||
|
||||
void OnGroupAction();
|
||||
void OnSandBoxAction();
|
||||
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; }
|
||||
virtual QAbstractItemModel* GetModel() { return m_pSortProxy; }
|
||||
|
||||
virtual void UpdateRunMenu(const CSandBoxPtr& pBox);
|
||||
|
||||
QMap<QString, QStringList> m_Groups;
|
||||
QSet<QString> m_Collapsed;
|
||||
bool m_UserConfigChanged;
|
||||
|
||||
private:
|
||||
|
||||
void UpdateMenu();
|
||||
void UpdateGroupMenu();
|
||||
void RenameGroup(const QString OldName, const QString NewName);
|
||||
|
||||
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;
|
||||
CSbieModel* m_pSbieModel;
|
||||
QSortFilterProxyModel* m_pSortProxy;
|
||||
|
||||
QMenu* m_pMenu2;
|
||||
|
||||
QAction* m_pNewBox;
|
||||
QAction* m_pAddGroupe;
|
||||
QAction* m_pRenGroupe;
|
||||
QAction* m_pDelGroupe;
|
||||
int m_iMenuTop;
|
||||
QMenu* m_pMenuRun;
|
||||
QAction* m_pMenuRunAny;
|
||||
QAction* m_pMenuRunMenu;
|
||||
QAction* m_pMenuRunBrowser;
|
||||
QAction* m_pMenuRunMailer;
|
||||
QMenu* m_pMenuRunTools;
|
||||
QAction* m_pMenuRunExplorer;
|
||||
QAction* m_pMenuRunRegEdit;
|
||||
QAction* m_pMenuRunAppWiz;
|
||||
QAction* m_pMenuAutoRun;
|
||||
QAction* m_pMenuRunCmd;
|
||||
QAction* m_pMenuRunCmdAdmin;
|
||||
QAction* m_pMenuRunCmd32;
|
||||
QAction* m_pMenuMkLink;
|
||||
QMenu* m_pMenuPresets;
|
||||
QActionGroup* m_pMenuPresetsAdmin;
|
||||
QAction* m_pMenuPresetsShowUAC;
|
||||
QAction* m_pMenuPresetsNoAdmin;
|
||||
QAction* m_pMenuPresetsFakeAdmin;
|
||||
QAction* m_pMenuPresetsINet;
|
||||
QAction* m_pMenuPresetsShares;
|
||||
QAction* m_pMenuOptions;
|
||||
QAction* m_pMenuSnapshots;
|
||||
QAction* m_pMenuEmptyBox;
|
||||
QMenu* m_pMenuContent;
|
||||
QAction* m_pMenuExplore;
|
||||
QAction* m_pMenuBrowse;
|
||||
QAction* m_pMenuRegEdit;
|
||||
QAction* m_pMenuRecover;
|
||||
QAction* m_pMenuCleanUp;
|
||||
QAction* m_pMenuRemove;
|
||||
QAction* m_pMenuMoveUp;
|
||||
//QAction* m_pMenuMoveBy;
|
||||
QAction* m_pMenuMoveDown;
|
||||
QMenu* m_pMenuMoveTo;
|
||||
int m_iMoveTo;
|
||||
QAction* m_pMenuRename;
|
||||
int m_iMenuBox;
|
||||
|
||||
QAction* m_pMenuTerminate;
|
||||
QAction* m_pMenuLinkTo;
|
||||
QMenu* m_pMenuPreset;
|
||||
QAction* m_pMenuBlackList;
|
||||
QAction* m_pMenuAllowInternet;
|
||||
QAction* m_pMenuMarkForced;
|
||||
QAction* m_pMenuMarkLinger;
|
||||
QAction* m_pMenuMarkLeader;
|
||||
QAction* m_pMenuPinToRun;
|
||||
//QAction* m_pMenuSuspend;
|
||||
//QAction* m_pMenuResume;
|
||||
int m_iMenuProc;
|
||||
|
||||
int m_iMenuRun;
|
||||
};
|
|
@ -1,327 +1,327 @@
|
|||
#include "stdafx.h"
|
||||
#include "TraceView.h"
|
||||
#include "..\SandMan.h"
|
||||
#include "../QSbieAPI/SbieAPI.h"
|
||||
#include "..\Models\TraceModel.h"
|
||||
#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;
|
||||
//};
|
||||
|
||||
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();
|
||||
m_pTraceTree = m_pTraceToolBar->addAction(CSandMan::GetIcon("Tree"), tr("Show as task tree"), this, SLOT(OnSetTree()));
|
||||
m_pTraceTree->setCheckable(true);
|
||||
m_pTraceTree->setChecked(theConf->GetBool("Options/UseLogTree"));
|
||||
m_pTraceToolBar->addSeparator();
|
||||
m_pTraceToolBar->layout()->setSpacing(3);
|
||||
|
||||
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_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_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);
|
||||
|
||||
m_pMainLayout->insertWidget(0, m_pTraceToolBar);
|
||||
|
||||
m_pTraceModel = new CTraceModel();
|
||||
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_pTreeList->setModel(m_pSortProxy);
|
||||
//m_pSortProxy->setView(m_pTreeList);
|
||||
|
||||
m_pTreeList->setModel(m_pTraceModel);
|
||||
|
||||
|
||||
m_pTreeList->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
#ifdef WIN32
|
||||
QStyle* pStyle = QStyleFactory::create("windows");
|
||||
m_pTreeList->setStyle(pStyle);
|
||||
#endif
|
||||
m_pTreeList->setExpandsOnDoubleClick(false);
|
||||
//m_pTreeList->setSortingEnabled(true);
|
||||
|
||||
m_pTreeList->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(m_pTreeList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OnMenu(const QPoint&)));
|
||||
|
||||
m_pTreeList->setColumnReset(1);
|
||||
//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, this));
|
||||
|
||||
|
||||
QByteArray Columns = theConf->GetBlob("MainWindow/TraceLog_Columns");
|
||||
if (!Columns.isEmpty())
|
||||
((QTreeViewEx*)GetView())->OnResetColumns();
|
||||
else
|
||||
((QTreeViewEx*)GetView())->restoreState(Columns);
|
||||
}
|
||||
|
||||
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_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();
|
||||
QList<QVariant> Added = m_pTraceModel->Sync(ResourceLog, CTraceView__Filter, this);
|
||||
|
||||
if (m_pTraceModel->IsTree())
|
||||
{
|
||||
QTimer::singleShot(100, this, [this, Added]() {
|
||||
//CSortFilterProxyModel* pSortProxy = (CSortFilterProxyModel*)GetModel();
|
||||
foreach(const QVariant ID, Added) {
|
||||
// m_pTreeList->expand(pSortProxy->mapFromSource(m_pTraceModel->FindIndex(ID)));
|
||||
m_pTreeList->expand(m_pTraceModel->FindIndex(ID));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void CTraceView::Clear()
|
||||
{
|
||||
m_pTracePid->clear();
|
||||
m_pTracePid->addItem(tr("[All]"), 0);
|
||||
|
||||
m_pTraceTid->clear();
|
||||
m_pTraceTid->addItem(tr("[All]"), 0);
|
||||
|
||||
theAPI->ClearTrace();
|
||||
m_pTraceModel->Clear();
|
||||
}
|
||||
|
||||
void CTraceView::OnSetTree()
|
||||
{
|
||||
m_pTraceModel->SetTree(m_pTraceTree->isChecked());
|
||||
m_pTraceModel->Clear();
|
||||
theConf->SetValue("Options/UseLogTree", m_pTraceTree->isChecked());
|
||||
}
|
||||
|
||||
void CTraceView::UpdateFilters()
|
||||
{
|
||||
quint32 cur_pid = m_pTracePid->currentData().toUInt();
|
||||
|
||||
QMap<quint32, CTraceModel::SProgInfo> pids = m_pTraceModel->GetPids();
|
||||
foreach(quint32 pid, pids.uniqueKeys()) {
|
||||
CTraceModel::SProgInfo& Info = pids[pid];
|
||||
|
||||
if(m_pTracePid->findData(pid) == -1)
|
||||
m_pTracePid->addItem(tr("%1 (%2)").arg(Info.Name).arg(pid), pid);
|
||||
|
||||
if (cur_pid != 0 && cur_pid != pid)
|
||||
continue;
|
||||
|
||||
foreach(quint32 tid, Info.Threads) {
|
||||
if (m_pTraceTid->findData(tid) == -1)
|
||||
m_pTraceTid->addItem(tr("%1").arg(tid), tid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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_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]() {
|
||||
|
||||
m_pTraceTid->clear();
|
||||
m_pTraceTid->addItem(tr("[All]"), 0);
|
||||
|
||||
UpdateFilters();
|
||||
});
|
||||
|
||||
//m_pSortProxy->setFilterKeyColumn(m_pSortProxy->filterKeyColumn());
|
||||
m_FullRefresh = true;
|
||||
m_pTreeList->expandAll();
|
||||
}
|
||||
|
||||
void CTraceView::OnSetTidFilter()
|
||||
{
|
||||
m_FilterTid = m_pTraceTid->currentData().toUInt();
|
||||
//m_pSortProxy->m_FilterTid = m_pTraceTid->currentData().toUInt();
|
||||
|
||||
//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();
|
||||
}
|
||||
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "TraceView.h"
|
||||
#include "..\SandMan.h"
|
||||
#include "../QSbieAPI/SbieAPI.h"
|
||||
#include "..\Models\TraceModel.h"
|
||||
#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;
|
||||
//};
|
||||
|
||||
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();
|
||||
m_pTraceTree = m_pTraceToolBar->addAction(CSandMan::GetIcon("Tree"), tr("Show as task tree"), this, SLOT(OnSetTree()));
|
||||
m_pTraceTree->setCheckable(true);
|
||||
m_pTraceTree->setChecked(theConf->GetBool("Options/UseLogTree"));
|
||||
m_pTraceToolBar->addSeparator();
|
||||
m_pTraceToolBar->layout()->setSpacing(3);
|
||||
|
||||
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_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_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);
|
||||
|
||||
m_pMainLayout->insertWidget(0, m_pTraceToolBar);
|
||||
|
||||
m_pTraceModel = new CTraceModel();
|
||||
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_pTreeList->setModel(m_pSortProxy);
|
||||
//m_pSortProxy->setView(m_pTreeList);
|
||||
|
||||
m_pTreeList->setModel(m_pTraceModel);
|
||||
|
||||
|
||||
m_pTreeList->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
#ifdef WIN32
|
||||
QStyle* pStyle = QStyleFactory::create("windows");
|
||||
m_pTreeList->setStyle(pStyle);
|
||||
#endif
|
||||
m_pTreeList->setExpandsOnDoubleClick(false);
|
||||
//m_pTreeList->setSortingEnabled(true);
|
||||
|
||||
m_pTreeList->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(m_pTreeList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OnMenu(const QPoint&)));
|
||||
|
||||
m_pTreeList->setColumnReset(1);
|
||||
//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, this));
|
||||
|
||||
|
||||
QByteArray Columns = theConf->GetBlob("MainWindow/TraceLog_Columns");
|
||||
if (!Columns.isEmpty())
|
||||
((QTreeViewEx*)GetView())->OnResetColumns();
|
||||
else
|
||||
((QTreeViewEx*)GetView())->restoreState(Columns);
|
||||
}
|
||||
|
||||
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_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();
|
||||
QList<QVariant> Added = m_pTraceModel->Sync(ResourceLog, CTraceView__Filter, this);
|
||||
|
||||
if (m_pTraceModel->IsTree())
|
||||
{
|
||||
QTimer::singleShot(100, this, [this, Added]() {
|
||||
//CSortFilterProxyModel* pSortProxy = (CSortFilterProxyModel*)GetModel();
|
||||
foreach(const QVariant ID, Added) {
|
||||
// m_pTreeList->expand(pSortProxy->mapFromSource(m_pTraceModel->FindIndex(ID)));
|
||||
m_pTreeList->expand(m_pTraceModel->FindIndex(ID));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void CTraceView::Clear()
|
||||
{
|
||||
m_pTracePid->clear();
|
||||
m_pTracePid->addItem(tr("[All]"), 0);
|
||||
|
||||
m_pTraceTid->clear();
|
||||
m_pTraceTid->addItem(tr("[All]"), 0);
|
||||
|
||||
theAPI->ClearTrace();
|
||||
m_pTraceModel->Clear();
|
||||
}
|
||||
|
||||
void CTraceView::OnSetTree()
|
||||
{
|
||||
m_pTraceModel->SetTree(m_pTraceTree->isChecked());
|
||||
m_pTraceModel->Clear();
|
||||
theConf->SetValue("Options/UseLogTree", m_pTraceTree->isChecked());
|
||||
}
|
||||
|
||||
void CTraceView::UpdateFilters()
|
||||
{
|
||||
quint32 cur_pid = m_pTracePid->currentData().toUInt();
|
||||
|
||||
QMap<quint32, CTraceModel::SProgInfo> pids = m_pTraceModel->GetPids();
|
||||
foreach(quint32 pid, pids.uniqueKeys()) {
|
||||
CTraceModel::SProgInfo& Info = pids[pid];
|
||||
|
||||
if(m_pTracePid->findData(pid) == -1)
|
||||
m_pTracePid->addItem(tr("%1 (%2)").arg(Info.Name).arg(pid), pid);
|
||||
|
||||
if (cur_pid != 0 && cur_pid != pid)
|
||||
continue;
|
||||
|
||||
foreach(quint32 tid, Info.Threads) {
|
||||
if (m_pTraceTid->findData(tid) == -1)
|
||||
m_pTraceTid->addItem(tr("%1").arg(tid), tid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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_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]() {
|
||||
|
||||
m_pTraceTid->clear();
|
||||
m_pTraceTid->addItem(tr("[All]"), 0);
|
||||
|
||||
UpdateFilters();
|
||||
});
|
||||
|
||||
//m_pSortProxy->setFilterKeyColumn(m_pSortProxy->filterKeyColumn());
|
||||
m_FullRefresh = true;
|
||||
m_pTreeList->expandAll();
|
||||
}
|
||||
|
||||
void CTraceView::OnSetTidFilter()
|
||||
{
|
||||
m_FilterTid = m_pTraceTid->currentData().toUInt();
|
||||
//m_pSortProxy->m_FilterTid = m_pTraceTid->currentData().toUInt();
|
||||
|
||||
//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();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,54 +1,54 @@
|
|||
#pragma once
|
||||
|
||||
#include "../../MiscHelpers/Common/PanelView.h"
|
||||
#include "../../MiscHelpers/Common/TreeviewEx.h"
|
||||
#include "../Models/SbieModel.h"
|
||||
|
||||
class CTraceFilterProxyModel;
|
||||
class CTraceModel;
|
||||
|
||||
class CTraceView : public CPanelWidget<QTreeViewEx>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CTraceView(QWidget* parent = 0);
|
||||
~CTraceView();
|
||||
|
||||
void Refresh();
|
||||
void Clear();
|
||||
|
||||
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;
|
||||
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_pAllBoxes;
|
||||
QComboBox* m_pTracePid;
|
||||
QComboBox* m_pTraceTid;
|
||||
QComboBox* m_pTraceType;
|
||||
QComboBox* m_pTraceStatus;
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../MiscHelpers/Common/PanelView.h"
|
||||
#include "../../MiscHelpers/Common/TreeviewEx.h"
|
||||
#include "../Models/SbieModel.h"
|
||||
|
||||
class CTraceFilterProxyModel;
|
||||
class CTraceModel;
|
||||
|
||||
class CTraceView : public CPanelWidget<QTreeViewEx>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CTraceView(QWidget* parent = 0);
|
||||
~CTraceView();
|
||||
|
||||
void Refresh();
|
||||
void Clear();
|
||||
|
||||
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;
|
||||
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_pAllBoxes;
|
||||
QComboBox* m_pTracePid;
|
||||
QComboBox* m_pTraceTid;
|
||||
QComboBox* m_pTraceType;
|
||||
QComboBox* m_pTraceStatus;
|
||||
|
||||
};
|
Loading…
Reference in New Issue