oops
This commit is contained in:
parent
625c6dddc9
commit
35f045f393
1 changed files with 57 additions and 41 deletions
98
src/main.cpp
98
src/main.cpp
|
@ -129,21 +129,25 @@ namespace {
|
||||||
|
|
||||||
content.push_back(text(String(userIcon) + "Hello " + name + "! ") | bold | color(Color::Cyan));
|
content.push_back(text(String(userIcon) + "Hello " + name + "! ") | bold | color(Color::Cyan));
|
||||||
content.push_back(separator() | color(ui::DEFAULT_THEME.border));
|
content.push_back(separator() | color(ui::DEFAULT_THEME.border));
|
||||||
content.push_back(hbox({
|
content.push_back(hbox(
|
||||||
text(String(paletteIcon)) | color(ui::DEFAULT_THEME.icon),
|
{
|
||||||
CreateColorCircles(),
|
text(String(paletteIcon)) | color(ui::DEFAULT_THEME.icon),
|
||||||
}));
|
CreateColorCircles(),
|
||||||
|
}
|
||||||
|
));
|
||||||
content.push_back(separator() | color(ui::DEFAULT_THEME.border));
|
content.push_back(separator() | color(ui::DEFAULT_THEME.border));
|
||||||
|
|
||||||
// Helper function for aligned rows
|
// Helper function for aligned rows
|
||||||
fn createRow = [&](const StringView& icon, const StringView& label, const StringView& value) { // NEW
|
fn createRow = [&](const StringView& icon, const StringView& label, const StringView& value) { // NEW
|
||||||
return hbox({
|
return hbox(
|
||||||
text(String(icon)) | color(ui::DEFAULT_THEME.icon),
|
{
|
||||||
text(String(label)) | color(ui::DEFAULT_THEME.label),
|
text(String(icon)) | color(ui::DEFAULT_THEME.icon),
|
||||||
filler(),
|
text(String(label)) | color(ui::DEFAULT_THEME.label),
|
||||||
text(String(value)) | color(ui::DEFAULT_THEME.value),
|
filler(),
|
||||||
text(" "),
|
text(String(value)) | color(ui::DEFAULT_THEME.value),
|
||||||
});
|
text(" "),
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
// System info rows
|
// System info rows
|
||||||
|
@ -154,31 +158,39 @@ namespace {
|
||||||
const weather::Output& weatherInfo = *data.weather;
|
const weather::Output& weatherInfo = *data.weather;
|
||||||
|
|
||||||
if (weather.showTownName)
|
if (weather.showTownName)
|
||||||
content.push_back(hbox({
|
content.push_back(hbox(
|
||||||
text(String(weatherIcon)) | color(ui::DEFAULT_THEME.icon),
|
{
|
||||||
text("Weather") | color(ui::DEFAULT_THEME.label),
|
text(String(weatherIcon)) | color(ui::DEFAULT_THEME.icon),
|
||||||
filler(),
|
text("Weather") | color(ui::DEFAULT_THEME.label),
|
||||||
|
filler(),
|
||||||
|
|
||||||
hbox({
|
hbox(
|
||||||
text(std::format("{}°F ", std::lround(weatherInfo.main.temp))),
|
{
|
||||||
text("in "),
|
text(std::format("{}°F ", std::lround(weatherInfo.main.temp))),
|
||||||
text(weatherInfo.name),
|
text("in "),
|
||||||
text(" "),
|
text(weatherInfo.name),
|
||||||
}) |
|
text(" "),
|
||||||
color(ui::DEFAULT_THEME.value),
|
}
|
||||||
}));
|
) |
|
||||||
|
color(ui::DEFAULT_THEME.value),
|
||||||
|
}
|
||||||
|
));
|
||||||
else
|
else
|
||||||
content.push_back(hbox({
|
content.push_back(hbox(
|
||||||
text(String(weatherIcon)) | color(ui::DEFAULT_THEME.icon),
|
{
|
||||||
text("Weather") | color(ui::DEFAULT_THEME.label),
|
text(String(weatherIcon)) | color(ui::DEFAULT_THEME.icon),
|
||||||
filler(),
|
text("Weather") | color(ui::DEFAULT_THEME.label),
|
||||||
|
filler(),
|
||||||
|
|
||||||
hbox({
|
hbox(
|
||||||
text(std::format("{}°F, {}", std::lround(weatherInfo.main.temp), weatherInfo.weather[0].description)),
|
{
|
||||||
text(" "),
|
text(std::format("{}°F, {}", std::lround(weatherInfo.main.temp), weatherInfo.weather[0].description)),
|
||||||
}) |
|
text(" "),
|
||||||
color(ui::DEFAULT_THEME.value),
|
}
|
||||||
}));
|
) |
|
||||||
|
color(ui::DEFAULT_THEME.value),
|
||||||
|
}
|
||||||
|
));
|
||||||
} else if (weather.enabled)
|
} else if (weather.enabled)
|
||||||
error_at(data.weather.error());
|
error_at(data.weather.error());
|
||||||
|
|
||||||
|
@ -239,14 +251,16 @@ namespace {
|
||||||
const String npText = artist + " - " + title;
|
const String npText = artist + " - " + title;
|
||||||
|
|
||||||
content.push_back(separator() | color(ui::DEFAULT_THEME.border));
|
content.push_back(separator() | color(ui::DEFAULT_THEME.border));
|
||||||
content.push_back(hbox({
|
content.push_back(hbox(
|
||||||
text(String(musicIcon)) | color(ui::DEFAULT_THEME.icon),
|
{
|
||||||
text("Playing") | color(ui::DEFAULT_THEME.label),
|
text(String(musicIcon)) | color(ui::DEFAULT_THEME.icon),
|
||||||
text(" "),
|
text("Playing") | color(ui::DEFAULT_THEME.label),
|
||||||
filler(),
|
text(" "),
|
||||||
paragraph(npText) | color(Color::Magenta) | size(WIDTH, LESS_THAN, ui::MAX_PARAGRAPH_LENGTH),
|
filler(),
|
||||||
text(" "),
|
paragraph(npText) | color(Color::Magenta) | size(WIDTH, LESS_THAN, ui::MAX_PARAGRAPH_LENGTH),
|
||||||
}));
|
text(" "),
|
||||||
|
}
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
return vbox(content) | borderRounded | color(Color::White);
|
return vbox(content) | borderRounded | color(Color::White);
|
||||||
|
@ -269,5 +283,7 @@ fn main() -> i32 {
|
||||||
Render(screen, document);
|
Render(screen, document);
|
||||||
screen.Print();
|
screen.Print();
|
||||||
|
|
||||||
|
std::println();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue