Example #1
0
void AmazonProviderWidget::loadData()
{
  AWSSettings awsSettings;

  m_accessKeyLineEdit->setText(awsSettings.accessKey().c_str());

  m_secretKeyLineEdit->setText(awsSettings.secretKey().c_str());

  m_cloudDialog->m_iAcceptCheckBox->setChecked(awsSettings.userAgreementSigned()); 

  if (!m_regionComboBox->count()) {
    for (const std::string & region : AWSProvider::availableRegions()) {
      m_regionComboBox->addItem(region.c_str());
    }
  }

  int index = m_regionComboBox->findText(awsSettings.region().c_str());
  if(index == -1){
    index = m_regionComboBox->findText(AWSProvider::defaultRegion().c_str());
  }
  m_regionComboBox->setCurrentIndex(index);


  if (!m_serverInstanceTypeComboBox->count()) {
    for (const std::string & serverInstanceType : AWSProvider::serverInstanceTypes()) {
      m_serverInstanceTypeComboBox->addItem(serverInstanceType.c_str());
    }
  }

  index = m_serverInstanceTypeComboBox->findText(awsSettings.serverInstanceType().c_str());
  if(index == -1){
    index = m_serverInstanceTypeComboBox->findText(AWSProvider::defaultServerInstanceType().c_str());
  }
  m_serverInstanceTypeComboBox->setCurrentIndex(index);

  if (!m_workerInstanceTypeComboBox->count()) {
    for (const std::string & workerInstanceType : AWSProvider::workerInstanceTypes()) {
      m_workerInstanceTypeComboBox->addItem(workerInstanceType.c_str());
    }
  }

  index = m_workerInstanceTypeComboBox->findText(awsSettings.workerInstanceType().c_str());
  if(index == -1){
    index = m_workerInstanceTypeComboBox->findText(AWSProvider::defaultWorkerInstanceType().c_str());
  }
  m_workerInstanceTypeComboBox->setCurrentIndex(index);

  QString temp;
  m_numberOfWorkerInstancesLineEdit->setText(temp.setNum(awsSettings.numWorkers()));

  //m_waitCheckBox->setChecked(awsSettings.terminationDelayEnabled());

  //m_waitLineEdit->setText(temp.setNum(awsSettings.terminationDelay()));
}
 AWSSettingsRecord_Impl::AWSSettingsRecord_Impl(const AWSSettings& awsSettings,
                                                ProjectDatabase& database)
   : CloudSettingsRecord_Impl(awsSettings, CloudSettingsRecordType::AWSSettingsRecord, database),
     m_userAgreementSigned(awsSettings.userAgreementSigned()),
     m_numWorkers(awsSettings.numWorkers()),
     m_terminationDelayEnabled(awsSettings.terminationDelayEnabled()),
     m_terminationDelay(awsSettings.terminationDelay()),
     m_region(awsSettings.region()),
     m_serverInstanceType(awsSettings.serverInstanceType()),
     m_workerInstanceType(awsSettings.workerInstanceType())
 {
 }