Skip to content

Commit

Permalink
janitor: Use slint instead of 60 as raw string sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
tronical committed Feb 9, 2022
1 parent 0eba0e3 commit fd34193
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions examples/iot-dashboard/dashboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ std::string WidgetLocation::location_bindings() const
};

return fmt::format(
R"60(row: {};
R"slint(row: {};
col: {};
{}{})60",
{}{})slint",
row, column, maybe_binding("rowspan", row_span), maybe_binding("colspan", col_span));
}

Expand Down Expand Up @@ -85,7 +85,8 @@ DashboardBuilder::build(slint::interpreter::ComponentCompiler &compiler) const
}

if (widget_imports.size() > 0) {
widget_imports = fmt::format("import {{ {} }} from \"iot-dashboard.slint\";", widget_imports);
widget_imports =
fmt::format("import {{ {} }} from \"iot-dashboard.slint\";", widget_imports);
}

// Vector of name/type_name of properties forwarded through the MainContent {} element.
Expand All @@ -98,11 +99,11 @@ DashboardBuilder::build(slint::interpreter::ComponentCompiler &compiler) const
const auto &[widget_name, widget_ptr] = widgets[widget_id];

main_grid.append(fmt::format(
R"60(
R"slint(
{0} := {1} {{
{2}
}}
)60",
)slint",
widget_name, widget_ptr->type_name(), location.location_bindings()));

std::string properties_prefix = widget_name;
Expand All @@ -125,10 +126,10 @@ DashboardBuilder::build(slint::interpreter::ComponentCompiler &compiler) const
const auto &[widget_name, widget_ptr] = widgets[widget_id];

top_bar.append(fmt::format(
R"60(
R"slint(
{0} := {1} {{
}}
)60",
)slint",
widget_name, widget_ptr->type_name()));

std::string properties_prefix = widget_name;
Expand All @@ -145,7 +146,7 @@ DashboardBuilder::build(slint::interpreter::ComponentCompiler &compiler) const
}

auto source_code = fmt::format(
R"60(
R"slint(
{0}
Expand Down Expand Up @@ -182,7 +183,7 @@ MainWindow := Window {{
}}
}}
}}
)60",
)slint",
widget_imports, top_bar, main_grid, exposed_properties, main_content_properties);

auto definition = compiler.build_from_source(source_code, SOURCE_DIR);
Expand Down

0 comments on commit fd34193

Please sign in to comment.