Browse Source

change ui_ads_hmi.

yuchuli 1 year ago
parent
commit
f4b0195eef

+ 9 - 9
src/ui/ui_ads_hmi/ADCIntelligentVehicle.cpp

@@ -710,7 +710,7 @@ void ADCIntelligentVehicle::timeoutslot()
     }
     else
     {
-        ui->label_13->setText(QString("前方没有障碍物"));
+        ui->label_13->setText(QString(tr("前方没有障碍物")));
     }
 
     ui->label_26->setText("ttc is "+QString::number(ServiceCarStatus.mfttc,'f',1) + " brake is " + QString::number(ServiceCarStatus.mfBrake,'f',2));  //add 20200518
@@ -1438,7 +1438,7 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
 void ADCIntelligentVehicle::on_pb_auto_drive_mode_clicked() {
     is_auto_drive_mode_enable_ = !is_auto_drive_mode_enable_;
     //    ServiceCanUtil.startsend(is_auto_drive_mode_enable_);
-    ui->pb_auto_drive_mode->setText(is_auto_drive_mode_enable_ ? QStringLiteral("决策控制使能:开") : QStringLiteral("决策控制使能:关"));
+    ui->pb_auto_drive_mode->setText(is_auto_drive_mode_enable_ ? QString(tr("决策控制使能:开")) : QString(tr("决策控制使能:关")));
 }
 
 /**
@@ -1447,7 +1447,7 @@ void ADCIntelligentVehicle::on_pb_auto_drive_mode_clicked() {
 void ADCIntelligentVehicle::on_pb_auto_braking_mode_clicked() {
     is_auto_braking_mode_enable_ = !is_auto_braking_mode_enable_;
     //    ServiceControlStatus.set_turnsignals_control(is_auto_braking_mode_enable_,0);
-    ui->pb_auto_braking_mode->setText(is_auto_braking_mode_enable_ ? QStringLiteral("左转向灯:开") : QStringLiteral("左转向灯:关"));
+    ui->pb_auto_braking_mode->setText(is_auto_braking_mode_enable_ ? QString(tr("左转向灯:开")) : QString(tr("左转向灯:关")));
 }
 
 /**
@@ -1457,7 +1457,7 @@ void ADCIntelligentVehicle::on_pb_auto_braking_mode_clicked() {
 void ADCIntelligentVehicle::on_pb_auto_accelerate_mode_clicked() {
     is_auto_accelerate_mode_enable_ = !is_auto_accelerate_mode_enable_;
     //    ServiceControlStatus.set_turnsignals_control(0,is_auto_accelerate_mode_enable_);
-    ui->pb_auto_accelerate_mode->setText(is_auto_accelerate_mode_enable_ ? QStringLiteral("右转向灯:开") : QStringLiteral("右转向灯:关"));
+    ui->pb_auto_accelerate_mode->setText(is_auto_accelerate_mode_enable_ ? QString(tr("右转向灯:开")) : QString(tr("右转向灯:关")));
 }
 
 /**
@@ -1466,7 +1466,7 @@ void ADCIntelligentVehicle::on_pb_auto_accelerate_mode_clicked() {
 void ADCIntelligentVehicle::on_pb_auto_wheel_mode_clicked() {
     is_auto_wheel_mode_enable_ = !is_auto_wheel_mode_enable_;
     //    ServiceControlStatus.set_speaker(is_auto_wheel_mode_enable_);
-    ui->pb_auto_wheel_mode->setText(is_auto_wheel_mode_enable_ ? QStringLiteral("喇叭") : QStringLiteral("喇叭"));
+    ui->pb_auto_wheel_mode->setText(is_auto_wheel_mode_enable_ ? QString(tr("喇叭")) : QString(tr("喇叭")));
 }
 
 /**
@@ -1475,7 +1475,7 @@ void ADCIntelligentVehicle::on_pb_auto_wheel_mode_clicked() {
 void ADCIntelligentVehicle::on_pushButton_clicked(){
     is_3 = !is_3;
     //    ServiceControlStatus.set_light(is_3);
-    ui->pushButton->setText(is_3 ? QStringLiteral("近光灯:开") : QStringLiteral("近光灯:关"));
+    ui->pushButton->setText(is_3 ? QString(tr("近光灯:开")) : QString(tr("近光灯:关")));
 }
 
 /**
@@ -1487,7 +1487,7 @@ void ADCIntelligentVehicle::on_pb_speed_control_mode_clicked() {
     //        ServiceControlStatus.set_engine(0x03);
     //    else
     //        ServiceControlStatus.set_engine(0x02);
-    ui->pb_speed_control_mode->setText(is_speed_control_mode_enable_ ? QStringLiteral("点火:开") : QStringLiteral("点火:关"));
+    ui->pb_speed_control_mode->setText(is_speed_control_mode_enable_ ? QString(tr("点火:开")) : QString(tr("点火:关")));
 }
 
 /**
@@ -2275,11 +2275,11 @@ void ADCIntelligentVehicle::on_pb_v2xEn_clicked()
 {
     qDebug()<<mv2xStEn;
     if(mv2xStEn){
-        ui->pb_v2xEn->setText("云平台控制:关");
+        ui->pb_v2xEn->setText(tr("云平台控制:关"));
         mv2xStEn = 0;
     }
     else{
-        ui->pb_v2xEn->setText("云平台控制:开");
+        ui->pb_v2xEn->setText(tr("云平台控制:开"));
         mv2xStEn = 1;
     }
     gIvlog->info("hmi","v2x enable:%d", mv2xStEn);

+ 4 - 4
src/ui/ui_ads_hmi/ADCIntelligentVehicle.ui

@@ -98,7 +98,7 @@
      </rect>
     </property>
     <property name="currentIndex">
-     <number>1</number>
+     <number>2</number>
     </property>
     <widget class="QWidget" name="page_0">
      <widget class="QGroupBox" name="groupBox_2">
@@ -1966,7 +1966,7 @@ background-color: rgb(85, 87, 83);</string>
 &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
 p, li { white-space: pre-wrap; }
 &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
        </property>
       </widget>
       <widget class="QLabel" name="label_12">
@@ -2087,7 +2087,7 @@ gridline-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(
 &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
 p, li { white-space: pre-wrap; }
 &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
        </property>
       </widget>
       <widget class="QTextEdit" name="textEdit_aobzdis_tj">
@@ -2142,7 +2142,7 @@ p, li { white-space: pre-wrap; }
 &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
 p, li { white-space: pre-wrap; }
 &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
        </property>
       </widget>
       <widget class="QTextEdit" name="textEdit_aocftime_tj">

+ 8 - 1
src/ui/ui_ads_hmi/ui_ads_hmi.pro

@@ -80,11 +80,14 @@ unix:!macx: DEPENDPATH += $$PWD/.
     error( "Couldn't find the ivboost.pri file!" )
 }
 
-
 if(contains(DEFINES,SYSTEM_AGX)){
 
 LIBS += -lQt5WebEngine -lQt5WebEngineWidgets
 }
+else
+{
+QT       +=  webenginewidgets
+}
 
 #win32: LIBS += D:/boost/stage/lib/libboost_thread-vc140-mt-gd-x64-1_68.lib D:/boost/stage/lib/libboost_system-vc140-mt-gd-x64-1_68.lib \
 #D:/boost/stage/lib/libboost_date_time-vc140-mt-gd-x64-1_68.lib D:/boost/stage/lib/libboost_chrono-vc140-mt-gd-x64-1_68.lib  \
@@ -108,3 +111,7 @@ DISTFILES += \
 #    -lrobosense_detection -lrobosense_module_manager -lrobosense_preprocessing -lrobosense_tracking
 
 LIBS += -livprotoif
+
+
+TRANSLATIONS = language_zh_CN.ts  \
+                language_zh_EN.ts