Make fc2dconfig read existing config file
This commit is contained in:
		
							parent
							
								
									b9c9cb3de4
								
							
						
					
					
						commit
						5c53e82fb7
					
				| 
						 | 
				
			
			@ -73,5 +73,8 @@ add_executable( fc2dconfig
 | 
			
		|||
	src/fc2dconfig.cpp
 | 
			
		||||
	src/paths.cpp
 | 
			
		||||
	src/modellist.cpp
 | 
			
		||||
	src/configfile.cpp
 | 
			
		||||
	src/toml.c
 | 
			
		||||
	src/tomlcpp.cpp
 | 
			
		||||
)
 | 
			
		||||
target_link_libraries( fc2dconfig  ${wxWidgets_LIBRARIES} )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,7 @@
 | 
			
		|||
#include <args.hpp>
 | 
			
		||||
#include <paths.hpp>
 | 
			
		||||
#include <modellist.hpp>
 | 
			
		||||
#include <configfile.hpp>
 | 
			
		||||
 | 
			
		||||
#include <wx/wxprec.h>
 | 
			
		||||
#ifndef WX_PRECOMP
 | 
			
		||||
| 
						 | 
				
			
			@ -22,6 +23,7 @@ class ConfigurationFrame : public wxFrame {
 | 
			
		|||
		std::vector<std::string> modelVec;
 | 
			
		||||
		wxCheckBox* useHaarCheckBox;
 | 
			
		||||
		wxChoice* modelNameChoice;
 | 
			
		||||
		void loadExistingConfig();	// loads existing config file and populates controls
 | 
			
		||||
		void OnApply(wxCommandEvent& event);
 | 
			
		||||
		void OnExit(wxCommandEvent& event);
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -85,6 +87,21 @@ ConfigurationFrame::ConfigurationFrame() : wxFrame(NULL, wxID_ANY, "Configure "
 | 
			
		|||
 | 
			
		||||
	Bind(wxEVT_BUTTON, &ConfigurationFrame::OnApply, this, wxID_APPLY);
 | 
			
		||||
	Bind(wxEVT_BUTTON, &ConfigurationFrame::OnExit, this, wxID_CANCEL);
 | 
			
		||||
 | 
			
		||||
	loadExistingConfig();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ConfigurationFrame::loadExistingConfig() {
 | 
			
		||||
	struct optData configData;
 | 
			
		||||
	configFileOpen(&configData);
 | 
			
		||||
 | 
			
		||||
	useHaarCheckBox->SetValue(configData.useHaar);
 | 
			
		||||
	for (int i = 0; i < modelVec.size(); i++) {
 | 
			
		||||
		if (modelVec[i] == configData.model) {
 | 
			
		||||
			modelNameChoice->SetSelection(i);
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ConfigurationFrame::OnApply(wxCommandEvent& event) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue