Пример #1
0
void ConnectionWizard::selected(const QString &page)
{
	if (page == "Connection target")
	{
		switch (rtype)
		{
			case None:
				rbNone->setChecked(true);
				setState(false, false, false, false, true);
				break;
			case FX:
				rbFX->setChecked(true);
				setState(false, true, false, true, false);
				break;
			case In:
				rbInput->setChecked(true);
				setState(false, true, false, true, false);
				break;
			case Out:
				rbOutput->setChecked(true);
				setState(false, true, false, true, false);
				break;
			case PIn:
			case POut:
				rbPatch->setChecked(true);
				setState(true, true, false, true, false);
				break;
		}
	}
	else if (page == "Patch")
	{
		finishButton()->setEnabled(false);
		if (pto)
		{
			// find patch
			lbPatch->setCurrentItem(patchList.find(pto));
			nextButton()->setEnabled(true);
		}
		else
		{
			QListBoxItem *si = lbPatch->selectedItem();
			if (si)
				lbPatch->setSelected(si, false);
			lbPatch->setCurrentItem(-1);
			nextButton()->setEnabled(false);
		}

		cbMulti->setChecked(route.getMulti());
		cbSimple->setChecked(route.getSimple());
	}
	else if (page == "End")
	{
		nextButton()->setEnabled(false);
		switch (rtype)
		{
			case None:
				break;
			case FX:
			case In:
			case Out:
				loadEnd(rtype);
				break;
			case PIn:
			case POut:
				// load patch in or out
				ios.clear();
				lbEnd->clear();

				for (int i = 0; i < (int)pto->getMaxIOIdx(out); i++)
				{
					RSItemIO *io = pto->getIO(out, i);
					if (io)
					{
						ios.append(io);
						lbEnd->insertItem(io->getDesc());
					}
				}
				
				route.setMulti(cbMulti->isChecked());
				route.setSimple(cbSimple->isChecked());
				break;
		}

		if (route.getToIO())
		{
			lbEnd->setCurrentItem(ios.find(route.getToIO()));
			finishButton()->setEnabled(true);
		}
		else
		{
			QListBoxItem *si = lbEnd->selectedItem();
			if (si)
				lbEnd->setSelected(si, false);
			lbEnd->setCurrentItem(-1);
			finishButton()->setEnabled(false);
		}
	}
}
Пример #2
0
bool ContextPrivate::load( const QString &pFileName, bool pPartial )
{
	if( !QFile( pFileName ).exists() )
	{
		qWarning() << pFileName << "doesn't exist";

		return( false );
	}

	QSettings										 CFG( pFileName, QSettings::IniFormat );
	int												 VER = 1;
	bool											 RET = false;

	if( CFG.status() != QSettings::NoError )
	{
		qWarning() << pFileName << "can't load";

		return( false );
	}

	if( CFG.format() != QSettings::IniFormat )
	{
		qWarning() << pFileName << "bad format";

		return( false );
	}

	mActive = false;

	emit loadStart( CFG, pPartial );

//	if( !CFG.childGroups().contains( "fugio" ) )
//	{
//		qWarning() << pFileName << "invalid file";

//		return( false );
//	}

	CFG.beginGroup( "fugio" );

	VER = CFG.value( "version", VER ).toInt();

	if( !pPartial )
	{
		qreal	NewDur = CFG.value( "duration", double( mDuration ) ).toDouble();

		setDuration( NewDur );
	}

	CFG.endGroup();

	if( !pPartial )
	{
		CFG.beginGroup( "meta" );

		for( auto it = mMetaNameMap.begin() ; it != mMetaNameMap.end() ; it++ )
		{
			const QString		V = CFG.value( it.value() ).toString();

			if( !V.isEmpty() )
			{
				mMetaInfoMap.insert( it.key(), V );
			}
		}

		CFG.endGroup();
	}

	if( VER == 2 )
	{
		RET = loadSettings( CFG, pPartial );
	}

	//-------------------------------------------------------------------------

	processDeferredNodes();

	//-------------------------------------------------------------------------

	if( !pPartial && mInitDeferNodeList.isEmpty() )
	{
		emit contextStart();
	}

	//-------------------------------------------------------------------------

	emit loading( CFG, pPartial );

	emit loadEnd( CFG, pPartial );

	mActive = true;

	return( RET );
}
Пример #3
0
/*************************************************************************
 * uLoad
 *   "Parse" a uCode source program (using flex to scan it).
 *************************************************************************/
int uLoad(uINSTRUCTION code[], int label[])
{
  uINSTRUCTION *currInstr;
  int codeLine = 0;

  int i, lab;

  do {
    currInstr = &(code[codeLine]);
    clearInstruction(currInstr);
    codeFlag = valid;
    loadOpcode(currInstr);
    if (codeFlag == valid) {
      switch (yytok) {
        case tHLT:
          break;

        case tRD:
        case tRDF:
        case tRDS:
          loadTarget(currInstr, 0);
          break;

        case tWRT:
        case tWRTLN:
          loadSource(currInstr, 0);
          break;

        case tWRTS:
        case tWRTLNS:
          break;

        case tMOV  :
        case tNEG  :
        case tNEGF :
        case tCASTI:
        case tCASTF:
          loadSource(currInstr, 0);
          loadTarget(currInstr, 1);
          break;

        case tADD :
        case tSUB :
        case tMUL :
        case tDIV :
        case tMOD :
        case tADDF :
        case tSUBF :
        case tMULF :
        case tDIVF :
          loadSource(currInstr, 0);
          loadSource(currInstr, 1);
          loadTarget(currInstr, 2);
          break;

        case tPUSH:
          loadSource(currInstr, 0);
          break;

        case tPOP :
          loadTarget(currInstr, 0);
          break;

        case tNEGS:
        case tADDS:
        case tSUBS:
        case tMULS:
        case tDIVS:
        case tMODS:
        case tNEGSF:
        case tADDSF:
        case tSUBSF:
        case tMULSF:
        case tDIVSF:
        case tCASTSI:
        case tCASTSF:
          break;

        /* Label instruction must be handled at load time */
        case tLAB :
        {
          sscanf(yytext, "%*[Ll]%d:", &lab);

          currInstr->Operand[0].Mode  = mLabel;
          setOperandValue(&(currInstr->Operand[0]), lab); 
          validateLabel(lab);

          if (codeFlag == valid) {
            if (label[lab] != undefinedLabel) {
              sprintf(loadMessage, "L%d REDEFINED", lab);
              codeFlag = badLabel;
            } else {
              label[lab] = codeLine;
            }
          }

          break;
        }
    
        case tANDS:
        case tORS:
        case tNOTS:
          break;

        case tCMPEQS:
        case tCMPGES:
        case tCMPGTS:
        case tCMPLES:
        case tCMPLTS:
        case tCMPNES:
        case tCMPEQSF:
        case tCMPGESF:
        case tCMPGTSF:
        case tCMPLESF:
        case tCMPLTSF:
        case tCMPNESF:
          break;

        case tBRTS:
        case tBRFS:
          loadLabel(currInstr, 0);
          break;

        case tBR  :
          loadLabel(currInstr, 0);
          break;

        case tBEQ :
        case tBGE :
        case tBGT :
        case tBLE :
        case tBLT :
        case tBNE :
        case tBEQF :
        case tBGEF :
        case tBGTF :
        case tBLEF :
        case tBLTF :
        case tBNEF :
          loadSource(currInstr, 0);
          loadSource(currInstr, 1);
          loadLabel (currInstr, 2);
          break;

        case tCALL:
          loadLabel(currInstr, 0);
          break;

        case tRET :
          break;

        case tEOF :
          break;

        case tPRTS:
        case tPRTR:
          break;

        default:
          perror(">>> INTERNAL ERROR IN LOAD_uCODE <<<");
          exit(1);
      }

    loadEnd();
  }


    /* Print an error message if an error occured */
    if (codeFlag != valid) {
      loadError(loadText, loadLine, loadMessage);
      switch (codeFlag) {
        case invalidOpcode:
          break;

        case invalidForm:
          printCorrectForm(currInstr->Opcode);
          break;

        case invalidRegister:
          fprintf(stderr, "\n   VALID RegisterS RANGE FROM 0 to ");
          fprintf(stderr, "%d", registerCount);
          fprintf(stderr, "\n");
          break;

        case invalidLabel:
          fprintf(stderr, "\n   VALID LABELS RANGE FROM 0 to ");
          fprintf(stderr, "%d", labelCount);
          fprintf(stderr, "\n");
          break;

        case badLabel:
        case invalidString:
          break;

        default:
          perror(">>> INTERNAL ERROR IN uLOAD <<<");
          exit(1);
      }
    }

    /* Process debugging information and update counters */
    fillInformation(currInstr, loadText, loadLine);

    loadText[0] = '\0';
    loadLine++;
    codeLine++;

    if (codeLine >= codeSize) {
      fprintf(stderr, ">>> CODE MEMORY OVERFLOW <<<\n");
      exit(1);
    }
  } while (yytok != tEOF);


  /* Resolve labels if source was loaded successfully */
  if (loadFlag == valid) {
    for (i = 0; i < labelCount; i++) {
      lab = label[i];

      while ((lab < 0) && (lab != undefinedLabel)) {
        label[i] = label[-label[i]];
        lab = label[i];
      }
    }
  }

  return (loadFlag == valid) ?1 :0;
}