bool ActivityDiagram::deleteGlyph(int id) { Glyph *glyph = getGlyphById(id); // 切斷連結 vector<Glyph*> targetGlyphs = glyph->getTargets(); for (unsigned int i = 0; i < targetGlyphs.size(); i++) deleteConnection(id, targetGlyphs[i]->getId()); vector<Glyph*> sourceGlyphs = glyph->getSources(); for (unsigned int i = 0; i < sourceGlyphs.size(); i++) deleteConnection(sourceGlyphs[i]->getId(), id); // 從 _glyphs 中移除 for (unsigned int i = 0; i < _glyphs.size(); i++) { if (_glyphs[i] == glyph) { delete _glyphs[i]; _glyphs.erase(_glyphs.begin() + i); notify(); return true; } } notify(); return false; }
void Server::incomingConnection(qintptr socketDescriptor) { QTcpSocket *socket = new QTcpSocket(this); socket->setSocketDescriptor(socketDescriptor); connect(socket, SIGNAL(disconnected()), this, SLOT(deleteConnection())); connect(socket, SIGNAL(disconnected()), this, SIGNAL(newConnection())); connections << socket; }
void Connection::releaseConnection() { if(m_refCount > 0) //Reschedule it and try again. Scheduler::getInstance().addEvent(createSchedulerTask(SCHEDULER_MINTICKS, boost::bind(&Connection::releaseConnection, this))); else deleteConnection(); }
void Connection::releaseConnection() { LOGt("Connection::releaseConnection()"); if(m_refCount > 0) //Reschedule it and try again. server.scheduler().addTask(SchedulerTask::create(Milliseconds(SCHEDULER_MINTICKS), std::bind(&Connection::releaseConnection, this))); else deleteConnection(); }
QList<QAction*> QgsSLConnectionItem::actions() { QList<QAction*> lst; //QAction* actionEdit = new QAction( tr( "Edit..." ), this ); //connect( actionEdit, SIGNAL( triggered() ), this, SLOT( editConnection() ) ); //lst.append( actionEdit ); QAction* actionDelete = new QAction( tr( "Delete" ), this ); connect( actionDelete, SIGNAL( triggered() ), this, SLOT( deleteConnection() ) ); lst.append( actionDelete ); return lst; }
/*! Delete all the active connections. */ void Server::clearAllConnections () { list<ConnectionPtr> connections; list<ConnectionPtr>::iterator it; connectionsScheduler.getConnections (connections); try { for (it = connections.begin (); it != connections.end (); it++) deleteConnection (*it); } catch (...) { throw; }; }
// Destructor ConferenceEngineMediaInterface::~ConferenceEngineMediaInterface() { mLock.acquire(); ConferenceEngineMediaConnection* pMediaConnection = NULL; UtlSListIterator iterator(mMediaConnections); while ((pMediaConnection = (ConferenceEngineMediaConnection*) iterator())) { deleteConnection(pMediaConnection->getValue()) ; } mpConferenceEngine->GIPSConf_Terminate(); delete mpConferenceEngine ; mpConferenceEngine = NULL; mLock.release(); }
// 針對Connector跟其他三種進行刪除 void ERModel::deleteFunction( int componentID ) { Component* delComponent = searchComponent(componentID); string deleteComponentIDSet; if (delComponent->getType() != PARAMETER_CONNECTOR) { deleteComponentIDSet = deleteComponent(delComponent); } else { deleteConnection(delComponent); deleteComponentIDSet = Toolkit::integerToString(componentID); } // 刪除完畢,通知observer更新 notifyDeleteComplete(deleteComponentIDSet); }
bool OldNode::deleteConnectionsFrom(uint32 nodeID, OldGenericMap& theMap) { // Get index of connection from nodeID uint32 i = 0; while ( (i < getNbrConnections()) && (getEntryConnection(i)->getFromNode() != nodeID) ) { ++i; } // Remove if found if (i < getNbrConnections()) { deleteConnection(i, theMap); return true; } return false; }
void Server::acceptConnection() { if(sockets.count() < 4) { QTcpSocket * socket = tcpServer->nextPendingConnection(); emit error(QString("setting up new connection: %1").arg((int)socket)); sockets << socket; connect(socket, SIGNAL(readyRead()), this, SLOT(processRead())); connect(socket, SIGNAL(disconnected()), this, SLOT(deleteConnection())); connect(socket, SIGNAL(disconnected()), socket, SLOT(deleteLater())); socket->write(QString("ACCEPT\n").toAscii()); } else { QTcpSocket * socket = tcpServer->nextPendingConnection(); emit error("To much connections"); socket->write(QString("GET LOST\n").toAscii()); connect(socket, SIGNAL(disconnected()), socket, SLOT(deleteLater())); //socket->disconnectFromHost(); } }
void ControllerConnection::setController( Controller * _controller ) { if( m_ownsController && m_controller ) { delete m_controller; m_controller = NULL; } if( m_controller && m_controller->type() != Controller::DummyController ) { m_controller->removeConnection( this ); } if( !_controller ) { m_controller = Controller::create( Controller::DummyController, NULL ); } else { m_controller = _controller; } m_controllerId = -1; if( _controller->type() != Controller::DummyController ) { _controller->addConnection( this ); QObject::connect( _controller, SIGNAL( valueChanged() ), this, SIGNAL( valueChanged() ) ); } m_ownsController = ( _controller->type() == Controller::MidiController ); // If we don't own the controller, allow deletion of controller // to delete the connection if( !m_ownsController ) { QObject::connect( _controller, SIGNAL( destroyed() ), this, SLOT( deleteConnection() ) ); } }
PAPIConnection * newConnection( PAPIConnectionListener inConnectionListener, void * inUserData, PAPIListener inInternalListener, void * inInternalListenerData, PAPIStatus * outStatus ) { PAPIStatus theStatus; PAPIConnection * theConnection = 0; int theSocket = daemonConnect( 10 ); if ( theSocket == INVALID_SOCKET ) { *outStatus = PAPIConnectionFailure; } else { *outStatus = PAPISuccess; } if ( *outStatus == PAPISuccess || isDaemonEnabled() == 1 ) { theConnection = allocConnection( inConnectionListener, inUserData, inInternalListener, inInternalListenerData, theSocket, &theStatus ); if ( theStatus == PAPISuccess ) { startListeningThread( theConnection, &theStatus ); } if ( theStatus != PAPISuccess ) { deleteConnection( theConnection ); theConnection = 0; *outStatus = theStatus; } } return theConnection; }
// Slot for deleting an existing connection void QgsOpenVectorLayerDialog::on_btnDelete_clicked() { deleteConnection(); }
/* * Constructs a DatabaseConnectionBase as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ DatabaseConnectionBase::DatabaseConnectionBase( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "DatabaseConnectionBase" ); setSizeGripEnabled( TRUE ); DatabaseConnectionBaseLayout = new QGridLayout( this, 1, 1, 11, 6, "DatabaseConnectionBaseLayout"); buttonNew = new QPushButton( this, "buttonNew" ); DatabaseConnectionBaseLayout->addWidget( buttonNew, 0, 1 ); listConnections = new QListBox( this, "listConnections" ); DatabaseConnectionBaseLayout->addMultiCellWidget( listConnections, 0, 4, 0, 0 ); buttonDelete = new QPushButton( this, "buttonDelete" ); DatabaseConnectionBaseLayout->addWidget( buttonDelete, 1, 1 ); Layout5 = new QHBoxLayout( 0, 0, 6, "Layout5"); buttonHelp = new QPushButton( this, "buttonHelp" ); buttonHelp->setAutoDefault( TRUE ); Layout5->addWidget( buttonHelp ); Horizontal_Spacing2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); Layout5->addItem( Horizontal_Spacing2 ); buttonClose = new QPushButton( this, "buttonClose" ); buttonClose->setAutoDefault( TRUE ); Layout5->addWidget( buttonClose ); DatabaseConnectionBaseLayout->addMultiCellLayout( Layout5, 5, 5, 0, 2 ); Spacer1 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); DatabaseConnectionBaseLayout->addMultiCell( Spacer1, 2, 4, 1, 1 ); grp = new QGroupBox( this, "grp" ); grp->setColumnLayout(0, Qt::Vertical ); grp->layout()->setSpacing( 6 ); grp->layout()->setMargin( 11 ); grpLayout = new QGridLayout( grp->layout() ); grpLayout->setAlignment( Qt::AlignTop ); Spacer3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); grpLayout->addItem( Spacer3, 0, 0 ); DatabaseConnectionBaseLayout->addMultiCellWidget( grp, 0, 2, 2, 2 ); Layout4 = new QHBoxLayout( 0, 0, 6, "Layout4"); Spacer4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); Layout4->addItem( Spacer4 ); buttonConnect = new QPushButton( this, "buttonConnect" ); buttonConnect->setEnabled( FALSE ); Layout4->addWidget( buttonConnect ); Spacer5 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); Layout4->addItem( Spacer5 ); DatabaseConnectionBaseLayout->addLayout( Layout4, 3, 2 ); Spacer6 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); DatabaseConnectionBaseLayout->addItem( Spacer6, 4, 2 ); languageChange(); resize( QSize(512, 309).expandedTo(minimumSizeHint()) ); clearWState( WState_Polished ); // signals and slots connections connect( buttonClose, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( buttonNew, SIGNAL( clicked() ), this, SLOT( newConnection() ) ); connect( buttonDelete, SIGNAL( clicked() ), this, SLOT( deleteConnection() ) ); connect( buttonConnect, SIGNAL( clicked() ), this, SLOT( doConnect() ) ); connect( listConnections, SIGNAL( highlighted(const QString&) ), this, SLOT( currentConnectionChanged(const QString&) ) ); connect( listConnections, SIGNAL( selected(const QString&) ), this, SLOT( currentConnectionChanged(const QString&) ) ); // tab order setTabOrder( buttonClose, listConnections ); setTabOrder( listConnections, buttonNew ); setTabOrder( buttonNew, buttonDelete ); setTabOrder( buttonDelete, buttonConnect ); setTabOrder( buttonConnect, buttonHelp ); init(); }
// Slot for deleting an existing connection void QgsOgrSourceSelect::on_btnDelete_clicked() { deleteConnection(); }
// Delete button -> clicked void MainWindow::on_connectionsDeleteButton_clicked(){ deleteConnection(); }
// === CONTEXT MENU === // Connections context menu -> delete void MainWindow::on_actionDeleteConnection_triggered(){ deleteConnection(); }