|
|
|
@ -11,7 +11,7 @@ open_folder(const boost::filesystem::path& dir_path) { |
|
|
|
m_refTreeModel = Gtk::TreeStore::create(view()); |
|
|
|
m_refTreeModel = Gtk::TreeStore::create(view()); |
|
|
|
m_TreeView.set_model(m_refTreeModel); |
|
|
|
m_TreeView.set_model(m_refTreeModel); |
|
|
|
m_TreeView.remove_all_columns(); |
|
|
|
m_TreeView.remove_all_columns(); |
|
|
|
std::string project_name = get_project_name(dir_path); |
|
|
|
std::string project_name = GetCmakeVarValue(dir_path, "project"); |
|
|
|
m_TreeView.append_column(project_name, view().m_col_name); |
|
|
|
m_TreeView.append_column(project_name, view().m_col_name); |
|
|
|
int row_id = 0; |
|
|
|
int row_id = 0; |
|
|
|
Gtk::TreeModel::Row row; |
|
|
|
Gtk::TreeModel::Row row; |
|
|
|
@ -77,8 +77,9 @@ int Directories::Controller::count(const std::string path) { |
|
|
|
if (path[i] == '/') count++; |
|
|
|
if (path[i] == '/') count++; |
|
|
|
return count; |
|
|
|
return count; |
|
|
|
} |
|
|
|
} |
|
|
|
std::string Directories::Controller:: |
|
|
|
|
|
|
|
get_project_name(const boost::filesystem::path& dir_path) { |
|
|
|
std::string Directories::Controller:: |
|
|
|
|
|
|
|
GetCmakeVarValue(const boost::filesystem::path& dir_path, std::string command_name) { |
|
|
|
std::string project_name; |
|
|
|
std::string project_name; |
|
|
|
std::string project_name_var; |
|
|
|
std::string project_name_var; |
|
|
|
boost::filesystem::directory_iterator end_itr; |
|
|
|
boost::filesystem::directory_iterator end_itr; |
|
|
|
@ -89,8 +90,8 @@ get_project_name(const boost::filesystem::path& dir_path) { |
|
|
|
std::ifstream ifs(itr->path().string()); |
|
|
|
std::ifstream ifs(itr->path().string()); |
|
|
|
std::string line; |
|
|
|
std::string line; |
|
|
|
while (std::getline(ifs, line)) { |
|
|
|
while (std::getline(ifs, line)) { |
|
|
|
if (line.find("project(", 0) != std::string::npos |
|
|
|
if (line.find(command_name+"(", 0) != std::string::npos |
|
|
|
|| line.find("project (", 0) != std::string::npos ) { |
|
|
|
|| line.find(command_name+" (", 0) != std::string::npos ) { |
|
|
|
size_t variabel_start = line.find("{", 0); |
|
|
|
size_t variabel_start = line.find("{", 0); |
|
|
|
size_t variabel_end = line.find("}", variabel_start); |
|
|
|
size_t variabel_end = line.find("}", variabel_start); |
|
|
|
project_name_var = line.substr(variabel_start+1, |
|
|
|
project_name_var = line.substr(variabel_start+1, |
|
|
|
@ -124,32 +125,32 @@ get_project_name(const boost::filesystem::path& dir_path) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return "no project name"; |
|
|
|
return "no project name"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Directories::Config::Config() { |
|
|
|
Directories::Config::Config() { |
|
|
|
} |
|
|
|
} |
|
|
|
Directories::Config::Config(Directories::Config& cfg) : |
|
|
|
Directories::Config::Config(Directories::Config& cfg) : |
|
|
|
ignore_list_(cfg.ignore_list()), exception_list_(cfg.exception_list()) { |
|
|
|
ignore_list_(cfg.ignore_list()), exception_list_(cfg.exception_list()) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Directories::Config::AddIgnore(std::string filter) { |
|
|
|
void Directories::Config::AddIgnore(std::string filter) { |
|
|
|
ignore_list_.push_back(filter); |
|
|
|
ignore_list_.push_back(filter); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Directories::Config::AddException(std::string filter) { |
|
|
|
void Directories::Config::AddException(std::string filter) { |
|
|
|
exception_list_.push_back(filter); |
|
|
|
exception_list_.push_back(filter); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool Directories::Config::IsIgnored(std::string str) { |
|
|
|
bool Directories::Config::IsIgnored(std::string str) { |
|
|
|
for ( auto &i : ignore_list() ) |
|
|
|
for ( auto &i : ignore_list() ) |
|
|
|
if (str.find(i, 0) != std::string::npos) |
|
|
|
if (str.find(i, 0) != std::string::npos) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool Directories::Config::IsException(std::string str) { |
|
|
|
bool Directories::Config::IsException(std::string str) { |
|
|
|
for ( std::string &i : exception_list() ) |
|
|
|
for ( std::string &i : exception_list() ) |
|
|
|
if (i == str) |
|
|
|
if (i == str) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|