diff --git a/lib/applications/src/app.cpp b/lib/applications/src/app.cpp index 9fde9db..53e5ccd 100644 --- a/lib/applications/src/app.cpp +++ b/lib/applications/src/app.cpp @@ -226,6 +226,7 @@ namespace AppManager { std::string fullname = prefix.size() ? (prefix + "." + dir) : (dir); libsystem::log("Loading app \"" + fullname + "\"."); + std::cout << "path: " << appPath.str() << std::endl; if (root) { app = std::make_shared( @@ -234,7 +235,7 @@ namespace AppManager { directory / dir / "manifest.json", true ); - } else if (allowedFiles.find(appPath.str() + "\n") != std::string::npos) { + } else if (allowedFiles.find((appPath / "app.lua").str() + "\n") != std::string::npos) { app = std::make_shared( dir, storage::Path(directory) / dir / "app.lua", diff --git a/lib/gui/src/elements/Slider.cpp b/lib/gui/src/elements/Slider.cpp index e6a23b9..3e65862 100644 --- a/lib/gui/src/elements/Slider.cpp +++ b/lib/gui/src/elements/Slider.cpp @@ -37,6 +37,7 @@ namespace gui::elements m_innerTextColor = graphics::constPackRGB565(250, 250, 250); // COLOR_LIGHT_GREY; m_outerTextColor = COLOR_BLACK; m_isPercentage = false; + m_hasEvents = true; } Slider::~Slider() = default; @@ -100,7 +101,24 @@ namespace gui::elements void Slider::slide() { - setValue(floor((touchX - getAbsoluteX()) * (m_maxValue - m_minValue) / m_width)); + //m_positionValue = (touchX - getAbsoluteX()); + //m_Value = (m_positionValue * (m_maxValue - m_minValue)) / m_width + m_minValue; + float value = (touchX - getAbsoluteX()) * (m_maxValue - m_minValue) / m_width + m_minValue; + value = valuem_maxValue?m_maxValue:value; + + if(m_Value!=value) + { + setValue(value); + m_hasChanged = true; + } + } + + void Slider::widgetUpdate() + { + if(widgetPressed == this && (globalPressedState == PressedState::PRESSED || globalPressedState == PressedState::SCROLLX) && touchX >= 0 && touchY >= 0) + { + slide(); + } } void Slider::render() diff --git a/lib/gui/src/elements/Slider.hpp b/lib/gui/src/elements/Slider.hpp index c289713..e6f32b3 100644 --- a/lib/gui/src/elements/Slider.hpp +++ b/lib/gui/src/elements/Slider.hpp @@ -113,7 +113,10 @@ namespace gui::elements * @brief set the value and redraw the slider based on the position clicked * */ + void slide(); + void widgetUpdate(); + bool hasChanged() { return m_hasChanged; m_hasChanged = false; } private: uint16_t m_minValue; @@ -123,6 +126,7 @@ namespace gui::elements bool m_displayValue; bool m_isPercentage; + bool m_hasChanged; color_t m_innerTextColor; color_t m_outerTextColor; diff --git a/lib/lua/src/lua_slider.cpp b/lib/lua/src/lua_slider.cpp index 23e24f6..c99df52 100644 --- a/lib/lua/src/lua_slider.cpp +++ b/lib/lua/src/lua_slider.cpp @@ -68,15 +68,8 @@ void LuaSlider::onChange(sol::protected_function func) void LuaSlider::specificUpdate() { - - if (this->widget->isFocused(true)) + if (onChangeFunc && widget->hasChanged()) { - int oldValue = widget->getValue(); - widget->slide(); - - if (onChangeFunc && oldValue != widget->getValue()) - { - onChangeFunc(); - } + onChangeFunc(); } } \ No newline at end of file diff --git a/storage/sys_apps/settings/app.lua b/storage/sys_apps/settings/app.lua index 38de65c..fb54495 100644 --- a/storage/sys_apps/settings/app.lua +++ b/storage/sys_apps/settings/app.lua @@ -153,7 +153,7 @@ function systemSettings() end) local sleepTimeBox = createBox(win2, 100, 73) - local textsleepTime = gui:label(sleepTimeBox, 16, 0, 177, 55) + local textsleepTime = gui:label(sleepTimeBox, 16, 0, 177, 50) textsleepTime:setFontSize(24) textsleepTime:setVerticalAlignment(CENTER_ALIGNMENT) textsleepTime:setText("Veille: " .. int(settings.getStandBySleepTime()/1000) .. "s") diff --git a/storage/system/config.bfc b/storage/system/config.bfc index 1de9a0e..f4f29d9 100644 Binary files a/storage/system/config.bfc and b/storage/system/config.bfc differ diff --git a/storage/system/permissions/auth.list b/storage/system/permissions/auth.list index 55ce59d..f3f3c0b 100644 --- a/storage/system/permissions/auth.list +++ b/storage/system/permissions/auth.list @@ -1,14 +1,9 @@ ./storage/apps/alarme/sub/.task/app.lua -./storage/apps/snake/app.lua -./storage/apps/demineur/app.lua -./storage/apps/phone/app.lua -./storage/apps/calendrier/app.lua -./storage/apps/alarme/sub/.task/app.lua ./storage/apps/alarme/app.lua -./storage/apps/calendrier/app.lua ./storage/apps/messages/app.lua -./storage/apps/phone/app.lua ./storage/apps/demineur/app.lua -./storage/apps/contacts/app.lua ./storage/apps/snake/app.lua +./storage/apps/phone/app.lua +./storage/apps/contacts/app.lua +./storage/apps/calendrier/app.lua ./storage/apps/calculatrice/app.lua