Move updater setup to separate function
This commit is contained in:
		
							parent
							
								
									c2a1dab1c7
								
							
						
					
					
						commit
						87987f4a71
					
				@ -72,18 +72,7 @@ void Manager::updateSettings()
 | 
			
		||||
  LTRACE() << "updateSettings";
 | 
			
		||||
  SOFT_ASSERT(settings_, return );
 | 
			
		||||
  setupProxy(*settings_);
 | 
			
		||||
 | 
			
		||||
  updater_->model()->setExpansions({
 | 
			
		||||
      {"$translators$", settings_->translatorsDir},
 | 
			
		||||
      {"$tessdata$", settings_->tessdataPath},
 | 
			
		||||
  });
 | 
			
		||||
  if (settings_->autoUpdateIntervalDays > 0) {
 | 
			
		||||
    updateAutoChecker_ = std::make_unique<update::AutoChecker>(*updater_);
 | 
			
		||||
    updateAutoChecker_->setLastCheckDate(settings_->lastUpdateCheck);
 | 
			
		||||
    updateAutoChecker_->setCheckIntervalDays(settings_->autoUpdateIntervalDays);
 | 
			
		||||
  } else {
 | 
			
		||||
    updateAutoChecker_.reset();
 | 
			
		||||
  }
 | 
			
		||||
  setupUpdates(*settings_);
 | 
			
		||||
 | 
			
		||||
  tray_->updateSettings();
 | 
			
		||||
  capturer_->updateSettings();
 | 
			
		||||
@ -118,6 +107,22 @@ void Manager::setupProxy(const Settings &settings)
 | 
			
		||||
  QNetworkProxy::setApplicationProxy(proxy);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Manager::setupUpdates(const Settings &settings)
 | 
			
		||||
{
 | 
			
		||||
  updater_->model()->setExpansions({
 | 
			
		||||
      {"$translators$", settings.translatorsDir},
 | 
			
		||||
      {"$tessdata$", settings.tessdataPath},
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  if (settings.autoUpdateIntervalDays > 0) {
 | 
			
		||||
    updateAutoChecker_ = std::make_unique<update::AutoChecker>(*updater_);
 | 
			
		||||
    updateAutoChecker_->setLastCheckDate(settings.lastUpdateCheck);
 | 
			
		||||
    updateAutoChecker_->setCheckIntervalDays(settings.autoUpdateIntervalDays);
 | 
			
		||||
  } else {
 | 
			
		||||
    updateAutoChecker_.reset();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Manager::finishTask(const TaskPtr &task)
 | 
			
		||||
{
 | 
			
		||||
  SOFT_ASSERT(task, return );
 | 
			
		||||
 | 
			
		||||
@ -29,6 +29,7 @@ public:
 | 
			
		||||
private:
 | 
			
		||||
  void updateSettings();
 | 
			
		||||
  void setupProxy(const Settings &settings);
 | 
			
		||||
  void setupUpdates(const Settings &settings);
 | 
			
		||||
  void finishTask(const TaskPtr &task);
 | 
			
		||||
 | 
			
		||||
  std::unique_ptr<Settings> settings_;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user