mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 03:20:05 +00:00 
			
		
		
		
	GPS info dialog
This commit is contained in:
		
							parent
							
								
									69309ca8e6
								
							
						
					
					
						commit
						1cce358a52
					
				
					 9 changed files with 538 additions and 12 deletions
				
			
		
							
								
								
									
										1
									
								
								scwx-qt/res/icons/font-awesome-6/copy-regular.svg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								scwx-qt/res/icons/font-awesome-6/copy-regular.svg
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M384 336H192c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16l140.1 0L400 115.9V320c0 8.8-7.2 16-16 16zM192 384H384c35.3 0 64-28.7 64-64V115.9c0-12.7-5.1-24.9-14.1-33.9L366.1 14.1c-9-9-21.2-14.1-33.9-14.1H192c-35.3 0-64 28.7-64 64V320c0 35.3 28.7 64 64 64zM64 128c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H256c35.3 0 64-28.7 64-64V416H272v32c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V192c0-8.8 7.2-16 16-16H96V128H64z"/></svg> | ||||||
| After Width: | Height: | Size: 646 B | 
|  | @ -239,6 +239,7 @@ set(HDR_UI source/scwx/qt/ui/about_dialog.hpp | ||||||
|            source/scwx/qt/ui/county_dialog.hpp |            source/scwx/qt/ui/county_dialog.hpp | ||||||
|            source/scwx/qt/ui/download_dialog.hpp |            source/scwx/qt/ui/download_dialog.hpp | ||||||
|            source/scwx/qt/ui/flow_layout.hpp |            source/scwx/qt/ui/flow_layout.hpp | ||||||
|  |            source/scwx/qt/ui/gps_info_dialog.hpp | ||||||
|            source/scwx/qt/ui/hotkey_edit.hpp |            source/scwx/qt/ui/hotkey_edit.hpp | ||||||
|            source/scwx/qt/ui/imgui_debug_dialog.hpp |            source/scwx/qt/ui/imgui_debug_dialog.hpp | ||||||
|            source/scwx/qt/ui/imgui_debug_widget.hpp |            source/scwx/qt/ui/imgui_debug_widget.hpp | ||||||
|  | @ -263,6 +264,7 @@ set(SRC_UI source/scwx/qt/ui/about_dialog.cpp | ||||||
|            source/scwx/qt/ui/county_dialog.cpp |            source/scwx/qt/ui/county_dialog.cpp | ||||||
|            source/scwx/qt/ui/download_dialog.cpp |            source/scwx/qt/ui/download_dialog.cpp | ||||||
|            source/scwx/qt/ui/flow_layout.cpp |            source/scwx/qt/ui/flow_layout.cpp | ||||||
|  |            source/scwx/qt/ui/gps_info_dialog.cpp | ||||||
|            source/scwx/qt/ui/hotkey_edit.cpp |            source/scwx/qt/ui/hotkey_edit.cpp | ||||||
|            source/scwx/qt/ui/imgui_debug_dialog.cpp |            source/scwx/qt/ui/imgui_debug_dialog.cpp | ||||||
|            source/scwx/qt/ui/imgui_debug_widget.cpp |            source/scwx/qt/ui/imgui_debug_widget.cpp | ||||||
|  | @ -285,6 +287,7 @@ set(UI_UI  source/scwx/qt/ui/about_dialog.ui | ||||||
|            source/scwx/qt/ui/animation_dock_widget.ui |            source/scwx/qt/ui/animation_dock_widget.ui | ||||||
|            source/scwx/qt/ui/collapsible_group.ui |            source/scwx/qt/ui/collapsible_group.ui | ||||||
|            source/scwx/qt/ui/county_dialog.ui |            source/scwx/qt/ui/county_dialog.ui | ||||||
|  |            source/scwx/qt/ui/gps_info_dialog.ui | ||||||
|            source/scwx/qt/ui/imgui_debug_dialog.ui |            source/scwx/qt/ui/imgui_debug_dialog.ui | ||||||
|            source/scwx/qt/ui/layer_dialog.ui |            source/scwx/qt/ui/layer_dialog.ui | ||||||
|            source/scwx/qt/ui/open_url_dialog.ui |            source/scwx/qt/ui/open_url_dialog.ui | ||||||
|  |  | ||||||
|  | @ -32,6 +32,7 @@ | ||||||
|         <file>res/icons/font-awesome-6/angles-up-solid.svg</file> |         <file>res/icons/font-awesome-6/angles-up-solid.svg</file> | ||||||
|         <file>res/icons/font-awesome-6/backward-step-solid.svg</file> |         <file>res/icons/font-awesome-6/backward-step-solid.svg</file> | ||||||
|         <file>res/icons/font-awesome-6/book-solid.svg</file> |         <file>res/icons/font-awesome-6/book-solid.svg</file> | ||||||
|  |         <file>res/icons/font-awesome-6/copy-regular.svg</file> | ||||||
|         <file>res/icons/font-awesome-6/discord.svg</file> |         <file>res/icons/font-awesome-6/discord.svg</file> | ||||||
|         <file>res/icons/font-awesome-6/earth-americas-solid.svg</file> |         <file>res/icons/font-awesome-6/earth-americas-solid.svg</file> | ||||||
|         <file>res/icons/font-awesome-6/font-solid.svg</file> |         <file>res/icons/font-awesome-6/font-solid.svg</file> | ||||||
|  |  | ||||||
|  | @ -23,6 +23,7 @@ | ||||||
| #include <scwx/qt/ui/animation_dock_widget.hpp> | #include <scwx/qt/ui/animation_dock_widget.hpp> | ||||||
| #include <scwx/qt/ui/collapsible_group.hpp> | #include <scwx/qt/ui/collapsible_group.hpp> | ||||||
| #include <scwx/qt/ui/flow_layout.hpp> | #include <scwx/qt/ui/flow_layout.hpp> | ||||||
|  | #include <scwx/qt/ui/gps_info_dialog.hpp> | ||||||
| #include <scwx/qt/ui/imgui_debug_dialog.hpp> | #include <scwx/qt/ui/imgui_debug_dialog.hpp> | ||||||
| #include <scwx/qt/ui/layer_dialog.hpp> | #include <scwx/qt/ui/layer_dialog.hpp> | ||||||
| #include <scwx/qt/ui/level2_products_widget.hpp> | #include <scwx/qt/ui/level2_products_widget.hpp> | ||||||
|  | @ -85,6 +86,7 @@ public: | ||||||
|        alertDockWidget_ {nullptr}, |        alertDockWidget_ {nullptr}, | ||||||
|        animationDockWidget_ {nullptr}, |        animationDockWidget_ {nullptr}, | ||||||
|        aboutDialog_ {nullptr}, |        aboutDialog_ {nullptr}, | ||||||
|  |        gpsInfoDialog_ {nullptr}, | ||||||
|        imGuiDebugDialog_ {nullptr}, |        imGuiDebugDialog_ {nullptr}, | ||||||
|        layerDialog_ {nullptr}, |        layerDialog_ {nullptr}, | ||||||
|        placefileDialog_ {nullptr}, |        placefileDialog_ {nullptr}, | ||||||
|  | @ -190,6 +192,7 @@ public: | ||||||
|    ui::AlertDockWidget*     alertDockWidget_; |    ui::AlertDockWidget*     alertDockWidget_; | ||||||
|    ui::AnimationDockWidget* animationDockWidget_; |    ui::AnimationDockWidget* animationDockWidget_; | ||||||
|    ui::AboutDialog*         aboutDialog_; |    ui::AboutDialog*         aboutDialog_; | ||||||
|  |    ui::GpsInfoDialog*       gpsInfoDialog_; | ||||||
|    ui::ImGuiDebugDialog*    imGuiDebugDialog_; |    ui::ImGuiDebugDialog*    imGuiDebugDialog_; | ||||||
|    ui::LayerDialog*         layerDialog_; |    ui::LayerDialog*         layerDialog_; | ||||||
|    ui::PlacefileDialog*     placefileDialog_; |    ui::PlacefileDialog*     placefileDialog_; | ||||||
|  | @ -264,6 +267,9 @@ MainWindow::MainWindow(QWidget* parent) : | ||||||
|    p->alertDockWidget_->setVisible(false); |    p->alertDockWidget_->setVisible(false); | ||||||
|    addDockWidget(Qt::BottomDockWidgetArea, p->alertDockWidget_); |    addDockWidget(Qt::BottomDockWidgetArea, p->alertDockWidget_); | ||||||
| 
 | 
 | ||||||
|  |    // GPS Info Dialog
 | ||||||
|  |    p->gpsInfoDialog_ = new ui::GpsInfoDialog(this); | ||||||
|  | 
 | ||||||
|    // Configure Menu
 |    // Configure Menu
 | ||||||
|    ui->menuView->insertAction(ui->actionRadarToolbox, |    ui->menuView->insertAction(ui->actionRadarToolbox, | ||||||
|                               ui->radarToolboxDock->toggleViewAction()); |                               ui->radarToolboxDock->toggleViewAction()); | ||||||
|  | @ -535,6 +541,11 @@ void MainWindow::on_actionExit_triggered() | ||||||
|    close(); |    close(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void MainWindow::on_actionGpsInfo_triggered() | ||||||
|  | { | ||||||
|  |    p->gpsInfoDialog_->show(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void MainWindow::on_actionColorTable_triggered(bool checked) | void MainWindow::on_actionColorTable_triggered(bool checked) | ||||||
| { | { | ||||||
|    p->layerModel_->SetLayerDisplayed(types::LayerType::Information, |    p->layerModel_->SetLayerDisplayed(types::LayerType::Information, | ||||||
|  |  | ||||||
|  | @ -38,6 +38,7 @@ private slots: | ||||||
|    void on_actionOpenTextEvent_triggered(); |    void on_actionOpenTextEvent_triggered(); | ||||||
|    void on_actionSettings_triggered(); |    void on_actionSettings_triggered(); | ||||||
|    void on_actionExit_triggered(); |    void on_actionExit_triggered(); | ||||||
|  |    void on_actionGpsInfo_triggered(); | ||||||
|    void on_actionColorTable_triggered(bool checked); |    void on_actionColorTable_triggered(bool checked); | ||||||
|    void on_actionRadarRange_triggered(bool checked); |    void on_actionRadarRange_triggered(bool checked); | ||||||
|    void on_actionRadarSites_triggered(bool checked); |    void on_actionRadarSites_triggered(bool checked); | ||||||
|  |  | ||||||
|  | @ -39,7 +39,7 @@ | ||||||
|      <x>0</x> |      <x>0</x> | ||||||
|      <y>0</y> |      <y>0</y> | ||||||
|      <width>1024</width> |      <width>1024</width> | ||||||
|      <height>21</height> |      <height>33</height> | ||||||
|     </rect> |     </rect> | ||||||
|    </property> |    </property> | ||||||
|    <widget class="QMenu" name="menuFile"> |    <widget class="QMenu" name="menuFile"> | ||||||
|  | @ -85,6 +85,7 @@ | ||||||
|     </widget> |     </widget> | ||||||
|     <addaction name="actionRadarToolbox"/> |     <addaction name="actionRadarToolbox"/> | ||||||
|     <addaction name="actionAlerts"/> |     <addaction name="actionAlerts"/> | ||||||
|  |     <addaction name="actionGpsInfo"/> | ||||||
|     <addaction name="separator"/> |     <addaction name="separator"/> | ||||||
|     <addaction name="menuMapLayers"/> |     <addaction name="menuMapLayers"/> | ||||||
|    </widget> |    </widget> | ||||||
|  | @ -135,13 +136,13 @@ | ||||||
|      <item> |      <item> | ||||||
|       <widget class="QScrollArea" name="radarToolboxScrollArea"> |       <widget class="QScrollArea" name="radarToolboxScrollArea"> | ||||||
|        <property name="frameShape"> |        <property name="frameShape"> | ||||||
|         <enum>QFrame::NoFrame</enum> |         <enum>QFrame::Shape::NoFrame</enum> | ||||||
|        </property> |        </property> | ||||||
|        <property name="horizontalScrollBarPolicy"> |        <property name="horizontalScrollBarPolicy"> | ||||||
|         <enum>Qt::ScrollBarAsNeeded</enum> |         <enum>Qt::ScrollBarPolicy::ScrollBarAsNeeded</enum> | ||||||
|        </property> |        </property> | ||||||
|        <property name="sizeAdjustPolicy"> |        <property name="sizeAdjustPolicy"> | ||||||
|         <enum>QAbstractScrollArea::AdjustToContents</enum> |         <enum>QAbstractScrollArea::SizeAdjustPolicy::AdjustToContents</enum> | ||||||
|        </property> |        </property> | ||||||
|        <property name="widgetResizable"> |        <property name="widgetResizable"> | ||||||
|         <bool>true</bool> |         <bool>true</bool> | ||||||
|  | @ -151,8 +152,8 @@ | ||||||
|          <rect> |          <rect> | ||||||
|           <x>0</x> |           <x>0</x> | ||||||
|           <y>0</y> |           <y>0</y> | ||||||
|           <width>193</width> |           <width>190</width> | ||||||
|           <height>688</height> |           <height>686</height> | ||||||
|          </rect> |          </rect> | ||||||
|         </property> |         </property> | ||||||
|         <layout class="QVBoxLayout" name="verticalLayout_6"> |         <layout class="QVBoxLayout" name="verticalLayout_6"> | ||||||
|  | @ -171,10 +172,10 @@ | ||||||
|          <item> |          <item> | ||||||
|           <widget class="QFrame" name="radarInfoFrame"> |           <widget class="QFrame" name="radarInfoFrame"> | ||||||
|            <property name="frameShape"> |            <property name="frameShape"> | ||||||
|             <enum>QFrame::StyledPanel</enum> |             <enum>QFrame::Shape::StyledPanel</enum> | ||||||
|            </property> |            </property> | ||||||
|            <property name="frameShadow"> |            <property name="frameShadow"> | ||||||
|             <enum>QFrame::Raised</enum> |             <enum>QFrame::Shadow::Raised</enum> | ||||||
|            </property> |            </property> | ||||||
|            <layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0,0,0"> |            <layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0,0,0"> | ||||||
|             <item row="0" column="2"> |             <item row="0" column="2"> | ||||||
|  | @ -209,10 +210,10 @@ | ||||||
|             <item row="0" column="4"> |             <item row="0" column="4"> | ||||||
|              <widget class="QFrame" name="frame"> |              <widget class="QFrame" name="frame"> | ||||||
|               <property name="frameShape"> |               <property name="frameShape"> | ||||||
|                <enum>QFrame::NoFrame</enum> |                <enum>QFrame::Shape::NoFrame</enum> | ||||||
|               </property> |               </property> | ||||||
|               <property name="frameShadow"> |               <property name="frameShadow"> | ||||||
|                <enum>QFrame::Raised</enum> |                <enum>QFrame::Shadow::Raised</enum> | ||||||
|               </property> |               </property> | ||||||
|               <layout class="QHBoxLayout" name="horizontalLayout"> |               <layout class="QHBoxLayout" name="horizontalLayout"> | ||||||
|                <property name="leftMargin"> |                <property name="leftMargin"> | ||||||
|  | @ -260,7 +261,7 @@ | ||||||
|                    <normaloff>:/res/icons/font-awesome-6/star-solid.svg</normaloff>:/res/icons/font-awesome-6/star-solid.svg</iconset> |                    <normaloff>:/res/icons/font-awesome-6/star-solid.svg</normaloff>:/res/icons/font-awesome-6/star-solid.svg</iconset> | ||||||
|                  </property> |                  </property> | ||||||
|                  <property name="popupMode"> |                  <property name="popupMode"> | ||||||
|                   <enum>QToolButton::InstantPopup</enum> |                   <enum>QToolButton::ToolButtonPopupMode::InstantPopup</enum> | ||||||
|                  </property> |                  </property> | ||||||
|                 </widget> |                 </widget> | ||||||
|                </item> |                </item> | ||||||
|  | @ -340,7 +341,7 @@ | ||||||
|          <item> |          <item> | ||||||
|           <spacer name="radarToolboxSpacer"> |           <spacer name="radarToolboxSpacer"> | ||||||
|            <property name="orientation"> |            <property name="orientation"> | ||||||
|             <enum>Qt::Vertical</enum> |             <enum>Qt::Orientation::Vertical</enum> | ||||||
|            </property> |            </property> | ||||||
|            <property name="sizeHint" stdset="0"> |            <property name="sizeHint" stdset="0"> | ||||||
|             <size> |             <size> | ||||||
|  | @ -481,6 +482,11 @@ | ||||||
|     <string>Radar &Sites</string> |     <string>Radar &Sites</string> | ||||||
|    </property> |    </property> | ||||||
|   </action> |   </action> | ||||||
|  |   <action name="actionGpsInfo"> | ||||||
|  |    <property name="text"> | ||||||
|  |     <string>&GPS Info</string> | ||||||
|  |    </property> | ||||||
|  |   </action> | ||||||
|  </widget> |  </widget> | ||||||
|  <resources> |  <resources> | ||||||
|   <include location="../../../../scwx-qt.qrc"/> |   <include location="../../../../scwx-qt.qrc"/> | ||||||
|  |  | ||||||
							
								
								
									
										201
									
								
								scwx-qt/source/scwx/qt/ui/gps_info_dialog.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										201
									
								
								scwx-qt/source/scwx/qt/ui/gps_info_dialog.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,201 @@ | ||||||
|  | #include "gps_info_dialog.hpp" | ||||||
|  | #include "ui_gps_info_dialog.h" | ||||||
|  | 
 | ||||||
|  | #include <scwx/qt/manager/position_manager.hpp> | ||||||
|  | #include <scwx/common/geographic.hpp> | ||||||
|  | #include <scwx/util/time.hpp> | ||||||
|  | 
 | ||||||
|  | #include <units/angle.h> | ||||||
|  | #include <units/length.h> | ||||||
|  | #include <units/velocity.h> | ||||||
|  | #include <QClipboard> | ||||||
|  | #include <QGeoPositionInfo> | ||||||
|  | 
 | ||||||
|  | namespace scwx | ||||||
|  | { | ||||||
|  | namespace qt | ||||||
|  | { | ||||||
|  | namespace ui | ||||||
|  | { | ||||||
|  | 
 | ||||||
|  | static const QString kDisabledString_ = "---"; | ||||||
|  | 
 | ||||||
|  | class GpsInfoDialog::Impl | ||||||
|  | { | ||||||
|  | public: | ||||||
|  |    explicit Impl(GpsInfoDialog* self) : self_ {self} {}; | ||||||
|  |    ~Impl() = default; | ||||||
|  | 
 | ||||||
|  |    std::shared_ptr<manager::PositionManager> positionManager_ { | ||||||
|  |       manager::PositionManager::Instance()}; | ||||||
|  | 
 | ||||||
|  |    void Update(const QGeoPositionInfo& info, bool updateTime = true); | ||||||
|  | 
 | ||||||
|  |    GpsInfoDialog* self_; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | GpsInfoDialog::GpsInfoDialog(QWidget* parent) : | ||||||
|  |     QDialog(parent), p {std::make_unique<Impl>(this)}, ui(new Ui::GpsInfoDialog) | ||||||
|  | { | ||||||
|  |    ui->setupUi(this); | ||||||
|  | 
 | ||||||
|  |    p->Update({}, false); | ||||||
|  | 
 | ||||||
|  |    connect(p->positionManager_.get(), | ||||||
|  |            &manager::PositionManager::PositionUpdated, | ||||||
|  |            this, | ||||||
|  |            [this](const QGeoPositionInfo& info) { p->Update(info); }); | ||||||
|  | 
 | ||||||
|  |    connect(ui->copyCoordinateButton, | ||||||
|  |            &QAbstractButton::clicked, | ||||||
|  |            this, | ||||||
|  |            [this]() | ||||||
|  |            { | ||||||
|  |               QClipboard* clipboard = QGuiApplication::clipboard(); | ||||||
|  |               clipboard->setText(ui->coordinateLabel->text()); | ||||||
|  |            }); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | GpsInfoDialog::~GpsInfoDialog() | ||||||
|  | { | ||||||
|  |    delete ui; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void GpsInfoDialog::Impl::Update(const QGeoPositionInfo& info, bool updateTime) | ||||||
|  | { | ||||||
|  |    auto coordinate = info.coordinate(); | ||||||
|  | 
 | ||||||
|  |    if (coordinate.isValid()) | ||||||
|  |    { | ||||||
|  |       const QString latitude = QString::fromStdString( | ||||||
|  |          common::GetLatitudeString(coordinate.latitude())); | ||||||
|  |       const QString longitude = QString::fromStdString( | ||||||
|  |          common::GetLongitudeString(coordinate.longitude())); | ||||||
|  | 
 | ||||||
|  |       self_->ui->coordinateLabel->setText( | ||||||
|  |          QString("%1, %2").arg(latitude).arg(longitude)); | ||||||
|  |    } | ||||||
|  |    else | ||||||
|  |    { | ||||||
|  |       self_->ui->coordinateLabel->setText(kDisabledString_); | ||||||
|  |    } | ||||||
|  | 
 | ||||||
|  |    if (coordinate.type() == QGeoCoordinate::CoordinateType::Coordinate3D) | ||||||
|  |    { | ||||||
|  |       units::length::meters<double> altitude {coordinate.altitude()}; | ||||||
|  |       self_->ui->altitudeLabel->setText( | ||||||
|  |          QString::fromStdString(units::to_string(altitude))); | ||||||
|  |    } | ||||||
|  |    else | ||||||
|  |    { | ||||||
|  |       self_->ui->altitudeLabel->setText(kDisabledString_); | ||||||
|  |    } | ||||||
|  | 
 | ||||||
|  |    if (info.hasAttribute(QGeoPositionInfo::Attribute::Direction)) | ||||||
|  |    { | ||||||
|  |       units::angle::degrees<double> direction { | ||||||
|  |          info.attribute(QGeoPositionInfo::Attribute::Direction)}; | ||||||
|  |       self_->ui->directionLabel->setText( | ||||||
|  |          QString::fromStdString(units::to_string(direction))); | ||||||
|  |    } | ||||||
|  |    else | ||||||
|  |    { | ||||||
|  |       self_->ui->directionLabel->setText(kDisabledString_); | ||||||
|  |    } | ||||||
|  | 
 | ||||||
|  |    if (info.hasAttribute(QGeoPositionInfo::Attribute::GroundSpeed)) | ||||||
|  |    { | ||||||
|  |       units::velocity::meters_per_second<double> groundSpeed { | ||||||
|  |          info.attribute(QGeoPositionInfo::Attribute::GroundSpeed)}; | ||||||
|  |       self_->ui->groundSpeedLabel->setText( | ||||||
|  |          QString::fromStdString(units::to_string(groundSpeed))); | ||||||
|  |    } | ||||||
|  |    else | ||||||
|  |    { | ||||||
|  |       self_->ui->groundSpeedLabel->setText(kDisabledString_); | ||||||
|  |    } | ||||||
|  | 
 | ||||||
|  |    if (info.hasAttribute(QGeoPositionInfo::Attribute::VerticalSpeed)) | ||||||
|  |    { | ||||||
|  |       units::velocity::meters_per_second<double> verticalSpeed { | ||||||
|  |          info.attribute(QGeoPositionInfo::Attribute::VerticalSpeed)}; | ||||||
|  |       self_->ui->verticalSpeedLabel->setText( | ||||||
|  |          QString::fromStdString(units::to_string(verticalSpeed))); | ||||||
|  |    } | ||||||
|  |    else | ||||||
|  |    { | ||||||
|  |       self_->ui->verticalSpeedLabel->setText(kDisabledString_); | ||||||
|  |    } | ||||||
|  | 
 | ||||||
|  |    if (info.hasAttribute(QGeoPositionInfo::Attribute::MagneticVariation)) | ||||||
|  |    { | ||||||
|  |       units::angle::degrees<double> magneticVariation { | ||||||
|  |          info.attribute(QGeoPositionInfo::Attribute::MagneticVariation)}; | ||||||
|  |       self_->ui->magneticVariationLabel->setText( | ||||||
|  |          QString::fromStdString(units::to_string(magneticVariation))); | ||||||
|  |    } | ||||||
|  |    else | ||||||
|  |    { | ||||||
|  |       self_->ui->magneticVariationLabel->setText(kDisabledString_); | ||||||
|  |    } | ||||||
|  | 
 | ||||||
|  |    if (info.hasAttribute(QGeoPositionInfo::Attribute::HorizontalAccuracy)) | ||||||
|  |    { | ||||||
|  |       units::length::meters<double> horizontalAccuracy { | ||||||
|  |          info.attribute(QGeoPositionInfo::Attribute::HorizontalAccuracy)}; | ||||||
|  |       if (!std::isnan(horizontalAccuracy.value())) | ||||||
|  |       { | ||||||
|  |          self_->ui->horizontalAccuracyLabel->setText( | ||||||
|  |             QString::fromStdString(units::to_string(horizontalAccuracy))); | ||||||
|  |       } | ||||||
|  |       else | ||||||
|  |       { | ||||||
|  |          self_->ui->horizontalAccuracyLabel->setText(kDisabledString_); | ||||||
|  |       } | ||||||
|  |    } | ||||||
|  |    else | ||||||
|  |    { | ||||||
|  |       self_->ui->horizontalAccuracyLabel->setText(kDisabledString_); | ||||||
|  |    } | ||||||
|  | 
 | ||||||
|  |    if (info.hasAttribute(QGeoPositionInfo::Attribute::VerticalAccuracy)) | ||||||
|  |    { | ||||||
|  |       units::length::meters<double> verticalAccuracy { | ||||||
|  |          info.attribute(QGeoPositionInfo::Attribute::VerticalAccuracy)}; | ||||||
|  |       if (!std::isnan(verticalAccuracy.value())) | ||||||
|  |       { | ||||||
|  |          self_->ui->verticalAccuracyLabel->setText( | ||||||
|  |             QString::fromStdString(units::to_string(verticalAccuracy))); | ||||||
|  |       } | ||||||
|  |       else | ||||||
|  |       { | ||||||
|  |          self_->ui->verticalAccuracyLabel->setText(kDisabledString_); | ||||||
|  |       } | ||||||
|  |    } | ||||||
|  |    else | ||||||
|  |    { | ||||||
|  |       self_->ui->verticalAccuracyLabel->setText(kDisabledString_); | ||||||
|  |    } | ||||||
|  | 
 | ||||||
|  |    if (info.hasAttribute(QGeoPositionInfo::Attribute::DirectionAccuracy)) | ||||||
|  |    { | ||||||
|  |       units::angle::degrees<double> directionAccuracy { | ||||||
|  |          info.attribute(QGeoPositionInfo::Attribute::DirectionAccuracy)}; | ||||||
|  |       self_->ui->directionAccuracyLabel->setText( | ||||||
|  |          QString::fromStdString(units::to_string(directionAccuracy))); | ||||||
|  |    } | ||||||
|  |    else | ||||||
|  |    { | ||||||
|  |       self_->ui->directionAccuracyLabel->setText(kDisabledString_); | ||||||
|  |    } | ||||||
|  | 
 | ||||||
|  |    if (updateTime) | ||||||
|  |    { | ||||||
|  |       self_->ui->lastUpdateLabel->setText( | ||||||
|  |          info.timestamp().toString(Qt::DateFormat::ISODate)); | ||||||
|  |    } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | } // namespace ui
 | ||||||
|  | } // namespace qt
 | ||||||
|  | } // namespace scwx
 | ||||||
							
								
								
									
										36
									
								
								scwx-qt/source/scwx/qt/ui/gps_info_dialog.hpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								scwx-qt/source/scwx/qt/ui/gps_info_dialog.hpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,36 @@ | ||||||
|  | #pragma once | ||||||
|  | 
 | ||||||
|  | #include <QDialog> | ||||||
|  | 
 | ||||||
|  | namespace Ui | ||||||
|  | { | ||||||
|  | class GpsInfoDialog; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | namespace scwx | ||||||
|  | { | ||||||
|  | namespace qt | ||||||
|  | { | ||||||
|  | namespace ui | ||||||
|  | { | ||||||
|  | 
 | ||||||
|  | class GpsInfoDialog : public QDialog | ||||||
|  | { | ||||||
|  |    Q_OBJECT | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |    Q_DISABLE_COPY(GpsInfoDialog) | ||||||
|  | 
 | ||||||
|  | public: | ||||||
|  |    explicit GpsInfoDialog(QWidget* parent = nullptr); | ||||||
|  |    ~GpsInfoDialog(); | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |    class Impl; | ||||||
|  |    std::unique_ptr<Impl> p; | ||||||
|  |    Ui::GpsInfoDialog*    ui; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | } // namespace ui
 | ||||||
|  | } // namespace qt
 | ||||||
|  | } // namespace scwx
 | ||||||
							
								
								
									
										266
									
								
								scwx-qt/source/scwx/qt/ui/gps_info_dialog.ui
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										266
									
								
								scwx-qt/source/scwx/qt/ui/gps_info_dialog.ui
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,266 @@ | ||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <ui version="4.0"> | ||||||
|  |  <class>GpsInfoDialog</class> | ||||||
|  |  <widget class="QDialog" name="GpsInfoDialog"> | ||||||
|  |   <property name="geometry"> | ||||||
|  |    <rect> | ||||||
|  |     <x>0</x> | ||||||
|  |     <y>0</y> | ||||||
|  |     <width>313</width> | ||||||
|  |     <height>292</height> | ||||||
|  |    </rect> | ||||||
|  |   </property> | ||||||
|  |   <property name="windowTitle"> | ||||||
|  |    <string>GPS Info</string> | ||||||
|  |   </property> | ||||||
|  |   <layout class="QVBoxLayout" name="verticalLayout"> | ||||||
|  |    <item> | ||||||
|  |     <widget class="QWidget" name="widget" native="true"> | ||||||
|  |      <layout class="QGridLayout" name="gridLayout"> | ||||||
|  |       <property name="verticalSpacing"> | ||||||
|  |        <number>6</number> | ||||||
|  |       </property> | ||||||
|  |       <item row="8" column="0"> | ||||||
|  |        <widget class="QLabel" name="label_17"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Direction Accuracy</string> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="5" column="1"> | ||||||
|  |        <widget class="QLabel" name="magneticVariationLabel"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string/> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="6" column="1"> | ||||||
|  |        <widget class="QLabel" name="horizontalAccuracyLabel"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string/> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="8" column="1"> | ||||||
|  |        <widget class="QLabel" name="directionAccuracyLabel"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string/> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="10" column="0"> | ||||||
|  |        <spacer name="verticalSpacer"> | ||||||
|  |         <property name="orientation"> | ||||||
|  |          <enum>Qt::Orientation::Vertical</enum> | ||||||
|  |         </property> | ||||||
|  |         <property name="sizeHint" stdset="0"> | ||||||
|  |          <size> | ||||||
|  |           <width>20</width> | ||||||
|  |           <height>40</height> | ||||||
|  |          </size> | ||||||
|  |         </property> | ||||||
|  |        </spacer> | ||||||
|  |       </item> | ||||||
|  |       <item row="5" column="0"> | ||||||
|  |        <widget class="QLabel" name="label_11"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Magnetic Variation</string> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="2" column="0"> | ||||||
|  |        <widget class="QLabel" name="label_5"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Direction</string> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="4" column="0"> | ||||||
|  |        <widget class="QLabel" name="label_9"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Vertical Speed</string> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="2" column="1"> | ||||||
|  |        <widget class="QLabel" name="directionLabel"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string/> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="1" column="1"> | ||||||
|  |        <widget class="QLabel" name="altitudeLabel"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string/> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="7" column="0"> | ||||||
|  |        <widget class="QLabel" name="label_15"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Vertical Accuracy</string> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="0" column="2"> | ||||||
|  |        <widget class="QToolButton" name="copyCoordinateButton"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>...</string> | ||||||
|  |         </property> | ||||||
|  |         <property name="icon"> | ||||||
|  |          <iconset resource="../../../../scwx-qt.qrc"> | ||||||
|  |           <normaloff>:/res/icons/font-awesome-6/copy-regular.svg</normaloff>:/res/icons/font-awesome-6/copy-regular.svg</iconset> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="6" column="0"> | ||||||
|  |        <widget class="QLabel" name="label_13"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Horizonal Accuracy</string> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="3" column="1"> | ||||||
|  |        <widget class="QLabel" name="groundSpeedLabel"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string/> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="3" column="0"> | ||||||
|  |        <widget class="QLabel" name="label_7"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Ground Speed</string> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="4" column="1"> | ||||||
|  |        <widget class="QLabel" name="verticalSpeedLabel"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string/> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="0" column="1"> | ||||||
|  |        <widget class="QLabel" name="coordinateLabel"> | ||||||
|  |         <property name="sizePolicy"> | ||||||
|  |          <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> | ||||||
|  |           <horstretch>0</horstretch> | ||||||
|  |           <verstretch>0</verstretch> | ||||||
|  |          </sizepolicy> | ||||||
|  |         </property> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string/> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="0" column="0"> | ||||||
|  |        <widget class="QLabel" name="label"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Coordinate</string> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="7" column="1"> | ||||||
|  |        <widget class="QLabel" name="verticalAccuracyLabel"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string/> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="1" column="0"> | ||||||
|  |        <widget class="QLabel" name="label_2"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Altitude</string> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="9" column="0"> | ||||||
|  |        <widget class="QLabel" name="label_3"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Last Update</string> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |       <item row="9" column="1"> | ||||||
|  |        <widget class="QLabel" name="lastUpdateLabel"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Never</string> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|  |      </layout> | ||||||
|  |      <zorder>verticalAccuracyLabel</zorder> | ||||||
|  |      <zorder>label_11</zorder> | ||||||
|  |      <zorder>groundSpeedLabel</zorder> | ||||||
|  |      <zorder>magneticVariationLabel</zorder> | ||||||
|  |      <zorder>label_2</zorder> | ||||||
|  |      <zorder>coordinateLabel</zorder> | ||||||
|  |      <zorder>altitudeLabel</zorder> | ||||||
|  |      <zorder>directionAccuracyLabel</zorder> | ||||||
|  |      <zorder>label_5</zorder> | ||||||
|  |      <zorder>label_15</zorder> | ||||||
|  |      <zorder>label_13</zorder> | ||||||
|  |      <zorder>verticalSpeedLabel</zorder> | ||||||
|  |      <zorder>label_7</zorder> | ||||||
|  |      <zorder>label</zorder> | ||||||
|  |      <zorder>horizontalAccuracyLabel</zorder> | ||||||
|  |      <zorder>label_17</zorder> | ||||||
|  |      <zorder>directionLabel</zorder> | ||||||
|  |      <zorder>label_9</zorder> | ||||||
|  |      <zorder>copyCoordinateButton</zorder> | ||||||
|  |      <zorder>label_3</zorder> | ||||||
|  |      <zorder>lastUpdateLabel</zorder> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item> | ||||||
|  |     <widget class="QDialogButtonBox" name="buttonBox"> | ||||||
|  |      <property name="orientation"> | ||||||
|  |       <enum>Qt::Orientation::Horizontal</enum> | ||||||
|  |      </property> | ||||||
|  |      <property name="standardButtons"> | ||||||
|  |       <set>QDialogButtonBox::StandardButton::Close</set> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |   </layout> | ||||||
|  |  </widget> | ||||||
|  |  <resources> | ||||||
|  |   <include location="../../../../scwx-qt.qrc"/> | ||||||
|  |  </resources> | ||||||
|  |  <connections> | ||||||
|  |   <connection> | ||||||
|  |    <sender>buttonBox</sender> | ||||||
|  |    <signal>accepted()</signal> | ||||||
|  |    <receiver>GpsInfoDialog</receiver> | ||||||
|  |    <slot>accept()</slot> | ||||||
|  |    <hints> | ||||||
|  |     <hint type="sourcelabel"> | ||||||
|  |      <x>248</x> | ||||||
|  |      <y>254</y> | ||||||
|  |     </hint> | ||||||
|  |     <hint type="destinationlabel"> | ||||||
|  |      <x>157</x> | ||||||
|  |      <y>274</y> | ||||||
|  |     </hint> | ||||||
|  |    </hints> | ||||||
|  |   </connection> | ||||||
|  |   <connection> | ||||||
|  |    <sender>buttonBox</sender> | ||||||
|  |    <signal>rejected()</signal> | ||||||
|  |    <receiver>GpsInfoDialog</receiver> | ||||||
|  |    <slot>reject()</slot> | ||||||
|  |    <hints> | ||||||
|  |     <hint type="sourcelabel"> | ||||||
|  |      <x>316</x> | ||||||
|  |      <y>260</y> | ||||||
|  |     </hint> | ||||||
|  |     <hint type="destinationlabel"> | ||||||
|  |      <x>286</x> | ||||||
|  |      <y>274</y> | ||||||
|  |     </hint> | ||||||
|  |    </hints> | ||||||
|  |   </connection> | ||||||
|  |  </connections> | ||||||
|  | </ui> | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat