From: Mikko Rasa Date: Wed, 9 Apr 2014 21:23:42 +0000 (+0300) Subject: Set speed slider range from the advertised top speed of the train X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=1e7b81e843b584381ed779996b3e7a20f3ec19ce;p=r2c2.git Set speed slider range from the advertised top speed of the train --- diff --git a/source/engineer/traindialog.cpp b/source/engineer/traindialog.cpp index f202377..432f3dd 100644 --- a/source/engineer/traindialog.cpp +++ b/source/engineer/traindialog.cpp @@ -33,6 +33,9 @@ TrainDialog::TrainDialog(Engineer &e, R2C2::Train &t): btn_expand->signal_clicked.connect(sigc::mem_fun(this, &TrainDialog::expand_clicked)); lbl_speed = dynamic_cast(get_item(widgets, "lbl_speed")); sld_speed = dynamic_cast(get_item(widgets, "sld_speed")); + float max_speed = train.get_maximum_speed(); + if(max_speed>0) + sld_speed->set_range(0, max_speed*3.6/train.get_layout().get_catalogue().get_scale()); sld_speed->signal_value_changed.connect(sigc::mem_fun(this, &TrainDialog::ui_speed_changed)); tgl_forward = dynamic_cast(get_item(widgets, "tgl_forward")); tgl_forward->signal_toggled.connect(sigc::mem_fun(this, &TrainDialog::ui_forward_toggled));