Пример #1
0
// ---------------------------------------------------------------------------
// PosSettingsForm::PosSettingsForm
// Constructor
// ---------------------------------------------------------------------------
PosSettingsForm::PosSettingsForm(
    PosSettingsEngine& settingsEngine,
    QGraphicsItem *parent ):
    HbDataForm( parent ),mSettingsEngine( settingsEngine )
{
    qDebug() << "+ PosSettingsForm::PosSettingsForm()";
    //initialize the form model
    initSettingModel();

    // slots for required signals on required controls
    addConnection( mGpsPosType, SIGNAL(released()),
                   this, SLOT(onPressedGps()) );
    addConnection( mWirelessPosType, SIGNAL(released()),
                   this, SLOT(onPressedWireless()) );
    addConnection( mBgPosType, SIGNAL(released()),
                   this, SLOT(onPressedBackground()) );
    addConnection( mAdvancedSettings, SIGNAL(clicked()),
                   this, SLOT(onPressedAdvanced()) );

    //to check runtime if any positioning technology installed/removed or if its visibility is changed.
    connect(&mSettingsEngine, SIGNAL(positionTechnologyChange()),this, SLOT(validateVisibility()) );

    //validate visibility of controls based on visibility of positioning technology
    validateVisibility();
    qDebug() << "- PosSettingsForm::PosSettingsForm()";
}
Пример #2
0
void NodeGraphDisplay::startConnectingNodes(NodeControl *from_node, NCID *connector)
{
	if(!draggedNode)
	{
		std::cout << "STARTING CONNECTION...\n";

		draggedNode = from_node;

		NCID nc_id;
		NodeConnectionType type;

		if(connector && *connector)
		{
			draggedConnector = *connector;
			nc_id = draggedConnector;
			type = NodeConnector::getNodeConnector(draggedConnector)->ioType;
		}
		else
		{
			draggedConnector = 0;
			nc_id = from_node->getDefaultConnector()->getId();
			type = NodeConnector::getNodeConnector(nc_id)->ioType;
		}

		if(type == NodeConnectionType::DATA_INPUT || type == NodeConnectionType::INFO_INPUT)
			addConnection(nullptr, from_node, 0, nc_id);
		else
			addConnection(from_node, nullptr, nc_id, 0);

		connectionIndex = connections.size() - 1;
	}
}
Пример #3
0
void ProcessorGraph::clearConnections()
{

    for (int i = 0; i < getNumNodes(); i++)
    {
        Node* node = getNode(i);
        int nodeId = node->nodeId;

        if (nodeId != OUTPUT_NODE_ID)
        {

            if (nodeId != RECORD_NODE_ID && nodeId != AUDIO_NODE_ID)
            {
                disconnectNode(node->nodeId);
            }

            GenericProcessor* p = (GenericProcessor*) node->getProcessor();
            p->resetConnections();

        }
    }

    // connect audio subnetwork
    for (int n = 0; n < 2; n++)
    {

        addConnection(AUDIO_NODE_ID, n,
                      OUTPUT_NODE_ID, n);

    }

    addConnection(MESSAGE_CENTER_ID, midiChannelIndex,
                  RECORD_NODE_ID, midiChannelIndex);
}
Пример #4
0
	virtual void internalTransition(const vle::devs::Time& /*time*/)
	{
		if (mSended == false) {
			// Ajout des connexions mod�le coupl� -> mod�le sum
			const vle::vpz::ConnectionList& inputs = coupledmodel().getInputPortList();
			vle::vpz::ConnectionList::const_iterator it;
			
			/* DEBUG : affiche les connections
			for (it = inputs.begin(); it != inputs.end(); ++it) {
				std::cout << "model: " << getModel().getParentName() << it->first << std::endl;
			}*/
			
			for (it = inputs.begin(); it != inputs.end(); ++it) {
				if (it->first.size() >= 5 and it->first.compare(0, 5, "node-") == 0) {
					addInputPort("Deposition", it->first);
					addConnection(coupledmodelName(), it->first, "Deposition", it->first);
					mPortList.push_back(it->first);
				}
			}

			// Pour les mod�les sans d�pendances
			if (mPortList.empty()){
				createModelFromClass("node-init", "node-init");
				//delModel("Deposition");
				removeConnection("Deposition", "update", "Unit", "in");	
				addConnection("node-init", "update", "Unit", "in");
			}
			mSended = true;
		} else {
			mSended = false;
		}
    }
Пример #5
0
void ProcessorGraph::connectProcessors(GenericProcessor* source, GenericProcessor* dest)
{

    if (source == nullptr || dest == nullptr)
        return;

    std::cout << "     Connecting " << source->getName() << " " << source->getNodeId(); //" channel ";
    std::cout << " to " << dest->getName() << " " << dest->getNodeId() << std::endl;

    // 1. connect continuous channels
    for (int chan = 0; chan < source->getNumOutputs(); chan++)
    {
        //std::cout << chan << " ";

        addConnection(source->getNodeId(),         // sourceNodeID
                      chan,                        // sourceNodeChannelIndex
                      dest->getNodeId(),           // destNodeID
                      dest->getNextChannel(true)); // destNodeChannelIndex
    }

    // std::cout << "     Connecting " << source->getName() <<
    //           " event channel to " <<
    //           dest->getName() << std::endl;

    // 2. connect event channel
    addConnection(source->getNodeId(),    // sourceNodeID
                  midiChannelIndex,       // sourceNodeChannelIndex
                  dest->getNodeId(),      // destNodeID
                  midiChannelIndex);      // destNodeChannelIndex

}
Пример #6
0
// ---------------------------------------------------------------------------
// PosSettingsForm::addPosTypeConnection
// ---------------------------------------------------------------------------
void PosSettingsForm::addPosTypeConnection(HbDataFormModelItem*  posTypeModelItem)
{
    qDebug() << "+ PosSettingsForm::addPosTypeConnection()";
    if(posTypeModelItem == mGpsPosType)
    {
        addConnection( mGpsPosType, SIGNAL(released()),
                       this, SLOT(onPressedGps()) );
        qDebug() << "- PosSettingsForm::addPosTypeConnection()";
        return;
    }

    if(posTypeModelItem == mWirelessPosType)
    {
        addConnection( mWirelessPosType, SIGNAL(released()),
                       this, SLOT(onPressedWireless()) );
        qDebug() << "- PosSettingsForm::addPosTypeConnection()";
        return;
    }
    if(posTypeModelItem == mBgPosType)
    {
        addConnection( mBgPosType, SIGNAL(released()),
                       this, SLOT(onPressedBackground()) );
        qDebug() << "- PosSettingsForm::addPosTypeConnection()";
        return;
    }
}
Пример #7
0
void ConnectionManager::addConnectionNode(Connection *c, int point, int x, int y, std::vector<QPoint> &points) {
	ConnectionNode *node = new ConnectionNode();
	node->setX(NORM(x) - node->width()/2);
	node->setY(NORM(y) - node->height()/2);

	std::vector<QPoint> newPoints;
	newPoints.push_back(QPoint(NORM(x), NORM(y)));
	while (c->points.size() != point + 1) {
		qDebug() << c->points[point + 1];
		newPoints.push_back(c->points[point + 1]);
		c->points.erase(c->points.begin() + point + 1);
	}

	m_screen->addObject(node);

	int addpin1 = 0;
	int addpin2 = 0;
	int addpin3 = 0;
#define PINPOS(POINT, VAR)\
qDebug() << abs(POINT.y() - NORM(y)) << abs(POINT.x() - NORM(x));\
if (abs(POINT.y() - NORM(y)) < abs(POINT.x() - NORM(x))) { \
	if (POINT.x() < NORM(x)) \
		VAR = 0; \
	else \
		VAR = 2; \
} \
else { \
	if (POINT.y() < NORM(y)) \
		VAR = 3; \
	else \
		VAR = 1; \
} \
qDebug() << VAR;

	qDebug() << newPoints[0] << newPoints[1] << newPoints[newPoints.size() - 1];
	PINPOS(c->points[c->points.size() - 2], addpin1);
	PINPOS(newPoints[newPoints.size() - 1], addpin2);
	PINPOS(points[points.size() - 2], addpin3);

	Connection *c2 = addConnection(node, addpin2, c->to, c->tpin, newPoints);
	node->setConnection(addpin2, c2);

	c->to = node;
	c->tpin = addpin1;

	movePins(c->to);
	movePins(c->from);

	node->setConnection(addpin1, c);

	Connection *c3 = addConnection(m_fromObject, m_fromPin, node, addpin3, points);
	node->setConnection(addpin3, c3);
}
 void connect(const std::string& new_agent)
 {
     for (auto existing_agent : mModels)
     {
         addConnection(new_agent,
                       "agent_output",
                       existing_agent,
                       "agent_input");
         addConnection(existing_agent,
                       "agent_output",
                       new_agent,
                       "agent_input");
     }
 }
Пример #9
0
void ProcessorGraph::connectProcessorToAudioAndRecordNodes(GenericProcessor* source)
{

    if (source == nullptr)
        return;

    getRecordNode()->registerProcessor(source);

    for (int chan = 0; chan < source->getNumOutputs(); chan++)
    {

        getAudioNode()->addInputChannel(source, chan);

        // THIS IS A HACK TO MAKE SURE AUDIO NODE KNOWS WHAT THE SAMPLE RATE SHOULD BE
        // IT CAN CAUSE PROBLEMS IF THE SAMPLE RATE VARIES ACROSS PROCESSORS

		//TODO: See if this causes problems with the newer architectures
        //getAudioNode()->settings.sampleRate = source->getSampleRate();

        addConnection(source->getNodeId(),                   // sourceNodeID
                      chan,                                  // sourceNodeChannelIndex
                      AUDIO_NODE_ID,                         // destNodeID
                      getAudioNode()->getNextChannel(true)); // destNodeChannelIndex

        getRecordNode()->addInputChannel(source, chan);

        addConnection(source->getNodeId(),                    // sourceNodeID
                      chan,                                   // sourceNodeChannelIndex
                      RECORD_NODE_ID,                         // destNodeID
                      getRecordNode()->getNextChannel(true)); // destNodeChannelIndex

    }

    // connect event channel
    addConnection(source->getNodeId(),    // sourceNodeID
                  midiChannelIndex,       // sourceNodeChannelIndex
                  RECORD_NODE_ID,         // destNodeID
                  midiChannelIndex);      // destNodeChannelIndex

    // connect event channel
    addConnection(source->getNodeId(),    // sourceNodeID
                  midiChannelIndex,       // sourceNodeChannelIndex
                  AUDIO_NODE_ID,          // destNodeID
                  midiChannelIndex);      // destNodeChannelIndex


    getRecordNode()->addInputChannel(source, midiChannelIndex);

}
Пример #10
0
bool TCPSrcGUI::handleMessage(const Message& message)
{
	qDebug() << "TCPSrcGUI::handleMessage";

	if (TCPSrc::MsgTCPSrcConnection::match(message))
	{
		TCPSrc::MsgTCPSrcConnection& con = (TCPSrc::MsgTCPSrcConnection&) message;

		if(con.getConnect())
		{
			addConnection(con.getID(), con.getPeerAddress(), con.getPeerPort());
		}
		else
		{
			delConnection(con.getID());
		}

		qDebug() << "TCPSrcGUI::handleMessage: TCPSrc::MsgTCPSrcConnection: " << con.getConnect()
				<< " ID: " << con.getID()
				<< " peerAddress: " << con.getPeerAddress()
				<< " peerPort: " << con.getPeerPort();

		return true;
	}
	else
	{
		return false;
	}
}
void ConnDlg::on_okButton_clicked()
{
    if (ui.comboDriver->currentText().isEmpty())
    {
        ui.status_label->setText(tr("请选择一个数据库驱动!"));
        ui.comboDriver->setFocus();
    }
    else if(ui.comboDriver->currentText() =="QSQLITE")
    {
        addSqliteConnection();
        //创建数据库表,如已存在则无须执行
        creatDB();
        accept();
    }
    else
    {
        QSqlError err = addConnection(driverName(), databaseName(), hostName(),userName(), password(), port());
        if (err.type() != QSqlError::NoError)
            ui.status_label->setText(err.text());
        else
            ui.status_label->setText(tr("连接数据库成功!"));
        //创建数据库表,如已存在则无须执行
        accept();
        }
}
Пример #12
0
void AutoFocus::onDataRecord(IpfixDataRecord* record)
{
	// only treat non-Options Data Records (although we cannot be sure that there is a Flow inside)
	if((record->templateInfo->setId != TemplateInfo::NetflowTemplate) 
		&& (record->templateInfo->setId != TemplateInfo::IpfixTemplate) 
		&& (record->templateInfo->setId != TemplateInfo::IpfixDataTemplate)) {
		record->removeReference();
		return;
	}
	
	// convert ipfixrecord to connection struct
	Connection conn(record);


	//hardcoded for uni network
	uint32_t subnet = ntohl(2210136064UL);
	uint32_t mask = ntohl(4294901760UL);


	if ((conn.srcIP & mask) != subnet) 
	{
		conn.srcIP = conn.dstIP;
	}

	if ((conn.srcIP & mask) == subnet) 
	{
		addConnection(&conn);
	}

	record->removeReference();
}
Пример #13
0
toConnection::toConnection(const toConnectionOptions &opts)
    : Abort(false)
    , Provider(opts.provider)
    , User(opts.username)
    , Password(opts.password)
    , Host(opts.host)
    , Database(opts.database)
    , Color(opts.color)
    , Options(opts.options)
    , pConnectionImpl(NULL)
    , pTrait(NULL)
    , ConnectionOptions(opts)
    , pCache(NULL)
    , LoanCnt(0)
{
    pConnectionImpl = toConnectionProviderRegistrySing::Instance().get(Provider).createConnectionImpl(*this);
    pTrait = toConnectionProviderRegistrySing::Instance().get(Provider).createConnectionTrait();

    toConnectionSub* connSub = addConnection();
    Version = connSub->version();
    Connections.insert(connSub);

    setDefaultSchema(opts.schema);

    pCache = new toCache(*this, description(false).trimmed());

    ////Version = connSub->version();
    {
        QMutexLocker clock(&ConnectionLock);
        if (toConfigurationNewSingle::Instance().option(ToConfiguration::Database::ObjectCacheInt) == toCache::ON_CONNECT)
            pCache->readCache();

    }
}
Пример #14
0
void RBSWormDetector::onDataRecord(IpfixDataRecord* record)
{
	// only treat non-Options Data Records (although we cannot be sure that there is a Flow inside)
	if((record->templateInfo->setId != TemplateInfo::NetflowTemplate) 
		&& (record->templateInfo->setId != TemplateInfo::IpfixTemplate)) {
		record->removeReference();
		return;
	}
	
	// convert ipfixrecord to connection struct
	Connection conn(record);

	conn.swapIfNeeded();
	// only use this connection if it was a connection attempt
	if (conn.srcTcpControlBits&Connection::SYN ) {

		bool valid = false;

		map<uint32_t,uint32_t>::iterator iter = subnets.begin();
		while (iter != subnets.end()) 
		{
		if ((conn.srcIP & iter->second) == iter->first) 
		{
			valid=true;
			break;
		}
		iter++;
		}
		if (valid) addConnection(&conn);

	}
	record->removeReference();
}
Пример #15
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QMainWindow mainWin;
    mainWin.setWindowTitle(QObject::tr("Qt SQL Browser"));

    Browser browser(&mainWin);
    mainWin.setCentralWidget(&browser);

    QMenu *fileMenu = mainWin.menuBar()->addMenu(QObject::tr("&File"));
    fileMenu->addAction(QObject::tr("Add &Connection..."), &browser, SLOT(addConnection()));
    fileMenu->addSeparator();
    fileMenu->addAction(QObject::tr("&Quit"), &app, SLOT(quit()));

    QMenu *helpMenu = mainWin.menuBar()->addMenu(QObject::tr("&Help"));
    helpMenu->addAction(QObject::tr("About"), &browser, SLOT(about()));
    helpMenu->addAction(QObject::tr("About Qt"), qApp, SLOT(aboutQt()));

    QObject::connect(&browser, SIGNAL(statusMessage(QString)),
                     mainWin.statusBar(), SLOT(showMessage(QString)));

    addConnectionsFromCommandline(app.arguments(), &browser);
    mainWin.show();
    if (QSqlDatabase::connectionNames().isEmpty())
        QMetaObject::invokeMethod(&browser, "addConnection", Qt::QueuedConnection);

    return app.exec();
}
Пример #16
0
bool
MeshConnectionTable::addConnection(int index, int parent_id, bool only_unique)
{
  int connection_nbr;

  return addConnection(index, parent_id, connection_nbr, only_unique);
}
    void SimpleRecurrentNetwork::addNeuron()
    {

        addConnection(NUM_INPUTS - 1);
        ++numNeurons;
        pop.push_back(new neuron);
    }
Пример #18
0
void BuddyEditor::endConnection(QWidget *target, const QPoint &pos)
{
    Connection *tmp_con = newlyAddedConnection();
    Q_ASSERT(tmp_con != 0);

    tmp_con->setEndPoint(EndPoint::Target, target, pos);

    QWidget *source = tmp_con->widget(EndPoint::Source);
    Q_ASSERT(source != 0);
    Q_ASSERT(target != 0);
    setEnabled(false);
    Connection *new_con = createConnection(source, target);
    setEnabled(true);
    if (new_con != 0) {
        new_con->setEndPoint(EndPoint::Source, source, tmp_con->endPointPos(EndPoint::Source));
        new_con->setEndPoint(EndPoint::Target, target, tmp_con->endPointPos(EndPoint::Target));

        selectNone();
        addConnection(new_con);
        QLabel *source = qobject_cast<QLabel*>(new_con->widget(EndPoint::Source));
        QWidget *target = new_con->widget(EndPoint::Target);
        if (source) {
            undoStack()->push(createBuddyCommand(m_formWindow, source, target));
        } else {
            qDebug("BuddyEditor::endConnection(): not a label");
        }
        setSelected(new_con, true);
    }

    clearNewlyAddedConnection();
    findObjectsUnderMouse(mapFromGlobal(QCursor::pos()));
}
Пример #19
0
bool DataPool::addPort(RTT::base::PortInterface* port, const std::string& p_name, Data::Key key) {
  Logger::In in(getName());

  const RTT::types::TypeInfo *typeInfo = port->getTypeInfo();

  std::string name;
  if (!p_name.empty())
    name = p_name;
  else
    name = port->getName();

  Connection *connection;
  if (key)
    connection = find(key);
  else
    connection = find(name, typeInfo);

  // found matching connection?
  if (!connection) {
    // add new connection
    connection = addConnection(port, name, key);
    if (!connection) return false;
    log(Debug) << "Created new DataPool entry for " << name << endlog();
  }

  if (!connection->addPort(port)) {
    log(Error) << "Could not add port " << name << " to the DataPool!" << endlog();
    return false;
  }

  log(Debug) << "Added port " << name << " to the DataPool (" << connection->numReaders() << " readers, " << connection->numWriters() << " writers)" << endlog();
  return true;
}
Пример #20
0
void NodeGraphDisplay::addConnection(NCID from_id, NCID to_id)
{
	NodeConnector	*from_nc = NodeConnector::getNodeConnector(from_id),
					*to_nc = NodeConnector::getNodeConnector(to_id);

	addConnection(getNodeControl(from_nc->getNode()), getNodeControl(to_nc->getNode()), from_id, to_id);
}
void IConnectionLoader::addConnection(
        VertexMap& vertices, SystemTypeGetter* info,
        int from, int to)
{
    TypeSet tags = TypeSet();
    addConnection(vertices, info, from, to, tags);
}
Пример #22
0
void NetworkManager::restartTimer(QNetworkReply* reply, const Handler& handler)
{
	auto onReplyFinished = [=]()
	{
		abortTimer(reply);

		handler(reply);

		reply->deleteLater();
	};

	auto onTimeOut = [reply]()
	{
		Loggers::net->trace() << "request time out. aborting";
		reply->abort();
	};

	QVector<QMetaObject::Connection> connections;

	connections << QObject::connect(timer_, &QTimer::timeout, onTimeOut);

	connections << QObject::connect(reply, &QNetworkReply::finished, onReplyFinished);

	connections << QObject::connect(reply, static_cast<void(QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error)
		, onReplyFinished);

	addConnection(reply, connections);

	timer_->start();
}
Пример #23
0
void
NIImporter_SUMO::myStartElement(int element,
                                const SUMOSAXAttributes& attrs) {
    /* our goal is to reproduce the input net faithfully
     * there are different types of objects in the netfile:
     * 1) those which must be loaded into NBNetBuilder-Containers for processing
     * 2) those which can be ignored because they are recomputed based on group 1
     * 3) those which are of no concern to NBNetBuilder but should be exposed to
     *      NETEDIT. We will probably have to patch NBNetBuilder to contain them
     *      and hand them over to NETEDIT
     *    alternative idea: those shouldn't really be contained within the
     *    network but rather in separate files. teach NETEDIT how to open those
     *    (POI?)
     * 4) those which are of concern neither to NBNetBuilder nor NETEDIT and
     *    must be copied over - need to patch NBNetBuilder for this.
     *    copy unknown by default
     */
    switch (element) {
        case SUMO_TAG_NET: {
            bool ok;
            myAmLefthand = attrs.getOpt<bool>(SUMO_ATTR_LEFTHAND, 0, ok, false);
            myCornerDetail = attrs.getOpt<int>(SUMO_ATTR_CORNERDETAIL, 0, ok, 0);
            myLinkDetail = attrs.getOpt<int>(SUMO_ATTR_LINKDETAIL, 0, ok, -1);
            break;
        }
        case SUMO_TAG_EDGE:
            addEdge(attrs);
            break;
        case SUMO_TAG_LANE:
            addLane(attrs);
            break;
        case SUMO_TAG_JUNCTION:
            addJunction(attrs);
            break;
        case SUMO_TAG_REQUEST:
            addRequest(attrs);
            break;
        case SUMO_TAG_CONNECTION:
            addConnection(attrs);
            break;
        case SUMO_TAG_TLLOGIC:
            myCurrentTL = initTrafficLightLogic(attrs, myCurrentTL);
            break;
        case SUMO_TAG_PHASE:
            addPhase(attrs, myCurrentTL);
            break;
        case SUMO_TAG_LOCATION:
            myLocation = loadLocation(attrs);
            break;
        case SUMO_TAG_PROHIBITION:
            addProhibition(attrs);
            break;
        case SUMO_TAG_ROUNDABOUT:
            addRoundabout(attrs);
            break;
        default:
            break;
    }
}
Пример #24
0
// Constructor.
CodeViewModeState::CodeViewModeState(CodeView* pView, Editor *pEditor, QObject *pParent)
	: ModeState(pParent),
	m_pView( LEAN_ASSERT_NOT_NULL(pView) ),
	m_pEditor( LEAN_ASSERT_NOT_NULL(pEditor) )
{
	const Ui::MainWindow &mainWindow = m_pEditor->mainWindow()->widgets();

	// Enable clipboard functionality on entry
	assignProperty(mainWindow.actionCut, "enabled", false); // Set for proper revertion
	assignProperty(mainWindow.actionCopy, "enabled", false);
	assignProperty(mainWindow.actionPaste, "enabled", true);
	addConnection(m_pView->textEdit(), SIGNAL(copyAvailable(bool)), mainWindow.actionCut, SLOT(setEnabled(bool)));
	addConnection(m_pView->textEdit(), SIGNAL(copyAvailable(bool)), mainWindow.actionCopy, SLOT(setEnabled(bool)));
	addConnection(mainWindow.actionCut, SIGNAL(triggered()), m_pView->textEdit(), SLOT(cut()));
	addConnection(mainWindow.actionCopy, SIGNAL(triggered()), m_pView->textEdit(), SLOT(copy()));
	addConnection(mainWindow.actionPaste, SIGNAL(triggered()), m_pView->textEdit(), SLOT(paste()));
}
void AnimMatrixBlender::connectTo(
    AttachmentContainer *container, const std::string &fieldName)
{
    FDEBUG(("AnimMatrixBlender::connectTo: this [%p] target [%p] [%s]\n",
            this, container, fieldName.c_str()));

    addConnection(this, "outValue", container, fieldName.c_str());
}
Пример #26
0
void ProcessorGraph::connectProcessors(GenericProcessor* source, GenericProcessor* dest)
{

    if (source == nullptr || dest == nullptr)
        return;

    std::cout << "     Connecting " << source->getName() << " " << source->getNodeId(); //" channel ";
    std::cout << " to " << dest->getName() << " " << dest->getNodeId() << std::endl;

    bool connectContinuous = true;
    bool connectEvents = true;

    if (source->getDestNode() != nullptr)
    {
        if (source->getDestNode()->isMerger())
        {
            Merger* merger = (Merger*) source->getDestNode();
            connectContinuous = merger->sendContinuousForSource(source);
            connectEvents = merger->sendEventsForSource(source);
        }
    }

    // 1. connect continuous channels
    if (connectContinuous)
    {
        for (int chan = 0; chan < source->getNumOutputs(); chan++)
        {
            //std::cout << chan << " ";

            addConnection(source->getNodeId(),         // sourceNodeID
                          chan,                        // sourceNodeChannelIndex
                          dest->getNodeId(),           // destNodeID
                          dest->getNextChannel(true)); // destNodeChannelIndex
        }
    }

    // 2. connect event channel
    if (connectEvents)
    {
        addConnection(source->getNodeId(),    // sourceNodeID
                      midiChannelIndex,       // sourceNodeChannelIndex
                      dest->getNodeId(),      // destNodeID
                      midiChannelIndex);      // destNodeChannelIndex
    }

}
TelescopeClientDirectLx200::TelescopeClientDirectLx200 (const QString &name, const QString &parameters, Equinox eq) :
		TelescopeClient(name),
		equinox(eq)
{
	interpolatedPosition.reset();
	
	//Extract parameters
	//Format: "serial_port_name:time_delay"
	QRegExp paramRx("^([^:]*):(\\d+)$");
	QString serialDeviceName;
	if (paramRx.exactMatch(parameters))
	{
		// This QRegExp only matches valid integers
		serialDeviceName = paramRx.capturedTexts().at(1).trimmed();
		time_delay       = paramRx.capturedTexts().at(2).toInt();
	}
	else
	{
		qWarning() << "ERROR creating TelescopeClientDirectLx200: invalid parameters.";
		return;
	}
	
	qDebug() << "TelescopeClientDirectLx200 paramaters: port, time_delay:" << serialDeviceName << time_delay;
	
	//Validation: Time delay
	if (time_delay <= 0 || time_delay > 10000000)
	{
		qWarning() << "ERROR creating TelescopeClientDirectLx200: time_delay not valid (should be less than 10000000)";
		return;
	}
	
	//end_of_timeout = -0x8000000000000000LL;
	
	#ifdef Q_OS_WIN32
	if(serialDeviceName.right(serialDeviceName.size() - 3).toInt() > 9)
		serialDeviceName = "\\\\.\\" + serialDeviceName;//"\\.\COMxx", not sure if it will work
	else
		serialDeviceName = serialDeviceName;
	#endif //Q_OS_WIN32
	
	//Try to establish a connection to the telescope
	lx200 = new Lx200Connection(*this, qPrintable(serialDeviceName));
	if (lx200->isClosed())
	{
		qWarning() << "ERROR creating TelescopeClientDirectLx200: cannot open serial device" << serialDeviceName;
		return;
	}
	
	// lx200 will be deleted in the destructor of Server
	addConnection(lx200);
	
	long_format_used = false; // unknown
	last_ra = 0;
	queue_get_position = true;
	next_pos_time = -0x8000000000000000LL;
	answers_received = false;
}
Пример #28
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    server.listen(QHostAddress::Any , 30000);
    connect(&server,SIGNAL(newConnection()),this, SLOT(addConnection()));

}
Пример #29
0
// Constructor.
DocumentModeState::DocumentModeState(AbstractDocument* pDocument, Editor *pEditor, QObject *pParent)
	: ModeState(pParent),
	m_pDocument( LEAN_ASSERT_NOT_NULL(pDocument) ),
	m_pEditor( LEAN_ASSERT_NOT_NULL(pEditor) ),
	m_pViewModes()
{
	const Ui::MainWindow &mainWindow = m_pEditor->mainWindow()->widgets();

	// Main window title
	checkedConnect(m_pDocument, SIGNAL(fileChanged(const QString&)), this, SLOT(updateWindowTitle()));
	checkedConnect(m_pDocument, SIGNAL(documentChanged(bool)), this, SLOT(updateWindowTitle()));

	// Enable save functionality on entry
	assignProperty(mainWindow.actionSave, "enabled", true);
	assignProperty(mainWindow.actionSave_As, "enabled", true);
	addConnection(mainWindow.actionSave, SIGNAL(triggered()), this, SLOT(save()));
	addConnection(mainWindow.actionSave_As, SIGNAL(triggered()), this, SLOT(saveAs()));
}
Пример #30
0
 bool channelReady( ChannelElementBase::shared_ptr channel) 
 {
   if (channel && channel->inputReady())
   {
     addConnection(channel);
     return true;
   }
   return false;
 }