Skip to content

Commit 0a6c84b

Browse files
committed
Save grid parameters when switching KIT
1 parent af305bf commit 0a6c84b

File tree

9 files changed

+56
-47
lines changed

9 files changed

+56
-47
lines changed

plugins/robots/common/twoDModel/include/twoDModel/engine/model/model.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ class TWO_D_MODEL_EXPORT Model : public QObject
115115
/// @param robotModel Pointer to robot model which was added
116116
void robotRemoved(twoDModel::model::RobotModel *robotModel);
117117

118+
void modelInited();
119+
118120
private Q_SLOTS:
119121
void resetPhysics();
120122
void recalculatePhysicsParams();

plugins/robots/common/twoDModel/src/engine/items/wallItem.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ WallItem::WallItem(graphicsUtils::AbstractCoordinateSystem *metricSystem,
5151

5252
WallItem *WallItem::clone() const
5353
{
54-
WallItem * const cloned = new WallItem(coordinateSystem(), {x1(), y1()}, {x2(), y2()});
54+
auto * const cloned = new WallItem(coordinateSystem(), {x1(), y1()}, {x2(), y2()});
5555
AbstractItem::copyTo(cloned);
5656
connect(this, &AbstractItem::positionChanged, cloned, &WallItem::recalculateBorders);
5757
connect(this, &AbstractItem::x1Changed, cloned, &WallItem::recalculateBorders);
@@ -65,7 +65,7 @@ WallItem *WallItem::clone() const
6565

6666
QAction *WallItem::wallTool()
6767
{
68-
QAction * const result = new QAction(QIcon(":/icons/2d_wall.png"), tr("Wall (W)"), nullptr);
68+
auto * const result = new QAction(QIcon(":/icons/2d_wall.png"), tr("Wall (W)"), nullptr);
6969
result->setShortcuts({QKeySequence(Qt::Key_W), QKeySequence(Qt::Key_2)});
7070
result->setCheckable(true);
7171
return result;
@@ -175,8 +175,8 @@ void WallItem::deserialize(const QDomElement &element)
175175
setY2(end.y());
176176

177177
readPenBrush(element);
178-
if (pen().widthF()) {
179-
mWallWidth = pen().widthF();
178+
if (pen().width()) {
179+
mWallWidth = pen().width();
180180
}
181181

182182
SolidItem::deserialize(element);

plugins/robots/common/twoDModel/src/engine/items/wallItem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class WallItem : public graphicsUtils::AbstractItem, public SolidItem
7979
const QImage mImage;
8080

8181
QPainterPath mPath;
82-
qreal mWallWidth {10};
82+
int mWallWidth {10};
8383
QPointF mEstimatedPos;
8484
};
8585

plugins/robots/common/twoDModel/src/engine/model/model.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ void Model::init(qReal::ErrorReporterInterface &errorReporter
9494
, this, [&errorReporter](const QString &message) {
9595
errorReporter.addCritical(tr("Error in checker: %1").arg(message));
9696
});
97+
Q_EMIT modelInited();
9798
}
9899

99100
WorldModel &Model::worldModel()

plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ TwoDModelWidget::TwoDModelWidget(Model &model, QWidget *parent)
104104
connect(&*mScene, &TwoDModelScene::robotPressed, mUi->palette, &Palette::unselect);
105105
connect(&*mScene, &TwoDModelScene::robotListChanged, this, &TwoDModelWidget::onRobotListChange);
106106

107+
connect(&mModel, &model::Model::modelInited
108+
, this, [this]() {
109+
connect(mUi->gridParametersBox, &twoDModel::view::GridParameters::parametersChanged,
110+
this, &TwoDModelWidget::saveWorldModelToRepo);
111+
});
112+
107113
connect(&mModel.worldModel(), &WorldModel::itemRemoved
108114
, this, [this]() { saveWorldModelToRepo(); });
109115

qrtranslations/es/plugins/robots/common/twoDModel_es.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -492,17 +492,17 @@
492492
<translation>Error en el verificador: %1</translation>
493493
</message>
494494
<message>
495-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/model/model.cpp" line="170"/>
495+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/model/model.cpp" line="171"/>
496496
<source>The &quot;version&quot; field of the &quot;root&quot; tag must not be empty.</source>
497497
<translation>El campo &quot;version&quot; de la etiqueta &quot;root&quot; no debe estar vacío.</translation>
498498
</message>
499499
<message>
500-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/model/model.cpp" line="176"/>
500+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/model/model.cpp" line="177"/>
501501
<source>The world model has version %1. The current version is %2. Please check that the world model behaves as expected.</source>
502502
<translation>El modelo del mundo tiene versión %1. La versión actual es %2. Por favor, verifique que el modelo del mundo se comporte como se espera.</translation>
503503
</message>
504504
<message>
505-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/model/model.cpp" line="210"/>
505+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/model/model.cpp" line="211"/>
506506
<source>This robot model already exists</source>
507507
<translation>Este modelo de robot ya existe</translation>
508508
</message>
@@ -877,70 +877,70 @@
877877
<translation type="vanished">cm</translation>
878878
</message>
879879
<message>
880-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="187"/>
880+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="193"/>
881881
<source>kg</source>
882882
<translation>kg</translation>
883883
</message>
884884
<message>
885-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="380"/>
885+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="386"/>
886886
<source>Warning</source>
887887
<translation>Advertencia</translation>
888888
</message>
889889
<message>
890-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="381"/>
890+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="387"/>
891891
<source>Do you really want to clear scene?</source>
892892
<translation>¿Realmente desea limpiar la escena?</translation>
893893
</message>
894894
<message>
895-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="490"/>
895+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="496"/>
896896
<source>Training mode: solution will not be checked</source>
897897
<translation>Modo entrenamiento: la solución no será verificada</translation>
898898
</message>
899899
<message>
900-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="491"/>
900+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="497"/>
901901
<source>Checking mode: solution will be checked, errors will be reported</source>
902902
<translation>Modo verificación: la solución será comprobada, se informará de errores</translation>
903903
</message>
904904
<message>
905-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="553"/>
905+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="559"/>
906906
<source>Saving world and robot model</source>
907907
<translation>Guardando modelo del mundo y del robot</translation>
908908
</message>
909909
<message>
910-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="553"/>
911-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="573"/>
912-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="587"/>
910+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="559"/>
911+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="579"/>
912+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="593"/>
913913
<source>2D model saves (*.xml)</source>
914914
<translation>Guardados del modelo 2D (*.xml)</translation>
915915
</message>
916916
<message>
917-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="573"/>
917+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="579"/>
918918
<source>Loading world and robot model</source>
919919
<translation>Cargando modelo del mundo y del robot</translation>
920920
</message>
921921
<message>
922-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="587"/>
922+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="593"/>
923923
<source>Loading world without robot model</source>
924924
<translation>Cargando modelo del mundo sin modelo de robot</translation>
925925
</message>
926926
<message>
927-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="905"/>
927+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="911"/>
928928
<source>Hide details</source>
929929
<translation>Ocultar detalles</translation>
930930
</message>
931931
<message>
932-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="905"/>
932+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="911"/>
933933
<source>Show details</source>
934934
<translation>Mostrar detalles</translation>
935935
</message>
936936
<message>
937-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="1114"/>
938-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="1115"/>
937+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="1120"/>
938+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="1121"/>
939939
<source>No wheel</source>
940940
<translation>Ausente</translation>
941941
</message>
942942
<message>
943-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="1121"/>
943+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="1127"/>
944944
<source>%1 (port %2)</source>
945945
<translation>%1 (puerto %2)</translation>
946946
</message>

qrtranslations/fr/plugins/robots/common/twoDModel_fr.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@
500500
<translation>Erreur dans le vérificateur : %1</translation>
501501
</message>
502502
<message>
503-
<location line="+75"/>
503+
<location line="+76"/>
504504
<source>The &quot;version&quot; field of the &quot;root&quot; tag must not be empty.</source>
505505
<translation>Le champ &quot;version&quot; de la balise &quot;root&quot; ne doit pas être vide.</translation>
506506
</message>
@@ -881,7 +881,7 @@
881881
<context>
882882
<name>twoDModel::view::TwoDModelWidget</name>
883883
<message>
884-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="+380"/>
884+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="+386"/>
885885
<source>Warning</source>
886886
<translation>Attention</translation>
887887
</message>

qrtranslations/ru/plugins/robots/common/twoDModel_ru.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@
776776
<translation>Ошибка в проверяющей программе: %1</translation>
777777
</message>
778778
<message>
779-
<location line="+75"/>
779+
<location line="+76"/>
780780
<source>The &quot;version&quot; field of the &quot;root&quot; tag must not be empty.</source>
781781
<translation>Поле &quot;version&quot; тега &quot;root&quot; не должно быть пустым.</translation>
782782
</message>
@@ -1224,7 +1224,7 @@
12241224
<context>
12251225
<name>twoDModel::view::TwoDModelWidget</name>
12261226
<message>
1227-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="+380"/>
1227+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="+386"/>
12281228
<source>Warning</source>
12291229
<translation>Предупреждение</translation>
12301230
</message>

qrtranslations/vi/plugins/robots/common/twoDModel_vi.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -492,17 +492,17 @@
492492
<translation>Lỗi trong chương trình kiểm tra: %1</translation>
493493
</message>
494494
<message>
495-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/model/model.cpp" line="170"/>
495+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/model/model.cpp" line="171"/>
496496
<source>The &quot;version&quot; field of the &quot;root&quot; tag must not be empty.</source>
497497
<translation>Trường &quot;version&quot; của thẻ &quot;root&quot; không được để trống.</translation>
498498
</message>
499499
<message>
500-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/model/model.cpp" line="176"/>
500+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/model/model.cpp" line="177"/>
501501
<source>The world model has version %1. The current version is %2. Please check that the world model behaves as expected.</source>
502502
<translation>Mô hình thế giới có phiên bản %1. Phiên bản hiện tại là %2. Vui lòng kiểm tra xem mô hình thế giới có hoạt động như mong đợi hay không.</translation>
503503
</message>
504504
<message>
505-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/model/model.cpp" line="210"/>
505+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/model/model.cpp" line="211"/>
506506
<source>This robot model already exists</source>
507507
<translation>Mô hình robot này đã tồn tại</translation>
508508
</message>
@@ -877,70 +877,70 @@
877877
<translation type="vanished">cm</translation>
878878
</message>
879879
<message>
880-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="187"/>
880+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="193"/>
881881
<source>kg</source>
882882
<translation>kg</translation>
883883
</message>
884884
<message>
885-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="380"/>
885+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="386"/>
886886
<source>Warning</source>
887887
<translation>Cảnh báo</translation>
888888
</message>
889889
<message>
890-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="381"/>
890+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="387"/>
891891
<source>Do you really want to clear scene?</source>
892892
<translation>Bạn có thực sự muốn xóa toàn bộ cảnh?</translation>
893893
</message>
894894
<message>
895-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="490"/>
895+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="496"/>
896896
<source>Training mode: solution will not be checked</source>
897897
<translation>Chế độ luyện tập: lời giải sẽ không được kiểm tra</translation>
898898
</message>
899899
<message>
900-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="491"/>
900+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="497"/>
901901
<source>Checking mode: solution will be checked, errors will be reported</source>
902902
<translation>Chế độ kiểm tra: lời giải sẽ được kiểm tra, các lỗi sẽ được báo cáo</translation>
903903
</message>
904904
<message>
905-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="553"/>
905+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="559"/>
906906
<source>Saving world and robot model</source>
907907
<translation>Đang lưu mô hình thế giới và robot</translation>
908908
</message>
909909
<message>
910-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="553"/>
911-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="573"/>
912-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="587"/>
910+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="559"/>
911+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="579"/>
912+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="593"/>
913913
<source>2D model saves (*.xml)</source>
914914
<translation>Tệp lưu mô hình 2D (*.xml)</translation>
915915
</message>
916916
<message>
917-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="573"/>
917+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="579"/>
918918
<source>Loading world and robot model</source>
919919
<translation>Đang tải mô hình thế giới và robot</translation>
920920
</message>
921921
<message>
922-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="587"/>
922+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="593"/>
923923
<source>Loading world without robot model</source>
924924
<translation>Đang tải mô hình thế giới mà không có mô hình robot</translation>
925925
</message>
926926
<message>
927-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="905"/>
927+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="911"/>
928928
<source>Hide details</source>
929929
<translation>Ẩn chi tiết</translation>
930930
</message>
931931
<message>
932-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="905"/>
932+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="911"/>
933933
<source>Show details</source>
934934
<translation>Hiển thị chi tiết</translation>
935935
</message>
936936
<message>
937-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="1114"/>
938-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="1115"/>
937+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="1120"/>
938+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="1121"/>
939939
<source>No wheel</source>
940940
<translation>Không có bánh xe</translation>
941941
</message>
942942
<message>
943-
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="1121"/>
943+
<location filename="../../../../../plugins/robots/common/twoDModel/src/engine/view/twoDModelWidget.cpp" line="1127"/>
944944
<source>%1 (port %2)</source>
945945
<translation>%1 (cổng %2)</translation>
946946
</message>

0 commit comments

Comments
 (0)