From 7edd65fa0db5732e244dfd0e6b16c4275b19c74c Mon Sep 17 00:00:00 2001 From: Anne de Jong Date: Thu, 5 Jan 2017 16:37:15 +0100 Subject: [PATCH] Coupled backlog --- src/gui/mainwindow.cpp | 6 +++++- src/gui/mainwindow.h | 3 +++ src/gui/mainwindow.ui | 2 +- src/protobuf/model.proto | 6 +++--- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index ed532fb..3bb86f9 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -165,7 +165,7 @@ void TaSMETMainWindow::saveModel(string* filepath) { filepath = &_filepath; } try { - saveMessage(*filepath,_model); + saveMessage(*filepath,_model); _filepath = *filepath; changed(); } @@ -252,6 +252,8 @@ void TaSMETMainWindow::changed() { _window->removesegment->setEnabled(is_segment); _window->segmenttype->setEnabled(!is_segment); + QString backlog = _window->backlog->toPlainText(); + *_model.mutable_backlog() = backlog.toStdString(); } void TaSMETMainWindow::set(const pb::Model& model) { @@ -266,6 +268,8 @@ void TaSMETMainWindow::set(const pb::Model& model) { _window->systemtype->setCurrentIndex((int) sys.systemtype()); _window->gastype->setCurrentIndex((int) sys.gastype()); + _window->backlog->setPlainText(QString::fromStdString(model.backlog())); + _model = model; _system = *_model.mutable_system(); _init = false; diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 85075ef..07565ec 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -72,6 +72,9 @@ private slots: void on_T0_textEdited() {changed();} void on_p0_textEdited() {changed();} void on_systemtype_currentIndexChanged(int) {changed();} + + void on_backlog_textChanged() {changed();} + }; diff --git a/src/gui/mainwindow.ui b/src/gui/mainwindow.ui index d9dd039..d5ef1b1 100644 --- a/src/gui/mainwindow.ui +++ b/src/gui/mainwindow.ui @@ -272,7 +272,7 @@ - + 0 diff --git a/src/protobuf/model.proto b/src/protobuf/model.proto index bb07c63..0766be7 100644 --- a/src/protobuf/model.proto +++ b/src/protobuf/model.proto @@ -6,10 +6,10 @@ import "solver.proto"; message Model { - required System system = 1; - required SolverParams sparams = 2; + optional System system = 1; + optional SolverParams sparams = 2; - optional string backlog = 3 [default="Type your info here"]; + optional string backlog = 3 [default="Type your info here..."]; repeated double solution = 4;