Esempio n. 1
0
void EwFirstPage::browse()
{
  QMap<ExportWizard::Format, QString> formats;
  formats[ExportWizard::CsvFormat]  = tr("CSV file (*.csv)");
  formats[ExportWizard::HtmlFormat] = tr("HTML file (*.html)");
  formats[ExportWizard::SqlFormat]  = tr("SQL file (*.sql)");

  pathLineEdit->setText(
      QFileDialog::getSaveFileName(this,
                                   tr("Output file"),
                                   QDir::homePath(),
                                   QStringList(formats.values()).join(";;"),
                                   &formats[selectedFormat()]
                                   ));
  lastPath = pathLineEdit->text();

  if(pathLineEdit->text().endsWith("csv", Qt::CaseInsensitive))
    csvRadioButton->setChecked(true);

  if(pathLineEdit->text().endsWith("html", Qt::CaseInsensitive))
    htmlRadioButton->setChecked(true);

  if(pathLineEdit->text().endsWith("sql", Qt::CaseInsensitive))
    sqlRadioButton->setChecked(true);
}
Esempio n. 2
0
void QgsWCSSourceSelect::addClicked()
{
  QgsDebugMsg( "entered" );
  QgsDataSourceURI uri = mUri;

  QString identifier = selectedIdentifier();
  if ( identifier.isEmpty() ) { return; }

  uri.setParam( "identifier", identifier );

  // Set crs only if necessary (multiple offered), so that we can decide in the
  // provider if WCS 1.0 with RESPONSE_CRS has to be used.  Not perfect, they can
  // add more CRS in future and URI will be saved in project without any.
  // TODO: consider again, currently if crs in url is used to set WCS coverage CRS,
  //       without that param user is asked for CRS
  //if ( selectedLayersCRSs().size() > 1 )
  //{
  uri.setParam( "crs", selectedCRS() );
  //}

  QgsDebugMsg( "selectedFormat = " +  selectedFormat() );
  if ( !selectedFormat().isEmpty() )
  {
    uri.setParam( "format", selectedFormat() );
  }

  QgsDebugMsg( "selectedTime = " +  selectedTime() );
  if ( !selectedTime().isEmpty() )
  {
    uri.setParam( "time", selectedTime() );
  }

  QString cache;
  QgsDebugMsg( QString( "selectedCacheLoadControl = %1" ).arg( selectedCacheLoadControl() ) );
  cache = QgsNetworkAccessManager::cacheLoadControlName( selectedCacheLoadControl() );
  uri.setParam( "cache", cache );

  emit addRasterLayer( uri.encodedUri(), identifier, "wcs" );
}
Esempio n. 3
0
void QgsWCSSourceSelect::updateButtons()
{

  if ( mLayersTreeWidget->selectedItems().isEmpty() )
  {
    showStatusMessage( tr( "Select a layer" ) );
  }
  else
  {
    if ( selectedCrs().isEmpty() )
    {
      showStatusMessage( tr( "No CRS selected" ) );
    }
  }

  emit enableButtons( !mLayersTreeWidget->selectedItems().isEmpty() && !selectedCrs().isEmpty() && !selectedFormat().isEmpty() );
}
Esempio n. 4
0
void QgsWCSSourceSelect::updateButtons()
{
  QgsDebugMsg( "entered" );

  if ( mLayersTreeWidget->selectedItems().isEmpty() )
  {
    showStatusMessage( tr( "Select a layer" ) );
  }
  else
  {
    if ( selectedCRS().isEmpty() )
    {
      showStatusMessage( tr( "No CRS selected" ) );
    }
  }

  mAddButton->setEnabled( !mLayersTreeWidget->selectedItems().isEmpty() && !selectedCRS().isEmpty() && !selectedFormat().isEmpty() );
}