[color] Batch conversions
This commit is contained in:
@@ -44,6 +44,7 @@ class LayoutFactory
|
||||
virtual const ZoneOption * getOptions() const = 0;
|
||||
virtual WidgetsContainer * create(LayoutPersistentData * persistentData) const = 0;
|
||||
virtual WidgetsContainer * load(LayoutPersistentData * persistentData) const = 0;
|
||||
virtual void initPersistentData(LayoutPersistentData * persistentData) const = 0;
|
||||
|
||||
protected:
|
||||
const char * id;
|
||||
|
||||
@@ -150,7 +150,7 @@ class BaseLayoutFactory: public LayoutFactory
|
||||
return layout;
|
||||
}
|
||||
|
||||
void initPersistentData(Layout::PersistentData * persistentData) const
|
||||
void initPersistentData(Layout::PersistentData * persistentData) const override
|
||||
{
|
||||
memset(persistentData, 0, sizeof(Layout::PersistentData));
|
||||
if (options) {
|
||||
|
||||
@@ -128,16 +128,14 @@ class ModelButton: public Button {
|
||||
}
|
||||
else {
|
||||
error = readModel(modelCell->modelFilename, (uint8_t *)&partialModel.header, sizeof(partialModel), &version);
|
||||
// LEN_BITMAP_NAME has now 4 bytes more
|
||||
if (version <= 218) {
|
||||
memmove(partialModel.timers, &(partialModel.header.bitmap[10]), sizeof(TimerData)*MAX_TIMERS);
|
||||
memclear(&(partialModel.header.bitmap[10]), 4);
|
||||
if (!error) {
|
||||
if (modelCell->modelName[0] == '\0'
|
||||
&& partialModel.header.name[0] != '\0') {
|
||||
modelCell->setModelName(partialModel.header.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if (modelCell->modelName[0] == '\0' && !error)
|
||||
// setModelName(partialModel.header.name); // resets buffer!!!
|
||||
|
||||
buffer = new BitmapBuffer(BMP_RGB565, MODELCELL_WIDTH, MODELCELL_HEIGHT);
|
||||
if (buffer == nullptr) {
|
||||
return;
|
||||
|
||||
@@ -402,11 +402,12 @@ class Theme480: public OpenTxTheme
|
||||
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, FONT(XS)|FOCUS_COLOR|CENTERED);
|
||||
}
|
||||
|
||||
void drawProgressBar(BitmapBuffer * dc, coord_t x, coord_t y, coord_t w, coord_t h, int value) const override
|
||||
void drawProgressBar(BitmapBuffer *dc, coord_t x, coord_t y, coord_t w,
|
||||
coord_t h, int value, int total) const override
|
||||
{
|
||||
dc->drawSolidRect(x, y, w, h, 1, DEFAULT_COLOR);
|
||||
if (value > 0) {
|
||||
int width = (w * value) / 100;
|
||||
int width = (w * value) / total;
|
||||
dc->drawSolidFilledRect(x + 2, y + 2, width - 4, h - 4, CHECKBOX_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -420,11 +420,12 @@ class FlyskyTheme: public OpenTxTheme
|
||||
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, FONT(XS)|FOCUS_COLOR|CENTERED);
|
||||
}
|
||||
|
||||
void drawProgressBar(BitmapBuffer * dc, coord_t x, coord_t y, coord_t w, coord_t h, int value) const override
|
||||
void drawProgressBar(BitmapBuffer *dc, coord_t x, coord_t y, coord_t w,
|
||||
coord_t h, int value, int total) const override
|
||||
{
|
||||
dc->drawSolidRect(x, y, w, h, 1, DEFAULT_COLOR);
|
||||
if (value > 0) {
|
||||
int width = (w * value) / 100;
|
||||
int width = (w * value) / total;
|
||||
dc->drawSolidFilledRect(x + 2, y + 2, width - 4, h - 4, CHECKBOX_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user