From 874c8981de674fff9726aca3c55e37da0b252d78 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 19 Nov 2013 08:43:54 +0200 Subject: [PATCH] Add a missing function for the locomotive import UI --- source/engineer/newtraindialog.cpp | 7 +++++++ source/engineer/newtraindialog.h | 3 +++ 2 files changed, 10 insertions(+) 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); }; -- 2.45.2