[DEV] add print log and correct the tree view

This commit is contained in:
Edouard DUPIN 2019-04-01 22:17:27 +02:00
parent b7b962c3f5
commit 626c9ba386
3 changed files with 40 additions and 4 deletions

View File

@ -12,6 +12,7 @@ namespace appl {
};
#define APPL_BASE(info,data) ELOG_BASE(appl::getLogId(),info,data)
#define APPL_PRINT(data) APPL_BASE(-1, data)
#define APPL_CRITICAL(data) APPL_BASE(1, data)
#define APPL_ERROR(data) APPL_BASE(2, data)
#define APPL_WARNING(data) APPL_BASE(3, data)

View File

@ -26,6 +26,7 @@
#include <appl/ctags/readtags.hpp>
#include <appl/globalMsg.hpp>
#include <appl/TextPluginCtags.hpp>
#include <appl/debug.hpp>
class MainApplication : public ewol::context::Application {
private:
@ -38,8 +39,8 @@ class MainApplication : public ewol::context::Application {
etk::String tmpppp = _context.getCmd().get(iii);
if ( tmpppp == "-h"
|| tmpppp == "--help") {
APPL_INFO(" --ctags=xxx c-flags-file-name" );
APPL_INFO(" -h/--help display this help" );
APPL_PRINT(" --ctags=xxx c-flags-file-name" );
APPL_PRINT(" -h/--help display this help" );
exit(0);
}
}

View File

@ -102,7 +102,42 @@ void appl::widget::BufferTree::populateNodeIfNeeded(ememory::SharedPtr<etk::Tree
return;
}
if (_node->haveChild() == true) {
// already populated...
// already populated... ==> updat list of elements: ...
etk::Vector<etk::Path> child = etk::path::list(value.m_path, etk::path::LIST_FOLDER|etk::path::LIST_FILE);
etk::algorithm::quickSort(child, localSort);
APPL_VERBOSE(" nbChilds: " << child.size() << " for path: " << value.m_path);
// Add missing element (at the end ...)
for (auto& it: child) {
bool find = false;
for (auto &nodeIt: _node->getChilds()) {
if (nodeIt->getData().m_path == it) {
find = true;
break;
}
}
if (find == false) {
auto elem = etk::TreeNode<appl::TreeElement>::create(TreeElement(it, false));
_node->addChild(elem);
}
}
// remove destroyed elements:
size_t iii = 0;
while (iii < _node->getChilds().size()) {
auto node = _node->getChilds()[iii];
bool find = false;
for (auto& it: child) {
if (node->getData().m_path == it) {
find = true;
break;
}
}
if (find == false) {
_node->rmChild(node);
} else {
++iii;
}
}
return;
}
etk::Vector<etk::Path> child = etk::path::list(value.m_path, etk::path::LIST_FOLDER|etk::path::LIST_FILE);
@ -112,7 +147,6 @@ void appl::widget::BufferTree::populateNodeIfNeeded(ememory::SharedPtr<etk::Tree
APPL_VERBOSE("add element: " << it);
auto elem = etk::TreeNode<appl::TreeElement>::create(TreeElement(it, false));
_node->addChild(elem);
// TODO: ETK_FREE(etk::FSNode, it);
}
}