From 3c94c5755873b38ea914537309a1ab11f87cc027 Mon Sep 17 00:00:00 2001 From: Epicalert Date: Fri, 2 Jul 2021 18:25:32 +0800 Subject: [PATCH] Improve readability of config menu --- src/fc2dconfig.cpp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/fc2dconfig.cpp b/src/fc2dconfig.cpp index 92c0dda..f74f468 100644 --- a/src/fc2dconfig.cpp +++ b/src/fc2dconfig.cpp @@ -39,31 +39,43 @@ bool ConfigurationApp::OnInit() { } ConfigurationFrame::ConfigurationFrame() : wxFrame(NULL, wxID_ANY, "Configure " PROJECT_NAME) { - wxPanel* panel = new wxPanel(this, wxID_ANY); - - // TODO: load config file and populate values - useHaarCheckBox = new wxCheckBox(panel, wxID_ANY, "Disable DNN face detection"); - // find models to populate model dropdown modelVec = listModels(); wxString modelArray[modelVec.size()]; - for (int i = 0; i < modelVec.size(); i++) { modelArray[i] = wxString(modelVec[i]); } + + wxPanel* panel = new wxPanel(this, wxID_ANY); + + // TODO: load config file and populate values + // define all controls and labels + useHaarCheckBox = new wxCheckBox(panel, wxID_ANY, "Disable DNN face detection"); + wxStaticText* modelNameText = new wxStaticText(panel, wxID_ANY, "Model name:"); modelNameChoice = new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, modelVec.size(), modelArray); + wxBoxSizer* modelSizer = new wxBoxSizer(wxHORIZONTAL); // need to put label next to dropdown + modelSizer->Add(modelNameText, 0, wxALIGN_CENTER | wxALL, 5); + modelSizer->Add(modelNameChoice, 0, wxLEFT, 20); + + wxStaticBoxSizer* generalBoxSizer = new wxStaticBoxSizer(new wxStaticBox(panel, wxID_ANY, "General"), wxVERTICAL); + generalBoxSizer->Add(modelSizer, 0, wxALL, 5); + + wxStaticBoxSizer* performanceBoxSizer = new wxStaticBoxSizer(new wxStaticBox(panel, wxID_ANY, "Performance"), wxVERTICAL); + performanceBoxSizer->Add(useHaarCheckBox, 0, wxALL, 5); + + // define bottom buttons (Cancel and Apply) and their sizer wxButton* cancelButton = new wxButton(panel, wxID_CANCEL, "Cancel"); wxButton* applyButton = new wxButton(panel, wxID_APPLY, "Apply settings"); - wxBoxSizer* bottomButtonSizer = new wxBoxSizer(wxHORIZONTAL); bottomButtonSizer->Add(cancelButton, 0, wxALL, 5); bottomButtonSizer->Add(applyButton, 0, wxALL, 5); + // define main sizer wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); - sizer->Add(useHaarCheckBox, 0, wxALL | wxALIGN_LEFT, 5); - sizer->Add(modelNameChoice, 0, wxALL | wxALIGN_LEFT, 5); + sizer->Add(generalBoxSizer, 0, wxALL | wxALIGN_LEFT | wxEXPAND, 10); + sizer->Add(performanceBoxSizer, 0, wxALL | wxALIGN_LEFT | wxEXPAND, 10); sizer->AddStretchSpacer(1); sizer->Add(bottomButtonSizer, 0, wxALIGN_RIGHT | wxALL, 10);