diff --git a/src/blackgui/components/coordinatedialog.cpp b/src/blackgui/components/coordinatedialog.cpp index 1abd9ca46..d8291dcd4 100644 --- a/src/blackgui/components/coordinatedialog.cpp +++ b/src/blackgui/components/coordinatedialog.cpp @@ -27,7 +27,7 @@ namespace BlackGui ui->editor_Coordinate->showSetButton(false); this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); this->noDefaultButtons(); - connect(ui->editor_Coordinate, &CCoordinateForm::changedCoordinate, this, &CCoordinateDialog::changedCoordinate); + connect(this, &QDialog::accepted, this, &CCoordinateDialog::changedCoordinate); } CCoordinateDialog::~CCoordinateDialog() diff --git a/src/blackgui/components/coordinatedialog.ui b/src/blackgui/components/coordinatedialog.ui index 253f89974..1678a0bfc 100644 --- a/src/blackgui/components/coordinatedialog.ui +++ b/src/blackgui/components/coordinatedialog.ui @@ -6,26 +6,41 @@ 0 0 - 500 - 150 + 599 + 158 - - - 500 - 150 - - Coordinates + + 1 + + + 4 + + + 4 + + + 4 + + + 4 + + + + 0 + 0 + + 0 - 75 + 0 diff --git a/src/blackgui/components/weathercomponent.cpp b/src/blackgui/components/weathercomponent.cpp index f9cfc7afb..bb9f91cfc 100644 --- a/src/blackgui/components/weathercomponent.cpp +++ b/src/blackgui/components/weathercomponent.cpp @@ -46,7 +46,7 @@ namespace BlackGui ui->setupUi(this); m_coordinateDialog->showElevation(false); m_coordinateDialog->setReadOnly(ui->cb_UseOwnAcftPosition->isChecked()); - connect(ui->pb_Coordinate, &QPushButton::clicked, this, &CWeatherComponent::showCoordinateDialog); + connect(ui->pb_SetPosition, &QPushButton::clicked, this, &CWeatherComponent::showCoordinateDialog); m_weatherScenarios = CWeatherGrid::getAllScenarios(); for (const auto &scenario : as_const(m_weatherScenarios)) @@ -103,10 +103,14 @@ namespace BlackGui if (useOwnAircraftPosition) { m_weatherUpdateTimer.start(); + ui->pb_SetPosition->setText("Show Position"); } else { m_weatherUpdateTimer.stop(); + const CCoordinateGeodetic c; + m_coordinateDialog->setCoordinate(c); + ui->pb_SetPosition->setText("Select Position"); } updateWeatherInformation(); } @@ -157,6 +161,7 @@ namespace BlackGui void CWeatherComponent::updateWeatherInformation() { setWeatherGrid({}); + ui->lbl_Status->setText({}); const bool useOwnAcftPosition = ui->cb_UseOwnAcftPosition->isChecked(); BlackMisc::Geo::CCoordinateGeodetic position; Q_ASSERT(ui->cb_weatherScenario->currentData().canConvert()); @@ -166,10 +171,16 @@ namespace BlackGui { Q_ASSERT(sGui->getIContextOwnAircraft()); position = sGui->getIContextOwnAircraft()->getOwnAircraft().getPosition(); + m_coordinateDialog->setCoordinate(position); } else { position = m_coordinateDialog->getCoordinate(); + if (position.isNull()) + { + ui->lbl_Status->setText("No position selected."); + return; + } } if (CWeatherScenario::isRealWeatherScenario(scenario)) @@ -218,7 +229,7 @@ namespace BlackGui void CWeatherComponent::requestWeatherGrid(const CCoordinateGeodetic &position) { - ui->lbl_Status->setText("Loading..."); + ui->lbl_Status->setText(QStringLiteral("Loading around %1 %2").arg(position.latitude().toWgs84(), position.longitude().toWgs84())); CWeatherGrid weatherGrid { { {}, position } }; auto ident = identifier(); sGui->getIContextSimulator()->requestWeatherGrid(weatherGrid, ident); diff --git a/src/blackgui/components/weathercomponent.ui b/src/blackgui/components/weathercomponent.ui index ed7540fd8..42a097dce 100644 --- a/src/blackgui/components/weathercomponent.ui +++ b/src/blackgui/components/weathercomponent.ui @@ -6,8 +6,8 @@ 0 0 - 280 - 396 + 307 + 459 @@ -17,6 +17,9 @@ 0 + + 1 + 3 @@ -68,9 +71,40 @@ - - + + + 3 + + + 3 + + + 3 + + + 3 + + + + + + 0 + 0 + + + + Show Position + + + + + + + 0 + 0 + + Use own aircraft position @@ -79,13 +113,6 @@ - - - - coordinate - - - @@ -98,6 +125,9 @@ + + 0 + Temperature diff --git a/src/blackgui/editors/coordinateform.cpp b/src/blackgui/editors/coordinateform.cpp index 56f964bf9..78cf065e9 100644 --- a/src/blackgui/editors/coordinateform.cpp +++ b/src/blackgui/editors/coordinateform.cpp @@ -140,6 +140,11 @@ namespace BlackGui ui->le_LngSecFrag->setReadOnly(readonly); ui->le_Longitude->setReadOnly(readonly); + ui->rb_E->setEnabled(!readonly); + ui->rb_N->setEnabled(!readonly); + ui->rb_S->setEnabled(!readonly); + ui->rb_W->setEnabled(!readonly); + ui->le_Location->setReadOnly(readonly); ui->le_Location->setVisible(!readonly); // does not make sense to show it in ro, no reverse lookup ui->lbl_Location->setVisible(!readonly); diff --git a/src/blackgui/editors/coordinateform.ui b/src/blackgui/editors/coordinateform.ui index d8bad1478..2844733d0 100644 --- a/src/blackgui/editors/coordinateform.ui +++ b/src/blackgui/editors/coordinateform.ui @@ -6,10 +6,16 @@ 0 0 - 740 - 144 + 976 + 162 + + + 0 + 0 + + Frame @@ -325,7 +331,7 @@ - +