mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-14 01:15:38 -04:00
Formatted code (#1007)
* Updated style * Updated files * fixed new line * Updated spacing * File fix WIP * Updated to clang 13 * updated comment style * Removed old comment code
This commit is contained in:
parent
7aca7ce74d
commit
033c4e9a5b
599 changed files with 70746 additions and 66896 deletions
|
@ -34,24 +34,24 @@ namespace ui {
|
|||
namespace detail {
|
||||
|
||||
const Bitmap& bitmap_sd_card(const sd_card::Status status) {
|
||||
switch(status) {
|
||||
case sd_card::Status::IOError:
|
||||
case sd_card::Status::MountError:
|
||||
case sd_card::Status::ConnectError:
|
||||
return bitmap_sd_card_error;
|
||||
switch (status) {
|
||||
case sd_card::Status::IOError:
|
||||
case sd_card::Status::MountError:
|
||||
case sd_card::Status::ConnectError:
|
||||
return bitmap_sd_card_error;
|
||||
|
||||
case sd_card::Status::NotPresent:
|
||||
return bitmap_sd_card_unknown;
|
||||
case sd_card::Status::NotPresent:
|
||||
return bitmap_sd_card_unknown;
|
||||
|
||||
case sd_card::Status::Present:
|
||||
return bitmap_sd_card_unknown;
|
||||
case sd_card::Status::Present:
|
||||
return bitmap_sd_card_unknown;
|
||||
|
||||
case sd_card::Status::Mounted:
|
||||
return bitmap_sd_card_ok;
|
||||
case sd_card::Status::Mounted:
|
||||
return bitmap_sd_card_ok;
|
||||
|
||||
default:
|
||||
return bitmap_sd_card_unknown;
|
||||
}
|
||||
default:
|
||||
return bitmap_sd_card_unknown;
|
||||
}
|
||||
}
|
||||
|
||||
static constexpr Color color_sd_card_error = Color::red();
|
||||
|
@ -59,55 +59,54 @@ static constexpr Color color_sd_card_unknown = Color::yellow();
|
|||
static constexpr Color color_sd_card_ok = Color::green();
|
||||
|
||||
const Color color_sd_card(const sd_card::Status status) {
|
||||
switch(status) {
|
||||
case sd_card::Status::IOError:
|
||||
case sd_card::Status::MountError:
|
||||
case sd_card::Status::ConnectError:
|
||||
return color_sd_card_error;
|
||||
switch (status) {
|
||||
case sd_card::Status::IOError:
|
||||
case sd_card::Status::MountError:
|
||||
case sd_card::Status::ConnectError:
|
||||
return color_sd_card_error;
|
||||
|
||||
case sd_card::Status::NotPresent:
|
||||
return color_sd_card_unknown;
|
||||
case sd_card::Status::NotPresent:
|
||||
return color_sd_card_unknown;
|
||||
|
||||
case sd_card::Status::Present:
|
||||
return color_sd_card_unknown;
|
||||
case sd_card::Status::Present:
|
||||
return color_sd_card_unknown;
|
||||
|
||||
case sd_card::Status::Mounted:
|
||||
return color_sd_card_ok;
|
||||
case sd_card::Status::Mounted:
|
||||
return color_sd_card_ok;
|
||||
|
||||
default:
|
||||
return color_sd_card_unknown;
|
||||
}
|
||||
default:
|
||||
return color_sd_card_unknown;
|
||||
}
|
||||
}
|
||||
|
||||
} /* namespace detail */
|
||||
|
||||
SDCardStatusView::SDCardStatusView(
|
||||
const Rect parent_rect
|
||||
) : Image { parent_rect, &bitmap_sd_card_unknown, detail::color_sd_card_unknown, Color::dark_grey() }
|
||||
{
|
||||
const Rect parent_rect)
|
||||
: Image{parent_rect, &bitmap_sd_card_unknown, detail::color_sd_card_unknown, Color::dark_grey()} {
|
||||
}
|
||||
|
||||
void SDCardStatusView::on_show() {
|
||||
sd_card_status_signal_token = sd_card::status_signal += [this](const sd_card::Status status) {
|
||||
this->on_status(status);
|
||||
};
|
||||
sd_card_status_signal_token = sd_card::status_signal += [this](const sd_card::Status status) {
|
||||
this->on_status(status);
|
||||
};
|
||||
}
|
||||
|
||||
void SDCardStatusView::on_hide() {
|
||||
sd_card::status_signal -= sd_card_status_signal_token;
|
||||
sd_card::status_signal -= sd_card_status_signal_token;
|
||||
}
|
||||
|
||||
void SDCardStatusView::paint(Painter& painter) {
|
||||
const auto status = sd_card::status();
|
||||
set_bitmap(&detail::bitmap_sd_card(status));
|
||||
set_foreground(detail::color_sd_card(status));
|
||||
const auto status = sd_card::status();
|
||||
set_bitmap(&detail::bitmap_sd_card(status));
|
||||
set_foreground(detail::color_sd_card(status));
|
||||
|
||||
Image::paint(painter);
|
||||
Image::paint(painter);
|
||||
}
|
||||
|
||||
void SDCardStatusView::on_status(const sd_card::Status) {
|
||||
// Don't update image properties here, they might change. Wait until paint.
|
||||
set_dirty();
|
||||
// Don't update image properties here, they might change. Wait until paint.
|
||||
set_dirty();
|
||||
}
|
||||
|
||||
} /* namespace ui */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue