예제 #1
0
bool GenericTab::initBinder(MapperRuleBinder* mapperBinderPtr)
{
    // initialize rule binder and *connect* signals!! (on init())
    //m_mapperBinderPtr=new MapperRuleBinder(m_ruleCheckerPtr, mapper);
    mapperBinderPtr->init();

    //! This is are the signals of the rule binder we need to connect to:
    // addRecord, first stage record added and second stage record added (run and finish running post-triggers)
    // the pre triggers signals are connected in the binder classes; then we just need the stuff to show messages...

    // Default Rules
    connect(this, SIGNAL(addRecord()), mapperBinderPtr,
        SIGNAL(addRecord()));

    // Pre Submit Rules
    connect(this, SIGNAL(submit()), mapperBinderPtr,
        SIGNAL(submitRecord()));

    connect(mapperBinderPtr, SIGNAL(finishedPreSubmit(const bool)), this,
        SLOT(onPreSubmit(const bool)));

    // Messages
    connect(mapperBinderPtr, SIGNAL(showError(QString, const bool)), this,
    SIGNAL(showError(QString, const bool)));

    connect(mapperBinderPtr, SIGNAL(showStatus(QString)), this,
        SIGNAL(showStatus(QString)));

    return true;
}
예제 #2
0
bool ChartEditorWindow::loadChartTable(){
    bool ok;

    this->lvi.clear();
    this->lvi << chartTable.loadChartTableFromXML(chartTableXMLFile, &ok);

    // TODO: doesn't show layer if it doesn't have level 0

    if(!ok){
        showStatus("Error loading " + chartTableXMLFile);
        return false;
    }
    showStatus("Loaded " + chartTableXMLFile);
    m_ui->actionSave->setEnabled(true);
    m_ui->actionSaveAs->setEnabled(true);

    // update selection list
    layerSelectionVector.clear();
    QVectorIterator<LayerVisualInfo*> lviIt(lvi);
    while(lviIt.hasNext()){
        LayerVisualInfo * tmpLVI = lviIt.next();
        if(tmpLVI->getSimpLevel() == 0){
            LayerSelectionItem * selItem = new LayerSelectionItem(tmpLVI->getLayerId(), true);
            layerSelectionVector << selItem;
        }
    }

    showChartTable();
    showLayers();

    return true;
}
예제 #3
0
void MainWin::on_call_state(pjsua_call_id call_id, pjsip_event *e)
{
    pjsua_call_info ci;

    PJ_UNUSED_ARG(e);

    pjsua_call_get_info(call_id, &ci);

    if (currentCall_ == -1 && ci.state < PJSIP_INV_STATE_DISCONNECTED &&
	ci.role == PJSIP_ROLE_UAC)
    {
	emit signalNewCall(call_id, false);
    }

    char status[80];
    if (ci.state == PJSIP_INV_STATE_DISCONNECTED) {
	snprintf(status, sizeof(status), "Call is %s (%s)",
	         ci.state_text.ptr,
	         ci.last_status_text.ptr);
	showStatus(status);
	emit signalCallReleased();
    } else {
	snprintf(status, sizeof(status), "Call is %s", pjsip_inv_state_name(ci.state));
	showStatus(status);
    }
}
예제 #4
0
bool ChartEditorWindow::createChartTable(){
    bool ok;
    QStringList selectedLayers;

    // create table using the currently selected layers

    for(int i=0; i < m_ui->tableWidgetSelect->rowCount(); i++){
        QTableWidgetItem *item = m_ui->tableWidgetSelect->item(0, i);
        if(item->checkState() == Qt::Checked)
            selectedLayers << item->text();
    }

    chartTable.setSettings(chartTableSettings);
    this->lvi = chartTable.generateLayerVisualInfoForAllTables(selectedLayers, &ok);
    if(!ok){
        showStatus("Error creating chart table.");
        return false;
    }

    showChartTable();
    //showLayers();	// don't update! must be selected before generation

    showStatus("Generated chart table");
    m_ui->actionSave->setEnabled(true);
    m_ui->actionSaveAs->setEnabled(true);

    return true;
}
예제 #5
0
void wavrChatWindow::init(User *pLocalUser, User *pRemoteUser, bool connected) {
    localId = pLocalUser->id;
    localName = pLocalUser->name;

    peerId = pRemoteUser->id;
    peerIds.insert(peerId, pRemoteUser->id);
    peerNames.insert(peerId, pRemoteUser->name);
    peerStatuses.insert(peerId, pRemoteUser->status);
    peerCaps.insert(peerId, pRemoteUser->caps);

    this->pLocalUser = pLocalUser;

    pMessageLog->localId = localId;
    pMessageLog->peerId = peerId;
    pMessageLog->peerName = pRemoteUser->name;

    //  get the avatar image for the users
    pMessageLog->participantAvatars.insert(localId, pLocalUser->avatarPath);
    pMessageLog->participantAvatars.insert(peerId, pRemoteUser->avatarPath);

    createSmileyMenu();
    createToolBar();

    bConnected = connected;
    if(!bConnected)
        showStatus(IT_Disconnected, true);

    int index = wavrHelper::statusIndexFromCode(pRemoteUser->status);
    if(index != -1) {
        setWindowIcon(QIcon(statusPic[index]));
        if(statusType[index] == StatusTypeOffline)
            showStatus(IT_Offline, true);
        else if(statusType[index] == StatusTypeAway)
            showStatus(IT_Away, true);
        else if(statusType[index] == StatusTypeBusy)
            showStatus(IT_Busy, true);
    }

    pSettings = new wavrSettings();
    showSmiley = pSettings->value(IDS_EMOTICON, IDS_EMOTICON_VAL).toBool();
    pMessageLog->showSmiley = showSmiley;
    pMessageLog->autoFile = pSettings->value(IDS_AUTOFILE, IDS_AUTOFILE_VAL).toBool();
    pMessageLog->messageTime = pSettings->value(IDS_MESSAGETIME, IDS_MESSAGETIME_VAL).toBool();
    pMessageLog->messageDate = pSettings->value(IDS_MESSAGEDATE, IDS_MESSAGEDATE_VAL).toBool();
    pMessageLog->allowLinks = pSettings->value(IDS_ALLOWLINKS, IDS_ALLOWLINKS_VAL).toBool();
    pMessageLog->pathToLink = pSettings->value(IDS_PATHTOLINK, IDS_PATHTOLINK_VAL).toBool();
    pMessageLog->trimMessage = pSettings->value(IDS_TRIMMESSAGE, IDS_TRIMMESSAGE_VAL).toBool();
    clearOnClose = pSettings->value(IDS_CLEARONCLOSE, IDS_CLEARONCLOSE_VAL).toBool();

    setUIText();

    ui.txtMessage->setFocus();

    QString themePath = pSettings->value(IDS_THEME, IDS_THEME_VAL).toString();
    pMessageLog->initMessageLog(themePath);
    if(!clearOnClose)
        pMessageLog->restoreMessageLog(QDir(StdLocation::cacheDir()).absoluteFilePath("msg_" + peerId + ".tmp"));
}
// mouseMove
//---------------------------------------------------------------------------
void VehicleSelectionView::mouseMove(const iXY &prevPos, const iXY &newPos)
{
    GameTemplateView::mouseMove(prevPos, newPos);

    if (highlightedButton >= 0) {
        showStatus(buttons[highlightedButton]->getToolTip());
    } else {
        showStatus("Select a unit for production");
    }

} // end VehicleSelectionView::mouseMove
예제 #7
0
void UploaderThread::run()
{
	if ( samba->connect( deviceKey ) != Samba::OK )
	{
		mainWindow->messageThreadSafe( QString( "Usb> Upload Failed - couldn't connect.") );
		mainWindow->messageThreadSafe( QString( "  ** Check USB cable is plugged in.") );
		mainWindow->messageThreadSafe( QString( "  ** Make sure you've erased the current program, reset the power, and try again.") );
		Samba::Status disconnectStatus;
		disconnectStatus = samba->disconnect( );
		return;
	}
	
	Samba::Status uploaderStatus = samba->flashUpload( bin_file );
	if ( uploaderStatus != Samba::OK )
  {
  	showStatus( QString( "Usb> Upload Failed." ), 2000 );
  	switch ( uploaderStatus )
  	{
  		case Samba::ERROR_INCORRECT_CHIP_INFO:
			mainWindow->messageThreadSafe( QString( 
				"Usb> Upload Failed - don't recognize the chip you're trying to program.") );
			  break;
  		case Samba::ERROR_COULDNT_FIND_FILE:
  		case Samba::ERROR_COULDNT_OPEN_FILE:
			mainWindow->messageThreadSafe( QString( 
				"Usb> Upload Failed - Couldn't find or open the specified .bin file.") );
			  break;
  		case Samba::ERROR_SENDING_FILE:
			mainWindow->messageThreadSafe( QString( 
				"Usb> Upload Failed - Couldn't complete download.") );
    		mainWindow->messageThreadSafe( QString( 
    			"  ** Noisy power supply?  Flakey USB connection?") );
			  break;
  		default:
			mainWindow->messageThreadSafe( QString( 
				"Usb> Upload Failed - Unknown Error - %d.").arg(uploaderStatus) );
    		mainWindow->messageThreadSafe( QString( 
    			"  ** Note error number and consult the support forums.") );
			  break;	
  	}
  }
	
	// set up samba to actually boot from this file
	if ( samba->bootFromFlash( ) != Samba::OK )
		mainWindow->messageThreadSafe( QString( "Usb> Could not switch to boot from flash.") );
		
	if ( samba->reset(  ) != Samba::OK )
		mainWindow->messageThreadSafe( QString( "Usb> Could not switch to boot from flash.") );
		
	showStatus( QString( "Upload complete." ), 2000 );
	progress( -1 );
	monitor->deviceRemoved( deviceKey );
}
예제 #8
0
void ExcitationThread::run()
{
    emit showStatus("Generating excitation...");
    try {
        Excitation::generate( this->wrkDir, this->cfg);
        emit generated();
    } catch(QLE e) {
        emit showCritical(e.msg);
        emit showStatus("Excitation generating failed!", 2000);
        return;
    }
    emit showStatus("Excitation and inverse filter are generated!", 2000);
}
예제 #9
0
void ChartEditorWindow::saveAsChartTable(){
    bool ok;

    QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), chartTableXMLFile,
                                                    tr("XML files (*.xml);;Any file (*)"));
    if(!fileName.isEmpty()){
        chartTableXMLFile = fileName;
        ok = chartTable.saveChartTableToXML(this->lvi, chartTableXMLFile);
        if(ok)
            showStatus(tr("Saved ") + chartTableXMLFile);
        else
            showStatus(tr("Error saving ") + chartTableXMLFile);

    }
}
예제 #10
0
void KJavaApplet::stateChange( const int newStateInt ) {
    AppletState newState = (AppletState)newStateInt;
    bool ok = false;
    if (d->failed) {
        return;
    }
    switch ( newState ) {
        case CLASS_LOADED:
            ok = (d->state == UNKNOWN);
            break;
        case INSTANCIATED:
            if (ok) {
                showStatus(i18n("Initializing Applet \"%1\"...").arg(appletName()));
            }
            ok = (d->state == CLASS_LOADED);
            break;
        case INITIALIZED:
            ok = (d->state == INSTANCIATED);
            if (ok) { 
                showStatus(i18n("Starting Applet \"%1\"...").arg(appletName()));
                start();
            }
            break;
        case STARTED:
            ok = (d->state == INITIALIZED || d->state == STOPPED);
            if (ok) {    
                showStatus(i18n("Applet \"%1\" started").arg(appletName()));
            }
            break;
        case STOPPED:
            ok = (d->state == INITIALIZED || d->state == STARTED);
            if (ok) {    
                showStatus(i18n("Applet \"%1\" stopped").arg(appletName()));
            }
            break;
        case DESTROYED:
            ok = true;
            break;
        default:
            break;
    }
    if (ok) {
        d->state = newState;
    } else {
        kdError(6100) << "KJavaApplet::stateChange : don't want to switch from state "
            << d->state << " to " << newState << endl;
    } 
}
예제 #11
0
void FrmSampling::insertRow()
{
    if (!tSampLevels->insertRow(tSampLevels->rowCount()))
        emit showError(tr("Could not add a sampled level to the table!"));
    else 
        emit showStatus(tr("Sampled level successfully initialized!"));
}
예제 #12
0
bool FrmSampling::comitSamplingTechnique()
{
    bool bError=false;

    int curIndex=mapper1->currentIndex();
    if (curIndex==-1) return true; //there are no changes on this form!! (CAREFULL WITH THIS TEST)

    if (!mapper1->submit()){
            if (tRefSampTec->lastError().type()!=QSqlError::NoError)
                emit showError(tRefSampTec->lastError().text());
            else
                emit showError(tr("Could not submit mapper!"));
            bError=true;
    }else{
            QModelIndex idx=tRefSampTec->index(tRefSampTec->rowCount()-1,8);
            if (!idx.isValid()) return false;
            if (!tRefSampTec->setData(idx,m_sample->frameTimeId)) return false;

            if (!tRefSampTec->submitAll()){
                if (tRefSampTec->lastError().type()!=QSqlError::NoError)
                    emit showError(tRefSampTec->lastError().text());
                else
                    emit showError(tr("Could not write Sampling Technique in the database!"));
                bError=true;
            }else
                emit showStatus(tr("Sampling Technique successfully written in the database!"));
    }

    mapper1->setCurrentIndex(curIndex);

    return !bError;
}
예제 #13
0
bool FrmSampling::comitSampledLevels()
{
    bool bError=false;
    int id;
    int ct=0;

    QModelIndex indexTechnique=tRefSampTec->index(tRefSampTec->rowCount()-1,0);
    if (!indexTechnique.isValid()) return false;
    id=indexTechnique.data().toInt();
    for (int i=0; i < tSampLevels->rowCount(); ++i)
    {
            QModelIndex indexId=tSampLevels->index(i,0);
            if (!indexId.isValid()) return false;
            if (tSampLevels->isDirty(indexId)){
                QModelIndex indexFr=tSampLevels->index(i,7);
                if (!indexFr.isValid()) return false;
                if (!tSampLevels->setData(indexFr,id)) return false;
                ++ct;
            }
    }

    if (!tSampLevels->submitAll()){
        if (tSampLevels->lastError().type()!=QSqlError::NoError){
            emit showError(tSampLevels->lastError().text());
        }else
            emit showError(tr("Could not write Sampling levels in the database!"));
        bError=true;
    }else{
        emit showStatus(tr("Sampling Technique successfully written in the database!"));
        if (m_mode==CREATE)tSampLevels->setFilter("id_sampling_technique=" + QVariant(id).toString());
    }

    return !bError;
}
예제 #14
0
void lmcBroadcastWindow::init(bool connected) {
	createToolBar();

	setWindowIcon(QIcon(IDR_APPICON));
	ui.splitter->setStyleSheet("QSplitter::handle { image: url("IDR_HGRIP"); }");

	ui.tvUserList->setIconSize(QSize(16, 16));
    ui.tvUserList->header()->setSectionsMovable(false);
	ui.tvUserList->header()->setStretchLastSection(false);
    ui.tvUserList->header()->setSectionResizeMode(0, QHeaderView::Stretch);
	ui.tvUserList->setCheckable(true);

	//	load settings
	pSettings = new lmcSettings();
	restoreGeometry(pSettings->value(IDS_WINDOWBROADCAST).toByteArray());
	ui.splitter->restoreState(pSettings->value(IDS_SPLITTERBROADCAST).toByteArray());
	showSmiley = pSettings->value(IDS_EMOTICON, IDS_EMOTICON_VAL).toBool();
	sendKeyMod = pSettings->value(IDS_SENDKEYMOD, IDS_SENDKEYMOD_VAL).toBool();
	fontSizeVal = pSettings->value(IDS_FONTSIZE, IDS_FONTSIZE_VAL).toInt();
	pFontGroup->actions()[fontSizeVal]->setChecked(true);
	int viewType = pSettings->value(IDS_USERLISTVIEW, IDS_USERLISTVIEW_VAL).toInt();
	ui.tvUserList->setView((UserListView)viewType);

	//	show a message if not connected
	bConnected = connected;
	ui.btnSend->setEnabled(bConnected);
	if(!bConnected)
		showStatus(IT_Disconnected, true);

	setUIText();

	ui.txtMessage->setStyleSheet("QTextEdit { " + fontStyle[fontSizeVal] + " }");
	ui.txtMessage->setFocus();
}
예제 #15
0
파일: Web.cpp 프로젝트: paulv888/Arduino
void postMessage(const byte deviceIdx) {

	if (DEBUG_MEMORY) printMem("Post ");

	if (client_send.connect(vlosite, 80)) {
		if (DEBUG_WEB) dbg.println("NewC");

		int len = 0;
		printP(COMMAND_IO_SEND, TXTPOST);
		len = printResponse(COMMAND_IO_SEND, deviceIdx, true);
		client_send.println(len);
		if (DEBUG_WEB) dbg.println(len);
		client_send.println();
		if (DEBUG_WEB) dbg.println();
		printResponse(COMMAND_IO_SEND, deviceIdx, false);
		client_send.println();

		delay (3);
		while (client_send.available()) {
			char c = client_send.read();
			if (DEBUG_WEB) dbg.print(c);
		}

	} else {
		if (DEBUG_WEB) dbg.println("Fail");
		showStatus(NET_ERROR, 0);
		Reset_AVR();
	}

	delay(1);
	if (DEBUG_WEB) dbg.println("Disc");
	client_send.stop();
}
예제 #16
0
//==============================================================================
int performCommandLine (const String& commandLine)
{
    StringArray args;
    args.addTokens (commandLine, true);
    args.trim();

    String command (args[0]);

    try
    {
        if (matchArgument (command, "help"))                     { showHelp(); return 0; }
        if (matchArgument (command, "h"))                        { showHelp(); return 0; }
        if (matchArgument (command, "resave"))                   { resaveProject (args, false); return 0; }
        if (matchArgument (command, "resave-resources"))         { resaveProject (args, true); return 0; }
        if (matchArgument (command, "set-version"))              { setVersion (args); return 0; }
        if (matchArgument (command, "bump-version"))             { bumpVersion (args); return 0; }
        if (matchArgument (command, "git-tag-version"))          { gitTag (args); return 0; }
        if (matchArgument (command, "buildmodule"))              { buildModules (args, false); return 0; }
        if (matchArgument (command, "buildallmodules"))          { buildModules (args, true); return 0; }
        if (matchArgument (command, "status"))                   { showStatus (args); return 0; }
        if (matchArgument (command, "trim-whitespace"))          { cleanWhitespace (args, false); return 0; }
        if (matchArgument (command, "remove-tabs"))              { cleanWhitespace (args, true); return 0; }
        if (matchArgument (command, "tidy-divider-comments"))    { tidyDividerComments (args); return 0; }
        if (matchArgument (command, "fix-broken-include-paths")) { fixRelativeIncludePaths (args); return 0; }
    }
    catch (const CommandLineError& error)
    {
        std::cout << error.message << std::endl << std::endl;
        return 1;
    }

    return commandLineNotPerformed;
}
예제 #17
0
void lmcChatRoomWindow::setUIText(void) {
	ui.retranslateUi(this);

	setWindowTitle(getWindowTitle());

	QTreeWidgetItem* pGroupItem = getGroupItem(&GroupId);
	pGroupItem->setText(0, tr("Participants"));

	userChatAction->setText(tr("&Conversation"));
	userFileAction->setText(tr("Send &File"));
	userInfoAction->setText(tr("Get &Information"));
	pbtnSmiley->setToolTip(tr("Insert Smiley"));
	pSaveAction->setText(tr("&Save As..."));
	pSaveAction->setToolTip(tr("Save this conversation"));
	pFontAction->setText(tr("Change Font..."));
	pFontAction->setToolTip(tr("Change message font"));
	pFontColorAction->setText(tr("Change Color..."));
	pFontColorAction->setToolTip(tr("Change message text color"));

	if(groupMode) {
		addContactAction->setText(tr("&Add Contacts..."));
		addContactAction->setToolTip(tr("Add people to this conversation"));
	}

	showStatus(IT_Ok, true);	//	this will force the info label to retranslate
}
예제 #18
0
// New current line
bool DebuggerManager::setActiveLine (const QString& file, int line )
{
  //Get local filename
  QString filename = file;

  // Remove old active line mark
  setMark(m_currentFile, m_currentLine, false, KTextEditor::MarkInterface::markType05);

  // Update vars with active line
  m_currentFile = filename;
  m_currentLine = line;

  // No new current position
  if(filename.isEmpty() || quantaApp->previewVisible())
    return true;

  // Find new position in editor
  if(ViewManager::ref()->isOpened(filename) || QExtFileInfo::exists(filename, true, 0L))
    quantaApp->gotoFileAndLine(filename, line, 0);
  else
  {
    showStatus(i18n("Unable to open file %1, check your basedirs and mappings.").arg(filename), true);
  }

  // Add new active line mark
  setMark(filename, line, true, KTextEditor::MarkInterface::markType05);
  return true;
}
void
MSWindowsClientTaskBarReceiver::onStatusChanged()
{
    if (IsWindowVisible(m_window)) {
        showStatus();
    }
}
void GeneratorWithPressureSensor::loop() {
	tps.update();
	led.update();

	tps.smooth(analogRead(pressurePin), &pressure, 4);
	tps.smooth(analogRead(cellTemperaturePin), &cellTemperature, 4);
	tps.smooth(analogRead(mosfetTemperaturePin), &mosfetTemperature, 4);
	tps.smooth(analogRead(ambientTemperaturePin), &ambientTemperature, 4);
	tempCurrent = analogRead(currentPin);
	if (tempCurrent > currentMinThreshold) {
		currentTPS.update();
		currentTPS.smooth(tempCurrent, &current, 4);
	}

	processReader();
	if (maxPressure < pressure)
		maxPressure = pressure;
	if (maxCurrent < current)
		maxCurrent = current;
	if (checkThresholdsExceeded()) {
		// turn off
		noTone(mosfetPin);
		led.playBlink(BLINK_FAST, 0);
		if (isPlaying) {
			isPlaying = false;
			showStatus(true);
		}
	}
}
예제 #21
0
	void Driver::stop()
	{
		while (car_.speed() != 0)
			car_.brake();
		showStatus();

	}
예제 #22
0
void MainWin::on_reg_state(pjsua_acc_id acc_id)
{
    pjsua_acc_info info;

    pjsua_acc_get_info(acc_id, &info);

    char reg_status[80];
    char status[120];

    if (!info.has_registration) {
	pj_ansi_snprintf(reg_status, sizeof(reg_status), "%.*s",
			 (int)info.status_text.slen,
			 info.status_text.ptr);

    } else {
	pj_ansi_snprintf(reg_status, sizeof(reg_status),
			 "%d/%.*s (expires=%d)",
			 info.status,
			 (int)info.status_text.slen,
			 info.status_text.ptr,
			 info.expires);

    }

    snprintf(status, sizeof(status),
	     "%.*s: %s\n",
	     (int)info.acc_uri.slen, info.acc_uri.ptr,
	     reg_status);
    showStatus(status);
}
void
CMSWindowsPortableTaskBarReceiver::onStatusChanged()
{
	if (IsWindowVisible(m_window)) {
		showStatus();
	}
}
예제 #24
0
void SyntroCVCamConsole::runConsole()
{
	struct termios ctty;

	tcgetattr(fileno(stdout), &ctty);
	ctty.c_lflag &= ~(ICANON);
	tcsetattr(fileno(stdout), TCSANOW, &ctty);

	while (m_running) {
		printf("\nEnter option: ");

		switch (toupper(getchar())) {
		case 'H':
			showHelp();
			break;

		case 'S':
			showStatus();
			break;

		case 'X':
			printf("\nExiting\n");
			m_running = false;
			break;

		case '\n':
			continue;
		}
	}
}
예제 #25
0
int GenericTab::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: lockControls((*reinterpret_cast< bool(*)>(_a[1])),(*reinterpret_cast< QList<QWidget*>(*)>(_a[2]))); break;
        case 1: forward((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 2: gotPar(); break;
        case 3: navigate((*reinterpret_cast< const bool(*)>(_a[1])),(*reinterpret_cast< const int(*)>(_a[2]))); break;
        case 4: hideFrameDetails((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 5: showFrameDetails((*reinterpret_cast< const FrmFrameDetails::Mode(*)>(_a[1])),(*reinterpret_cast< const FrmFrameDetails::Persistence(*)>(_a[2])),(*reinterpret_cast< Sample*(*)>(_a[3])),(*reinterpret_cast< QList<int>(*)>(_a[4])),(*reinterpret_cast< const FrmFrameDetails::Options(*)>(_a[5]))); break;
        case 6: showFrameDetails((*reinterpret_cast< const FrmFrameDetails::Mode(*)>(_a[1])),(*reinterpret_cast< const FrmFrameDetails::Persistence(*)>(_a[2])),(*reinterpret_cast< Sample*(*)>(_a[3])),(*reinterpret_cast< QList<int>(*)>(_a[4]))); break;
        case 7: showFrameDetails((*reinterpret_cast< const FrmFrameDetails::Mode(*)>(_a[1])),(*reinterpret_cast< const FrmFrameDetails::Persistence(*)>(_a[2])),(*reinterpret_cast< Sample*(*)>(_a[3]))); break;
        case 8: showStatus((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 9: showError((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< const bool(*)>(_a[2]))); break;
        case 10: showError((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 11: fillHeader((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 12: onShowForm(); break;
        case 13: { bool _r = next();
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 14: goBack(); break;
        case 15: goForward(); break;
        case 16: onLockControls((*reinterpret_cast< bool(*)>(_a[1])),(*reinterpret_cast< QList<QWidget*>(*)>(_a[2]))); break;
        default: ;
        }
        _id -= 17;
    }
    return _id;
}
예제 #26
0
void forward( int rotations, int power ){
	resetEncoders(); //Resets the motor encoder readings.
	while( (nMotorEncoder[leftWheel1] < rotations) && (nMotorEncoder[rightWheel1] < rotations) && (nMotorEncoder[leftWheel2]) < rotations && (nMotorEncoder[rightWheel2] < rotations)){
		showStatus(rotations, power);
		motor[leftWheel1] = power;
		motor[rightWheel1] = power;
		motor[leftWheel2] = power;
		motor[rightWheel2] = power;
	}//goes forward until one of the two sides has rotated enough
	stopMotors();

	if( ( nMotorEncoder[leftWheel1] + nMotorEncoder[leftWheel2] ) - ( nMotorEncoder[rightWheel1] + nMotorEncoder[rightWheel2] ) > 100){
		//if shifted to face left
		while( nMotorEncoder[leftWheel1] - nMotorEncoder[rightWheel1] > 0 ){
			motor[rightWheel1] = power / 5;//turns to be straight
		}
			stopMotors();
			resetEncoders();
	}
	if( ( nMotorEncoder[rightWheel1] + nMotorEncoder[rightWheel2] ) - ( nMotorEncoder[leftWheel1] + nMotorEncoder[leftWheel2] ) > 100 ){
		//if shifted to face right
		while( nMotorEncoder[rightWheel1] - nMotorEncoder[leftWheel1] > 0 ){
			motor[leftWheel1] = power/5;//turns to be straight
		}
	}

	stopMotors();
	resetEncoders();
}//forward function
예제 #27
0
파일: main.c 프로젝트: pkarneliuk/clumsy
static int uiStopCb(Ihandle *ih) {
    int ix;
    UNREFERENCED_PARAMETER(ih);
    
    // try stopping
    IupSetAttribute(filterButton, "ACTIVE", "NO");
    IupFlush(); // flush to show disabled state
    divertStop();

    IupSetAttribute(filterText, "ACTIVE", "YES");
    IupSetAttribute(filterButton, "TITLE", "Start");
    IupSetAttribute(filterButton, "ACTIVE", "YES");
    IupSetCallback(filterButton, "ACTION", uiStartCb);

    // stop timer and clean up icons
    IupSetAttribute(timer, "RUN", "NO");
    for (ix = 0; ix < MODULE_CNT; ++ix) {
        modules[ix]->processTriggered = 0; // use = here since is threads already stopped
        IupSetAttribute(modules[ix]->iconHandle, "IMAGE", "none_icon");
    }
    sendState = SEND_STATUS_NONE;
    IupSetAttribute(stateIcon, "IMAGE", "none_icon");

    showStatus("Successfully stoped. Edit criteria and click Start to begin again.");
    return IUP_DEFAULT;
}
예제 #28
0
void ChartEditorWindow::onActionGenerateTriggered(){
    generatorSettingsDialog->setChartTableSettings(this->chartTableSettings);
    int confirm = generatorSettingsDialog->exec();
    if(confirm)
        createChartTable();
    else
        showStatus("");
}
예제 #29
0
파일: main.c 프로젝트: pkarneliuk/clumsy
static int uiStartCb(Ihandle *ih) {
    char buf[MSG_BUFSIZE];
    UNREFERENCED_PARAMETER(ih);
    if (divertStart(IupGetAttribute(filterText, "VALUE"), buf) == 0) {
        showStatus(buf);
        return IUP_DEFAULT;
    }

    // successfully started
    showStatus("Started filtering. Enable functionalities to take effect.");
    IupSetAttribute(filterText, "ACTIVE", "NO");
    IupSetAttribute(filterButton, "TITLE", "Stop");
    IupSetCallback(filterButton, "ACTION", uiStopCb);
    IupSetAttribute(timer, "RUN", "YES");

    return IUP_DEFAULT;
}
예제 #30
0
void MainWin::showError(const char *title, pj_status_t status)
{
    char errmsg[PJ_ERR_MSG_SIZE];
    char errline[120];

    pj_strerror(status, errmsg, sizeof(errmsg));
    snprintf(errline, sizeof(errline), "%s error: %s", title, errmsg);
    showStatus(errline);
}