Ejemplo n.º 1
0
void SourceAddDialog::openDataSource()
{
  ui->BrowseButton->setEnabled(false);
  ui->ConnectButton->setEnabled(false);
  ui->URLLineEdit->setEnabled(false);
  ui->LayersTableWidget->setEnabled(false);
  ui->ButtonBox->setEnabled(false);
  ui->StatusProgressBar->setValue(0);
  ui->LayersTableWidget->setRowCount(0);
  ui->StatusProgressBar->setTextVisible(false);
  ui->StatusProgressBar->setVisible(true);
  ui->StatusLabel->setText(tr("Connecting to source"));
  setCursor(Qt::WaitCursor);


  QThread* WThread = new QThread;
  SourceWorker* Worker = new SourceWorker(m_CurrentSourceURI,mp_DataSource);
  Worker->moveToThread(WThread);

  connect(Worker, SIGNAL(finished()), this, SLOT(handleSourceFinished()));
  connect(Worker, SIGNAL(sourceLinked(void*)), this, SLOT(handleSourceLinked(void*)));
  connect(Worker, SIGNAL(layerCounted(int)), this, SLOT(handleLayerCounted(int)));
  connect(Worker, SIGNAL(layerFetched(int,QString,QString)), this, SLOT(handleLayerFetched(int,QString,QString)));
  connect(Worker, SIGNAL(errorHappened(QString)), this, SLOT(handleSourceError(QString)));
  connect(WThread, SIGNAL(started()), Worker, SLOT(run()));
  connect(Worker, SIGNAL(finished()), WThread, SLOT(quit()));
  connect(Worker, SIGNAL(finished()), Worker, SLOT(deleteLater()));
  connect(WThread, SIGNAL(finished()), WThread, SLOT(deleteLater()));

  WThread->start();
}
Ejemplo n.º 2
0
	SourceErrorHandler::SourceErrorHandler (SourceObject *source, IEntityManager *iem)
	: QObject { source }
	, Source_ { source }
	, IEM_ { iem }
	{
		connect (Source_,
				SIGNAL (error (QString, SourceError)),
				this,
				SLOT (handleSourceError (QString, SourceError)));
	}