LvglSync removed (#591)
Replaced all usages with lvgl-module functions.
This commit is contained in:
committed by
GitHub
parent
03a6285328
commit
3354924359
@@ -1,10 +1,9 @@
|
||||
#include "lvgl/lvgl.h"
|
||||
|
||||
#include <Tactility/app/AppManifest.h>
|
||||
#include <Tactility/app/fileselection/FileSelection.h>
|
||||
#include <Tactility/file/FileLock.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <Tactility/Assets.h>
|
||||
|
||||
#include <Tactility/file/File.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
@@ -42,16 +41,16 @@ class NotesApp final : public App {
|
||||
break;
|
||||
case 1: // Save
|
||||
if (!filePath.empty()) {
|
||||
lvgl::getSyncLock()->lock();
|
||||
lvgl_lock();
|
||||
saveBuffer = lv_textarea_get_text(uiNoteText);
|
||||
lvgl::getSyncLock()->unlock();
|
||||
lvgl_unlock();
|
||||
saveFile(filePath);
|
||||
}
|
||||
break;
|
||||
case 2: // Save as...
|
||||
lvgl::getSyncLock()->lock();
|
||||
lvgl_lock();
|
||||
saveBuffer = lv_textarea_get_text(uiNoteText);
|
||||
lvgl::getSyncLock()->unlock();
|
||||
lvgl_unlock();
|
||||
saveFileLaunchId = fileselection::startForExistingOrNewFile();
|
||||
LOG_I(TAG, "launched with id %u", saveFileLaunchId);
|
||||
break;
|
||||
@@ -87,13 +86,12 @@ class NotesApp final : public App {
|
||||
file::getLock(path)->withLock([this, path] {
|
||||
auto data = file::readString(path);
|
||||
if (data != nullptr) {
|
||||
auto lockable = lvgl::getSyncLock();
|
||||
auto lock = lockable->asScopedLock();
|
||||
lock.lock();
|
||||
lv_textarea_set_text(uiNoteText, reinterpret_cast<const char*>(data.get()));
|
||||
lv_label_set_text(uiCurrentFileName, path.c_str());
|
||||
filePath = path;
|
||||
LOG_I(TAG, "Loaded from %s", path.c_str());
|
||||
lvgl_lock();
|
||||
lv_textarea_set_text(uiNoteText, reinterpret_cast<const char*>(data.get()));
|
||||
lv_label_set_text(uiCurrentFileName, path.c_str());
|
||||
lvgl_unlock();
|
||||
filePath = path;
|
||||
LOG_I(TAG, "Loaded from %s", path.c_str());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user