pacnt:筛选数量匹配架子。

This commit is contained in:
taynpg 2025-04-17 21:03:35 +08:00
parent 1443f14fb3
commit 038dc600b8
8 changed files with 131 additions and 6 deletions

View File

@ -12,4 +12,20 @@ message(STATUS "Compiler CXX ID: ${CMAKE_CXX_COMPILER_ID}")
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}/)
add_subdirectory(ParamMatchCnt)
add_subdirectory(ParamMatchCnt)
execute_process(
COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE VERSION_GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE VERSION_GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
configure_file(version.h.in version.h)
message(STATUS "build dir:${PROJECT_BINARY_DIR}")
include_directories(${PROJECT_BINARY_DIR})

View File

@ -17,6 +17,8 @@ set(PSOURCES
mainframe.h
mainframe.cxx
main.cxx
mainfunc.h
mainfunc.cxx
)
find_package(wxWidgets CONFIG REQUIRED)

View File

@ -6,6 +6,9 @@ public:
virtual bool OnInit()
{
MainFrame* frame = new MainFrame(wxT("ParamMatchCnt"));
if (!frame->Init()) {
return false;
}
frame->Show(true);
return true;
}

View File

@ -1,7 +1,11 @@
#include "mainframe.h"
#include <wx/grid.h>
constexpr int g_Border = 2;
MainFrame::MainFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(800, 600))
{
match_func_ = std::make_shared<MatchFunc>();
}
MainFrame::~MainFrame()
@ -10,5 +14,81 @@ MainFrame::~MainFrame()
bool MainFrame::Init()
{
return false;
}
auto* panel = new wxPanel(this, wxID_ANY);
auto* mainSizer = new wxBoxSizer(wxVERTICAL);
auto* sizerA = new wxBoxSizer(wxHORIZONTAL);
auto* staticTextA = new wxStaticText(panel, wxID_ANY, wxT("工程目录:"));
proj_root_ = new wxTextCtrl(panel, wxID_ANY, wxT(""));
auto* buttonA = new wxButton(panel, wxID_ANY, wxT("..."));
buttonA->Bind(wxEVT_BUTTON, &MainFrame::OnSelectDir, this, buttonA->GetId());
sizerA->Add(staticTextA, 0, wxALL | wxALIGN_CENTER_VERTICAL, g_Border);
sizerA->Add(proj_root_, 1, wxALL, g_Border);
sizerA->Add(buttonA, 0, wxALL, g_Border);
auto* sizerHelp = new wxBoxSizer(wxHORIZONTAL);
auto* sizerB = new wxBoxSizer(wxHORIZONTAL);
auto* helpText = new wxStaticText(panel, wxID_ANY, wxT("简要说明:筛选框多个内容以|分隔。"));
sizerHelp->Add(helpText, 1, wxALL, g_Border);
auto* staticTextB = new wxStaticText(panel, wxID_ANY, wxT("筛选后缀:"));
auto* staticTextC = new wxStaticText(panel, wxID_ANY, wxT("筛选函数:"));
auto* combox = new wxChoice(panel, wxID_ANY);
combox->Append(wxT("printf"));
combox->Append(wxT("format"));
combox->SetSelection(0);
auto* textCtrlC = new wxTextCtrl(panel, wxID_ANY, wxT("cxx|cpp|h|hpp|cc|c"));
sizerB->Add(staticTextB, 0, wxALL | wxALIGN_CENTER_VERTICAL, g_Border);
sizerB->Add(textCtrlC, 1, wxALL | wxEXPAND, g_Border);
sizerB->Add(staticTextC, 0, wxALL | wxALIGN_CENTER_VERTICAL, g_Border);
sizerB->Add(combox, 0, wxALL, g_Border);
auto* sizerC = new wxBoxSizer(wxHORIZONTAL);
// 表格控件
auto* tableCtrl = new wxGrid(panel, wxID_ANY);
tableCtrl->CreateGrid(1, 2);
tableCtrl->SetColLabelValue(0, wxT("文件名"));
tableCtrl->SetColLabelValue(1, wxT("行号"));
sizerC->Add(tableCtrl, 1, wxALL, g_Border);
auto* sizerD = new wxBoxSizer(wxHORIZONTAL);
auto* btnStart = new wxButton(panel, wxID_ANY, wxT("开始"));
auto* btnRecheck = new wxButton(panel, wxID_ANY, wxT("重查"));
auto* btnSimpleIntro = new wxButton(panel, wxID_ANY, wxT("工具简介"));
auto* btnExit = new wxButton(panel, wxID_ANY, wxT("退出"));
sizerD->Add(btnStart, 0, wxALL, g_Border);
sizerD->Add(btnRecheck, 0, wxALL, g_Border);
sizerD->Add(btnSimpleIntro, 0, wxALL, g_Border);
sizerD->Add(btnExit, 0, wxALL, g_Border);
mainSizer->Add(sizerA, 0, wxEXPAND | wxALL, g_Border);
mainSizer->Add(sizerHelp, 0, wxEXPAND | wxALL, g_Border);
mainSizer->Add(sizerB, 0, wxEXPAND | wxALL, g_Border);
mainSizer->Add(sizerC, 1, wxEXPAND | wxALL, g_Border);
mainSizer->Add(sizerD, 0, wxEXPAND | wxALL, g_Border);
panel->SetSizer(mainSizer);
return true;
}
void MainFrame::OnSelectDir(wxCommandEvent& event)
{
wxDirDialog dialog(this, wxT("选择工程根目录"));
if (dialog.ShowModal() == wxID_OK) {
proj_root_->SetValue(dialog.GetPath());
}
}
void MainFrame::Start(wxCommandEvent& event)
{
auto dir = proj_root_->GetValue();
if (dir.Trim().IsEmpty()) {
wxMessageBox(wxT("请选择工程根目录!"), wxT("提示"), wxOK | wxICON_INFORMATION);
return;
}
}

View File

@ -1,6 +1,8 @@
#ifndef MAINFRAME_H
#define MAINFRAME_H
#include "mainfunc.h"
#include <memory>
#include <wx/wx.h>
class MainFrame : public wxFrame
@ -13,7 +15,16 @@ public:
bool Init();
private:
wxTextCtrl* proj_root_;
private:
// 选择目录
void OnSelectDir(wxCommandEvent& event);
void Start(wxCommandEvent& event);
private:
std::shared_ptr<MatchFunc> match_func_;
};
#endif // MAINFRAME_H

View File

@ -0,0 +1,5 @@
#include "mainfunc.h"
MatchFunc::MatchFunc()
{
}

10
ParamMatchCnt/mainfunc.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef MAINFUNC_CXX
#define MAINFUNC_CXX
class MatchFunc
{
public:
MatchFunc();
};
#endif // MAINFUNC_CXX

View File

@ -3,7 +3,5 @@
#define VERSION_GIT_COMMIT "@VERSION_GIT_HASH@"
#define VERSION_GIT_BRANCH "@VERSION_GIT_BRANCH@"
#define VERSION_NUM "@PROJECT_VERSION@"
#define VERSION_URL "@PROJECT_URL@"
#endif