Skip to content

Commit

Permalink
meta: Formated code-base.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Feb 18, 2025
1 parent 4f438c9 commit bdb4bfb
Show file tree
Hide file tree
Showing 200 changed files with 910 additions and 915 deletions.
2 changes: 1 addition & 1 deletion src/apps/hideo-about/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Ui::Child app() {
});

auto licenseBtn = Ui::button(
[](auto &n) {
[](auto& n) {
Ui::showDialog(n, Kr::licenseDialog());
},
Ui::ButtonStyle::outline(), Mdi::LICENSE, "License"
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-about/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

#include "../app.h"

Async::Task<> entryPointAsync(Sys::Context &ctx) {
Async::Task<> entryPointAsync(Sys::Context& ctx) {
co_return Ui::runApp(ctx, Hideo::About::app());
}
2 changes: 1 addition & 1 deletion src/apps/hideo-apps/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "../app.h"

Async::Task<> entryPointAsync(Sys::Context &ctx) {
Async::Task<> entryPointAsync(Sys::Context& ctx) {
co_return Ui::runApp(
ctx,
Hideo::Apps::app()
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-avplayer/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "../app.h"

Async::Task<> entryPointAsync(Sys::Context &ctx) {
Async::Task<> entryPointAsync(Sys::Context& ctx) {
co_return Ui::runApp(
ctx,
Hideo::Avplayer::app()
Expand Down
6 changes: 3 additions & 3 deletions src/apps/hideo-calculator/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Ui::Child textButton(Ui::OnPress onPress, String t) {
return textButton(std::move(onPress), Ui::ButtonStyle::regular(), t);
}

Ui::Child keypad(State const &state) {
Ui::Child keypad(State const& state) {
return Ui::insets(
8,
Ui::grid(
Expand Down Expand Up @@ -79,7 +79,7 @@ Ui::Child keypad(State const &state) {
);
}

Ui::Child screen(State const &state) {
Ui::Child screen(State const& state) {
// auto debugExpr = Ui::text("op: {}, lhs: {}, rhs: {}", toFmt(state.op), state.lhs, state.rhs);

auto currExpr =
Expand All @@ -97,7 +97,7 @@ Ui::Child screen(State const &state) {
}

Ui::Child app() {
return Ui::reducer<Model>([](State const &state) {
return Ui::reducer<Model>([](State const& state) {
return Kr::scaffold({
.icon = Mdi::CALCULATOR,
.title = "Calculator"s,
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-calculator/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "../app.h"

Async::Task<> entryPointAsync(Sys::Context &ctx) {
Async::Task<> entryPointAsync(Sys::Context& ctx) {
#ifdef __ck_sys_skift__
co_return co_await Ui::runAsync(ctx, Hideo::Calculator::app());
#else
Expand Down
4 changes: 2 additions & 2 deletions src/apps/hideo-calculator/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Hideo::Calculator {

void doOperator(State &s, Operator op) {
void doOperator(State& s, Operator op) {
if (not s.hasRhs)
s.op = op;

Expand Down Expand Up @@ -67,7 +67,7 @@ void doOperator(State &s, Operator op) {
}
}

Ui::Task<Action> reduce(State &s, Action action) {
Ui::Task<Action> reduce(State& s, Action action) {
s.error = NONE;

action.visit(Visitor{
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-calculator/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ using Action = Union<
MemClearAction, MemRecallAction, MemAddAction, MemSubAction, MemStoreAction,
EnterDecimalAction>;

Ui::Task<Action> reduce(State &, Action);
Ui::Task<Action> reduce(State&, Action);

using Model = Ui::Model<State, Action, reduce>;

Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-calendar/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "../app.h"

Async::Task<> entryPointAsync(Sys::Context &ctx) {
Async::Task<> entryPointAsync(Sys::Context& ctx) {
co_return Ui::runApp(
ctx,
Hideo::Calendar::app()
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-camera/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Hideo::Camera {
Ui::Child appContent() {
auto viewport = Ui::stack(
Ui::box({.backgroundFill = Gfx::BLUE400}, Ui::empty()),
Ui::canvas([](Gfx::Canvas &g, Math::Vec2i size) {
Ui::canvas([](Gfx::Canvas& g, Math::Vec2i size) {
g.strokeStyle(Gfx::Stroke{
.fill = Gfx::WHITE.withOpacity(0.5),
.width = 1,
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-camera/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "../app.h"

Async::Task<> entryPointAsync(Sys::Context &ctx) {
Async::Task<> entryPointAsync(Sys::Context& ctx) {
co_return Ui::runApp(
ctx,
Hideo::Camera::app()
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-canvas/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "../app.h"

Async::Task<> entryPointAsync(Sys::Context &ctx) {
Async::Task<> entryPointAsync(Sys::Context& ctx) {
co_return Ui::runApp(
ctx,
Hideo::Canvas::app()
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-chat/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "../app.h"

Async::Task<> entryPointAsync(Sys::Context &ctx) {
Async::Task<> entryPointAsync(Sys::Context& ctx) {
co_return Ui::runApp(
ctx,
Hideo::Chat::app()
Expand Down
12 changes: 6 additions & 6 deletions src/apps/hideo-clock/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ struct Clock : public Ui::View<Clock> {

Clock(Time time) : _time(time) {}

void reconcile(Clock &o) override {
void reconcile(Clock& o) override {
_time = o._time;
}

void _drawHand(Gfx::Canvas &g, f64 angle, f64 length, Gfx::Color color, f64 width) {
void _drawHand(Gfx::Canvas& g, f64 angle, f64 length, Gfx::Color color, f64 width) {
g.push();
g.beginPath();
g.translate(bound().center().cast<f64>());
Expand All @@ -35,7 +35,7 @@ struct Clock : public Ui::View<Clock> {
g.pop();
}

void paint(Gfx::Canvas &g, Math::Recti) override {
void paint(Gfx::Canvas& g, Math::Recti) override {
auto size = bound().size().min();

g.push();
Expand Down Expand Up @@ -88,7 +88,7 @@ Ui::Child alarmPage() {

// MARK: Clock Page ------------------------------------------------------------

Ui::Child clockPage(State const &s) {
Ui::Child clockPage(State const& s) {
auto time = s.dateTime.time;

return Ui::vflow(
Expand All @@ -113,7 +113,7 @@ Ui::Child stopwatchPage() {

// MARK: App -------------------------------------------------------------------

Ui::Child appContent(State const &s) {
Ui::Child appContent(State const& s) {
switch (s.page) {
case Page::ALARM:
return alarmPage();
Expand All @@ -128,7 +128,7 @@ Ui::Child appContent(State const &s) {

Ui::Child app() {
return Ui::reducer<Model>(
[](State const &s) {
[](State const& s) {
return Kr::scaffold({
.icon = Mdi::CLOCK,
.title = "Clock"s,
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-clock/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "../app.h"

Async::Task<> entryPointAsync(Sys::Context &ctx) {
Async::Task<> entryPointAsync(Sys::Context& ctx) {
Async::Cancelation c;
auto app = Hideo::Clock::app();
Async::detach(Hideo::Clock::timerTask(app, c.token()));
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-clock/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Hideo::Clock {

Ui::Task<Action> reduce(State &s, Action a) {
Ui::Task<Action> reduce(State& s, Action a) {
a.visit(Visitor{
[&](Page p) {
s.page = p;
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-clock/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct TimeTick {};

using Action = Union<Page, TimeTick>;

Ui::Task<Action> reduce(State &, Action);
Ui::Task<Action> reduce(State&, Action);

using Model = Ui::Model<State, Action, reduce>;

Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-code/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "../app.h"

Async::Task<> entryPointAsync(Sys::Context &ctx) {
Async::Task<> entryPointAsync(Sys::Context& ctx) {
co_return Ui::runApp(
ctx,
Hideo::Code::app()
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-console/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ Ui::Child app() {

} // namespace Hideo::Console

Async::Task<> entryPointAsync(Sys::Context &ctx) {
Async::Task<> entryPointAsync(Sys::Context& ctx) {
co_return Ui::runApp(ctx, Hideo::Console::app());
}
2 changes: 1 addition & 1 deletion src/apps/hideo-counter/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Hideo::Counter {

Ui::Child app() {
return Ui::reducer<Model>([](State const &s) {
return Ui::reducer<Model>([](State const& s) {
return Kr::scaffold({
.icon = Mdi::COUNTER,
.title = "Counter"s,
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-counter/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

#include "../app.h"

Async::Task<> entryPointAsync(Sys::Context &ctx) {
Async::Task<> entryPointAsync(Sys::Context& ctx) {
co_return Ui::runApp(ctx, Hideo::Counter::app());
}
2 changes: 1 addition & 1 deletion src/apps/hideo-counter/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Hideo::Counter {

Ui::Task<Action> reduce(State &s, Action a) {
Ui::Task<Action> reduce(State& s, Action a) {
a.visit(Visitor{
[&](ResetAction) {
s = State{.initial = true};
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-counter/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct DecrementAction {};

using Action = Union<ResetAction, IncrementAction, DecrementAction>;

Ui::Task<Action> reduce(State &, Action);
Ui::Task<Action> reduce(State&, Action);

using Model = Ui::Model<State, Action, reduce>;

Expand Down
6 changes: 3 additions & 3 deletions src/apps/hideo-demos/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct SwitchAction {

using Action = Union<SwitchAction>;

Ui::Task<Action> reduce(State &s, Action action) {
Ui::Task<Action> reduce(State& s, Action action) {
action.visit(
[&](SwitchAction action) {
s.current = action.index;
Expand All @@ -54,14 +54,14 @@ Ui::Task<Action> reduce(State &s, Action action) {
using Model = Ui::Model<State, Action, reduce>;

Ui::Child app() {
return Ui::reducer<Model>([](State const &s) {
return Ui::reducer<Model>([](State const& s) {
return Kr::scaffold({
.icon = Mdi::DUCK,
.title = "Demos"s,
.sidebar = [&] {
return Kr::sidenav(
iter(DEMOS)
.mapi([&](Demo const *demo, usize index) {
.mapi([&](Demo const* demo, usize index) {
return Kr::sidenavItem(
index == s.current,
Model::bind<SwitchAction>(index),
Expand Down
8 changes: 4 additions & 4 deletions src/apps/hideo-demos/demo-bezier.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace Hideo::Demos {

static Ui::Task<Edit> reduce(Math::Curvef &curve, Edit e) {
static Ui::Task<Edit> reduce(Math::Curvef& curve, Edit e) {
curve._pts[e.index] = e.pos;
return NONE;
}
Expand All @@ -23,9 +23,9 @@ static inline Demo BEZIER_DEMO{
"Curve editor",
[] {
using Model = Ui::Model<Math::Curvef, Edit, reduce>;
return Ui::reducer<Model>(Math::Curvef::linear(100, 300), [](Math::Curvef const &s) {
return Ui::reducer<Model>(Math::Curvef::linear(100, 300), [](Math::Curvef const& s) {
auto canvas = Ui::canvas(
[=](Gfx::Canvas &g, Math::Vec2i) {
[=](Gfx::Canvas& g, Math::Vec2i) {
g.beginPath();
g.moveTo(s.a);
g.cubicTo(s.b, s.c, s.d);
Expand Down Expand Up @@ -93,7 +93,7 @@ static inline Demo BEZIER_DEMO{
Ui::bound() |
Ui::dragRegion() |
Ui::placed(Math::Recti::fromCenter(pos.cast<isize>(), {24, 24})) |
Ui::intent([=](Ui::Node &n, App::Event &e) {
Ui::intent([=](Ui::Node& n, App::Event& e) {
if (auto m = e.is<Ui::DragEvent>()) {
e.accept();
Model::bubble<Edit>(n, {index, pos + m->delta});
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-demos/demo-circle.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static inline Demo CIRCLE_DEMO{
"Circles rendering",
[] {
return Ui::canvas(
[](Gfx::Canvas &g, Math::Vec2i size) {
[](Gfx::Canvas& g, Math::Vec2i size) {
Math::Rand rand{};

for (isize i = 0; i < 10; i++) {
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-demos/demo-gradient.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static inline Demo GRADIENT_DEMO{
"Gradients rendering",
[] {
return Ui::canvas(
[](Gfx::Canvas &g, Math::Vec2i bound) {
[](Gfx::Canvas& g, Math::Vec2i bound) {
// Red, orange, yellow, green, blue, indigo, violet
auto colors = Gfx::Gradient::linear()
.withColors(Gfx::RED, Gfx::ORANGE, Gfx::YELLOW, Gfx::GREEN, Gfx::BLUE, Gfx::INDIGO, Gfx::VIOLET)
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-demos/demo-mixbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ static inline Demo MIXBOX_DEMO{
"Pigment Acurate Color Mixing",
[] {
return Ui::canvas(
[](Gfx::Canvas &g, Math::Vec2i bound) {
[](Gfx::Canvas& g, Math::Vec2i bound) {
auto grad = Gfx::Gradient::linear();
for (f64 i = 0; i <= 100; i += 10)
grad.withStop(Mixbox::lerpColor(Gfx::YELLOW, Gfx::RED, i / 100.0), i / 100.0);
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-demos/demo-stroke.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static inline Demo STROKE_DEMO{
"Strokes styling and rendering",
[] {
return Ui::canvas(
[](Gfx::Canvas &g, auto...) {
[](Gfx::Canvas& g, auto...) {
g.beginPath();
g.translate({100, 100});
g.moveTo({0, 0});
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-demos/demo-svg.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static inline Demo SVG_DEMO{
"SVG rendering",
[] {
return Ui::canvas(
[](Gfx::Canvas &g, auto...) {
[](Gfx::Canvas& g, auto...) {
g.beginPath();

Math::Path p;
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-demos/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

#include "../app.h"

Async::Task<> entryPointAsync(Sys::Context &ctx) {
Async::Task<> entryPointAsync(Sys::Context& ctx) {
co_return Ui::runApp(ctx, Hideo::Demos::app());
}
Loading

0 comments on commit bdb4bfb

Please sign in to comment.