From ca126a4d6c9f5642c1dae9427cd05645f52e7a90 Mon Sep 17 00:00:00 2001 From: tedjk Date: Mon, 11 May 2015 14:08:25 +0200 Subject: [PATCH 1/9] made it work --- juci/CMakeLists.txt | 4 ++-- juci/api.cc | 11 +---------- juci/api.h | 4 +--- juci/api_ext.cc | 5 +---- juci/plugins.py | 6 ++++-- 5 files changed, 9 insertions(+), 21 deletions(-) diff --git a/juci/CMakeLists.txt b/juci/CMakeLists.txt index 625d06a..53b86cb 100644 --- a/juci/CMakeLists.txt +++ b/juci/CMakeLists.txt @@ -131,8 +131,8 @@ link_directories( ${LIBCLANG_LIBRARY_DIRS} ) #module: -set_target_properties(${module} PROPERTIES PREFIX "" - LIBRARY_OUTPUT_DIRECTORY "/usr/lib/python2.7/dist-packages/") +set_target_properties(${module} PROPERTIES PREFIX "") +# LIBRARY_OUTPUT_DIRECTORY "/usr/lib/python2.7/dist-packages/") target_link_libraries(${module} ${PYTHON_LIBRARIES} ${Boost_LIBRARIES}) #executable: target_link_libraries(${project_name} ${LIVCLANG_LIBRARIES} ${LCL_LIBRARIES} ${GTKMM_LIBRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES}) diff --git a/juci/api.cc b/juci/api.cc index ae7534a..4c74620 100644 --- a/juci/api.cc +++ b/juci/api.cc @@ -107,7 +107,7 @@ void libjuci::ReplaceWord(const std::string word) { } void libjuci::ReplaceLine(const std::string line) { - std::cout << "unimplemented function: 'libjuci::ReplaceLine()' called" + std::cout << "unimplemented: " << __func__ << " called" << std::endl; } std::string libjuci::GetWord() { @@ -201,16 +201,7 @@ void libjuci::IterToWordEnd(Gtk::TextIter &iter) { } Glib::RefPtr libjuci::BufferFromNotebook() { - // finding focused view - // int i = 0; - // while (!PluginApi::notebook_->source_vec_.at(i)->view().has_focus()) { - // i++; - // while(!PluginApi::notebook_->CurrentTextView().has_focus()) { - // i++; - // } return Glib::RefPtr(PluginApi::notebook_ - // ->source_vec_.at(i) - // ->view().get_buffer()); ->CurrentTextView().get_buffer()); } diff --git a/juci/api.h b/juci/api.h index 46f3f98..4534487 100644 --- a/juci/api.h +++ b/juci/api.h @@ -25,7 +25,6 @@ public: const std::string menu_func_name, const std::string plugin_path, const std::string menu_keybinding); - // text-buffer functions static void ReplaceWord(const std::string word); static void ReplaceLine(const std::string line); protected: @@ -64,11 +63,10 @@ namespace libjuci { namespace bp = boost::python; bp::api::object OpenPythonScript(const std::string path, bp::api::object python_name_space); - void LoadPlugin(const std::string& plugin_name); void LoadPluginFunction(const std::string &function_name, const std::string &plugin_path); void InitPlugin(const std::string& plugin_path); -} // libjuci +} // namespace libjuci #endif // JUCI_API_H_ diff --git a/juci/api_ext.cc b/juci/api_ext.cc index e04bc11..9b8b1ba 100644 --- a/juci/api_ext.cc +++ b/juci/api_ext.cc @@ -12,7 +12,4 @@ BOOST_PYTHON_MODULE(juci_to_python_api) { def("replaceLine", &libjuci::ReplaceLine); def("replaceWord", &libjuci::ReplaceWord); def("getWord", &libjuci::GetWord); - - - //something more - }// module::juci_to_python_api + } // module::juci_to_python_api diff --git a/juci/plugins.py b/juci/plugins.py index 70bbf5b..f8faf6e 100644 --- a/juci/plugins.py +++ b/juci/plugins.py @@ -1,9 +1,11 @@ #!/usr/bin/python #plugin handler -import juci_to_python_api as juci, os, glob +import sys, os, glob +cwd = os.getcwd() +sys.path.append(cwd) +import juci_to_python_api as juci def loadplugins(): - cwd = os.getcwd() plugin_files = glob.glob(cwd+"/plugins/*.py") for current_file in plugin_files: juci.initPlugin(current_file) From 14313e817eb7d89cbfb2f402b662ce232363e4f4 Mon Sep 17 00:00:00 2001 From: tedjk Date: Mon, 11 May 2015 14:38:04 +0200 Subject: [PATCH 2/9] created constructor to api, and added it to window --- juci/api.cc | 7 +++++++ juci/api.h | 1 + juci/config.cc | 13 +++++-------- juci/window.cc | 7 ++----- juci/window.h | 1 + 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/juci/api.cc b/juci/api.cc index 4c74620..2363e41 100644 --- a/juci/api.cc +++ b/juci/api.cc @@ -5,6 +5,13 @@ Notebook::Controller* PluginApi::notebook_; ///////////////////////////// //// API ServiceProvider //// ///////////////////////////// +PluginApi::PluginApi(Menu::Controller& menu_ctl_, + Notebook::Controller& notebook_ctl_) { + menu_ = &menu_ctl_; + notebook_ = ¬ebook_ctl_; + InitPlugins(); +} + std::string PluginApi::ProjectPath() { int MAXPATHLEN = 50; char temp[MAXPATHLEN]; diff --git a/juci/api.h b/juci/api.h index 4534487..5b09f0a 100644 --- a/juci/api.h +++ b/juci/api.h @@ -12,6 +12,7 @@ //////////////////// class PluginApi { public: + PluginApi(Menu::Controller&, Notebook::Controller&); static Menu::Controller* menu_; static Notebook::Controller* notebook_; static void InitPlugins(); diff --git a/juci/config.cc b/juci/config.cc index 689fd19..49de901 100644 --- a/juci/config.cc +++ b/juci/config.cc @@ -6,20 +6,17 @@ MainConfig::MainConfig() : GenerateSource(); GenerateKeybindings(); GenerateDirectoryFilter(); - // 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 : colors_json ) { + for (auto &i : colors_json) { source_cfg_.InsertTag(i.first, i.second.get_value()); } - for ( auto &i : syntax_json ) { - source_cfg_.InsertType(i.first, i.second.get_value()); + for (auto &i : syntax_json) { + source_cfg_.InsertType(i.first, i.second.get_value()); } } @@ -40,9 +37,9 @@ void MainConfig::GenerateDirectoryFilter() { boost::property_tree::ptree dir_json = cfg_.get_child("directoryfilter"); boost::property_tree::ptree ignore_json = dir_json.get_child("ignore"); boost::property_tree::ptree except_json = dir_json.get_child("exceptions"); - for ( auto &i : except_json ) + for ( auto &i : except_json ) dir_cfg_.AddException(i.second.get_value()); - for ( auto &i : ignore_json ) + for ( auto &i : ignore_json ) dir_cfg_.AddIgnore(i.second.get_value()); } diff --git a/juci/window.cc b/juci/window.cc index 94bd534..b7c0e11 100644 --- a/juci/window.cc +++ b/juci/window.cc @@ -5,7 +5,8 @@ Window::Window() : main_config_(), keybindings_(main_config_.keybindings_cfg()), notebook_(this,keybindings(), main_config_.source_cfg(), main_config_.dir_cfg()), - menu_(keybindings()) { + menu_(keybindings()), + api_(menu_, notebook_) { set_title("juCi++"); set_default_size(600, 400); add(window_box_); @@ -77,10 +78,6 @@ Window::Window() : connect(sigc::mem_fun(*this,&Window::OnMouseRelease),false); terminal_.Terminal().signal_button_release_event(). connect(sigc::mem_fun(*this,&Window::OnMouseRelease),false); - - PluginApi::menu_ = &menu_; - PluginApi::notebook_ = ¬ebook_; - PluginApi::InitPlugins(); add_accel_group(keybindings_.ui_manager_menu()->get_accel_group()); add_accel_group(keybindings_.ui_manager_hidden()->get_accel_group()); diff --git a/juci/window.h b/juci/window.h index e9c5424..a39bd23 100644 --- a/juci/window.h +++ b/juci/window.h @@ -22,6 +22,7 @@ public: Menu::Controller menu_; Notebook::Controller notebook_; Terminal::Controller terminal_; + PluginApi api_; Keybindings::Controller& keybindings() { return keybindings_; } private: From 2dac7179b9aca9dd84811f9812c0f3f6f7450df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lien=20Sell=C3=A6g?= Date: Mon, 11 May 2015 15:37:28 +0200 Subject: [PATCH 3/9] Add logging service --- juci/CMakeLists.txt | 3 ++- juci/logging.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 juci/logging.h diff --git a/juci/CMakeLists.txt b/juci/CMakeLists.txt index 625d06a..c98f47e 100644 --- a/juci/CMakeLists.txt +++ b/juci/CMakeLists.txt @@ -3,6 +3,7 @@ set(project_name juci) set(module juci_to_python_api) project (${project_name}) +add_definitions(-DBOOST_LOG_DYN_LINK) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules/") @@ -52,7 +53,7 @@ endif() #Boost_INCLUDE_DIRS - Boost include directories #Boost_LIBRARY_DIRS - Link directories for Boost libraries #Boost_LIBRARIES - Boost component libraries to be linked -find_package(Boost 1.5 REQUIRED COMPONENTS python timer system filesystem) +find_package(Boost 1.55 COMPONENTS python thread log system filesystem REQUIRED) #If boost is not found if(${Boost_FOUND}) diff --git a/juci/logging.h b/juci/logging.h new file mode 100644 index 0000000..7046990 --- /dev/null +++ b/juci/logging.h @@ -0,0 +1,28 @@ +#ifndef JUCI_LOGGING_H_ +#define JUCI_LOGGING_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + + +using namespace boost::log; + +#define TRACE(x) BOOST_LOG_TRIVIAL(trace) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; +#define DEBUG(x) BOOST_LOG_TRIVIAL(debug) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; +#define INFO(x) BOOST_LOG_TRIVIAL(info) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; +#define WARNING(x) BOOST_LOG_TRIVIAL(warning) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; +#define ERROR(x) BOOST_LOG_TRIVIAL(error) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; +#define FATAL(x) BOOST_LOG_TRIVIAL(fatal) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; + +void init() { + add_file_log("juci.log"); +} + + +#endif // JUCI_LOGGING_H_ From 1fdad2e876ed2e0407294943dc56837880280e26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lien=20Sell=C3=A6g?= Date: Tue, 12 May 2015 09:24:04 +0200 Subject: [PATCH 4/9] add logging service --- juci/juci.cc | 3 +-- juci/logging.h | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/juci/juci.cc b/juci/juci.cc index b2afc98..e09efd6 100644 --- a/juci/juci.cc +++ b/juci/juci.cc @@ -6,8 +6,7 @@ int main(int argc, char *argv[]) { argv, "no.sout.juci"); + init_logging(); Window window; - - //api::LoadPlugin("juci_api_test"); return app->run(window); } diff --git a/juci/logging.h b/juci/logging.h index 7046990..c779488 100644 --- a/juci/logging.h +++ b/juci/logging.h @@ -10,7 +10,6 @@ #include #include - using namespace boost::log; #define TRACE(x) BOOST_LOG_TRIVIAL(trace) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; @@ -20,9 +19,8 @@ using namespace boost::log; #define ERROR(x) BOOST_LOG_TRIVIAL(error) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; #define FATAL(x) BOOST_LOG_TRIVIAL(fatal) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; -void init() { +void init_logging() { add_file_log("juci.log"); } - #endif // JUCI_LOGGING_H_ From 7d8cea21288a670fdc6605b090a341913385f09b Mon Sep 17 00:00:00 2001 From: tedjk Date: Tue, 12 May 2015 09:35:35 +0200 Subject: [PATCH 5/9] last cleanup --- juci/directories.cc | 26 +++++++++++++------------- juci/window.cc | 4 +++- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/juci/directories.cc b/juci/directories.cc index ba3008c..fd86611 100644 --- a/juci/directories.cc +++ b/juci/directories.cc @@ -92,16 +92,16 @@ int Directories::Controller::count(const std::string path) { while (std::getline(ifs, line)) { if (line.find(command_name+"(", 0) != std::string::npos || line.find(command_name+" (", 0) != std::string::npos ) { - size_t variabel_start = line.find("{", 0); - size_t variabel_end = line.find("}", variabel_start); - project_name_var = line.substr(variabel_start+1, - (variabel_end)-variabel_start-1); + size_t variable_start = line.find("{", 0); + size_t variable_end = line.find("}", variable_start); + project_name_var = line.substr(variable_start+1, + (variable_end)-variable_start-1); boost::algorithm::trim(project_name_var); - if (variabel_start == std::string::npos) { // not a variabel - variabel_start = line.find("(", 0); - variabel_end = line.find(")", variabel_start); - return line.substr(variabel_start+1, - (variabel_end)-variabel_start-1); + if (variable_start == std::string::npos) { // not a variable + variable_start = line.find("(", 0); + variable_end = line.find(")", variable_start); + return line.substr(variable_start+1, + (variable_end)-variable_start-1); } break; } @@ -111,11 +111,11 @@ int Directories::Controller::count(const std::string path) { if (line.find("set(", 0) != std::string::npos || line.find("set (", 0) != std::string::npos) { if( line.find(project_name_var, 0) != std::string::npos) { - size_t variabel_start = line.find(project_name_var, 0) + size_t variable_start = line.find(project_name_var, 0) +project_name_var.length(); - size_t variabel_end = line.find(")", variabel_start); - project_name = line.substr(variabel_start+1, - variabel_end-variabel_start-1); + size_t variable_end = line.find(")", variable_start); + project_name = line.substr(variable_start+1, + variable_end-variable_start-1); boost::algorithm::trim(project_name); return project_name; } diff --git a/juci/window.cc b/juci/window.cc index b7c0e11..065ff93 100644 --- a/juci/window.cc +++ b/juci/window.cc @@ -4,7 +4,9 @@ Window::Window() : window_box_(Gtk::ORIENTATION_VERTICAL), main_config_(), keybindings_(main_config_.keybindings_cfg()), - notebook_(this,keybindings(), main_config_.source_cfg(), main_config_.dir_cfg()), + notebook_(this,keybindings(), + main_config_.source_cfg(), + main_config_.dir_cfg()), menu_(keybindings()), api_(menu_, notebook_) { set_title("juCi++"); From de40073fac76788bc2be6ab9e3932291a2bc8e33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lien=20Sell=C3=A6g?= Date: Tue, 12 May 2015 09:39:25 +0200 Subject: [PATCH 6/9] add include --- juci/juci.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/juci/juci.cc b/juci/juci.cc index e09efd6..d20260e 100644 --- a/juci/juci.cc +++ b/juci/juci.cc @@ -1,4 +1,5 @@ #include "window.h" +#include "logging.h" int main(int argc, char *argv[]) { Glib::RefPtr app = Gtk::Application::create( From f1d9b005de6b1a15ba5e1014ca0c30895588512c Mon Sep 17 00:00:00 2001 From: tedjk Date: Tue, 12 May 2015 10:02:29 +0200 Subject: [PATCH 7/9] moved python module to local folder --- juci/api.cc | 7 +++++++ juci/api.h | 1 + 2 files changed, 8 insertions(+) diff --git a/juci/api.cc b/juci/api.cc index 2363e41..0ae1587 100644 --- a/juci/api.cc +++ b/juci/api.cc @@ -12,6 +12,13 @@ PluginApi::PluginApi(Menu::Controller& menu_ctl_, InitPlugins(); } +PluginApi::~PluginApi() { + delete menu_; + delete notebook_; + menu_ = NULL; + notebook_ = NULL; +} + std::string PluginApi::ProjectPath() { int MAXPATHLEN = 50; char temp[MAXPATHLEN]; diff --git a/juci/api.h b/juci/api.h index 5b09f0a..900d206 100644 --- a/juci/api.h +++ b/juci/api.h @@ -13,6 +13,7 @@ class PluginApi { public: PluginApi(Menu::Controller&, Notebook::Controller&); + ~PluginApi(); static Menu::Controller* menu_; static Notebook::Controller* notebook_; static void InitPlugins(); From 839949b7fedd21cb66661e6ffb187d8b5f46a83e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lien=20Sell=C3=A6g?= Date: Tue, 12 May 2015 10:22:30 +0200 Subject: [PATCH 8/9] edit logging service --- juci/juci.cc | 3 ++- juci/logging.h | 16 ++++++---------- juci/source.cc | 8 ++++---- juci/window.cc | 3 +++ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/juci/juci.cc b/juci/juci.cc index d20260e..199d97e 100644 --- a/juci/juci.cc +++ b/juci/juci.cc @@ -7,7 +7,8 @@ int main(int argc, char *argv[]) { argv, "no.sout.juci"); - init_logging(); + add_file_log("juci.log"); + INFO("Logging initalized"); Window window; return app->run(window); } diff --git a/juci/logging.h b/juci/logging.h index c779488..f6cdc55 100644 --- a/juci/logging.h +++ b/juci/logging.h @@ -12,15 +12,11 @@ using namespace boost::log; -#define TRACE(x) BOOST_LOG_TRIVIAL(trace) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; -#define DEBUG(x) BOOST_LOG_TRIVIAL(debug) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; -#define INFO(x) BOOST_LOG_TRIVIAL(info) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; -#define WARNING(x) BOOST_LOG_TRIVIAL(warning) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; -#define ERROR(x) BOOST_LOG_TRIVIAL(error) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; -#define FATAL(x) BOOST_LOG_TRIVIAL(fatal) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; - -void init_logging() { - add_file_log("juci.log"); -} +#define TRACE(x) BOOST_LOG_TRIVIAL(trace) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">"; +#define DEBUG(x) BOOST_LOG_TRIVIAL(debug) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">"; +#define INFO(x) BOOST_LOG_TRIVIAL(info) << __func__ << "(" << __LINE__ << "): \"" x << "\""; +#define WARNING(x) BOOST_LOG_TRIVIAL(warning) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">"; +#define ERROR(x) BOOST_LOG_TRIVIAL(error) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">"; +#define FATAL(x) BOOST_LOG_TRIVIAL(fatal) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">"; #endif // JUCI_LOGGING_H_ diff --git a/juci/source.cc b/juci/source.cc index ea6a213..ea05e9c 100644 --- a/juci/source.cc +++ b/juci/source.cc @@ -5,9 +5,7 @@ #include #include #include "notebook.h" - -#define log( var ) \ - std::cout << "source.cc (" << __LINE__ << ") " << #var << std::endl +#include "logging.h" Source::Location:: Location(int line_number, int column_offset) : @@ -267,7 +265,9 @@ HighlightToken(clang::Token *token, // Constructor for Controller Source::Controller::Controller(const Source::Config &config, Notebook::Controller *notebook) : - model_(config), notebook_(notebook) { } + model_(config), notebook_(notebook) { + INFO("Source Controller with childs constructed"); +} // Source::Controller::view() // return shared_ptr to the view diff --git a/juci/window.cc b/juci/window.cc index 5177995..562f09b 100644 --- a/juci/window.cc +++ b/juci/window.cc @@ -1,4 +1,5 @@ #include "window.h" +#include "logging.h" Window::Window() : window_box_(Gtk::ORIENTATION_VERTICAL), @@ -6,6 +7,7 @@ Window::Window() : keybindings_(main_config_.keybindings_cfg()), notebook_(this,keybindings(), main_config_.source_cfg(), main_config_.dir_cfg()), menu_(keybindings()) { + INFO("Creating window"); set_title("juCi++"); set_default_size(600, 400); add(window_box_); @@ -83,6 +85,7 @@ Window::Window() : window_box_.pack_start(notebook_.view()); window_box_.pack_end(terminal_.view(),Gtk::PACK_SHRINK); show_all_children(); + INFO("Window created"); } // Window constructor void Window::OnWindowHide() { From e49aa2e635aacdd474181abd19bff47ac1785f8c Mon Sep 17 00:00:00 2001 From: tedjk Date: Tue, 12 May 2015 12:56:34 +0200 Subject: [PATCH 9/9] added some logging --- juci/api.cc | 3 +-- juci/config.cc | 6 ++++++ juci/config.json | 1 + juci/directories.cc | 7 +++++++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/juci/api.cc b/juci/api.cc index 0ae1587..989bd3e 100644 --- a/juci/api.cc +++ b/juci/api.cc @@ -1,4 +1,5 @@ #include "api.h" +#include "logging.h" Menu::Controller* PluginApi::menu_; Notebook::Controller* PluginApi::notebook_; @@ -13,8 +14,6 @@ PluginApi::PluginApi(Menu::Controller& menu_ctl_, } PluginApi::~PluginApi() { - delete menu_; - delete notebook_; menu_ = NULL; notebook_ = NULL; } diff --git a/juci/config.cc b/juci/config.cc index 49de901..22dbffb 100644 --- a/juci/config.cc +++ b/juci/config.cc @@ -1,4 +1,5 @@ #include "config.h" +#include "logging.h" MainConfig::MainConfig() : keybindings_cfg_(), source_cfg_() { @@ -9,6 +10,7 @@ MainConfig::MainConfig() : } void MainConfig::GenerateSource() { + INFO("Generating source cfg"); 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"); @@ -18,19 +20,23 @@ void MainConfig::GenerateSource() { for (auto &i : syntax_json) { source_cfg_.InsertType(i.first, i.second.get_value()); } + INFO("Source cfg generated"); } void MainConfig::GenerateKeybindings() { + INFO("Generating keybindings"); std::string line; std::ifstream menu_xml("menu.xml"); if (menu_xml.is_open()) { while (getline(menu_xml, line)) { keybindings_cfg_.AppendXml(line); } + } boost::property_tree::ptree keys_json = cfg_.get_child("keybindings"); for (auto &i : keys_json) keybindings_cfg_.key_map()[i.first] = i.second.get_value(); + INFO("Keybindings generated"); } void MainConfig::GenerateDirectoryFilter() { diff --git a/juci/config.json b/juci/config.json index 3305cf8..9344fbb 100644 --- a/juci/config.json +++ b/juci/config.json @@ -36,6 +36,7 @@ "#", "~", ".idea", + ".so", "in-lowercase.pls" ], "exceptions": [ diff --git a/juci/directories.cc b/juci/directories.cc index fd86611..c54ba0e 100644 --- a/juci/directories.cc +++ b/juci/directories.cc @@ -1,4 +1,5 @@ #include "directories.h" +#include "logging.h" Directories::Controller::Controller(Directories::Config& cfg) : config_(cfg) { @@ -8,6 +9,7 @@ Directories::Controller::Controller(Directories::Config& cfg) : void Directories::Controller:: open_folder(const boost::filesystem::path& dir_path) { + INFO("Open folder"); m_refTreeModel = Gtk::TreeStore::create(view()); m_TreeView.set_model(m_refTreeModel); m_TreeView.remove_all_columns(); @@ -17,6 +19,7 @@ open_folder(const boost::filesystem::path& dir_path) { Gtk::TreeModel::Row row; list_dirs(dir_path, row, row_id); m_refTreeModel->set_sort_column(0, Gtk::SortType::SORT_ASCENDING); + INFO("Folder opened"); } bool Directories::Controller::IsIgnored(std::string path) { @@ -80,6 +83,7 @@ int Directories::Controller::count(const std::string path) { std::string Directories::Controller:: GetCmakeVarValue(const boost::filesystem::path& dir_path, std::string command_name) { + INFO("fetches cmake variable value for: "+command_name); std::string project_name; std::string project_name_var; boost::filesystem::directory_iterator end_itr; @@ -100,6 +104,7 @@ int Directories::Controller::count(const std::string path) { if (variable_start == std::string::npos) { // not a variable variable_start = line.find("(", 0); variable_end = line.find(")", variable_start); + INFO("Wasn't a variable, returning value"); return line.substr(variable_start+1, (variable_end)-variable_start-1); } @@ -117,6 +122,7 @@ int Directories::Controller::count(const std::string path) { project_name = line.substr(variable_start+1, variable_end-variable_start-1); boost::algorithm::trim(project_name); + INFO("found variable, returning value"); return project_name; } } @@ -124,6 +130,7 @@ int Directories::Controller::count(const std::string path) { break; } } + INFO("Couldn't find value in CMakeLists.txt"); return "no project name"; }