You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 lines
3.2 KiB

#pragma once
#include "dispatcher.h"
#include <boost/filesystem.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
class Config {
11 years ago
public:
class Menu {
public:
std::unordered_map<std::string, std::string> keys;
};
class Theme {
public:
std::string name;
std::string variant;
std::string font;
};
class Terminal {
public:
int history_size;
10 years ago
std::string font;
};
class Project {
public:
class CMake {
public:
std::string command;
std::string compile_command;
};
class Meson {
public:
std::string command;
std::string compile_command;
};
std::string default_build_path;
std::string debug_build_path;
CMake cmake;
Meson meson;
std::string default_build_management_system;
bool save_on_compile_or_run;
10 years ago
bool clear_terminal_on_compile;
std::string ctags_command;
std::string grep_command;
std::string python_command;
std::string markdown_command;
};
class Source {
public:
class DocumentationSearch {
public:
std::string separator;
std::unordered_map<std::string, std::string> queries;
};
std::string style;
std::string font;
std::string spellcheck_language;
bool cleanup_whitespace_characters;
10 years ago
std::string show_whitespace_characters;
bool format_style_on_save;
bool format_style_on_save_if_style_file_found;
bool smart_brackets;
bool smart_inserts;
bool show_map;
unsigned map_font_size;
Git integration through libgit2 (#244) * Git integration, fixes #63 * Fixed a crash when deleting directories, added libgit2 to MSYS2 CI, adjusted colors slightly * Git integration now supports debian stable * Fixed compilation error on MSYS2 * Added git_test * git_test fix * Git integration: now updates correct paths on source save. Also added slight delay to source diff git monitor change signal * git_test fixed * Now monitors .git directory instead. The .git/index file does not always update on for instance: git commit -m ... * Directories cleanup * Fixed git status update on rename refactoring, and some additional cleanup * Added menu items: Go to Next Diff, and Show Diff * Fixed Go to Next Diff and Show Diff keybindings * Minor fixes to git integration * Added: implement method * Minor fixes to Implement Method * Minor fixes to source_diff * source_diff: optimisations added, as well as some minor improvements * Fixed a crash when trying to show diff in a buffer not related to a diff repository * Git integration: MSYS2 support * source_diff: source should now refresh correctly when .git directory has changed * directories.cc: stop updating parent path colors when path including .git directory/file is found * Spellcheck underline no longer shows for for instance '\n' * Made directory view's git status update async * Use boost::filesystem::path in git.* * Optimisation: now stores a cache of git status, which can be slow, that is used when possible * Source view will now grab focus when a selection dialog is shown * Source menu should now be correctly updated * Implement Method: improved * git.cc: minor fix
10 years ago
bool show_git_diff;
bool show_background_pattern;
bool show_right_margin;
unsigned right_margin_position;
bool auto_tab_char_and_size;
char default_tab_char;
unsigned default_tab_size;
bool tab_indents_line;
bool wrap_lines;
bool highlight_current_line;
bool show_line_numbers;
bool enable_multiple_cursors;
bool auto_reload_changed_files;
bool search_for_selection;
std::string clang_format_style;
unsigned clang_usages_threads;
bool debug_place_cursor_at_stop;
std::unordered_map<std::string, DocumentationSearch> documentation_searches;
};
class Log {
public:
bool libclang;
bool language_server;
};
private:
Config();
public:
static Config &get() {
static Config singleton;
return singleton;
}
void load();
std::string version;
Menu menu;
Theme theme;
Terminal terminal;
Project project;
Source source;
Log log;
boost::filesystem::path home_path;
boost::filesystem::path home_juci_path;
private:
/// Used to dispatch Terminal outputs after juCi++ GUI setup and configuration
Dispatcher dispatcher;
void update(boost::property_tree::ptree &cfg);
void make_version_dependent_corrections(boost::property_tree::ptree &cfg, const boost::property_tree::ptree &default_cfg, const std::string &version);
bool add_missing_nodes(boost::property_tree::ptree &cfg, const boost::property_tree::ptree &default_cfg, std::string parent_path = "");
bool remove_deprecated_nodes(boost::property_tree::ptree &cfg, const boost::property_tree::ptree &default_cfg, std::string parent_path = "");
void read(const boost::property_tree::ptree &cfg);
11 years ago
};