|
@@ -233,6 +233,12 @@ void MainWindow::CreateView()
|
|
|
mpBrake->setminvalue(0);
|
|
|
mpBrake->setmaxvalue(100);
|
|
|
|
|
|
+ mpVehSpeed = new Speed(ui->centralwidget);
|
|
|
+ mpVehSpeed->settitle(QStringLiteral("车速(km/h)"));
|
|
|
+ mpVehSpeed->updatevalue(0);
|
|
|
+ mpVehSpeed->setminvalue(0);
|
|
|
+ mpVehSpeed->setmaxvalue(30);
|
|
|
+
|
|
|
mmyview = new MyView(ui->centralwidget);
|
|
|
mmyview->setObjectName(QStringLiteral("graphicsView"));
|
|
|
mmyview->setGeometry(QRect(30, 30, 600, 600));
|
|
@@ -287,6 +293,7 @@ void MainWindow::keyReleaseEvent(QKeyEvent *event)
|
|
|
{
|
|
|
showNormal();
|
|
|
ui->menubar->setVisible(true);
|
|
|
+ ui->statusbar->setVisible(true);
|
|
|
}
|
|
|
if(!event->isAutoRepeat())mPressKeys.remove(event->key());
|
|
|
qDebug("key count is %d",mPressKeys.count());
|
|
@@ -320,6 +327,8 @@ void MainWindow::resizeEvent(QResizeEvent *event)
|
|
|
if(nMode == 0)
|
|
|
{
|
|
|
|
|
|
+ mpVehSpeed->setVisible(false);
|
|
|
+
|
|
|
mmyview->setGeometry(10+sizemain.width()/2+10,10,sizemain.width()/2-30,sizemain.height()*3/5);
|
|
|
|
|
|
int nfrontpos_x = sizemain.width()/6;
|
|
@@ -448,17 +457,28 @@ void MainWindow::resizeEvent(QResizeEvent *event)
|
|
|
|
|
|
if(nMode == 1)
|
|
|
{
|
|
|
+ mpVehSpeed->setVisible(true);
|
|
|
|
|
|
- int nfrontpos_x = sizemain.width()*2/5;
|
|
|
+ double fViewWidth = sizemain.width();
|
|
|
+ int nfrontpos_x = static_cast<int>(fViewWidth/2.0 - fViewWidth * mfWide_View_CenterRatio * 0.5) ;
|
|
|
int nfrontpos_y = 0;
|
|
|
- int nfrontsize_x = sizemain.width()*1/5;
|
|
|
+ int nfrontsize_x = static_cast<int>(fViewWidth * mfWide_View_CenterRatio ) ;
|
|
|
int nfrontsize_y = sizemain.height();
|
|
|
- mmyview->setGeometry(nfrontpos_x,nfrontpos_y,nfrontsize_x,nfrontsize_y);
|
|
|
|
|
|
- int nleftpos_x = 0;
|
|
|
+ int nleftpos_x = static_cast<int>(static_cast<double>(nfrontpos_x) - static_cast<double>(nfrontsize_x) * mfWide_View_LRRatio);
|
|
|
int nleftpos_y = 0;
|
|
|
- int nleftsize_x = sizemain.width()*1/5;
|
|
|
- int nleftsize_y = sizemain.height();
|
|
|
+ int nleftsize_x = static_cast<int>( static_cast<double>(nfrontsize_x) * mfWide_View_LRRatio);
|
|
|
+ int nleftsize_y = static_cast<int>( static_cast<double>(nfrontsize_y) * mfWide_View_LRRatio);
|
|
|
+
|
|
|
+ int nrightpos_x = static_cast<int>(static_cast<double>(nfrontpos_x) + static_cast<double>(nfrontsize_x) );
|
|
|
+ int nrightpos_y = 0;
|
|
|
+ int nrightsize_x = static_cast<int>( static_cast<double>(nfrontsize_x) * mfWide_View_LRRatio);
|
|
|
+ int nrightsize_y = static_cast<int>( static_cast<double>(nfrontsize_y) * mfWide_View_LRRatio);
|
|
|
+
|
|
|
+
|
|
|
+ mmyview->setGeometry(nfrontpos_x,nfrontpos_y,nfrontsize_x,nfrontsize_y);
|
|
|
+
|
|
|
+
|
|
|
mmyviewLeft->setGeometry(nleftpos_x,nleftpos_y,nleftsize_x,nleftsize_y);
|
|
|
|
|
|
// int nrearpos_x = sizemain.width()/3;
|
|
@@ -469,10 +489,7 @@ void MainWindow::resizeEvent(QResizeEvent *event)
|
|
|
|
|
|
mmyviewRear->setVisible(false);
|
|
|
|
|
|
- int nrightpos_x = sizemain.width() * 4/5;
|
|
|
- int nrightpos_y = 0;
|
|
|
- int nrightsize_x = sizemain.width()*1/5;
|
|
|
- int nrightsize_y = sizemain.height();
|
|
|
+
|
|
|
mmyviewRight->setGeometry(nrightpos_x,nrightpos_y,nrightsize_x,nrightsize_y);
|
|
|
|
|
|
// mppicshow->SetGeometry(10+sizemain.width()/2+10,10,sizemain.width()/2-30,sizemain.height()*3/5);
|
|
@@ -485,37 +502,44 @@ void MainWindow::resizeEvent(QResizeEvent *event)
|
|
|
|
|
|
// mpWheel->setGeometry(sizemain.width()/2 + 20,10,200,200);
|
|
|
|
|
|
- int grouppos_x = sizemain.width()*1/5;
|
|
|
- int grouppos_y = 260;
|
|
|
- int grouppos_width = sizemain.width()*1/5;
|
|
|
- int grouppos_height = sizemain.height() -260;
|
|
|
+ int grouppos_x = static_cast<int>(fViewWidth*0.2) ;
|
|
|
+ int grouppos_y = nleftsize_y;
|
|
|
+ int grouppos_width = nfrontpos_x - grouppos_x;
|
|
|
+ int grouppos_height = sizemain.height() - grouppos_y;
|
|
|
|
|
|
|
|
|
// int speed_width = grouppos_height-40;
|
|
|
// if((speed_width*3 + 150)>grouppos_width)speed_width = (grouppos_width - 150)/3;
|
|
|
|
|
|
int speed_width = grouppos_height - 130;
|
|
|
- if(speed_width*3 > (sizemain.width()*1/5))speed_width = (sizemain.width()*1/5)/3;
|
|
|
+ if(speed_width*3 > (grouppos_width))speed_width = (grouppos_width)/3;
|
|
|
mpWheel->setGeometry(0,130 ,speed_width,speed_width);
|
|
|
mpBrake->setGeometry(grouppos_width*1/3,130,speed_width,speed_width);
|
|
|
mpAcc->setGeometry(grouppos_width*2/3 ,130,speed_width,speed_width);
|
|
|
ui->groupBox_rem->setGeometry(grouppos_x,grouppos_y,grouppos_width,grouppos_height);
|
|
|
|
|
|
|
|
|
+ int vehspeed_x = nfrontpos_x + nfrontsize_x + 10;
|
|
|
+ int vehspeed_y = nrightsize_y + 10;
|
|
|
+ int vehspeed_width = 200;
|
|
|
+ int vehspeed_height = nfrontsize_y - nrightsize_y-10;
|
|
|
+ if(vehspeed_height>vehspeed_width)vehspeed_height = vehspeed_width;
|
|
|
+ else vehspeed_width = vehspeed_height;
|
|
|
+ mpVehSpeed->setGeometry(vehspeed_x,vehspeed_y,vehspeed_width,vehspeed_height);
|
|
|
|
|
|
- int groupmap_x = sizemain.width()*1/5;
|
|
|
+ int groupmap_x = static_cast<int>(static_cast<double>(nfrontpos_x) + static_cast<double>(nfrontsize_x) + static_cast<double>(nrightsize_x)) ;
|
|
|
int groupmap_y = 0;//sizemain.height();
|
|
|
- int groupmap_width = sizemain.width()/5;
|
|
|
- int groupmap_height = 80;// sizemain.height();
|
|
|
+ int groupmap_width = static_cast<int>(fViewWidth - static_cast<double>(nfrontpos_x) - static_cast<double>(nfrontsize_x) - static_cast<double>(nrightsize_x));
|
|
|
+ int groupmap_height = sizemain.height();// sizemain.height();
|
|
|
|
|
|
ui->comboBox_Station->setGeometry(10,30,groupmap_width*3/5,30);
|
|
|
ui->pushButton_Go->setGeometry(20 + groupmap_width*3/5,30,groupmap_width*2/5 - 30,30);
|
|
|
|
|
|
ui->groupBox_map->setGeometry(groupmap_x,groupmap_y,groupmap_width,groupmap_height);
|
|
|
|
|
|
- int groupgps_x = sizemain.width()*1/5;
|
|
|
- int groupgps_y = 80;//sizemain.height()/2;
|
|
|
- int groupgps_width = sizemain.width()/5;
|
|
|
+ int groupgps_x = 0;
|
|
|
+ int groupgps_y = 0;//sizemain.height()/2;
|
|
|
+ int groupgps_width = static_cast<int>(fViewWidth*0.2) ;
|
|
|
int groupgps_height = 160;//sizemain.height()/2;
|
|
|
|
|
|
|
|
@@ -577,6 +601,8 @@ void MainWindow::resizeEvent(QResizeEvent *event)
|
|
|
|
|
|
}
|
|
|
|
|
|
+ mbNeedSetBack = true;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -603,6 +629,7 @@ void MainWindow::on_radioButton_manual_clicked()
|
|
|
mManualTime.restart();
|
|
|
mnLastTime = mManualTime.elapsed();
|
|
|
mpTimerManual->start(10);
|
|
|
+ mbNeedSetBack = true;
|
|
|
}
|
|
|
|
|
|
void MainWindow::onTimerManual()
|
|
@@ -817,6 +844,8 @@ void MainWindow::on_radioButton_auto_clicked()
|
|
|
mPressKeys.clear();
|
|
|
mpTimerManual->stop();
|
|
|
|
|
|
+ mbNeedSetBack = true;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
void MainWindow::onTimerRemote()
|
|
@@ -952,6 +981,8 @@ void MainWindow::onTimerUpdateView()
|
|
|
|
|
|
mstrGPSTime = QDateTime::fromMSecsSinceEpoch(xgpsimu.msgtime()).toString("GPS: yyyy-MM-dd hh:mm:ss ");
|
|
|
setWindowTitle(mstrProgName + mstrVIN + mstrGPSTime + mstrPicTime);
|
|
|
+
|
|
|
+ mpVehSpeed->updatevalue(xgpsimu.speed()*3.6);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -973,9 +1004,28 @@ void MainWindow::onCamUpdate(int ncampos, QImage image)
|
|
|
|
|
|
void MainWindow::paintEvent(QPaintEvent *)
|
|
|
{
|
|
|
- int i;
|
|
|
+
|
|
|
QTime xTime;
|
|
|
- xTime;
|
|
|
+
|
|
|
+ static int mnDraw = 10;
|
|
|
+ if(mbNeedSetBack == true)
|
|
|
+ {
|
|
|
+ mnDraw = 10;
|
|
|
+ mbNeedSetBack = false;
|
|
|
+ }
|
|
|
+ if(mnDraw>0)
|
|
|
+ {
|
|
|
+ mpainter_background = new QPainter(this);
|
|
|
+ mpainter_background->drawPixmap(0, 0, this->width(), this->height(), QPixmap(":/pic/background2.jpg"));
|
|
|
+ delete mpainter_background;
|
|
|
+ mnDraw--;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ int i;
|
|
|
+
|
|
|
xTime.start();
|
|
|
int nupdate = 0;
|
|
|
for(i=0;i<NUM_CAM;i++)
|
|
@@ -1046,6 +1096,7 @@ void MainWindow::on_comboBox_Station_currentIndexChanged(int index)
|
|
|
char strscript[256];
|
|
|
snprintf(strscript,255,"objLocation(%11.7f,%11.7f);",xpos.mflon,xpos.mflat);
|
|
|
// mMapview->page()->runJavaScript(strscript);
|
|
|
+ mbNeedSetBack = true;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1065,12 +1116,13 @@ void MainWindow::on_checkBox_Null_clicked()
|
|
|
|
|
|
void MainWindow::on_checkBox_Rear_clicked()
|
|
|
{
|
|
|
-
|
|
|
+ mbNeedSetBack = true;
|
|
|
}
|
|
|
|
|
|
void MainWindow::on_radioButton_Drive_clicked()
|
|
|
{
|
|
|
mnShift = 1;
|
|
|
+ mbNeedSetBack = true;
|
|
|
|
|
|
// on_radioButton_picfront_clicked();
|
|
|
}
|
|
@@ -1078,6 +1130,7 @@ void MainWindow::on_radioButton_Drive_clicked()
|
|
|
void MainWindow::on_radioButton_Null_clicked()
|
|
|
{
|
|
|
mnShift = 0;
|
|
|
+ mbNeedSetBack = true;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1245,6 +1298,8 @@ void MainWindow::on_actionFullScreem_triggered()
|
|
|
{
|
|
|
showFullScreen();
|
|
|
ui->menubar->setVisible(false);
|
|
|
+ ui->statusbar->setVisible(false);
|
|
|
+ mbNeedSetBack = true;
|
|
|
}
|
|
|
|
|
|
void MainWindow::on_actionNormal_triggered()
|
|
@@ -1256,10 +1311,12 @@ void MainWindow::on_horizontalSlider_wheelspeed_sliderMoved(int position)
|
|
|
{
|
|
|
(void)position;
|
|
|
mfWheelSpeed = mfWheelBaseSpeed * ui->horizontalSlider_wheelspeed->value();
|
|
|
+ mbNeedSetBack = true;
|
|
|
}
|
|
|
|
|
|
void MainWindow::on_horizontalSlider_wheelspeed_valueChanged(int value)
|
|
|
{
|
|
|
(void)value;
|
|
|
mfWheelSpeed = mfWheelBaseSpeed * ui->horizontalSlider_wheelspeed->value();
|
|
|
+ mbNeedSetBack = true;
|
|
|
}
|