mirror of
https://github.com/levinsv/pgadmin3.git
synced 2026-05-21 06:45:27 -06:00
Add new feature frmLog
Для окна состояние "Server status" выполняется: set log_min_messages = FATAL Для Log view добавлена: подержка быстрой навигации: Shift+KeyUP,KeyDOWN переход на запись с тем же sql_state, Alt+KeyUP,KeyDOWN - переход на запись с другим sql_state Добавлена колонка Server - сервер с которого получен лог.
This commit is contained in:
parent
ae38ba2377
commit
8b9ddb7974
11 changed files with 195 additions and 44 deletions
|
|
@ -849,6 +849,8 @@ wxSize ctlSQLGrid::GetBestSize(int row, int col)
|
||||||
{
|
{
|
||||||
wxClientDC dc(GetGridWindow());
|
wxClientDC dc(GetGridWindow());
|
||||||
size = renderer->GetBestSize(*this, *attr, dc, row, col);
|
size = renderer->GetBestSize(*this, *attr, dc, row, col);
|
||||||
|
int h = renderer->GetBestHeight(*this, *attr, dc, row, col, size.GetWidth());
|
||||||
|
size.SetHeight(h);
|
||||||
renderer->DecRef();
|
renderer->DecRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -130,8 +130,12 @@ void frmLog::getFilename() {
|
||||||
wxString namepage;
|
wxString namepage;
|
||||||
for (size_t i = 0;i< conArray.GetCount(); i++) {
|
for (size_t i = 0;i< conArray.GetCount(); i++) {
|
||||||
|
|
||||||
|
if (!namepage.IsEmpty()) namepage += ",";
|
||||||
|
|
||||||
if (!conArray[i].conn->IsAlive()) continue;
|
if (!conArray[i].conn->IsAlive()) {
|
||||||
|
namepage += "-"+conArray[i].conn->GetDbname();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
set = conArray[i].conn->ExecuteSet(
|
set = conArray[i].conn->ExecuteSet(
|
||||||
wxT("select current_setting('log_directory')||'/'||name filename,modification filetime,size len\n")
|
wxT("select current_setting('log_directory')||'/'||name filename,modification filetime,size len\n")
|
||||||
wxT(" FROM pg_ls_logdir() where name ~ '.csv' ORDER BY modification DESC"));
|
wxT(" FROM pg_ls_logdir() where name ~ '.csv' ORDER BY modification DESC"));
|
||||||
|
|
@ -140,7 +144,6 @@ void frmLog::getFilename() {
|
||||||
|
|
||||||
//logfileTimestamp = set->GetDateTime(wxT("filetime"));
|
//logfileTimestamp = set->GetDateTime(wxT("filetime"));
|
||||||
len[i] = set->GetLong(wxT("len"));
|
len[i] = set->GetLong(wxT("len"));
|
||||||
if (!namepage.IsEmpty()) namepage += ",";
|
|
||||||
namepage += conArray[i].conn->GetDbname();
|
namepage += conArray[i].conn->GetDbname();
|
||||||
m_storage_model->getStorage()->SetHost(conArray[i].conn->GetHostName());
|
m_storage_model->getStorage()->SetHost(conArray[i].conn->GetHostName());
|
||||||
|
|
||||||
|
|
@ -417,7 +420,7 @@ frmLog::frmLog(frmMain *form, const wxString &_title, pgServer *srv) : pgFrame(N
|
||||||
wxDefaultSize, wxDV_VARIABLE_LINE_HEIGHT | wxDV_HORIZ_RULES | wxDV_VERT_RULES);
|
wxDefaultSize, wxDV_VARIABLE_LINE_HEIGHT | wxDV_HORIZ_RULES | wxDV_VERT_RULES);
|
||||||
my_view->GetMainWindow()->Bind(wxEVT_MOTION, &MyDataViewCtrl::OnMouseMove, my_view);
|
my_view->GetMainWindow()->Bind(wxEVT_MOTION, &MyDataViewCtrl::OnMouseMove, my_view);
|
||||||
my_view->GetMainWindow()->Bind(wxEVT_KEY_DOWN, &MyDataViewCtrl::OnKEY_DOWN, my_view);
|
my_view->GetMainWindow()->Bind(wxEVT_KEY_DOWN, &MyDataViewCtrl::OnKEY_DOWN, my_view);
|
||||||
my_view->GetMainWindow()->Bind(wxEVT_KEY_UP, &MyDataViewCtrl::OnKEY_DOWN, my_view);
|
my_view->GetMainWindow()->Bind(wxEVT_KEY_UP, &MyDataViewCtrl::OnKEY_UP, my_view);
|
||||||
my_view->Bind(wxEVT_DATAVIEW_COLUMN_HEADER_CLICK, &MyDataViewCtrl::OnEVT_DATAVIEW_COLUMN_HEADER_CLICK, my_view);
|
my_view->Bind(wxEVT_DATAVIEW_COLUMN_HEADER_CLICK, &MyDataViewCtrl::OnEVT_DATAVIEW_COLUMN_HEADER_CLICK, my_view);
|
||||||
my_view->Bind(wxEVT_DATAVIEW_SELECTION_CHANGED, &MyDataViewCtrl::OnEVT_DATAVIEW_SELECTION_CHANGED, my_view);
|
my_view->Bind(wxEVT_DATAVIEW_SELECTION_CHANGED, &MyDataViewCtrl::OnEVT_DATAVIEW_SELECTION_CHANGED, my_view);
|
||||||
my_view->Bind(wxEVT_DATAVIEW_ITEM_CONTEXT_MENU, &MyDataViewCtrl::OnContextMenu, my_view);
|
my_view->Bind(wxEVT_DATAVIEW_ITEM_CONTEXT_MENU, &MyDataViewCtrl::OnContextMenu, my_view);
|
||||||
|
|
|
||||||
|
|
@ -220,6 +220,10 @@ frmStatus::frmStatus(frmMain *form, const wxString &_title, pgConn *conn) : pgFr
|
||||||
initquery = wxT("SET log_statement='none';SET log_duration='off';SET log_min_duration_statement=-1;");
|
initquery = wxT("SET log_statement='none';SET log_duration='off';SET log_min_duration_statement=-1;");
|
||||||
else
|
else
|
||||||
initquery = wxT("SET log_statement='off';SET log_duration='off';SET log_min_duration_statement=-1;");
|
initquery = wxT("SET log_statement='off';SET log_duration='off';SET log_min_duration_statement=-1;");
|
||||||
|
#ifndef _DEBUG
|
||||||
|
initquery += wxT("set log_min_messages = FATAL;");
|
||||||
|
#endif // !_DEBUG
|
||||||
|
|
||||||
connection->ExecuteVoid(initquery, false);
|
connection->ExecuteVoid(initquery, false);
|
||||||
}
|
}
|
||||||
//pg_is_in_recovery()
|
//pg_is_in_recovery()
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,8 @@ private:
|
||||||
wxArrayInt rowsGroup, end;
|
wxArrayInt rowsGroup, end;
|
||||||
wxArrayDouble run;
|
wxArrayDouble run;
|
||||||
};
|
};
|
||||||
|
//#define TEST_wxGridCellAutoWrapStringRenderer
|
||||||
|
#ifndef TEST_wxGridCellAutoWrapStringRenderer
|
||||||
class CursorCellRenderer : public wxGridCellStringRenderer
|
class CursorCellRenderer : public wxGridCellStringRenderer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -197,46 +198,75 @@ class CursorCellRenderer : public wxGridCellStringRenderer
|
||||||
attr.GetAlignment(&hAlign, &vAlign);
|
attr.GetAlignment(&hAlign, &vAlign);
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//CursorCellRenderer::Draw(grid, attr, dc, rect, row, col, isSelected); //
|
//CursorCellRenderer::Draw(grid, attr, dc, rect, row, col, isSelected); //
|
||||||
dc.SetBackgroundMode( wxSOLID );
|
dc.SetBackgroundMode( wxSOLID );
|
||||||
wxString text=grid.GetCellValue(row, col);
|
wxString text=grid.GetCellValue(row, col);
|
||||||
// grey out fields if the grid is disabled
|
// grey out fields if the grid is disabled
|
||||||
if ( grid.IsEnabled() )
|
if ( grid.IsEnabled() )
|
||||||
{
|
{
|
||||||
if ( isSelected )
|
if ( isSelected )
|
||||||
{
|
{
|
||||||
wxColour clr;
|
wxColour clr;
|
||||||
if ( wxWindow::FindFocus() == grid.GetGridWindow() )
|
if ( wxWindow::FindFocus() == grid.GetGridWindow() )
|
||||||
clr = grid.GetSelectionBackground();
|
clr = grid.GetSelectionBackground();
|
||||||
else
|
else
|
||||||
clr = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW);
|
clr = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW);
|
||||||
|
|
||||||
|
|
||||||
dc.SetBrush( wxBrush(clr, wxSOLID) );
|
dc.SetBrush( wxBrush(clr, wxSOLID) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxColor color;
|
wxColor color;
|
||||||
color.Set(239, 228, 176);
|
color.Set(239, 228, 176);
|
||||||
if (text.Find(wxT('\n'))!=wxNOT_FOUND )
|
if (text.Find(wxT('\n'))!=wxNOT_FOUND )
|
||||||
dc.SetBrush( wxBrush(color, wxSOLID) );
|
dc.SetBrush( wxBrush(color, wxSOLID) );
|
||||||
|
else
|
||||||
|
dc.SetBrush( wxBrush(attr.GetBackgroundColour(), wxSOLID) );
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
dc.SetBrush( wxBrush(attr.GetBackgroundColour(), wxSOLID) );
|
{
|
||||||
}
|
dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE), wxSOLID));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE), wxSOLID));
|
|
||||||
}
|
|
||||||
|
|
||||||
dc.SetPen( *wxTRANSPARENT_PEN );
|
dc.SetPen( *wxTRANSPARENT_PEN );
|
||||||
dc.DrawRectangle(rect);
|
dc.DrawRectangle(rect);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
SetTextColoursAndFont(grid, attr, dc, isSelected);
|
SetTextColoursAndFont(grid, attr, dc, isSelected);
|
||||||
grid.DrawTextRectangle(dc, text,
|
grid.DrawTextRectangle(dc, text,
|
||||||
rect, hAlign, vAlign);
|
rect, hAlign, vAlign);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
class CursorCellRenderer : public wxGridCellAutoWrapStringRenderer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void Draw(wxGrid& grid,
|
||||||
|
wxGridCellAttr& attr,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rectCell,
|
||||||
|
int row, int col,
|
||||||
|
bool isSelected) {
|
||||||
|
bool f = false;
|
||||||
|
wxString text = grid.GetCellValue(row, col);
|
||||||
|
wxColor prev;
|
||||||
|
if (!isSelected) {
|
||||||
|
wxColor color;
|
||||||
|
color.Set(239, 228, 176);
|
||||||
|
if (text.Find(wxT('\n')) != wxNOT_FOUND)
|
||||||
|
{
|
||||||
|
//dc.SetBrush(wxBrush(color, wxSOLID));
|
||||||
|
prev = attr.GetBackgroundColour();
|
||||||
|
attr.SetBackgroundColour(color);
|
||||||
|
f = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
wxGridCellAutoWrapStringRenderer::Draw(grid, attr, dc, rectCell, row, col, isSelected);
|
||||||
|
if (f) attr.SetBackgroundColour(prev);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ public:
|
||||||
void AddRow(wxString csvtext);
|
void AddRow(wxString csvtext);
|
||||||
void OnMouseMove(wxMouseEvent& event);
|
void OnMouseMove(wxMouseEvent& event);
|
||||||
void OnKEY_DOWN(wxKeyEvent& event);
|
void OnKEY_DOWN(wxKeyEvent& event);
|
||||||
|
void OnKEY_UP(wxKeyEvent& event);
|
||||||
#ifdef MYTEST
|
#ifdef MYTEST
|
||||||
void OnTimer(wxTimerEvent& event);
|
void OnTimer(wxTimerEvent& event);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ namespace MyConst {
|
||||||
logHint,
|
logHint,
|
||||||
logappname,
|
logappname,
|
||||||
logbtype,
|
logbtype,
|
||||||
|
logSERVER,
|
||||||
Col_Max
|
Col_Max
|
||||||
};
|
};
|
||||||
enum iconIndex {
|
enum iconIndex {
|
||||||
|
|
@ -67,6 +68,7 @@ struct Line {
|
||||||
ps logHint = { 0,0 };
|
ps logHint = { 0,0 };
|
||||||
ps logappname = { 0,0 };
|
ps logappname = { 0,0 };
|
||||||
ps logbtype = { 0,0 };
|
ps logbtype = { 0,0 };
|
||||||
|
ps logSERVER = { 0,0 };
|
||||||
wxString text;
|
wxString text;
|
||||||
};
|
};
|
||||||
struct LineFilter {
|
struct LineFilter {
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ public:
|
||||||
Col_Hint,
|
Col_Hint,
|
||||||
Col_Detail,
|
Col_Detail,
|
||||||
Col_Message,
|
Col_Message,
|
||||||
|
Col_Server,
|
||||||
Col_Max
|
Col_Max
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -132,8 +132,15 @@ void MyDataViewCtrl::ViewGroup(bool view) {
|
||||||
void MyDataViewCtrl::AddRow(wxString csvtext) {
|
void MyDataViewCtrl::AddRow(wxString csvtext) {
|
||||||
StorageModel* m = dynamic_cast<StorageModel*>(GetModel());
|
StorageModel* m = dynamic_cast<StorageModel*>(GetModel());
|
||||||
wxDataViewItem select;
|
wxDataViewItem select;
|
||||||
if (HasSelection()) select = GetSelection();
|
if (HasSelection()) {
|
||||||
|
//select = GetSelection();
|
||||||
|
if (GetSelectedItemsCount() == 1) {
|
||||||
|
wxDataViewItemArray sel;
|
||||||
|
GetSelections(sel);
|
||||||
|
if (sel.size()>0) select = sel[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (m->Prepend(csvtext)) {
|
if (m->Prepend(csvtext)) {
|
||||||
if (!select.IsOk()) return;
|
if (!select.IsOk()) return;
|
||||||
|
|
@ -396,11 +403,93 @@ void MyDataViewCtrl::OnEVT_DATAVIEW_COLUMN_HEADER_CLICK(wxDataViewEvent& event)
|
||||||
|
|
||||||
event.Skip(true);
|
event.Skip(true);
|
||||||
}
|
}
|
||||||
|
void MyDataViewCtrl::OnKEY_UP(wxKeyEvent& event) {
|
||||||
|
// goto next state code
|
||||||
|
int go = 0;
|
||||||
|
if (event.GetKeyCode() == WXK_DOWN) {
|
||||||
|
go = 1;
|
||||||
|
}
|
||||||
|
if (event.GetKeyCode() == WXK_UP) {
|
||||||
|
go = -1;
|
||||||
|
}
|
||||||
|
bool reverse = false;
|
||||||
|
int currrow = -1;
|
||||||
|
wxDataViewItem item;
|
||||||
|
//find next state != current state
|
||||||
|
if ((event.GetModifiers() & wxMOD_ALT) == wxMOD_ALT) {
|
||||||
|
reverse = true;
|
||||||
|
item = this->GetCurrentItem();
|
||||||
|
}
|
||||||
|
//find next state == current state
|
||||||
|
if ((event.GetModifiers() & wxMOD_SHIFT) == wxMOD_SHIFT) {
|
||||||
|
item = this->GetCurrentItem();
|
||||||
|
}
|
||||||
|
if (item.IsOk() && (go != 0)) {
|
||||||
|
|
||||||
|
|
||||||
|
StorageModel* m = dynamic_cast<StorageModel*>(GetModel());
|
||||||
|
Storage* sta = m->getStorage();
|
||||||
|
wxVariant v, t;
|
||||||
|
|
||||||
|
int r = m->GetRow(item);
|
||||||
|
if (r != -1) {
|
||||||
|
m->GetValueByRow(v, r, 0);
|
||||||
|
}
|
||||||
|
else return;
|
||||||
|
int cnt = m->GetRowCount();
|
||||||
|
wxDataViewIconText ic;
|
||||||
|
ic << v;
|
||||||
|
wxString str = ic.GetText();
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
r = r + go;
|
||||||
|
if (r < 0 || r >= cnt) break;
|
||||||
|
m->GetValueByRow(t, r, 0);
|
||||||
|
ic << t;
|
||||||
|
bool rez = ic.GetText() == str;
|
||||||
|
if (reverse) rez = !rez;
|
||||||
|
if (rez)
|
||||||
|
{
|
||||||
|
item = m->GetItem(r);
|
||||||
|
this->SetCurrentItem(item);
|
||||||
|
EnsureVisible(item);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
event.Skip(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
void MyDataViewCtrl::OnKEY_DOWN(wxKeyEvent& event) {
|
void MyDataViewCtrl::OnKEY_DOWN(wxKeyEvent& event) {
|
||||||
if ((event.GetModifiers() & wxMOD_CONTROL) == wxMOD_CONTROL) {
|
if ((event.GetModifiers() & wxMOD_CONTROL) == wxMOD_CONTROL) {
|
||||||
modctrl = true;
|
modctrl = true;
|
||||||
}
|
}
|
||||||
else modctrl = false;
|
else modctrl = false;
|
||||||
|
int go = 0;
|
||||||
|
if (event.GetKeyCode() == WXK_DOWN) {
|
||||||
|
go = 1;
|
||||||
|
}
|
||||||
|
if (event.GetKeyCode() == WXK_UP) {
|
||||||
|
go = -1;
|
||||||
|
}
|
||||||
|
bool reverse = false;
|
||||||
|
int currrow = -1;
|
||||||
|
wxDataViewItem item;
|
||||||
|
//find next state != current state
|
||||||
|
if ((event.GetModifiers() & wxMOD_ALT) == wxMOD_ALT) {
|
||||||
|
reverse = true;
|
||||||
|
item = this->GetCurrentItem();
|
||||||
|
}
|
||||||
|
//find next state == current state
|
||||||
|
if ((event.GetModifiers() & wxMOD_SHIFT) == wxMOD_SHIFT) {
|
||||||
|
item = this->GetCurrentItem();
|
||||||
|
}
|
||||||
|
if (item.IsOk() && (go != 0)) {
|
||||||
|
event.Skip(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
event.Skip(true);
|
event.Skip(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -341,6 +341,9 @@ wxString Storage::get_field(Line& l, MyConst::colField col) {
|
||||||
case MyConst::colField::logbtype:
|
case MyConst::colField::logbtype:
|
||||||
return l.text.substr(l.logbtype.s, l.logbtype.l);
|
return l.text.substr(l.logbtype.s, l.logbtype.l);
|
||||||
break;
|
break;
|
||||||
|
case MyConst::colField::logSERVER:
|
||||||
|
return l.text.substr(l.logSERVER.s, l.logSERVER.l);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -434,6 +437,9 @@ Line Storage::getLineParse(const wxString& str, bool csv) {
|
||||||
wxString logType = tk.GetNextToken();
|
wxString logType = tk.GetNextToken();
|
||||||
st.logbtype = { static_cast<unsigned short int>(t.Len()),static_cast<unsigned short int>(logType.Len()) };
|
st.logbtype = { static_cast<unsigned short int>(t.Len()),static_cast<unsigned short int>(logType.Len()) };
|
||||||
t += logType;
|
t += logType;
|
||||||
|
logCursorpos = GetHost();
|
||||||
|
st.logSERVER = { static_cast<unsigned short int>(t.Len()),static_cast<unsigned short int>(logCursorpos.Len()) };
|
||||||
|
t += logCursorpos;
|
||||||
//fields.Add(logType);
|
//fields.Add(logType);
|
||||||
//st.logType = { t.Len(),logType.Len() };
|
//st.logType = { t.Len(),logType.Len() };
|
||||||
//t += logType;
|
//t += logType;
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,7 @@ void StorageModel::BuildColumns(MyDataViewCtrl* ctrl) {
|
||||||
new MyCustomRendererText(wxDATAVIEW_CELL_EDITABLE, StorageModel::Col_LogTime),
|
new MyCustomRendererText(wxDATAVIEW_CELL_EDITABLE, StorageModel::Col_LogTime),
|
||||||
StorageModel::Col_LogTime,
|
StorageModel::Col_LogTime,
|
||||||
wxCOL_WIDTH_AUTOSIZE,
|
wxCOL_WIDTH_AUTOSIZE,
|
||||||
wxALIGN_LEFT,
|
wxALIGN_NOT,
|
||||||
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE
|
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE
|
||||||
));
|
));
|
||||||
colmap[StorageModel::Col_LogTime] = MyConst::colField::logtime;
|
colmap[StorageModel::Col_LogTime] = MyConst::colField::logtime;
|
||||||
|
|
@ -278,7 +278,7 @@ void StorageModel::BuildColumns(MyDataViewCtrl* ctrl) {
|
||||||
new MyCustomRendererText(wxDATAVIEW_CELL_EDITABLE, StorageModel::Col_User),
|
new MyCustomRendererText(wxDATAVIEW_CELL_EDITABLE, StorageModel::Col_User),
|
||||||
StorageModel::Col_User,
|
StorageModel::Col_User,
|
||||||
wxCOL_WIDTH_AUTOSIZE,
|
wxCOL_WIDTH_AUTOSIZE,
|
||||||
wxALIGN_LEFT,
|
wxALIGN_NOT,
|
||||||
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE
|
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE
|
||||||
));
|
));
|
||||||
colmap[StorageModel::Col_User] = MyConst::colField::loguser;
|
colmap[StorageModel::Col_User] = MyConst::colField::loguser;
|
||||||
|
|
@ -287,7 +287,7 @@ void StorageModel::BuildColumns(MyDataViewCtrl* ctrl) {
|
||||||
new MyCustomRendererText(wxDATAVIEW_CELL_EDITABLE, StorageModel::Col_Db),
|
new MyCustomRendererText(wxDATAVIEW_CELL_EDITABLE, StorageModel::Col_Db),
|
||||||
StorageModel::Col_Db,
|
StorageModel::Col_Db,
|
||||||
30,
|
30,
|
||||||
wxALIGN_LEFT,
|
wxALIGN_NOT,
|
||||||
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE
|
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE
|
||||||
));
|
));
|
||||||
colmap[StorageModel::Col_Db] = MyConst::colField::logdb;
|
colmap[StorageModel::Col_Db] = MyConst::colField::logdb;
|
||||||
|
|
@ -296,7 +296,7 @@ void StorageModel::BuildColumns(MyDataViewCtrl* ctrl) {
|
||||||
new MyCustomRendererText(wxDATAVIEW_CELL_EDITABLE, StorageModel::Col_PID),
|
new MyCustomRendererText(wxDATAVIEW_CELL_EDITABLE, StorageModel::Col_PID),
|
||||||
StorageModel::Col_PID,
|
StorageModel::Col_PID,
|
||||||
60,
|
60,
|
||||||
wxALIGN_LEFT,
|
wxALIGN_NOT,
|
||||||
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE
|
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE
|
||||||
));
|
));
|
||||||
colmap[StorageModel::Col_PID] = MyConst::colField::logpid;
|
colmap[StorageModel::Col_PID] = MyConst::colField::logpid;
|
||||||
|
|
@ -305,7 +305,7 @@ void StorageModel::BuildColumns(MyDataViewCtrl* ctrl) {
|
||||||
new MyCustomRendererText(wxDATAVIEW_CELL_EDITABLE, StorageModel::Col_Host),
|
new MyCustomRendererText(wxDATAVIEW_CELL_EDITABLE, StorageModel::Col_Host),
|
||||||
StorageModel::Col_Host,
|
StorageModel::Col_Host,
|
||||||
90,
|
90,
|
||||||
wxALIGN_LEFT,
|
wxALIGN_NOT,
|
||||||
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE
|
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE
|
||||||
));
|
));
|
||||||
colmap[StorageModel::Col_Host] = MyConst::colField::loghost;
|
colmap[StorageModel::Col_Host] = MyConst::colField::loghost;
|
||||||
|
|
@ -314,7 +314,7 @@ void StorageModel::BuildColumns(MyDataViewCtrl* ctrl) {
|
||||||
new MyCustomRendererText(wxDATAVIEW_CELL_EDITABLE, StorageModel::Col_App),
|
new MyCustomRendererText(wxDATAVIEW_CELL_EDITABLE, StorageModel::Col_App),
|
||||||
StorageModel::Col_App,
|
StorageModel::Col_App,
|
||||||
100,
|
100,
|
||||||
wxALIGN_LEFT,
|
wxALIGN_NOT,
|
||||||
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE
|
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE
|
||||||
));
|
));
|
||||||
colmap[StorageModel::Col_App] = MyConst::colField::logappname;
|
colmap[StorageModel::Col_App] = MyConst::colField::logappname;
|
||||||
|
|
@ -323,7 +323,7 @@ void StorageModel::BuildColumns(MyDataViewCtrl* ctrl) {
|
||||||
new MyCustomRendererText(wxDATAVIEW_CELL_EDITABLE, StorageModel::Col_Hint),
|
new MyCustomRendererText(wxDATAVIEW_CELL_EDITABLE, StorageModel::Col_Hint),
|
||||||
StorageModel::Col_Hint,
|
StorageModel::Col_Hint,
|
||||||
90,
|
90,
|
||||||
wxALIGN_LEFT,
|
wxALIGN_NOT,
|
||||||
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE
|
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE
|
||||||
));
|
));
|
||||||
colmap[StorageModel::Col_Hint] = MyConst::colField::logHint;
|
colmap[StorageModel::Col_Hint] = MyConst::colField::logHint;
|
||||||
|
|
@ -332,7 +332,7 @@ void StorageModel::BuildColumns(MyDataViewCtrl* ctrl) {
|
||||||
new MyCustomRendererText(wxDATAVIEW_CELL_EDITABLE, StorageModel::Col_Detail),
|
new MyCustomRendererText(wxDATAVIEW_CELL_EDITABLE, StorageModel::Col_Detail),
|
||||||
StorageModel::Col_Detail,
|
StorageModel::Col_Detail,
|
||||||
60,
|
60,
|
||||||
wxALIGN_LEFT,
|
wxALIGN_NOT,
|
||||||
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE
|
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE
|
||||||
));
|
));
|
||||||
colmap[StorageModel::Col_Detail] = MyConst::colField::logDetail;
|
colmap[StorageModel::Col_Detail] = MyConst::colField::logDetail;
|
||||||
|
|
@ -342,10 +342,19 @@ void StorageModel::BuildColumns(MyDataViewCtrl* ctrl) {
|
||||||
new MyCustomRendererText(wxDATAVIEW_CELL_EDITABLE, StorageModel::Col_Message),
|
new MyCustomRendererText(wxDATAVIEW_CELL_EDITABLE, StorageModel::Col_Message),
|
||||||
StorageModel::Col_Message,
|
StorageModel::Col_Message,
|
||||||
wxCOL_WIDTH_AUTOSIZE,
|
wxCOL_WIDTH_AUTOSIZE,
|
||||||
wxALIGN_LEFT,
|
wxALIGN_NOT,
|
||||||
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE
|
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE
|
||||||
));
|
));
|
||||||
colmap[StorageModel::Col_Message] = MyConst::colField::logMessage;
|
colmap[StorageModel::Col_Message] = MyConst::colField::logMessage;
|
||||||
|
ctrl->AppendColumn(
|
||||||
|
new wxDataViewColumn("Server",
|
||||||
|
new MyCustomRendererText(wxDATAVIEW_CELL_EDITABLE, StorageModel::Col_Server),
|
||||||
|
StorageModel::Col_Server,
|
||||||
|
wxCOL_WIDTH_AUTOSIZE,
|
||||||
|
wxALIGN_NOT,
|
||||||
|
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE
|
||||||
|
));
|
||||||
|
colmap[StorageModel::Col_Server] = MyConst::colField::logSERVER;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -368,6 +377,7 @@ StorageModel::StorageModel(MyDataViewCtrl* view) :
|
||||||
bool StorageModel::setFilter(int col, wxString val, int flags, MyDataViewCtrl* view) {
|
bool StorageModel::setFilter(int col, wxString val, int flags, MyDataViewCtrl* view) {
|
||||||
|
|
||||||
bool r = store->SetFilter(colmap[col], val, flags);
|
bool r = store->SetFilter(colmap[col], val, flags);
|
||||||
|
m_view->UnselectAll();
|
||||||
Reset(store->getCountFilter());
|
Reset(store->getCountFilter());
|
||||||
if (col != -1) {
|
if (col != -1) {
|
||||||
wxDataViewColumn* vc = view->GetColumn(col);
|
wxDataViewColumn* vc = view->GetColumn(col);
|
||||||
|
|
@ -382,6 +392,7 @@ int StorageModel::testFilter(int col, int position = 0) {
|
||||||
}
|
}
|
||||||
void StorageModel::ApplyFilter() {
|
void StorageModel::ApplyFilter() {
|
||||||
store->ApplyFilter();
|
store->ApplyFilter();
|
||||||
|
m_view->UnselectAll();
|
||||||
Reset(store->getCountFilter());
|
Reset(store->getCountFilter());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -406,6 +417,8 @@ bool StorageModel::Prepend(const wxString& text)
|
||||||
IncCountFreq(StorageModel::Col_Hint, store->GetFieldStorage(row, MyConst::colField::logHint, false));
|
IncCountFreq(StorageModel::Col_Hint, store->GetFieldStorage(row, MyConst::colField::logHint, false));
|
||||||
val = store->GetFieldStorage(row, MyConst::colField::logSqlstate, false);
|
val = store->GetFieldStorage(row, MyConst::colField::logSqlstate, false);
|
||||||
IncCountFreq(StorageModel::Col_ToggleIconText, val);
|
IncCountFreq(StorageModel::Col_ToggleIconText, val);
|
||||||
|
val = store->GetFieldStorage(row, MyConst::colField::logSERVER, false);
|
||||||
|
IncCountFreq(StorageModel::Col_Server, val);
|
||||||
|
|
||||||
|
|
||||||
if (store->ApplyFilter(row)) {
|
if (store->ApplyFilter(row)) {
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue