mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 03:00:06 +00:00 
			
		
		
		
	Add NMEA to settings dialog
This commit is contained in:
		
							parent
							
								
									b7a258d143
								
							
						
					
					
						commit
						8270153957
					
				
					 4 changed files with 412 additions and 475 deletions
				
			
		|  | @ -4,6 +4,41 @@ | |||
| 
 | ||||
| #include <QWidget> | ||||
| 
 | ||||
| #define SCWX_ENUM_MAP_FROM_VALUE(Iterator, ToName)                             \ | ||||
|    [](const std::string& text) -> std::string                                  \ | ||||
|    {                                                                           \ | ||||
|       for (auto enumValue : Iterator)                                          \ | ||||
|       {                                                                        \ | ||||
|          const std::string enumName = ToName(enumValue);                       \ | ||||
|                                                                                \ | ||||
|          if (boost::iequals(text, enumName))                                   \ | ||||
|          {                                                                     \ | ||||
|             /* Return label */                                                 \ | ||||
|             return enumName;                                                   \ | ||||
|          }                                                                     \ | ||||
|       }                                                                        \ | ||||
|                                                                                \ | ||||
|       /* Label not found, return unknown */                                    \ | ||||
|       return "?";                                                              \ | ||||
|    } | ||||
| 
 | ||||
| #define SCWX_SETTINGS_COMBO_BOX(settingsInterface, comboBox, Iterator, ToName) \ | ||||
|    for (const auto& enumValue : Iterator)                                      \ | ||||
|    {                                                                           \ | ||||
|       comboBox->addItem(QString::fromStdString(ToName(enumValue)));            \ | ||||
|    }                                                                           \ | ||||
|                                                                                \ | ||||
|    settingsInterface.SetMapFromValueFunction(                                  \ | ||||
|       SCWX_ENUM_MAP_FROM_VALUE(Iterator, ToName));                             \ | ||||
|    settingsInterface.SetMapToValueFunction(                                    \ | ||||
|       [](std::string text) -> std::string                                      \ | ||||
|       {                                                                        \ | ||||
|          boost::to_lower(text);                                                \ | ||||
|          return text;                                                          \ | ||||
|       });                                                                      \ | ||||
|                                                                                \ | ||||
|    settingsInterface.SetEditWidget(comboBox); | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace qt | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat