[DEV] update new etk Uri API

This commit is contained in:
Edouard DUPIN 2018-10-23 22:19:31 +02:00
parent c8863cde93
commit 437e6b3c18
3 changed files with 19 additions and 22 deletions

View File

@ -10,7 +10,6 @@
#include <ewol/widget/Image.hpp>
#include <ewol/context/Context.hpp>
#include <etk/os/FSNode.hpp>
#include <eproperty/Value.hpp>
appl::MainWindows::MainWindows() :
@ -42,7 +41,7 @@ void appl::MainWindows::onCallbackShortCut(const etk::String& _value) {
}
}
void appl::MainWindows::setListOfFiles(etk::Vector<etk::String> _listImages) {
void appl::MainWindows::setListOfFiles(etk::Vector<etk::Path> _listImages) {
m_listImages = _listImages;
if (m_listImages.size() == 0) {
m_idDisplayed = -1;
@ -51,7 +50,7 @@ void appl::MainWindows::setListOfFiles(etk::Vector<etk::String> _listImages) {
} else {
m_idDisplayed = 0;
m_image->propertySource.set(m_listImages[0]);
propertyTitle.set("EVI:" + m_listImages[0]);
propertyTitle.set("EVI:" + m_listImages[0].getString());
}
}
@ -74,7 +73,7 @@ bool appl::MainWindows::onEventEntry(const ewol::event::Entry& _event) {
return true;
}
m_image->propertySource.set(m_listImages[m_idDisplayed]);
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed].getString() + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
return true;
}
if (_event.getType() == gale::key::keyboard::left) {
@ -84,7 +83,7 @@ bool appl::MainWindows::onEventEntry(const ewol::event::Entry& _event) {
return true;
}
m_image->propertySource.set(m_listImages[m_idDisplayed]);
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed].getString() + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
return true;
}
if (_event.getType() == gale::key::keyboard::down) {
@ -93,7 +92,7 @@ bool appl::MainWindows::onEventEntry(const ewol::event::Entry& _event) {
m_idDisplayed = m_listImages.size()-1;
}
m_image->propertySource.set(m_listImages[m_idDisplayed]);
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed].getString() + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
return true;
}
if (_event.getType() == gale::key::keyboard::up) {
@ -102,19 +101,19 @@ bool appl::MainWindows::onEventEntry(const ewol::event::Entry& _event) {
m_idDisplayed = 0;
}
m_image->propertySource.set(m_listImages[m_idDisplayed]);
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed].getString() + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
return true;
}
if (_event.getType() == gale::key::keyboard::pageDown) {
m_idDisplayed = m_listImages.size()-1;
m_image->propertySource.set(m_listImages[m_idDisplayed]);
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed].getString() + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
return true;
}
if (_event.getType() == gale::key::keyboard::pageUp) {
m_idDisplayed = 0;
m_image->propertySource.set(m_listImages[m_idDisplayed]);
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed].getString() + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
return true;
}
}

View File

@ -13,7 +13,7 @@ namespace appl {
class MainWindows : public ewol::widget::Windows {
private:
ewol::widget::ImageShared m_image;
etk::Vector<etk::String> m_listImages;
etk::Vector<etk::Path> m_listImages;
int64_t m_idDisplayed;
public:
// Constructeur
@ -22,7 +22,7 @@ namespace appl {
public:
DECLARE_FACTORY(MainWindows);
~MainWindows() {};
void setListOfFiles(etk::Vector<etk::String> _listImages);
void setListOfFiles(etk::Vector<etk::Path> _listImages);
protected:
void onCallbackShortCut(const etk::String& _value);
bool onEventInput(const ewol::event::Input& _event) override;

View File

@ -6,7 +6,8 @@
#include <etk/types.hpp>
#include <etk/types.hpp>
#include <etk/os/FSNode.hpp>
#include <etk/theme/theme.hpp>
#include <etk/path/fileSystem.hpp>
#include <ewol/ewol.hpp>
#include <ewol/object/Object.hpp>
#include <ewol/context/Context.hpp>
@ -17,7 +18,7 @@
namespace appl {
class MainApplication : public ewol::context::Application {
private:
etk::Vector<etk::String> m_listFiles;
etk::Vector<etk::Path> m_listFiles;
public:
virtual void onCreate(ewol::Context& _context) {
APPL_INFO(" == > CREATE ... (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ") (BEGIN)");
@ -35,19 +36,16 @@ namespace appl {
continue;
}
// TODO : Check if it is a path ...
if (etk::FSNodeExist(tmpppp) == false) {
if (etk::path::exist(tmpppp) == false) {
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) {
if (etk::path::isFile(tmpppp) == true) {
m_listFiles.pushBack(tmpppp);
} else {
etk::Vector<etk::Path> list = etk::path::list(tmpppp, etk::path::LIST_FILE);
for (auto &it : list) {
m_listFiles.pushBack(it);
}
} else {
// simple file:
m_listFiles.pushBack(tmpppp);
}
}
}