mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 06:50:05 +00:00 
			
		
		
		
	Add track location checkbox to map settings group
This commit is contained in:
		
							parent
							
								
									fca6a6484e
								
							
						
					
					
						commit
						da7cedddff
					
				
					 2 changed files with 43 additions and 2 deletions
				
			
		|  | @ -4,6 +4,7 @@ | ||||||
| #include <scwx/qt/main/application.hpp> | #include <scwx/qt/main/application.hpp> | ||||||
| #include <scwx/qt/main/versions.hpp> | #include <scwx/qt/main/versions.hpp> | ||||||
| #include <scwx/qt/manager/placefile_manager.hpp> | #include <scwx/qt/manager/placefile_manager.hpp> | ||||||
|  | #include <scwx/qt/manager/position_manager.hpp> | ||||||
| #include <scwx/qt/manager/radar_product_manager.hpp> | #include <scwx/qt/manager/radar_product_manager.hpp> | ||||||
| #include <scwx/qt/manager/text_event_manager.hpp> | #include <scwx/qt/manager/text_event_manager.hpp> | ||||||
| #include <scwx/qt/manager/timeline_manager.hpp> | #include <scwx/qt/manager/timeline_manager.hpp> | ||||||
|  | @ -34,6 +35,7 @@ | ||||||
| 
 | 
 | ||||||
| #include <boost/asio/post.hpp> | #include <boost/asio/post.hpp> | ||||||
| #include <boost/asio/thread_pool.hpp> | #include <boost/asio/thread_pool.hpp> | ||||||
|  | #include <boost/uuid/random_generator.hpp> | ||||||
| #include <QDesktopServices> | #include <QDesktopServices> | ||||||
| #include <QFileDialog> | #include <QFileDialog> | ||||||
| #include <QMessageBox> | #include <QMessageBox> | ||||||
|  | @ -61,6 +63,7 @@ class MainWindowImpl : public QObject | ||||||
| 
 | 
 | ||||||
| public: | public: | ||||||
|    explicit MainWindowImpl(MainWindow* mainWindow) : |    explicit MainWindowImpl(MainWindow* mainWindow) : | ||||||
|  |        uuid_ {boost::uuids::random_generator()()}, | ||||||
|        mainWindow_ {mainWindow}, |        mainWindow_ {mainWindow}, | ||||||
|        settings_ {}, |        settings_ {}, | ||||||
|        activeMap_ {nullptr}, |        activeMap_ {nullptr}, | ||||||
|  | @ -82,6 +85,7 @@ public: | ||||||
|        settingsDialog_ {nullptr}, |        settingsDialog_ {nullptr}, | ||||||
|        updateDialog_ {nullptr}, |        updateDialog_ {nullptr}, | ||||||
|        placefileManager_ {manager::PlacefileManager::Instance()}, |        placefileManager_ {manager::PlacefileManager::Instance()}, | ||||||
|  |        positionManager_ {manager::PositionManager::Instance()}, | ||||||
|        textEventManager_ {manager::TextEventManager::Instance()}, |        textEventManager_ {manager::TextEventManager::Instance()}, | ||||||
|        timelineManager_ {manager::TimelineManager::Instance()}, |        timelineManager_ {manager::TimelineManager::Instance()}, | ||||||
|        updateManager_ {manager::UpdateManager::Instance()}, |        updateManager_ {manager::UpdateManager::Instance()}, | ||||||
|  | @ -117,6 +121,11 @@ public: | ||||||
|       settings_.setApiKey(QString {mapProviderApiKey.c_str()}); |       settings_.setApiKey(QString {mapProviderApiKey.c_str()}); | ||||||
|       settings_.setCacheDatabasePath(QString {cacheDbPath.c_str()}); |       settings_.setCacheDatabasePath(QString {cacheDbPath.c_str()}); | ||||||
|       settings_.setCacheDatabaseMaximumSize(20 * 1024 * 1024); |       settings_.setCacheDatabaseMaximumSize(20 * 1024 * 1024); | ||||||
|  | 
 | ||||||
|  |       if (settings::GeneralSettings::Instance().track_location().GetValue()) | ||||||
|  |       { | ||||||
|  |          positionManager_->TrackLocation(uuid_, true); | ||||||
|  |       } | ||||||
|    } |    } | ||||||
|    ~MainWindowImpl() { threadPool_.join(); } |    ~MainWindowImpl() { threadPool_.join(); } | ||||||
| 
 | 
 | ||||||
|  | @ -146,6 +155,8 @@ public: | ||||||
| 
 | 
 | ||||||
|    boost::asio::thread_pool threadPool_ {1u}; |    boost::asio::thread_pool threadPool_ {1u}; | ||||||
| 
 | 
 | ||||||
|  |    boost::uuids::uuid uuid_; | ||||||
|  | 
 | ||||||
|    MainWindow*           mainWindow_; |    MainWindow*           mainWindow_; | ||||||
|    QMapLibreGL::Settings settings_; |    QMapLibreGL::Settings settings_; | ||||||
|    map::MapProvider      mapProvider_; |    map::MapProvider      mapProvider_; | ||||||
|  | @ -172,6 +183,7 @@ public: | ||||||
|    ui::UpdateDialog*        updateDialog_; |    ui::UpdateDialog*        updateDialog_; | ||||||
| 
 | 
 | ||||||
|    std::shared_ptr<manager::PlacefileManager> placefileManager_; |    std::shared_ptr<manager::PlacefileManager> placefileManager_; | ||||||
|  |    std::shared_ptr<manager::PositionManager>  positionManager_; | ||||||
|    std::shared_ptr<manager::TextEventManager> textEventManager_; |    std::shared_ptr<manager::TextEventManager> textEventManager_; | ||||||
|    std::shared_ptr<manager::TimelineManager>  timelineManager_; |    std::shared_ptr<manager::TimelineManager>  timelineManager_; | ||||||
|    std::shared_ptr<manager::UpdateManager>    updateManager_; |    std::shared_ptr<manager::UpdateManager>    updateManager_; | ||||||
|  | @ -244,9 +256,13 @@ MainWindow::MainWindow(QWidget* parent) : | ||||||
|    p->mapSettingsGroup_ = new ui::CollapsibleGroup(tr("Map Settings"), this); |    p->mapSettingsGroup_ = new ui::CollapsibleGroup(tr("Map Settings"), this); | ||||||
|    p->mapSettingsGroup_->GetContentsLayout()->addWidget(ui->mapStyleLabel); |    p->mapSettingsGroup_->GetContentsLayout()->addWidget(ui->mapStyleLabel); | ||||||
|    p->mapSettingsGroup_->GetContentsLayout()->addWidget(ui->mapStyleComboBox); |    p->mapSettingsGroup_->GetContentsLayout()->addWidget(ui->mapStyleComboBox); | ||||||
|  |    p->mapSettingsGroup_->GetContentsLayout()->addWidget( | ||||||
|  |       ui->trackLocationCheckBox); | ||||||
|    ui->radarToolboxScrollAreaContents->layout()->replaceWidget( |    ui->radarToolboxScrollAreaContents->layout()->replaceWidget( | ||||||
|       ui->mapSettingsGroupBox, p->mapSettingsGroup_); |       ui->mapSettingsGroupBox, p->mapSettingsGroup_); | ||||||
|    ui->mapSettingsGroupBox->setVisible(false); |    ui->mapSettingsGroupBox->setVisible(false); | ||||||
|  |    ui->trackLocationCheckBox->setChecked( | ||||||
|  |       settings::GeneralSettings::Instance().track_location().GetValue()); | ||||||
| 
 | 
 | ||||||
|    // Add Level 2 Products
 |    // Add Level 2 Products
 | ||||||
|    p->level2ProductsGroup_ = |    p->level2ProductsGroup_ = | ||||||
|  | @ -846,6 +862,24 @@ void MainWindowImpl::ConnectOtherSignals() | ||||||
|                  } |                  } | ||||||
|               } |               } | ||||||
|            }); |            }); | ||||||
|  |    connect(mainWindow_->ui->trackLocationCheckBox, | ||||||
|  |            &QCheckBox::stateChanged, | ||||||
|  |            mainWindow_, | ||||||
|  |            [this](int state) | ||||||
|  |            { | ||||||
|  |               bool trackingEnabled = (state == Qt::CheckState::Checked); | ||||||
|  | 
 | ||||||
|  |               settings::GeneralSettings::Instance().track_location().StageValue( | ||||||
|  |                  trackingEnabled); | ||||||
|  | 
 | ||||||
|  |               for (std::size_t i = 0; i < maps_.size(); ++i) | ||||||
|  |               { | ||||||
|  |                  // maps_[i]->SetTrackLocation(trackingEnabled);
 | ||||||
|  |               } | ||||||
|  | 
 | ||||||
|  |               // Turn on location tracking (location manager)
 | ||||||
|  |               positionManager_->TrackLocation(uuid_, trackingEnabled); | ||||||
|  |            }); | ||||||
|    connect(level2ProductsWidget_, |    connect(level2ProductsWidget_, | ||||||
|            &ui::Level2ProductsWidget::RadarProductSelected, |            &ui::Level2ProductsWidget::RadarProductSelected, | ||||||
|            mainWindow_, |            mainWindow_, | ||||||
|  |  | ||||||
|  | @ -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>22</height> | ||||||
|     </rect> |     </rect> | ||||||
|    </property> |    </property> | ||||||
|    <widget class="QMenu" name="menuFile"> |    <widget class="QMenu" name="menuFile"> | ||||||
|  | @ -142,7 +142,7 @@ | ||||||
|           <x>0</x> |           <x>0</x> | ||||||
|           <y>0</y> |           <y>0</y> | ||||||
|           <width>157</width> |           <width>157</width> | ||||||
|           <height>702</height> |           <height>697</height> | ||||||
|          </rect> |          </rect> | ||||||
|         </property> |         </property> | ||||||
|         <layout class="QVBoxLayout" name="verticalLayout_6"> |         <layout class="QVBoxLayout" name="verticalLayout_6"> | ||||||
|  | @ -244,6 +244,13 @@ | ||||||
|             <item> |             <item> | ||||||
|              <widget class="QComboBox" name="mapStyleComboBox"/> |              <widget class="QComboBox" name="mapStyleComboBox"/> | ||||||
|             </item> |             </item> | ||||||
|  |             <item> | ||||||
|  |              <widget class="QCheckBox" name="trackLocationCheckBox"> | ||||||
|  |               <property name="text"> | ||||||
|  |                <string>Track Location</string> | ||||||
|  |               </property> | ||||||
|  |              </widget> | ||||||
|  |             </item> | ||||||
|            </layout> |            </layout> | ||||||
|           </widget> |           </widget> | ||||||
|          </item> |          </item> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat