Warning fixes

This commit is contained in:
Bertrand Songis
2020-04-09 19:05:05 +02:00
parent 4e27a07a38
commit d48f8beb68
3 changed files with 18 additions and 13 deletions
+4 -4
View File
@@ -29,12 +29,12 @@ void CarouselWindow::update()
for (auto & item: items) {
Window * window;
if (index == selection) {
item.back->detach();
window = item.front;
item->back->detach();
window = item->front;
}
else {
item.front->detach();
window = item.back;
item->front->detach();
window = item->back;
}
window->attach(this);
window->setLeft(lastPosition);
+12 -7
View File
@@ -50,19 +50,24 @@ class CarouselWindow: public Window {
~CarouselWindow() override
{
for (auto & item: items) {
item.front->deleteLater();
item.back->deleteLater();
item->front->deleteLater();
item->back->deleteLater();
}
}
void addItem(CarouselItem item)
void addItem(CarouselItem * item)
{
items.emplace_back(item);
items.push_back(item);
update();
}
void clear()
{
for (auto & item: items) {
item->front->deleteLater();
item->back->deleteLater();
delete item;
}
items.clear();
Window::clear();
}
@@ -74,7 +79,7 @@ class CarouselWindow: public Window {
}
protected:
std::vector<CarouselItem> items;
std::vector<CarouselItem *> items;
int selection = 0;
void update();
};
@@ -93,9 +98,9 @@ class Carousel: public Window {
}
#endif
void addItem(CarouselItem item)
void addItem(CarouselItem * item)
{
body->addItem(std::move(item));
body->addItem(item);
}
void clear()
+2 -2
View File
@@ -43,7 +43,7 @@
#define FONT_MASK 0x0F00u
#define FONT_INDEX(flags) (((flags) & FONT_MASK) >> 8u)
#define FONT(xx) (FONT_ ## xx ## _INDEX << 8u)
#define FONT(xx) (unsigned(FONT_ ## xx ## _INDEX) << 8u)
#define TIMEHOUR 0x2000u
#define EXPANDED 0x2000u
@@ -92,7 +92,7 @@
#define RGB(r, g, b) (uint16_t)((((r) & 0xF8) << 8) + (((g) & 0xFC) << 3) + (((b) & 0xF8) >> 3))
#define ARGB(a, r, g, b) (uint16_t)((((a) & 0xF0) << 8) + (((r) & 0xF0) << 4) + (((g) & 0xF0) << 0) + (((b) & 0xF0) >> 4))
#define COLOR(index) LcdFlags((index) << 16u)
#define COLOR(index) LcdFlags(unsigned(index) << 16u)
#define COLOR_IDX(att) uint8_t((att) >> 16u)
#define DEFAULT_COLOR COLOR(DEFAULT_COLOR_INDEX)