[DEBUG] build back tools

This commit is contained in:
Edouard DUPIN 2017-11-07 10:18:48 +01:00
parent 10be74f158
commit f2dbed233f

View File

@ -14,94 +14,94 @@
#include <appl/debug.hpp> #include <appl/debug.hpp>
#include <appl/MainWindows.hpp> #include <appl/MainWindows.hpp>
namespace appl {
class MainApplication : public ewol::context::Application { class MainApplication : public ewol::context::Application {
private: private:
etk::Vector<etk::String> m_listFiles; etk::Vector<etk::String> m_listFiles;
public: public:
virtual void onCreate(ewol::Context& _context) { virtual void onCreate(ewol::Context& _context) {
APPL_INFO(" == > CREATE ... (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ") (BEGIN)"); APPL_INFO(" == > CREATE ... (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ") (BEGIN)");
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) { for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
etk::String tmpppp = _context.getCmd().get(iii); etk::String tmpppp = _context.getCmd().get(iii);
if ( tmpppp == "-h" if ( tmpppp == "-h"
|| tmpppp == "--help") { || tmpppp == "--help") {
APPL_INFO(" -t c-flags-file-name" ); APPL_INFO(" -t c-flags-file-name" );
APPL_INFO(" -h/--help display this help" ); APPL_INFO(" -h/--help display this help" );
exit(0); exit(0);
} }
if ( tmpppp.size()>=2 if ( tmpppp.size()>=2
&& tmpppp[0] == '-' && tmpppp[0] == '-'
&& tmpppp[1] == '-') { && tmpppp[1] == '-') {
continue; continue;
} }
// TODO : Check if it is a path ... // TODO : Check if it is a path ...
if (etk::FSNodeExist(tmpppp) == false) { if (etk::FSNodeExist(tmpppp) == false) {
APPL_ERROR("element does not exist: '" << tmpppp << "' ==> rejected"); APPL_ERROR("element does not exist: '" << tmpppp << "' ==> rejected");
} else {
etk::FSNode elem(tmpppp);
if (elem.getNodeType() == etk::typeNode_folder) {
etk::Vector<etk::String> tmp = elem.folderGetSub(false, true, ".*");
tmp.sort(0, tmp.size(), [](const etk::String& _left, const etk::String& _right) { return _left < _right;});
for (auto &it : tmp) {
m_listFiles.pushBack(it);
}
} else { } else {
// simple file: etk::FSNode elem(tmpppp);
m_listFiles.pushBack(tmpppp); if (elem.getNodeType() == etk::typeNode_folder) {
etk::Vector<etk::String> tmp = elem.folderGetSub(false, true, ".*");
tmp.sort(0, tmp.size(), [](const etk::String& _left, const etk::String& _right) { return _left < _right;});
for (auto &it : tmp) {
m_listFiles.pushBack(it);
}
} else {
// simple file:
m_listFiles.pushBack(tmpppp);
}
} }
} }
//etk::theme::setName("COLOR", "color/black/");
etk::theme::setName("COLOR", "color/white/");
_context.setSize(vec2(800, 600));
_context.setTitle("egami-viewer");
// select internal data for font ...
_context.getFontDefault().setUseExternal(true);
#ifdef __TARGET_OS__Android
_context.getFontDefault().set("FreeSerif", 19);
#else
_context.getFontDefault().set("FreeSerif;DejaVuSansMono",14);
#endif
// set the application icon ...
_context.setIcon("DATA:icon.png");
APPL_INFO("==> CREATE ... (END)");
} }
//etk::theme::setName("COLOR", "color/black/");
etk::theme::setName("COLOR", "color/white/");
_context.setSize(vec2(800, 600)); void onStart(ewol::Context& _context) {
APPL_INFO("==> START ... (BEGIN)");
_context.setTitle("egami-viewer");
ememory::SharedPtr<appl::MainWindows> basicWindows = appl::MainWindows::create();
// select internal data for font ... if (basicWindows == nullptr) {
_context.getFontDefault().setUseExternal(true); APPL_ERROR("Can not allocate the basic windows");
#ifdef __TARGET_OS__Android return;
_context.getFontDefault().set("FreeSerif", 19); }
#else basicWindows->setListOfFiles(m_listFiles);
_context.getFontDefault().set("FreeSerif;DejaVuSansMono",14); // create the specific windows
#endif _context.setWindows(basicWindows);
if (basicWindows == nullptr) {
// set the application icon ... APPL_ERROR("Can not allocate the basic windows");
_context.setIcon("DATA:icon.png"); _context.exit(-1);
return;
APPL_INFO("==> CREATE ... (END)"); }
}
// create the specific windows
void onStart(ewol::Context& _context) { _context.setWindows(basicWindows);
APPL_INFO("==> START ... (BEGIN)");
APPL_INFO("==> START ... (END)");
ememory::SharedPtr<appl::MainWindows> basicWindows = appl::MainWindows::create();
if (basicWindows == nullptr) {
APPL_ERROR("Can not allocate the basic windows");
return;
}
basicWindows->setListOfFiles(m_listFiles);
// create the specific windows
_context.setWindows(basicWindows);
if (basicWindows == nullptr) {
APPL_ERROR("Can not allocate the basic windows");
_context.exit(-1);
return; return;
} }
// create the specific windows void onStop(ewol::Context& _context) {
_context.setWindows(basicWindows); APPL_INFO("==> STOP ... (START)");
APPL_INFO("==> STOP ... (END)");
APPL_INFO("==> START ... (END)"); }
return; };
} }
void onStop(ewol::Context& _context) {
APPL_INFO("==> STOP ... (START)");
APPL_INFO("==> STOP ... (END)");
}
};
/** /**
@ -110,8 +110,7 @@ class MainApplication : public ewol::context::Application {
* @return std IO * @return std IO
*/ */
int main(int _argc, const char *_argv[]) { int main(int _argc, const char *_argv[]) {
// second possibility return ewol::run(ETK_NEW(appl::MainApplication), _argc, _argv);
return ewol::run(ETK_NEW(appl::MainApplication)(), _argc, _argv);
} }