void TrackingSystemIGSTKService::initialize()
{
	if (!this->isConfigured())
	{
		connect(this, SIGNAL(configured()), this, SLOT(initializeAfterConfigSlot()));
		this->configure();
		return;
	}

	if (!this->isConfigured())
	{
		reportWarning("Please configure before trying to initialize.");
		return;
	}

#ifndef WIN32
	if (!this->createSymlink())
	{
		reportError("Initialization of tracking failed.");
		return;
	}
#endif

	if (mTrackerThread)
		mTrackerThread->initialize(true);
	else
		reportError("Cannot initialize the tracking system because the tracking thread does not exist.");
}
Beispiel #2
0
bool Compass::configured(void)
{
    bool all_configured = true;
    for(uint8_t i=0; i<get_count(); i++) {
        all_configured = all_configured && (!use_for_yaw(i) || configured(i));
    }
    return all_configured;
}
/*!

*/
void
DebugMessageWindow::toggleShowDebugLogObjects( bool checked )
{
    if ( Options::instance().showDebugLogObjects() != checked )
    {
        Options::instance().toggleShowDebugLogObjects();
        emit configured();
    }
}
/*!

*/
void
DebugMessageWindow::toggleShowDebugViewTarget( bool checked )
{
    if ( Options::instance().showDebugViewTarget() != checked )
    {
        Options::instance().toggleShowDebugViewTarget();
        emit configured();
    }
}
/*!

*/
void
DebugMessageWindow::toggleDebugLevel( int level )
{
    //M_level ^= DebugLogData::LEVEL_1; // reverse only 1 bit

    if ( level < 1 || 32 < level )
    {
        std::cerr << "Invalid level " << level << std::endl;
        return;
    }

    int level_flag = 1 << ( level - 1 );

    M_main_data.getDebugLogHolder().setLevel( level_flag,
                                              M_debug_level_act[level-1]->isChecked() );

    updateMessage();
    emit configured();
}
void PlainTextEditorWidget::configure(const MimeType &mimeType)
{
    Highlighter *highlighter = new Highlighter();
    baseTextDocument()->setSyntaxHighlighter(highlighter);

    setCodeFoldingSupported(false);

    if (!mimeType.isNull()) {
        m_isMissingSyntaxDefinition = true;

        setMimeTypeForHighlighter(highlighter, mimeType);
        const QString &type = mimeType.type();
        setMimeType(type);

        QString definitionId = Manager::instance()->definitionIdByMimeType(type);
        if (definitionId.isEmpty())
            definitionId = findDefinitionId(mimeType, true);

        if (!definitionId.isEmpty()) {
            m_isMissingSyntaxDefinition = false;
            const QSharedPointer<HighlightDefinition> &definition =
                Manager::instance()->definition(definitionId);
            if (!definition.isNull() && definition->isValid()) {
                m_commentDefinition.isAfterWhiteSpaces = definition->isCommentAfterWhiteSpaces();
                m_commentDefinition.singleLine = definition->singleLineComment();
                m_commentDefinition.multiLineStart = definition->multiLineCommentStart();
                m_commentDefinition.multiLineEnd = definition->multiLineCommentEnd();

                setCodeFoldingSupported(true);
            }
        } else if (editorDocument()) {
            const QString &fileName = editorDocument()->filePath();
            if (TextEditorSettings::highlighterSettings().isIgnoredFilePattern(fileName))
                m_isMissingSyntaxDefinition = false;
        }
    }

    setFontSettings(TextEditorSettings::fontSettings());

    emit configured(editor());
}
void TrackingSystemIGSTKService::trackerConfiguredSlot(bool on)
{
	if (!on)
	{
		this->deconfigure();
		return;
	}

	if (!mTrackerThread)
	{
		reportDebug("Received a configured signal in ToolManager, but we don't have a mTrackerThread, this should never happen, contact programmer.");
		return;
	}

	//new all tools
	mTools.clear();
	std::map<QString, IgstkToolPtr> igstkTools = mTrackerThread->getTools();
	IgstkToolPtr reference = mTrackerThread->getRefereceTool();
	std::map<QString, IgstkToolPtr>::iterator it = igstkTools.begin();
	for (; it != igstkTools.end(); ++it)
	{
		IgstkToolPtr igstkTool = it->second;
		cxToolPtr tool(new ToolUsingIGSTK(igstkTool));
		if (tool->isValid())
		{
			mTools.push_back(tool);
			if (tool->getProbe())
				emit newProbe(tool);
		}
		else
			reportWarning("Creation of the cxTool " + it->second->getUid() + " failed.");
	}

	mState = Tool::tsCONFIGURED;

	reportSuccess("IGSTK Tracking Service Configured.");
	emit configured();
	emit stateChanged();
}
static inline void set_config(struct udc *udc, int config)
{
	struct usb_endpoint_descriptor *desc1, *desc2;

	if (udc->speed == USB_SPEED_HIGH) {
		desc1 = &usbtool_dths_config.ep1;
		desc2 = &usbtool_dths_config.ep2;
	} else {
		desc1 = &usbtool_dtfs_config.ep1;
		desc2 = &usbtool_dtfs_config.ep2;
	}

	tx_ep->ops->disable(tx_ep);
	rx_ep->ops->disable(rx_ep);
	if (config) {
		tx_ep->ops->enable(tx_ep, desc1);
		rx_ep->ops->enable(rx_ep, desc2);
		configured(udc);
	}

	udc->config = config;
}
Beispiel #9
0
/*!
  Returns the URL of the MMS serveri (including the port).

  \sa setMmsServer(), QUrl
*/
QUrl QWapAccount::mmsServer() const
{
    QUrl url;

    QString host( d->conf->value( QLatin1String("MMS/Server") ).toString() );
    QString port( d->conf->value( QLatin1String("MMS/Port") ).toString() );

    if ( !host.isEmpty() ) {
        QUrl configured( host );
        url.setHost( configured.host() );
        if ( configured.port() != -1 )
            url.setPort( configured.port() );
        if ( !configured.scheme().isEmpty() )
            url.setScheme( configured.scheme() );
        if ( !configured.path().isEmpty() )
            url.setPath( configured.path() );
    }
    if ( !port.isEmpty() ) {
        url.setPort( port.toInt() );
    }

    return url;
}
Beispiel #10
0
 /** Transmits count bytes from the txData buffer. Sets txPending and
     bytesLost as needed. @return true if we consumed some data from the tx
     buffer. */
 bool TxHelper()
 {
     size_t count;
     bool signal = false;
     for (count = 0; count < MAX_TX_PACKET_LENGTH;)
     {
         uint8_t *data;
         size_t max_count = std::min(txBuf->data_read_pointer(&data),
                                     MAX_TX_PACKET_LENGTH - count);
         if (max_count)
         {
             memcpy(&txData[count], data, max_count);
             count += max_count;
             txBuf->consume(max_count);
             signal = true;
         }
         else
         {
             break;
         }
     }
     if (!count)
     {
         txPending = false;
         return signal;
     }
     if (!configured())
     {
         // An error occured, data was lost.
         txPending = false;
         overrunCount += count;
         return signal;
     }
     txPending = true;
     sendNB(txData, count);
     return signal;
 }
Beispiel #11
0
void ItemLineEdit::silentSetId(const int pId)
{
  XSqlQuery item;
  bool      found = FALSE;

  _parsed = TRUE;

  if (_useValidationQuery)
  {
    item.prepare(_validationSql);
    item.bindValue(":item_id", pId);
    item.exec();
    if (item.first())
      found = TRUE;
  }
  else if (_useQuery)
  {
    item.prepare(_sql);
    item.exec();
    found = (item.findFirst("item_id", pId) != -1);
  }
  else if (pId != -1)
  {
    QString pre( "SELECT DISTINCT item_number, item_descrip1, item_descrip2,"
                 "                uom_name, item_type, item_config, item_upccode");

    QStringList clauses;
    clauses = _extraClauses;
    clauses << "(item_id=:item_id)";

    item.prepare(buildItemLineEditQuery(pre, clauses, QString::null, _type));
    item.bindValue(":item_id", pId);
    item.exec();

    found = item.first();
  }

  if (found)
  {
    if (completer())
    {
      disconnect(this, SIGNAL(textChanged(QString)), this, SLOT(sHandleCompleter()));
      static_cast<QSqlQueryModel* >(completer()->model())->setQuery(QSqlQuery());
    }

    _itemNumber = item.value("item_number").toString();
    _uom        = item.value("uom_name").toString();
    _itemType   = item.value("item_type").toString();
    _configured = item.value("item_config").toBool();
    _upc        = item.value("item_upccode").toString();
    _id         = pId;
    _valid      = TRUE;

    setText(item.value("item_number").toString());
    emit aliasChanged("");
    emit typeChanged(_itemType);
    emit descrip1Changed(item.value("item_descrip1").toString());
    emit descrip2Changed(item.value("item_descrip2").toString());
    emit uomChanged(item.value("uom_name").toString());
    emit configured(item.value("item_config").toBool());
    emit upcChanged(item.value("item_upccode").toString());
    
    emit valid(TRUE);

    if (completer())
      connect(this, SIGNAL(textChanged(QString)), this, SLOT(sHandleCompleter()));
  }
  else
  {
    _itemNumber = "";
    _uom        = "";
    _itemType   = "";
    _id         = -1;
    _upc        = "";
    _valid      = FALSE;

    setText("");

    emit aliasChanged("");
    emit typeChanged("");
    emit descrip1Changed("");
    emit descrip2Changed("");
    emit uomChanged("");
    emit configured(FALSE);
    emit upcChanged("");

    emit valid(FALSE);
  }
} 
Beispiel #12
0
void ItemLineEdit::setItemNumber(const QString& pNumber)
{
  XSqlQuery item;
  bool      found = FALSE;

  _parsed = TRUE;

  if (pNumber == text())
    return;

  if (!pNumber.isEmpty())
  {
    if (_useValidationQuery)
    {
      item.prepare(_validationSql);
      item.bindValue(":item_number", pNumber);
      item.exec();
      if (item.first())
        found = TRUE;
    }
    else if (_useQuery)
    {
      item.prepare(_sql);
      item.exec();
      found = (item.findFirst("item_number", pNumber) != -1);
    }
    else if (pNumber != QString::Null())
    {
      QString pre( "SELECT DISTINCT item_id, item_number, item_descrip1, item_descrip2,"
                   "                uom_name, item_type, item_config, item_upccode");

      QStringList clauses;
      clauses = _extraClauses;
      clauses << "(item_number=:item_number OR item_upccode=:item_number)";

      item.prepare(buildItemLineEditQuery(pre, clauses, QString::null, _type));
      item.bindValue(":item_number", pNumber);
      item.exec();
      
      if (item.size() > 1)
      { 
        ParameterList params;
        params.append("search", pNumber);
        params.append("searchNumber");
        params.append("searchUpc");
        sSearch(params);
        return;
      }
      else
        found = item.first();
    }
  }
  if (found)
  {
    _itemNumber = pNumber;
    _uom        = item.value("uom_name").toString();
    _itemType   = item.value("item_type").toString();
    _configured = item.value("item_config").toBool();
    _id         = item.value("item_id").toInt();
    _upc        = item.value("item_upccode").toInt();
    _valid      = TRUE;

    setText(item.value("item_number").toString());

    emit aliasChanged("");
    emit typeChanged(_itemType);
    emit descrip1Changed(item.value("item_descrip1").toString());
    emit descrip2Changed(item.value("item_descrip2").toString());
    emit uomChanged(item.value("uom_name").toString());
    emit configured(item.value("item_config").toBool());
    emit upcChanged(item.value("item_upccode").toString());
    
    emit valid(TRUE);
  }
  else
  {
    _itemNumber = "";
    _uom        = "";
    _itemType   = "";
    _id         = -1;
    _valid      = FALSE;
    _upc        = "";

    setText("");

    emit aliasChanged("");
    emit typeChanged("");
    emit descrip1Changed("");
    emit descrip2Changed("");
    emit uomChanged("");
    emit configured(FALSE);
    emit upcChanged("");

    emit valid(FALSE);
  }
}
Beispiel #13
0
void ItemLineEdit::silentSetId(int pId)
{
    XSqlQuery item;
    bool      found = FALSE;

    _parsed = TRUE;

    if (_useValidationQuery)
    {
        item.prepare(_validationSql);
        item.bindValue(":item_id", pId);
        item.exec();
        if (item.first())
            found = TRUE;
    }
    else if (_useQuery)
    {
        item.prepare(_sql);
        item.exec();
        found = (item.findFirst("item_id", pId) != -1);
    }
    else if (pId != -1)
    {
        QString pre( "SELECT DISTINCT item_number, item_descrip1, item_descrip2,"
                     "                uom_name, item_type, item_config");

        QStringList clauses;
        clauses = _extraClauses;
        clauses << "(item_id=:item_id)";

        item.prepare(buildItemLineEditQuery(pre, clauses, QString::null, _type));
        item.bindValue(":item_id", pId);
        item.exec();

        found = item.first();
    }

    if (found)
    {
        _itemNumber = item.value("item_number").toString();
        _uom        = item.value("uom_name").toString();
        _itemType   = item.value("item_type").toString();
        _configured = item.value("item_config").toBool();
        _id         = pId;
        _valid      = TRUE;

        setText(item.value("item_number").toString());

        if (_mapper->model() &&
                _mapper->model()->data(_mapper->model()->index(_mapper->currentIndex(),_mapper->mappedSection(this))).toString() != text())
            _mapper->model()->setData(_mapper->model()->index(_mapper->currentIndex(),_mapper->mappedSection(this)), text());

        emit aliasChanged("");
        emit typeChanged(_itemType);
        emit descrip1Changed(item.value("item_descrip1").toString());
        emit descrip2Changed(item.value("item_descrip2").toString());
        emit uomChanged(item.value("uom_name").toString());
        emit configured(item.value("item_config").toBool());

        emit valid(TRUE);
    }
    else
    {
        _itemNumber = "";
        _uom        = "";
        _itemType   = "";
        _id         = -1;
        _valid      = FALSE;

        setText("");

        emit aliasChanged("");
        emit typeChanged("");
        emit descrip1Changed("");
        emit descrip2Changed("");
        emit uomChanged("");
        emit configured(FALSE);

        emit valid(FALSE);
    }
}
Beispiel #14
0
void ItemLineEdit::setItemNumber(QString pNumber)
{
    XSqlQuery item;
    bool      found = FALSE;

    _parsed = TRUE;

    if (_useValidationQuery)
    {
        item.prepare(_validationSql);
        item.bindValue(":item_number", pNumber);
        item.exec();
        if (item.first())
            found = TRUE;
    }
    else if (_useQuery)
    {
        item.prepare(_sql);
        item.exec();
        found = (item.findFirst("item_number", pNumber) != -1);
    }
    else if (pNumber != QString::Null())
    {
        QString pre( "SELECT DISTINCT item_number, item_descrip1, item_descrip2,"
                     "                uom_name, item_type, item_config");

        QStringList clauses;
        clauses = _extraClauses;
        clauses << "(item_number=:item_number)";

        item.prepare(buildItemLineEditQuery(pre, clauses, QString::null, _type));
        item.bindValue(":item_number", pNumber);
        item.exec();

        found = item.first();
    }

    if (found)
    {
        _itemNumber = pNumber;
        _uom        = item.value("uom_name").toString();
        _itemType   = item.value("item_type").toString();
        _configured = item.value("item_config").toBool();
        _id         = item.value("item_id").toInt();
        _valid      = TRUE;

        setText(item.value("item_number").toString());

        emit aliasChanged("");
        emit typeChanged(_itemType);
        emit descrip1Changed(item.value("item_descrip1").toString());
        emit descrip2Changed(item.value("item_descrip2").toString());
        emit uomChanged(item.value("uom_name").toString());
        emit configured(item.value("item_config").toBool());

        emit valid(TRUE);
    }
    else
    {
        _itemNumber = "";
        _uom        = "";
        _itemType   = "";
        _id         = -1;
        _valid      = FALSE;

        setText("");

        emit aliasChanged("");
        emit typeChanged("");
        emit descrip1Changed("");
        emit descrip2Changed("");
        emit uomChanged("");
        emit configured(FALSE);

        emit valid(FALSE);
    }
}
void TrackingSystemIGSTKService::initializeAfterConfigSlot()
{
	disconnect(this, SIGNAL(configured()), this, SLOT(initializeAfterConfigSlot()));
	this->initialize();
}
mediacenter::mediacenter(QWidget *parent)
    : QMainWindow(parent)
{
    memset(m_dmxBuffer, 0, 512);
    m_dmxThread = new DMXThread(m_dmxBuffer);

    QFile file("settings.json");
    if (file.open(QIODevice::ReadOnly) == false)
    {
        qDebug() << "Could not open" << file.fileName() << "for reading";
    }

    QJsonParseError error;
    QJsonDocument jsonDoc = QJsonDocument::fromJson(file.readAll(), &error);
    file.close();

    m_settingsObject = jsonDoc.object();

    lbars = new LightBars(m_dmxBuffer, this);
    lbars->buildUp(m_settingsObject);
	lbars->show();

	lpresets = new LightPresets( lbars, this );
    lpresets->buildUp(m_settingsObject);
	lpresets->show();

    /*bcontrol = new BeamerControl( this );
	connect( bcontrol, SIGNAL( stateChanged( QString ) ), this, SLOT( beamerStateChange( QString ) ) );
	connect( bcontrol, SIGNAL( updateStatus() ), this, SLOT( setSystrayToolTip() ) );
    bcontrol->show();*/
    bcontrol = nullptr;

	configDMX = new ConfigureDMX( this );
    configDMX->setWindowIcon(QIcon(QPixmap(QString("://on.xpm"))));

	connect( configDMX, SIGNAL( configured() ), lbars, SLOT( buildUp() ) );

	QRect geo = qApp->desktop()->availableGeometry();
	lbars->move( geo.width() - lbars->geometry().size().width() - 6, geo.y() );
	lpresets->move( lbars->geometry().x() - lpresets->geometry().width() - 9, geo.y() );
    /*bcontrol->move( lbars->geometry().x() - bcontrol->geometry().width() - 9,
        lpresets->geometry().y() + lpresets->geometry().height() + 3);*/

	hide();

    m_systray = new QSystemTrayIcon(QIcon(QString("://off.xpm")), this);
    m_systray->show();

	QMenu *menu = new QMenu();
	menu->addAction( tr("Connect DMX"), this, SLOT( connectDMX() ) );
	menu->addAction( tr("Disconnect DMX"), this, SLOT( disconnectDMX() ) );
	menu->addSeparator();
	menu->addAction( tr("Show All"), this, SLOT(showAllControls()) );
	menu->addAction( tr("Hide All"), this, SLOT(hideAllControls()) );
	menu->addSeparator();
	menu->addAction( tr("Show/Hide Light Bars"), lbars, SLOT( showToggle() ) );
	menu->addAction( tr("Show/Hide Light Presets"), lpresets, SLOT( showToggle() ) );
    //menu->addAction( tr("Show/Hide Beamer Control"), bcontrol, SLOT( showToggle() ) );
	menu->addSeparator();
    //menu->addAction( tr("Configure DMX Channels"), configDMX, SLOT( show() ) );
    //menu->addAction( tr("Configure Beamer Connection"), this, SLOT( configureBeamer() ) );
	menu->addSeparator();
	menu->addAction( tr("Close"), qApp, SLOT(quit()) );
	
    m_systray->setContextMenu( menu );

    m_dmxThread->connectDMX();
    m_dmxThread->start(QThread::TimeCriticalPriority);

#ifdef QT_DEBUG
    DebugWindow *debugWindow = new DebugWindow(m_dmxBuffer, this);
    debugWindow->show();
#endif //QT_DEBUG

}
Beispiel #17
0
template <std::size_t N> void m68705_device::set_port_mask(u8 mask)
{
	if (configured() || started())
		throw emu_fatalerror("Attempt to set physical port mask after configuration");
	m_port_mask[N] = mask;
}