Esempio n. 1
0
void QgsWFSSourceSelect::deleteEntryOfServerList()
{
  QString msg = tr( "Are you sure you want to remove the %1 connection and all associated settings?" )
                .arg( cmbConnections->currentText() );
  QMessageBox::StandardButton result = QMessageBox::information( this, tr( "Confirm Delete" ), msg, QMessageBox::Ok | QMessageBox::Cancel );
  if ( result == QMessageBox::Ok )
  {
    QgsWFSConnection::deleteConnection( cmbConnections->currentText() );
    cmbConnections->removeItem( cmbConnections->currentIndex() );
    emit connectionsChanged();

    if ( cmbConnections->count() > 0 )
    {
      // Connections available - enable various buttons
      btnConnect->setEnabled( true );
      btnEdit->setEnabled( true );
      btnDelete->setEnabled( true );
      btnSave->setEnabled( true );
    }
    else
    {
      // No connections available - disable various buttons
      btnConnect->setEnabled( false );
      btnEdit->setEnabled( false );
      btnDelete->setEnabled( false );
      btnSave->setEnabled( false );
    }
  }
}
Esempio n. 2
0
void QgsWFSSourceSelect::modifyEntryOfServerList()
{
  QgsNewHttpConnection nc( nullptr, QgsWFSConstants::CONNECTIONS_WFS, cmbConnections->currentText() );
  nc.setWindowTitle( tr( "Modify WFS connection" ) );

  if ( nc.exec() )
  {
    populateConnectionList();
    emit connectionsChanged();
  }
}
void QgsArcGisServiceSourceSelect::modifyEntryOfServerList()
{
  QgsNewHttpConnection nc( nullptr, QgsNewHttpConnection::ConnectionOther, QStringLiteral( "qgis/connections-%1/" ).arg( mServiceName.toLower() ), cmbConnections->currentText() );
  nc.setWindowTitle( tr( "Modify %1 Connection" ).arg( mServiceName ) );

  if ( nc.exec() )
  {
    populateConnectionList();
    emit connectionsChanged();
  }
}
Esempio n. 4
0
void QgsWFSSourceSelect::addEntryToServerList()
{
  QgsNewHttpConnection nc( nullptr, QgsWFSConstants::CONNECTIONS_WFS );
  nc.setWindowTitle( tr( "Create a new WFS connection" ) );

  if ( nc.exec() )
  {
    populateConnectionList();
    emit connectionsChanged();
  }
}
void QgsArcGisServiceSourceSelect::addEntryToServerList()
{
  QgsNewHttpConnection nc( nullptr, QgsNewHttpConnection::ConnectionOther, QStringLiteral( "qgis/connections-%1/" ).arg( mServiceName.toLower() ) );
  nc.setWindowTitle( tr( "Create a New %1 Connection" ).arg( mServiceName ) );

  if ( nc.exec() )
  {
    populateConnectionList();
    emit connectionsChanged();
  }
}
Esempio n. 6
0
void QgsWFSSourceSelect::modifyEntryOfServerList()
{
  QgsNewHttpConnection* nc = new QgsNewHttpConnection( this, QgsWFSConstants::CONNECTIONS_WFS, cmbConnections->currentText() );
  nc->setAttribute( Qt::WA_DeleteOnClose );
  nc->setWindowTitle( tr( "Modify WFS connection" ) );

  // For testability, do not use exec()
  if ( !property( "hideDialogs" ).toBool() )
    nc->open();
  connect( nc, SIGNAL( accepted() ), this, SLOT( populateConnectionList() ) );
  connect( nc, SIGNAL( accepted() ), this, SIGNAL( connectionsChanged() ) );
}
SingleSourceOrchestrator::SingleSourceOrchestrator(BlocksSource *source, QObject *parent) :
    SourcesOrchestatorAbstract(parent),
    source(source)
{
    hasDirection = true;
    if (source != nullptr) {

        forwarder = source->isReflexive();

        connect(this, SIGNAL(startChildren()), source, SLOT(startListening()), Qt::QueuedConnection);
        connect(this, SIGNAL(stopChildren()), source, SLOT(stopListening()), Qt::QueuedConnection);
        connect(this, SIGNAL(resetChildren()), source, SLOT(restart()), Qt::QueuedConnection);
        connect(source, SIGNAL(started()), SIGNAL(started()));
        connect(source, SIGNAL(stopped()), SIGNAL(stopped()));
        connect(source, SIGNAL(destroyed(QObject*)), this, SLOT(onBlockSourceDestroyed()));
        connect(source, SIGNAL(blockReceived(Block*)), SLOT(onBlockReceived(Block*)));
        connect(source, SIGNAL(reflexionChanged(bool)), this, SLOT(sourceReflexionChanged(bool)));
        connect(source, SIGNAL(log(QString,QString,Pip3lineConst::LOGLEVEL)), this, SIGNAL(log(QString,QString,Pip3lineConst::LOGLEVEL)), Qt::QueuedConnection);
        connect(source, SIGNAL(updated()), this, SIGNAL(connectionsChanged()), Qt::QueuedConnection);
        connect(source, SIGNAL(newConnection(BlocksSource*)), this, SIGNAL(connectionsChanged()), Qt::QueuedConnection);
        connect(source, SIGNAL(connectionClosed(BlocksSource*)), this, SIGNAL(connectionsChanged()), Qt::QueuedConnection);
    }
Esempio n. 8
0
void QgsWFSSourceSelect::on_btnLoad_clicked()
{
  QString fileName = QFileDialog::getOpenFileName( this, tr( "Load connections" ), QDir::homePath(),
                     tr( "XML files (*.xml *XML)" ) );
  if ( fileName.isEmpty() )
  {
    return;
  }

  QgsManageConnectionsDialog dlg( this, QgsManageConnectionsDialog::Import, QgsManageConnectionsDialog::WFS, fileName );
  dlg.exec();
  populateConnectionList();
  emit connectionsChanged();
}
void ConnectionEditor::disconnectClicked()
{
    QListViewItem *i = connectionView->currentItem();
    if ( !i )
	return;

    QMap<QListViewItem*, Connection>::Iterator it = connections.find( i );
    if ( it != connections.end() )
	connections.remove( it );
    delete i;
    if ( connectionView->currentItem() )
	connectionView->setSelected( connectionView->currentItem(), TRUE );
    connectionsChanged();
}
Esempio n. 10
0
ConnectionEditor::ConnectionEditor( QWidget *parent, QObject* sndr, QObject* rcvr, FormWindow *fw )
    : ConnectionEditorBase( parent, 0, TRUE ), formWindow( fw )
{
    connect( helpButton, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) );
    if ( rcvr == formWindow )
	rcvr = formWindow->mainContainer();
    if ( sndr == formWindow )
	sndr = formWindow->mainContainer();
    sender = sndr;
    receiver = rcvr;

    QStrList sigs = sender->metaObject()->signalNames( TRUE );
    sigs.remove( "destroyed()" );
    signalBox->insertStrList( sigs );

    if ( sender->inherits( "CustomWidget" ) ) {
	MetaDataBase::CustomWidget *w = ( (CustomWidget*)sender )->customWidget();
	for ( QValueList<QCString>::Iterator it = w->lstSignals.begin(); it != w->lstSignals.end(); ++it )
	    signalBox->insertItem( QString( *it ) );
    }

    labelSignal->setText( tr( "Signals (%1):" ).arg( sender->name() ) );
    labelSlot->setText( tr( "Slots (%1):" ).arg( receiver->name() ) );

    signalBox->setCurrentItem( signalBox->firstItem() );

    oldConnections = MetaDataBase::connections( formWindow, sender, receiver );
    if ( !oldConnections.isEmpty() ) {
	QValueList<MetaDataBase::Connection>::Iterator it = oldConnections.begin();
	for ( ; it != oldConnections.end(); ++it ) {
	    if ( formWindow->isMainContainer( (QWidget*)(*it).receiver ) && !MetaDataBase::hasSlot( formWindow, (*it).slot ) )
		continue;
	    MetaDataBase::Connection conn = *it;
	    QListViewItem *i = new QListViewItem( connectionView );
	    i->setText( 0, conn.sender->name() );
	    i->setText( 1, conn.signal );
	    i->setText( 2, conn.receiver->name() );
	    i->setText( 3, conn.slot );
	    Connection c;
	    c.signal = conn.signal;
	    c.slot = conn.slot;
	    this->connections.insert( i, c );
	}
    }

    connectionsChanged();
    connectButton->setEnabled( FALSE );
    buttonAddSlot->setEnabled( receiver == fw->mainContainer() );
}
void QgsArcGisServiceSourceSelect::deleteEntryOfServerList()
{
  QString msg = tr( "Are you sure you want to remove the %1 connection and all associated settings?" )
                .arg( cmbConnections->currentText() );
  QMessageBox::StandardButton result = QMessageBox::question( this, tr( "Confirm Delete" ), msg, QMessageBox::Yes | QMessageBox::No );
  if ( result == QMessageBox::Yes )
  {
    QgsOwsConnection::deleteConnection( mServiceName, cmbConnections->currentText() );
    cmbConnections->removeItem( cmbConnections->currentIndex() );
    emit connectionsChanged();
    bool connectionsAvailable = cmbConnections->count() > 0;
    btnConnect->setEnabled( connectionsAvailable );
    btnEdit->setEnabled( connectionsAvailable );
    btnDelete->setEnabled( connectionsAvailable );
    btnSave->setEnabled( connectionsAvailable );
  }
}
Esempio n. 12
0
void QNetworkManagerInterfaceDevice::propertiesSwap(QMap<QString,QVariant> map)
{
    QMapIterator<QString, QVariant> i(map);
    while (i.hasNext()) {
        i.next();
        if (i.key() == QStringLiteral("AvailableConnections")) { //Device
            const QDBusArgument &dbusArgs = i.value().value<QDBusArgument>();
            QDBusObjectPath path;
            QStringList paths;
            dbusArgs.beginArray();
            while (!dbusArgs.atEnd()) {
                dbusArgs >> path;
                paths << path.path();
            }
            dbusArgs.endArray();
            Q_EMIT connectionsChanged(paths);
        }
        propertyMap.insert(i.key(),i.value());
    }
    Q_EMIT propertiesChanged(map);
}
Esempio n. 13
0
File: server.cpp Progetto: otri/vive
// Check to see if all connections are alive, if not remove them from the list
// returns number of active connections.
int MyServer::checkAlive()
{
    listMutex.lock();

    bool done = false;
    bool modified = false;
	int  ret = 0;

    while(!done)
    {
        done = true;

        for(QList<ServerConnection*>::iterator i = connections.begin(); i != connections.end(); i++)
        {
            QTcpSocket *s = (*i)->socket;
            if(s->state() == QAbstractSocket::UnconnectedState)
            {
                emit outMessage(QString("Disconnected: %1").arg((*i)->str()));
                done = false;
                modified = true;
                delete *i;
                connections.erase(i);
                break;
            }

			if(s->state() == QAbstractSocket::ConnectedState)
				ret++;
        }

    }
    listMutex.unlock();

    if(modified) 
		emit connectionsChanged();

	return ret;
}
Esempio n. 14
0
File: server.cpp Progetto: otri/vive
// There is a new connection, server sends newConnection signal to me.
void MyServer::newConnection()
{
    bool change = false;
    while(1)
    {
        QTcpSocket *socket = server->nextPendingConnection();
        if(socket == NULL) break;

        change = true;

        ServerConnection *con = new ServerConnection(socket, this);

        listMutex.lock();
        connections.append(con);
        listMutex.unlock();

        emit outMessage(QString("Connection from: ") + con->str());
    }

    if(change)
    {
        emit connectionsChanged();
    }
}