From: Mikko Rasa Date: Tue, 19 Nov 2013 06:43:54 +0000 (+0200) Subject: Add a missing function for the locomotive import UI X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=874c8981de674fff9726aca3c55e37da0b252d78;p=r2c2.git Add a missing function for the locomotive import UI --- diff --git a/source/engineer/newtraindialog.cpp b/source/engineer/newtraindialog.cpp index 006a819..ef9fbf8 100644 --- a/source/engineer/newtraindialog.cpp +++ b/source/engineer/newtraindialog.cpp @@ -49,6 +49,13 @@ NewTrainDialog::NewTrainDialog(Engineer &e): loco_types.append(vt); } +void NewTrainDialog::prefill(const Driver::DetectedLocomotive &loco) +{ + drp_protocol->set_selected_index(protocols.find(loco.protocol)); + ent_address->set_text(lexical_cast(loco.address)); + ent_name->set_text(loco.name); +} + void NewTrainDialog::on_response(int code) { if(code) diff --git a/source/engineer/newtraindialog.h b/source/engineer/newtraindialog.h index 9cec84e..f6af7f3 100644 --- a/source/engineer/newtraindialog.h +++ b/source/engineer/newtraindialog.h @@ -6,6 +6,7 @@ #include #include #include "libr2c2/catalogue.h" +#include "libr2c2/driver.h" class Engineer; @@ -23,6 +24,8 @@ private: public: NewTrainDialog(Engineer &); + void prefill(const R2C2::Driver::DetectedLocomotive &); + private: virtual void on_response(int); };