Holiday Themes

This commit is contained in:
FrogAi
2024-03-05 17:44:50 -07:00
parent 7ef99716cc
commit ae0c294aab
171 changed files with 304 additions and 28 deletions

View File

@@ -47,6 +47,30 @@ Sidebar::Sidebar(QWidget *parent) : QFrame(parent), onroad(false), flag_pressed(
isStorageLeft = params.getBool("ShowStorageLeft");
isStorageUsed = params.getBool("ShowStorageUsed");
holidayThemeConfiguration = {
{1, {"april_fools", {QColor(255, 165, 0)}}},
{2, {"christmas", {QColor(0, 72, 255)}}},
{3, {"cinco_de_mayo", {QColor(255, 0, 0)}}},
{4, {"easter", {QColor(200, 150, 200)}}},
{5, {"fourth_of_july", {QColor(0, 72, 255)}}},
{6, {"halloween", {QColor(255, 0, 0)}}},
{7, {"new_years_day", {QColor(23, 134, 68)}}},
{8, {"st_patricks_day", {QColor(0, 128, 0)}}},
{9, {"thanksgiving", {QColor(255, 0, 0)}}},
{10, {"valentines_day", {QColor(23, 134, 68)}}},
{11, {"world_frog_day", {QColor(0, 72, 255)}}},
};
for (auto &[key, themeData] : holidayThemeConfiguration) {
QString &themeName = themeData.first;
QString base = QString("../frogpilot/assets/holiday_themes/%1/images").arg(themeName);
std::vector<QString> paths = {base + "/button_home.png", base + "/button_flag.png", base + "/button_settings.png"};
home_imgs[key] = loadPixmap(paths[0], home_btn.size());
flag_imgs[key] = loadPixmap(paths[1], home_btn.size());
settings_imgs[key] = loadPixmap(paths[2], settings_btn.size(), Qt::IgnoreAspectRatio);
}
themeConfiguration = {
{0, {"stock", {QColor(255, 255, 255)}}},
{1, {"frog_theme", {QColor(23, 134, 68)}}},
@@ -135,11 +159,17 @@ void Sidebar::updateState(const UIState &s) {
setProperty("netStrength", strength > 0 ? strength + 1 : 0);
// FrogPilot properties
home_img = home_imgs[scene.custom_icons];
flag_img = flag_imgs[scene.custom_icons];
settings_img = settings_imgs[scene.custom_icons];
currentColors = themeConfiguration[scene.custom_colors].second;
if (scene.current_holiday_theme != 0) {
home_img = home_imgs[scene.current_holiday_theme];
flag_img = flag_imgs[scene.current_holiday_theme];
settings_img = settings_imgs[scene.current_holiday_theme];
currentColors = holidayThemeConfiguration[scene.current_holiday_theme].second;
} else {
home_img = home_imgs[scene.custom_icons];
flag_img = flag_imgs[scene.custom_icons];
settings_img = settings_imgs[scene.custom_icons];
currentColors = themeConfiguration[scene.custom_colors].second;
}
auto frogpilotDeviceState = sm["frogpilotDeviceState"].getFrogpilotDeviceState();