chore(color): LVGL update, translation strings for theme file carousel (#3278)
* Use StaticText instead of 'paint' function for 'loading' message in theme file carousel, Add message strings to translation files. * Update translation. * Update translation. * Update translation. * Update translation. * Update translation. * Update translation. * Update translation.
This commit is contained in:
@@ -25,8 +25,6 @@ extern inline tmr10ms_t getTicks()
|
||||
return g_tmr10ms;
|
||||
}
|
||||
|
||||
|
||||
|
||||
FileCarosell::FileCarosell(Window *parent, const rect_t &rect,
|
||||
std::vector<std::string> fileNames) :
|
||||
FormGroup(parent, rect, NO_FOCUS | FORM_NO_BORDER),
|
||||
@@ -34,13 +32,10 @@ FileCarosell::FileCarosell(Window *parent, const rect_t &rect,
|
||||
fp(new FilePreview(this, {0, 0, rect.w, rect.h}, false))
|
||||
{
|
||||
timer = getTicks();
|
||||
message = new StaticText(this, {0, rect.h/2, rect.w, PAGE_LINE_HEIGHT}, "", 0, CENTERED | FONT(L) | COLOR_THEME_PRIMARY1);
|
||||
setSelected(0);
|
||||
}
|
||||
|
||||
FileCarosell::~FileCarosell()
|
||||
{
|
||||
}
|
||||
|
||||
void FileCarosell::setFileNames(std::vector<std::string> fileNames)
|
||||
{
|
||||
_fileNames = fileNames;
|
||||
@@ -51,23 +46,20 @@ void FileCarosell::setFileNames(std::vector<std::string> fileNames)
|
||||
|
||||
void FileCarosell::setSelected(int n)
|
||||
{
|
||||
if (n == selected) return;
|
||||
if (n != selected) {
|
||||
selected = n;
|
||||
|
||||
if (n >= 0 && n < (int)_fileNames.size()) {
|
||||
fp->setFile(_fileNames[selected].c_str());
|
||||
} else
|
||||
fp->setFile("");
|
||||
}
|
||||
|
||||
selected = n;
|
||||
|
||||
if (n >= 0 && n < (int)_fileNames.size()) {
|
||||
fp->setFile(_fileNames[selected].c_str());
|
||||
} else
|
||||
fp->setFile("");
|
||||
}
|
||||
|
||||
void FileCarosell::paint(BitmapBuffer *dc)
|
||||
{
|
||||
if (selected == -1 || _fileNames.size() == 0) {
|
||||
const char *message = selected == -1 && _fileNames.size() > 0
|
||||
? "Loading..."
|
||||
: "No theme image";
|
||||
dc->drawText(width() / 2, height() / 2, message, FONT(L) + CENTERED);
|
||||
if (selected == -1) {
|
||||
lv_obj_clear_flag(message->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||
message->setText(_fileNames.size() > 0 ? STR_LOADING : STR_NO_THEME_IMAGE);
|
||||
} else {
|
||||
lv_obj_add_flag(message->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,15 +67,13 @@ void FileCarosell::checkEvents()
|
||||
{
|
||||
FormGroup::checkEvents();
|
||||
|
||||
uint32_t newTicks = getTicks();
|
||||
|
||||
// if we are paused then just update time. we will begin the carosell after
|
||||
// timeout period once unpaused
|
||||
if (_paused) {
|
||||
timer = getTicks();
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t newTicks = getTicks();
|
||||
if (newTicks - timer > pageInterval && _fileNames.size()) {
|
||||
timer = newTicks;
|
||||
} else if (newTicks - timer > pageInterval && _fileNames.size()) {
|
||||
int newSelected = (selected + 1) % _fileNames.size();
|
||||
setSelected(newSelected);
|
||||
timer = newTicks;
|
||||
|
||||
@@ -32,7 +32,6 @@ class FileCarosell : public FormGroup
|
||||
public:
|
||||
FileCarosell(Window *parent, const rect_t &rect,
|
||||
std::vector<std::string> fileNames);
|
||||
~FileCarosell();
|
||||
|
||||
inline void setSelected(int n);
|
||||
void setFileNames(std::vector<std::string> fileNames);
|
||||
@@ -42,8 +41,6 @@ class FileCarosell : public FormGroup
|
||||
_paused = pause;
|
||||
}
|
||||
|
||||
void paint(BitmapBuffer *dc) override;
|
||||
|
||||
protected:
|
||||
bool _paused = false;
|
||||
int selected = -1;
|
||||
@@ -51,4 +48,5 @@ class FileCarosell : public FormGroup
|
||||
FilePreview *fp;
|
||||
uint32_t timer;
|
||||
uint32_t pageInterval = PAGE_INTERVAL;
|
||||
StaticText* message;
|
||||
};
|
||||
|
||||
@@ -724,6 +724,7 @@ const char STR_LOADING[] = TR_LOADING;
|
||||
const char STR_DELETE_THEME[] = TR_DELETE_THEME;
|
||||
const char STR_SAVE_THEME[] = TR_SAVE_THEME;
|
||||
const char STR_EDIT_COLOR[] = TR_EDIT_COLOR;
|
||||
const char STR_NO_THEME_IMAGE[] = TR_NO_THEME_IMAGE;
|
||||
#endif
|
||||
|
||||
#if !defined(COLORLCD)
|
||||
|
||||
@@ -745,6 +745,7 @@ extern const char STR_LOADING[];
|
||||
extern const char STR_DELETE_THEME[];
|
||||
extern const char STR_SAVE_THEME[];
|
||||
extern const char STR_EDIT_COLOR[];
|
||||
extern const char STR_NO_THEME_IMAGE[];
|
||||
#endif
|
||||
extern const char STR_EXECUTE_FILE[];
|
||||
extern const char STR_DELETE_FILE[];
|
||||
|
||||
@@ -742,7 +742,8 @@
|
||||
#define TR_LOADING "加载中..."
|
||||
#define TR_DELETE_THEME "删除主题?"
|
||||
#define TR_SAVE_THEME "保存主题?"
|
||||
#define TR_EDIT_COLOR "Edit Color"
|
||||
#define TR_EDIT_COLOR "编辑颜色"
|
||||
#define TR_NO_THEME_IMAGE "没有预览图"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_MODEL_QUICK_SELECT "快速选择模型"
|
||||
|
||||
@@ -742,7 +742,8 @@
|
||||
#define TR_LOADING "Načítání..."
|
||||
#define TR_DELETE_THEME "Smazat motiv?"
|
||||
#define TR_SAVE_THEME "Uložit motiv?"
|
||||
#define TR_EDIT_COLOR "Edit Color"
|
||||
#define TR_EDIT_COLOR "Upravit barvu"
|
||||
#define TR_NO_THEME_IMAGE "Náhled motivu nedostupný"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_MODEL_QUICK_SELECT "Rychlý výběr modelu"
|
||||
|
||||
@@ -748,7 +748,8 @@
|
||||
#define TR_LOADING "Indlæser..."
|
||||
#define TR_DELETE_THEME "Slet tema?"
|
||||
#define TR_SAVE_THEME "Gem tema?"
|
||||
#define TR_EDIT_COLOR "Edit Color"
|
||||
#define TR_EDIT_COLOR "Rediger farve"
|
||||
#define TR_NO_THEME_IMAGE "Ingen billede for tema"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_MODEL_QUICK_SELECT "Hurtigvalg af model"
|
||||
|
||||
@@ -740,7 +740,8 @@
|
||||
#define TR_LOADING "Wird geladen..."
|
||||
#define TR_DELETE_THEME "Theme löschen?"
|
||||
#define TR_SAVE_THEME "Theme speichern?"
|
||||
#define TR_EDIT_COLOR "Edit Color"
|
||||
#define TR_EDIT_COLOR "Farbe bearbeiten"
|
||||
#define TR_NO_THEME_IMAGE "Kein Theme Bild"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_MODEL_QUICK_SELECT "schnelle Modellauswahl"
|
||||
|
||||
@@ -742,6 +742,7 @@
|
||||
#define TR_DELETE_THEME "Delete Theme?"
|
||||
#define TR_SAVE_THEME "Save Theme?"
|
||||
#define TR_EDIT_COLOR "Edit Color"
|
||||
#define TR_NO_THEME_IMAGE "No theme image"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_MODEL_QUICK_SELECT "Model quick select"
|
||||
|
||||
@@ -743,6 +743,7 @@
|
||||
#define TR_DELETE_THEME "Delete Theme?"
|
||||
#define TR_SAVE_THEME "Save Theme?"
|
||||
#define TR_EDIT_COLOR "Edit Color"
|
||||
#define TR_NO_THEME_IMAGE "No theme image"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_MODEL_QUICK_SELECT "Model quick select"
|
||||
|
||||
@@ -755,6 +755,7 @@
|
||||
#define TR_DELETE_THEME "Delete Theme?"
|
||||
#define TR_SAVE_THEME "Save Theme?"
|
||||
#define TR_EDIT_COLOR "Edit Color"
|
||||
#define TR_NO_THEME_IMAGE "No theme image"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_MODEL_QUICK_SELECT "Mallin pikavalinta"
|
||||
|
||||
@@ -752,6 +752,7 @@
|
||||
#define TR_DELETE_THEME "Delete Theme?"
|
||||
#define TR_SAVE_THEME "Save Theme?"
|
||||
#define TR_EDIT_COLOR "Edit Color"
|
||||
#define TR_NO_THEME_IMAGE "No theme image"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_MODEL_QUICK_SELECT "Model quick select"
|
||||
|
||||
@@ -743,7 +743,8 @@
|
||||
#define TR_LOADING "Caricamento..."
|
||||
#define TR_DELETE_THEME "Cancello Tema?"
|
||||
#define TR_SAVE_THEME "Salvo Tema?"
|
||||
#define TR_EDIT_COLOR "Edit Color"
|
||||
#define TR_EDIT_COLOR "Edita colore"
|
||||
#define TR_NO_THEME_IMAGE "Nessuna immagine trovata"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_MODEL_QUICK_SELECT "Selezione veloce modello"
|
||||
|
||||
@@ -742,7 +742,8 @@
|
||||
#define TR_LOADING "読み込み中..."
|
||||
#define TR_DELETE_THEME "テーマを削除しますか?"
|
||||
#define TR_SAVE_THEME "テーマを保存しますか?"
|
||||
#define TR_EDIT_COLOR "Edit Color"
|
||||
#define TR_EDIT_COLOR "カラー編集"
|
||||
#define TR_NO_THEME_IMAGE "テーマ画像はありません"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_MODEL_QUICK_SELECT "モデル クイックセレクト"
|
||||
|
||||
@@ -747,6 +747,7 @@
|
||||
#define TR_DELETE_THEME "Delete Theme?"
|
||||
#define TR_SAVE_THEME "Save Theme?"
|
||||
#define TR_EDIT_COLOR "Edit Color"
|
||||
#define TR_NO_THEME_IMAGE "No theme image"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_MODEL_QUICK_SELECT "Model quick select"
|
||||
|
||||
@@ -740,6 +740,7 @@
|
||||
#define TR_DELETE_THEME "Usunąć motyw?"
|
||||
#define TR_SAVE_THEME "Zapisać motyw?"
|
||||
#define TR_EDIT_COLOR "Edit Color"
|
||||
#define TR_NO_THEME_IMAGE "No theme image"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_MODEL_QUICK_SELECT "Szybki wybór modelu"
|
||||
|
||||
@@ -747,6 +747,7 @@
|
||||
#define TR_DELETE_THEME "Delete Theme?"
|
||||
#define TR_SAVE_THEME "Save Theme?"
|
||||
#define TR_EDIT_COLOR "Edit Color"
|
||||
#define TR_NO_THEME_IMAGE "No theme image"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_MODEL_QUICK_SELECT "Model quick select"
|
||||
|
||||
@@ -764,6 +764,7 @@
|
||||
#define TR_DELETE_THEME "Radera tema?"
|
||||
#define TR_SAVE_THEME "Spara tema?"
|
||||
#define TR_EDIT_COLOR "Edit Color"
|
||||
#define TR_NO_THEME_IMAGE "Ingen temabild"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_MODEL_QUICK_SELECT "Snabbval av modell"
|
||||
|
||||
@@ -741,7 +741,8 @@
|
||||
#define TR_LOADING "加載中..."
|
||||
#define TR_DELETE_THEME "刪除主題?"
|
||||
#define TR_SAVE_THEME "保存主題?"
|
||||
#define TR_EDIT_COLOR "Edit Color"
|
||||
#define TR_EDIT_COLOR "编辑颜色"
|
||||
#define TR_NO_THEME_IMAGE "没有预览图"
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_MODEL_QUICK_SELECT "快速選擇模型"
|
||||
|
||||
Reference in New Issue
Block a user