text
stringlengths
0
234
if simulation_choice = Lancet then
QStackedWidget_setCurrentIndex (stack, 1);
update_simulation; -- lancet model stuff TODO : move to lancet_model
end if;
Function Definition: procedure init_chart is
Function Body: legend : QLegendH;
chart_view : QGraphicsViewH;
horizontal_layout : QBoxLayoutH := QHBoxLayout_create;
begin
chart := QChart_create;
legend := QChart_legend (chart);
QLegend_setVisible (legend, true);
chart_view := QChartView_create (chart);
QGraphicsView_setRenderHint (chart_view, QPainterAntialiasing);
QBoxLayout_addWidget (horizontal_layout, QWidgetH(chart_view));
QWidget_setLayout (QwidgetH (graphic_view), horizontal_layout);
Function Definition: procedure init_scenario_choices is
Function Body: begin
scenario_choice := QComboBoxH (QObject_findChild (QObjectH (covidsim_form), s2qs ("scenario_choice")));
for s in Scenario loop
QStringList_append(handle => scenarios, s => s2qs(enum_image_to_beautiful_image(s'Image)));
end loop;
QComboBox_addItems (handle => scenario_choice, texts => scenarios);
Function Definition: procedure slot_export_to_csv is
Function Body: scenario_name : String := beautiful_image_to_enum_image(qs2s(QComboBox_currentText(scenario_choice)));
results : Simulation_Data := Simulation(Scenario'Value(scenario_name), QSpinBox_value(number_population), QSpinBox_value(number_iterations));
begin
Export_To_CSV (results, Scenario'Value(scenario_name), QSpinBox_value(number_population), QSpinBox_value(number_iterations));
Function Definition: procedure covidsim is
Function Body: begin
covidsim_form_init;
QWidget_show(covidsim_form);
QApplication_invoke;
Function Definition: procedure init_country_choices is
Function Body: countries : QStringListH := QStringList_create;
disable : integer := 0;
begin
for c in country loop
QComboBox_addItem (country_choice, s2qs(all_countries(c).name));
declare
raw_ce : country_entries_array := get_country_data (data_filename, c);
begin
if raw_ce'length < 5 then
QComboBox_setItemData (country_choice, country'pos(c), QVariant_create(disable), QtUserRole-1);
end if;
Function Definition: procedure update_forecast_range_chart is
Function Body: axes : QObjectListH;
forecast_last : qreal := qreal (QSpinBox_value (forecast_days_value));
begin
axes := QChart_axes(chart);
QValueAxis_setRange(QAxisH(QObjectList_at(axes, 0)), 0.0, forecast_last);
Function Definition: procedure update_chart is
Function Body: current_index : integer := QComboBox_currentIndex (country_choice);
c : country := country'val(current_index);
start_date : QDateH := QDateTimeEdit_date (start_date_value);
start_time : Time := time_of (QDate_year (start_date), QDate_month (start_date), QDate_day (start_date));
end_date : QDateH := QDateTimeEdit_date (end_date_value);
end_time : Time := time_of (QDate_year (end_date), QDate_month (end_date), QDate_day (end_date));
country_ground_truth_first : QSeriesH;
country_ground_truth_date_range : QSeriesH;
country_ground_truth_last : QSeriesH;
country_forecast : QSeriesH;
procedure init_series is
pen_first : QPenH := QPen_create(QColor_create(0,255,0));
pen_date_range : QPenH := QPen_create(QColor_create(255,0,0));
pen_last : QPenH := QPen_create(QColor_create(0,255,0));
pen_forecast: QPenH := QPen_create(QColor_create(255,255,0));
begin
country_ground_truth_first := QLineSeries_create;
QPen_setWidth(pen_first, 3);
QAreaSeries_setPen(country_ground_truth_first, pen_first);
country_ground_truth_date_range := QLineSeries_create;
QPen_setWidth(pen_date_range, 3);
QAreaSeries_setPen(country_ground_truth_date_range, pen_date_range);
country_ground_truth_last := QLineSeries_create;
QPen_setWidth(pen_last, 3);
QAreaSeries_setPen(country_ground_truth_last, pen_last);