]> git.tdb.fi Git - r2c2.git/commitdiff
Add a missing function for the locomotive import UI
authorMikko Rasa <tdb@tdb.fi>
Tue, 19 Nov 2013 06:43:54 +0000 (08:43 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 19 Nov 2013 06:43:54 +0000 (08:43 +0200)
source/engineer/newtraindialog.cpp
source/engineer/newtraindialog.h

index 006a819b50d5a631ee86ef945858e4e709c92e5a..ef9fbf82b6dfe79a58924f65f5e34b610b31acd2 100644 (file)
@@ -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<string>(loco.address));
+       ent_name->set_text(loco.name);
+}
+
 void NewTrainDialog::on_response(int code)
 {
        if(code)
index 9cec84e4bb6b1c259fcfa1b87f6b45eae50a0ff2..f6af7f3b86dde67a9323530fdda997a55a473493 100644 (file)
@@ -6,6 +6,7 @@
 #include <msp/gltk/entry.h>
 #include <msp/gltk/listdata.h>
 #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);
 };