Improve readability of config menu

This commit is contained in:
Epicalert 2021-07-02 18:25:32 +08:00
parent e5a1cdd6da
commit 3c94c57558
No known key found for this signature in database
GPG key ID: CAA46F858D0979BD

View file

@ -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);