12 changed files with 206 additions and 88 deletions
@ -0,0 +1,25 @@
|
||||
#include "config.h" |
||||
|
||||
MainConfig::MainConfig() { |
||||
boost::property_tree::json_parser::read_json("config.json", cfg_); |
||||
GenerateSource(); |
||||
GenerateKeybindings(); |
||||
|
||||
// keybindings_cfg_ = cfg_.get_child("keybindings");
|
||||
// notebook_cfg_ = cfg_.get_child("notebook");
|
||||
// menu_cfg_ = cfg_.get_child("menu");
|
||||
} |
||||
|
||||
void MainConfig::GenerateSource(){ |
||||
boost::property_tree::ptree source_json = cfg_.get_child("source"); |
||||
boost::property_tree::ptree syntax_json = source_json.get_child("syntax"); |
||||
boost::property_tree::ptree colors_json = source_json.get_child("colors"); |
||||
for ( auto &i : syntax_json ) |
||||
source_cfg_.InsertTag(i.first, i.second.get_value<std::string>()); |
||||
|
||||
for ( auto &i : colors_json ) |
||||
source_cfg_.InsertType(i.first, i.second.get_value<std::string>());
|
||||
} |
||||
|
||||
void MainConfig::GenerateKeybindings(){ |
||||
} |
||||
@ -0,0 +1,30 @@
|
||||
#include <boost/property_tree/json_parser.hpp> |
||||
#include <boost/property_tree/xml_parser.hpp> |
||||
#include <fstream> |
||||
#include "source.h" |
||||
#include "keybindings.h" |
||||
class MainConfig { |
||||
public:
|
||||
MainConfig(); |
||||
const Source::Config& source_cfg() {return source_cfg_; } |
||||
const Keybindings::Config& keybindings_cfg() {return keybindings_cfg_; } |
||||
|
||||
void PrintMenu(); |
||||
//boost::property_tree::ptree& source_cfg();
|
||||
//boost::property_tree::ptree& keybindings_cfg();
|
||||
//boost::property_tree::ptree& notebookk_cfg();
|
||||
//boost::property_tree::ptree& menu_cfg();
|
||||
|
||||
boost::property_tree::ptree cfg_; |
||||
// boost::property_tree::ptree sourcecfg_;
|
||||
// boost::property_tree::ptree keybindings_cfg_;
|
||||
// boost::property_tree::ptree notebook_cfg_;
|
||||
// boost::property_tree::ptree menu_cfg_;
|
||||
|
||||
Source::Config source_cfg_; |
||||
Keybindings::Config keybindings_cfg_; |
||||
|
||||
void GenerateSource(); |
||||
void GenerateKeybindings(); |
||||
}; |
||||
|
||||
@ -1,19 +1,33 @@
|
||||
{ |
||||
"colors": { |
||||
"text_color": "#333333", |
||||
"string" : "#CC0000", |
||||
"namespace_ref" : "#990099", |
||||
"type" : "#0066FF", |
||||
"keyword": "blue", |
||||
"comment": "grey", |
||||
"own": "pink" |
||||
}, |
||||
"syntax": { |
||||
"43": "type", |
||||
"46": "namespace_ref", |
||||
"109": "string", |
||||
"702": "keyword", |
||||
"703": "own", |
||||
"705": "comment" |
||||
"source": { |
||||
"colors": { |
||||
"text_color": "#333333", |
||||
"string": "#CC0000", |
||||
"namespace_ref": "#990099", |
||||
"type": "#0066FF", |
||||
"keyword": "blue", |
||||
"comment": "grey", |
||||
"own": "pink" |
||||
}, |
||||
"syntax": { |
||||
"43": "type", |
||||
"46": "namespace_ref", |
||||
"109": "string", |
||||
"702": "keyword", |
||||
"703": "own", |
||||
"705": "comment" |
||||
} |
||||
}, |
||||
"example": { |
||||
"key": "value", |
||||
"key2": [ |
||||
"val1", |
||||
"val2", |
||||
3 |
||||
], |
||||
"key3": "value" |
||||
}, |
||||
"keybindings": { |
||||
"path" : "keybindings.xml" |
||||
} |
||||
} |
||||
|
||||
Loading…
Reference in new issue