예제 #1
0
void Output::errorDialog_results(ErrorDialog::Result r)
{
    switch(r)
    {
        case ErrorDialog::EdResultCancel:
            emit results(OutResultUserCancelled, QString::null, QString::null);
            isSaving = false;
            break;

        case ErrorDialog::EdResultOk:
            if(isSaving)
            {
                isSaving = false;
                emit results(OutResultInvalid, QString::null, QString::null);
            }
            else
            {
                emit results(OutResultInfoDismissed, QString::null, QString::null);
            }
            break;

        case ErrorDialog::EdResultContinue:
            doOutput();
            isSaving = false;
            break;
    }
}
예제 #2
0
void
SyncPollable::doError ()
{
    processingError = true;
    errorDirty = false;
    stateMutex.unlock ();

    for (;;) {
	pollable->processError ();

	stateMutex.lock ();
	if (errorDirty == false) {
	    if (inputDirty &&
		processingInput == false)
	    {
		doInput ();
	    }

	    if (outputDirty &&
		processingOutput == false)
	    {
		doOutput ();
	    }

	    if (errorDirty == false) {
		processingError = false;
		return;
	    }
	}

	errorDirty = false;
	stateMutex.unlock ();
    }
}
예제 #3
0
//-------------------------------------------< Operator Control >--------------------------------------------\\
task usercontrol()
{
	while (!bIfiAutonomousMode)
	{
		getInput();
		processOperator();
		doOutput();
	}
}
void Population::_iterate()
{
	for (vector<AspectBase *>::size_type a = 0; a < _runAspects.size(); a++)
	{
		_history++;
		_runAspects[a]->Evolve();
		doOutput();
	}
}
예제 #5
0
OsStatus MpOss::doOutputRs(const MpAudioSample* buffer, unsigned size)
{
   int sz = 2 * size * ((mStereoOps) ? 2 : 1);
   if (mStereoOps)
   {
      unsigned j;
      assert (size <= mUsedSamplesPerFrame);

      for (j = 0; j < size; j++)
      {
         mResamplerBuffer[2*j] = mResamplerBuffer[2*j + 1] = buffer[j];
      }
      return doOutput((const char*)mResamplerBuffer, sz);
   }
   else
   {
      return doOutput((const char*)buffer, sz);
   }
}
예제 #6
0
void SyncPollable::processOutput ()
{
    stateMutex.lock ();

    if (processingOutput ||
	processingError)
    {
	outputDirty = true;
    } else
	doOutput ();

    stateMutex.unlock ();
}
예제 #7
0
void Output::TrySave(const QString & headerPath, const QString & codefilePath)
{
    Q_ASSERT(errorDialog != NULL);

    if(isSaving)
    {
        // Shouldn't be possible because the UI is blocked while
        // isSaving is true.
        Q_ASSERT(false);
        emit results(OutResultErrorBusy, QString::null, QString::null);
    }

    currHeaderPath = headerPath;
    currCodefilePath = codefilePath;

    if(errorDialog->isVisible())
    {
        errorDialog->close();
    }

    isSaving = true;

    QStringList errors;
    QStringList warnings;
    AllSettings::GetErrors(errors, warnings);

    if(errors.count() > 0 || warnings.count() > 0)
    {
        if(errors.count() > 0)
        {
            // No more chance of saving at this point.
            isSaving = false;
            errorDialog->SetErrorText("Please correct the following invalid values before continuing:");
            errorDialog->ShowErrorsInfo(errors, warnings);
        }
        else
        {
            errorDialog->SetErrorText("Continue despite the following warnings?");
            errorDialog->ShowErrorsAction(errors, warnings);

            // Resumes in errorDialog_results if the user chooses
            // to continue
        }
    }
    else
    {
        // No errors were found; go straight to output.
        doOutput();
        isSaving = false;
    }
}
예제 #8
0
파일: charset.cpp 프로젝트: 0xf1sh/scummvm
void AGOSEngine::justifyOutPut(byte chr) {
	if (chr == 12) {
		_numLettersToPrint = 0;
		_printCharCurPos = 0;
		_printCharPixelCount = 0;
		doOutput(&chr, 1);
		clsCheck(_textWindow);
	} else if (chr == 0 || chr == ' ' || chr == 10) {
		bool fit;

		if (getGameType() == GType_FF || getGameType() == GType_PP) {
			fit = _printCharMaxPos - _printCharCurPos > _printCharPixelCount;
		} else {
			fit = _printCharMaxPos - _printCharCurPos >= _printCharPixelCount;
		}

		if (fit) {
			_printCharCurPos += _printCharPixelCount;
			doOutput(_lettersToPrintBuf, _numLettersToPrint);

			if (_printCharCurPos == _printCharMaxPos) {
				_printCharCurPos = 0;
			} else {
				if (chr)
					doOutput(&chr, 1);
				if (chr == 10)
					_printCharCurPos = 0;
				else if (chr != 0)
					_printCharCurPos += (getGameType() == GType_FF || getGameType() == GType_PP) ? getFeebleFontSize(chr) : 1;
			}
		} else {
			const byte newline_character = 10;
			_printCharCurPos = _printCharPixelCount;
			doOutput(&newline_character, 1);
			doOutput(_lettersToPrintBuf, _numLettersToPrint);
			if (chr == ' ') {
				doOutput(&chr, 1);
				_printCharCurPos += (getGameType() == GType_FF || getGameType() == GType_PP) ? getFeebleFontSize(chr) : 1;
			} else {
				doOutput(&chr, 1);
				_printCharCurPos = 0;
			}
		}
		_numLettersToPrint = 0;
		_printCharPixelCount = 0;
	} else {
		_lettersToPrintBuf[_numLettersToPrint++] = chr;
		_printCharPixelCount += (getGameType() == GType_FF || getGameType() == GType_PP) ? getFeebleFontSize(chr) : 1;
	}
}
예제 #9
0
task usercontrol()
{
  initializeOperator();
  StartTask(UpdatePIDControllers);
	#ifdef _SIMULATED
		while (!bSimulatedAutonomousMode)
	#else
		while (!bIfiAutonomousMode)
	#endif
		{
			getInput();
			processOperator();
			if (EnableOutput)
				doOutput();
		}
}
예제 #10
0
파일: openal2.cpp 프로젝트: Grokafar/qTox
/**
 * @brief Called on the captureTimer events to capture audio
 */
void OpenAL2::doAudio()
{
    QMutexLocker lock(&audioLock);

    // output section
    if (echoCancelSupported && outputInitialized && !peerSources.isEmpty()) {
        doOutput();
    } else {
        kill_filter_audio(filterer);
        filterer = nullptr;
    }

    // input section
    if (alInDev && inSubscriptions) {
        doInput();
    }
}
예제 #11
0
int doWithdraw(Account accountList)
{
	int amounttowithdraw = getAmount();

	if (accountList.balance < amounttowithdraw)
	{
		eraseDisplay();
		displayString(0,"Error, Insufficient Balance");
		return -1;
	}
	int bills[5] = {0, 0, 0, 0, 0};
	billsToOutput(amounttowithdraw, bills);

	doOutput(bills);

	return amounttowithdraw;
}
예제 #12
0
void
SyncPollable::doInput ()
{
    processingInput = true;
    inputDirty = false;
    stateMutex.unlock ();

    for (;;) {
	pollable->processInput ();

	stateMutex.lock ();

	if (processingError) {
	    if (errorDirty) {
		processingInput = false;
		return;
	    }

	    /* If we are processing an error,
	     * then output and input processing threads
	     * have already collapsed into one thread,
	     * and we have to call output handlers
	     * from within input handlers, and vice versa. */

	    if (processingOutput == false)
		if (outputDirty)
		    doOutput ();
	} else
	    if (errorDirty)
		doError ();

	if (inputDirty == false) {
	    processingInput = false;
	    return;
	}

	inputDirty = false;
	stateMutex.unlock ();
    }
}
예제 #13
0
STATIC void parseString( const char *str ) {

/**/myassert( str != NULL );
    for(;;) {
        while( isspace( *str ) ) ++str;
        switch( *str ) {
        case 0:
            return;
        case SWCHAR:
        case '-':
            str += 2;
            switch( str[-1] ) {
            case 'o':   str = doOutput( str );      break;
            case 'd':   str = doDebug( str );       break;
            case 'p':   str = doParse( str );       break;
            case 'f':   str = doFile( str );        break;
            case 'q':   /* FALL THROUGH */
#if 0
            case 'l':
#endif
            case 'b':   str = doToggle( str );      break;
            default:    usage();
            }
            if( !isBreakChar( *str ) ) usage();
            break;
        case INCCHAR:
            str = doInclude( str + 1 );
            break;
        case CMTCHAR:
            str = doComment( str + 1 );
            break;
        default:
            str = addFile( str );
            break;
        }
    }

}
예제 #14
0
OsStatus MpOss::initDeviceFinal(unsigned samplesPerSec, unsigned samplesPerFrame)
{
   int stereo = PRODUCE_STEREO_TO_DEV;
   int res = ioctl(mfdDevice, SNDCTL_DSP_STEREO, &stereo);
   if (res == -1)
   {
      if (stereo)
      {
         stereo = 0;
         res = ioctl(mfdDevice, SNDCTL_DSP_STEREO, &stereo);
      }

      if (res == -1)
      {
         OsSysLog::add(FAC_MP, PRI_EMERG,
            "OSS: could not set needed channel audio count!\n");
         return OS_FAILED;
      }
      else
      {
         OsSysLog::add(FAC_MP, PRI_WARNING,
            "OSS: could not set stereo, using mono!\n");
      }
   }

   res = ioctl(mfdDevice, SNDCTL_DSP_GETCAPS, &mDeviceCap);
   if (res == -1)
   {
      OsSysLog::add(FAC_MP, PRI_EMERG,
         "OSS: could not get capabilities; *** NO SOUND! ***!\n");
      return OS_FAILED;
   }

   int duplex = isDevCapDuplex();

   // Try to find optimal internal OSS buffer size to satisfy latency constraint
   const int minSegmentBits = 5;
   
   for (int segmentBits = 8; segmentBits >= minSegmentBits; segmentBits--)
   {
      int bytesInOneFrame = 2 * samplesPerFrame * ((stereo) ? 2 : 1);
      int frmsize = samplesPerFrame * 1000 / samplesPerSec;
      int buffering = OSS_LATENCY_LENGTH * bytesInOneFrame / frmsize  + bytesInOneFrame;
      if (duplex)
      {
         // Increase buffer by 2.25 for duplex operations
         // Use addition quater because input and output can't operate on the same buffer
         buffering =  (buffering * 9) >> 2;
      }

      int reqfragsize = (1 << segmentBits);
      int cnt = buffering / reqfragsize + ((buffering % reqfragsize) ? 1 : 0);

      int minimumfrag = 2 + (buffering / (bytesInOneFrame/2));

      // We must have sufficient amount of buffers to minimize latemcy
      if  ((segmentBits > minSegmentBits) && (cnt < minimumfrag))
         continue;
      else if ((segmentBits == minSegmentBits) && (cnt < minimumfrag))
      {
         OsSysLog::add(FAC_MP, PRI_DEBUG,
           "OSS: Minimum segment count has been limited to: %d giving a few amount of buffers: %d, while recommended count is %d. May be poor sound.",
           minSegmentBits, cnt, minimumfrag);
      }

      int fragment = (cnt << 16) | segmentBits;
      res = ioctl(mfdDevice, SNDCTL_DSP_SETFRAGMENT, &fragment);
      if(res == -1)
      {
         OsSysLog::add(FAC_MP, PRI_EMERG,
                       "OSS: could not set fragment size %x; *** NO SOUND! ***\n",
                       fragment);

         return OS_FAILED;
      }

      int fragsize = 0;
      res = ioctl(mfdDevice, SNDCTL_DSP_GETBLKSIZE, &fragsize);
      if (res == -1)
      {
         OsSysLog::add(FAC_MP, PRI_DEBUG,
            "OSS: could not get fragment size.\n");
         break;
      }

      if (fragsize != reqfragsize)
      {
         OsSysLog::add(FAC_MP, PRI_DEBUG,
            "OSS: could not set fragment size %x, using %x. Sound quality may be poor\n",
            fragment, reqfragsize);
      }
      OsSysLog::add(FAC_MP, PRI_DEBUG,
         "OSS: Use fragment size %x; Bytes in a frame:%d; Internal buffer size:%d; Minimum buffers count:%d;\n",
         fragment, bytesInOneFrame, fragsize, minimumfrag);
   
      break;
   }

   int speed = samplesPerSec;
   int wspeed = speed;
   res = ioctl(mfdDevice, SNDCTL_DSP_SPEED, &speed);
   if ((res == -1) || (speed != wspeed))
   {
      OsSysLog::add(FAC_MP, PRI_EMERG,
         "OSS: could not set sample speed; *** NO SOUND! ***");
      return OS_FAILED;
   }

   mUsedSamplesPerSec = samplesPerSec;
   mUsedSamplesPerFrame = samplesPerFrame;
   mStereoOps = stereo;

   if (!duplex)
   {
      char buff[8] = {0};
      OsStatus st = doOutput(buff, 8);

      mbWriteCap = (st == OS_SUCCESS);
      mbReadCap = !mbWriteCap;


      OsSysLog::add(FAC_MP, PRI_DEBUG,
         "OSS: device support only %s operations",
         (mbWriteCap) ? "output" : "input");
   }

   //Initialize resampler
   if (mStereoOps)
   {
      int buffSize = ((mStereoOps) ? 2 : 1) * samplesPerFrame;
      assert(mResamplerBuffer == NULL);
      mResamplerBuffer = new MpAudioSample[buffSize];

      assert(buffSize * 2 <=  SOUND_MAXBUFFER);
   }

   return OS_SUCCESS;
}
예제 #15
0
파일: macro.c 프로젝트: xrg/RPM
/**
 * The main macro recursion loop.
 * @todo Dynamically reallocate target buffer.
 * @param mb		macro expansion state
 * @return		0 on success, 1 on failure
 */
static int
expandMacro(MacroBuf mb)
{
    rpmMacroEntry *mep;
    rpmMacroEntry me;
    const char *s = mb->s, *se;
    const char *f, *fe;
    const char *g, *ge;
    size_t fn, gn;
    char *t = mb->t;	/* save expansion pointer for printExpand */
    int c;
    int rc = 0;
    int negate;
    const char * lastc;
    int chkexist;

    if (++mb->depth > max_macro_depth) {
	rpmlog(RPMLOG_ERR,
		_("Recursion depth(%d) greater than max(%d)\n"),
		mb->depth, max_macro_depth);
	mb->depth--;
	mb->expand_trace = 1;
	return 1;
    }

    while (rc == 0 && mb->nb > 0 && (c = *s) != '\0') {
	s++;
	/* Copy text until next macro */
	switch(c) {
	case '%':
		if (*s) {	/* Ensure not end-of-string. */
		    if (*s != '%')
			break;
		    s++;	/* skip first % in %% */
		}
	default:
		SAVECHAR(mb, c);
		continue;
		break;
	}

	/* Expand next macro */
	f = fe = NULL;
	g = ge = NULL;
	if (mb->depth > 1)	/* XXX full expansion for outermost level */
		t = mb->t;	/* save expansion pointer for printExpand */
	negate = 0;
	lastc = NULL;
	chkexist = 0;
	switch ((c = *s)) {
	default:		/* %name substitution */
		while (strchr("!?", *s) != NULL) {
			switch(*s++) {
			case '!':
				negate = ((negate + 1) % 2);
				break;
			case '?':
				chkexist++;
				break;
			}
		}
		f = se = s;
		if (*se == '-')
			se++;
		while((c = *se) && (risalnum(c) || c == '_'))
			se++;
		/* Recognize non-alnum macros too */
		switch (*se) {
		case '*':
			se++;
			if (*se == '*') se++;
			break;
		case '#':
			se++;
			break;
		default:
			break;
		}
		fe = se;
		/* For "%name " macros ... */
		if ((c = *fe) && isblank(c))
			if ((lastc = strchr(fe,'\n')) == NULL)
                lastc = strchr(fe, '\0');
		break;
	case '(':		/* %(...) shell escape */
		if ((se = matchchar(s, c, ')')) == NULL) {
			rpmlog(RPMLOG_ERR,
				_("Unterminated %c: %s\n"), (char)c, s);
			rc = 1;
			continue;
		}
		if (mb->macro_trace)
			printMacro(mb, s, se+1);

		s++;	/* skip ( */
		rc = doShellEscape(mb, s, (se - s));
		se++;	/* skip ) */

		s = se;
		continue;
		break;
	case '{':		/* %{...}/%{...:...} substitution */
		if ((se = matchchar(s, c, '}')) == NULL) {
			rpmlog(RPMLOG_ERR,
				_("Unterminated %c: %s\n"), (char)c, s);
			rc = 1;
			continue;
		}
		f = s+1;/* skip { */
		se++;	/* skip } */
		while (strchr("!?", *f) != NULL) {
			switch(*f++) {
			case '!':
				negate = ((negate + 1) % 2);
				break;
			case '?':
				chkexist++;
				break;
			}
		}
		for (fe = f; (c = *fe) && !strchr(" :}", c);)
			fe++;
		switch (c) {
		case ':':
			g = fe + 1;
			ge = se - 1;
			break;
		case ' ':
			lastc = se-1;
			break;
		default:
			break;
		}
		break;
	}

	/* XXX Everything below expects fe > f */
	fn = (fe - f);
	gn = (ge - g);
	if ((fe - f) <= 0) {
/* XXX Process % in unknown context */
		c = '%';	/* XXX only need to save % */
		SAVECHAR(mb, c);
#if 0
		rpmlog(RPMLOG_ERR,
			_("A %% is followed by an unparseable macro\n"));
#endif
		s = se;
		continue;
	}

	if (mb->macro_trace)
		printMacro(mb, s, se);

	/* Expand builtin macros */
	if (STREQ("global", f, fn)) {
		s = doDefine(mb, se, RMIL_GLOBAL, 1);
		continue;
	}
	if (STREQ("define", f, fn)) {
		s = doDefine(mb, se, mb->depth, 0);
		continue;
	}
	if (STREQ("undefine", f, fn)) {
		s = doUndefine(mb->mc, se);
		continue;
	}

	if (STREQ("echo", f, fn) ||
	    STREQ("warn", f, fn) ||
	    STREQ("error", f, fn)) {
		int waserror = 0;
		if (STREQ("error", f, fn))
			waserror = 1;
		if (g != NULL && g < ge)
			doOutput(mb, waserror, g, gn);
		else
			doOutput(mb, waserror, f, fn);
		s = se;
		continue;
	}

	if (STREQ("trace", f, fn)) {
		/* XXX TODO restore expand_trace/macro_trace to 0 on return */
		mb->expand_trace = mb->macro_trace = (negate ? 0 : mb->depth);
		if (mb->depth == 1) {
			print_macro_trace = mb->macro_trace;
			print_expand_trace = mb->expand_trace;
		}
		s = se;
		continue;
	}

	if (STREQ("dump", f, fn)) {
		rpmDumpMacroTable(mb->mc, NULL);
		while (iseol(*se))
			se++;
		s = se;
		continue;
	}

#ifdef	WITH_LUA
	if (STREQ("lua", f, fn)) {
		rpmlua lua = NULL; /* Global state. */
		const char *ls = s+sizeof("{lua:")-1;
		const char *lse = se-sizeof("}")+1;
		char *scriptbuf = (char *)xmalloc((lse-ls)+1);
		const char *printbuf;
		memcpy(scriptbuf, ls, lse-ls);
		scriptbuf[lse-ls] = '\0';
		rpmluaSetPrintBuffer(lua, 1);
		if (rpmluaRunScript(lua, scriptbuf, NULL) == -1)
		    rc = 1;
		printbuf = rpmluaGetPrintBuffer(lua);
		if (printbuf) {
		    size_t len = strlen(printbuf);
		    if (len > mb->nb)
			len = mb->nb;
		    memcpy(mb->t, printbuf, len);
		    mb->t += len;
		    mb->nb -= len;
		}
		rpmluaSetPrintBuffer(lua, 0);
		free(scriptbuf);
		s = se;
		continue;
	}
#endif

	/* XXX necessary but clunky */
	if (STREQ("basename", f, fn) ||
	    STREQ("suffix", f, fn) ||
	    STREQ("expand", f, fn) ||
	    STREQ("verbose", f, fn) ||
	    STREQ("uncompress", f, fn) ||
	    STREQ("url2path", f, fn) ||
	    STREQ("u2p", f, fn) ||
	    STREQ("getenv", f, fn) ||
	    STREQ("S", f, fn) ||
	    STREQ("P", f, fn) ||
	    STREQ("F", f, fn)) {
		/* FIX: verbose may be set */
		doFoo(mb, negate, f, fn, g, gn);
		s = se;
		continue;
	}

	/* Expand defined macros */
	mep = findEntry(mb->mc, f, fn);
	me = (mep ? *mep : NULL);

	/* XXX Special processing for flags */
	if (*f == '-') {
		if (me)
			me->used++;	/* Mark macro as used */
		if ((me == NULL && !negate) ||	/* Without -f, skip %{-f...} */
		    (me != NULL && negate)) {	/* With -f, skip %{!-f...} */
			s = se;
			continue;
		}

		if (g && g < ge) {		/* Expand X in %{-f:X} */
			rc = expandT(mb, g, gn);
		} else
		if (me && me->body && *me->body) {/* Expand %{-f}/%{-f*} */
			rc = expandT(mb, me->body, strlen(me->body));
		}
		s = se;
		continue;
	}

	/* XXX Special processing for macro existence */
	if (chkexist) {
		if ((me == NULL && !negate) ||	/* Without -f, skip %{?f...} */
		    (me != NULL && negate)) {	/* With -f, skip %{!?f...} */
			s = se;
			continue;
		}
		if (g && g < ge) {		/* Expand X in %{?f:X} */
			rc = expandT(mb, g, gn);
		} else
		if (me && me->body && *me->body) { /* Expand %{?f}/%{?f*} */
			rc = expandT(mb, me->body, strlen(me->body));
		}
		s = se;
		continue;
	}
	
	if (me == NULL) {	/* leave unknown %... as is */
#ifndef HACK
#if DEAD
		/* XXX hack to skip over empty arg list */
		if (fn == 1 && *f == '*') {
			s = se;
			continue;
		}
#endif
		/* XXX hack to permit non-overloaded %foo to be passed */
		c = '%';	/* XXX only need to save % */
		SAVECHAR(mb, c);
#else
		rpmlog(RPMLOG_ERR,
			_("Macro %%%.*s not found, skipping\n"), fn, f);
		s = se;
#endif
		continue;
	}

	/* Setup args for "%name " macros with opts */
	if (me && me->opts != NULL) {
		if (lastc != NULL) {
			se = grabArgs(mb, me, fe, lastc);
		} else {
			addMacro(mb->mc, "**", NULL, "", mb->depth);
			addMacro(mb->mc, "*", NULL, "", mb->depth);
			addMacro(mb->mc, "#", NULL, "0", mb->depth);
			addMacro(mb->mc, "0", NULL, me->name, mb->depth);
		}
	}

	/* Recursively expand body of macro */
	if (me->body && *me->body) {
		mb->s = me->body;
		rc = expandMacro(mb);
		if (rc == 0)
			me->used++;	/* Mark macro as used */
	}

	/* Free args for "%name " macros with opts */
	if (me->opts != NULL)
		freeArgs(mb);

	s = se;
    }

    *mb->t = '\0';
    mb->s = s;
    mb->depth--;
    if (rc != 0 || mb->expand_trace)
	printExpansion(mb, t, mb->t);
    return rc;
}
예제 #16
0
CCuteCom::CCuteCom(QWidget* parent)
:QWidget(parent)
,m_isConnected(false)
,m_fd(-1)
,m_cmdBufIndex(0)
,m_notifier(0)
,m_sz(0)
,m_progress(0)
,m_progressStepSize(1000)
,m_fileDlg(0)
,m_outputTimer(this)
,m_keyRepeatTimer(this)
,m_keyCode(0)
,m_hexBytes(0)
,m_previousChar('\0')
{
   WRITE_ERROR_LOGGER()
   QCoreApplication::setOrganizationName("CuteCom");
//   QCoreApplication::setOrganizationDomain("mysoft.com");
   QCoreApplication::setApplicationName("CuteCom");

   this->setupUi(this);
   fillBaudCb();

   connect(m_connectPb, SIGNAL(clicked()), this, SLOT(connectTTY()));
   connect(m_closePb, SIGNAL(clicked()), this, SLOT(disconnectTTY()));
   connect(m_clearOutputPb, SIGNAL(clicked()), this, SLOT(clearOutput()));
//   connect(m_clearInputPb, SIGNAL(clicked()), m_oldCmdsLb, SLOT(clear()));

   connect(m_cmdLe, SIGNAL(returnPressed()), this, SLOT(execCmd()));

   connect(m_sendPb, SIGNAL(clicked()), this, SLOT(sendFile()));
   connect(m_aboutPb, SIGNAL(clicked()), this, SLOT(showAboutMsg()));
   connect(m_quitPb, SIGNAL(clicked()), this, SLOT(close()));

   connect(m_oldCmdsLb, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(oldCmdClicked(QListWidgetItem*)));
   connect(m_oldCmdsLb, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(execCmd()));

   connect(m_hexOutputCb, SIGNAL(toggled(bool)), this, SLOT(hexOutputClicked(bool)));

   connect(m_connectPb, SIGNAL(clicked()), this, SLOT(saveSettings()));
   connect(m_deviceCb, SIGNAL(activated(int)), this, SLOT(saveSettings()));
   connect(m_baudCb, SIGNAL(activated(int)), this, SLOT(saveSettings()));
   connect(m_dataBitsCb, SIGNAL(activated(int)), this, SLOT(saveSettings()));
   connect(m_parityCb, SIGNAL(activated(int)), this, SLOT(saveSettings()));
   connect(m_stopCb, SIGNAL(activated(int)), this, SLOT(saveSettings()));
   connect(m_protoPb, SIGNAL(activated(int)), this, SLOT(saveSettings()));
   connect(m_softwareCb, SIGNAL(clicked()), this, SLOT(saveSettings()));
   connect(m_hardwareCb, SIGNAL(clicked()), this, SLOT(saveSettings()));
   connect(m_readCb, SIGNAL(clicked()), this, SLOT(saveSettings()));
   connect(m_writeCb, SIGNAL(clicked()), this, SLOT(saveSettings()));
   connect(m_applyCb, SIGNAL(clicked()), this, SLOT(saveSettings()));
   connect(m_hexOutputCb, SIGNAL(clicked()), this, SLOT(saveSettings()));
   connect(m_inputModeCb, SIGNAL(activated(int)), this, SLOT(saveSettings()));
   connect(m_charDelaySb, SIGNAL(valueChanged(int)), this, SLOT(saveSettings()));
   connect(m_logAppendCb, SIGNAL(activated(int)), this, SLOT(saveSettings()));

   connect(m_applyCb, SIGNAL(toggled(bool)), this, SLOT(enableSettingWidgets(bool)));
   connect(m_logFileFileDialog, SIGNAL(clicked()), this, SLOT(chooseLogFile()));

   connect(&m_outputTimer, SIGNAL(timeout()), this, SLOT(doOutput()));
   connect(&m_keyRepeatTimer, SIGNAL(timeout()), this, SLOT(sendKey()));

   connect(m_enableLoggingCb, SIGNAL(toggled(bool)), this, SLOT(enableLogging(bool)));
//   connect(m_enableLoggingCb, SIGNAL(toggled(bool)), this, SLOT(enableLogging(bool)));

   m_outputView->setWordWrapMode(QTextOption::WrapAnywhere); 
   m_outputView->document()->setMaximumBlockCount(500);
//  TODO ? m_outputView->setWordWrap(Q3TextEdit::WidgetWidth);

/*   QAccel* accel=new QAccel(this);
   accel->insertItem(CTRL+Key_C, 3);
   accel->insertItem(CTRL+Key_Q, 17);
   accel->insertItem(CTRL+Key_S, 19);
   connect(accel, SIGNAL(activated(int)), this, SLOT(sendByte(int)));*/

   m_outputTimerStart.start();

   readSettings();

   disconnectTTY();

   m_cmdLe->installEventFilter(this);
}
예제 #17
0
bool PSCommentLexer::parse(QIODevice& fin)
{
    char c;

    m_buffer.clear();
    m_curState = State_Start;

    parsingStarted();

    while (!fin.atEnd()) {
        fin.getChar(&c);

//    qDebug ("got %c", c);

        State newState;
        Action action;

        nextStep(c, &newState, &action);

        switch (action) {
        case Action_Copy :
            m_buffer.append(c);
            break;
        case Action_CopyOutput :
            m_buffer.append(c);
            doOutput();
            break;
        case Action_Output :
            doOutput();
            break;
        case Action_OutputUnget :
            doOutput();
            fin.ungetChar(c);
            break;
        case Action_Ignore :
            /* ignore */
            break;
        case Action_Abort :
            qWarning("state %s / %s char %c (%d)" , statetoa(m_curState), statetoa(newState), c, c);
            parsingAborted();
            return false;
            break;
        case Action_InitTemp :
            m_temp.clear();
            break;
        case Action_CopyTemp :
            m_temp.append(c);
            break;
        case Action_DecodeUnget :
            m_buffer.append(decode());
            fin.ungetChar(c);
            break;
        default :
            qWarning("unknown action: %d ", action);
        }

        m_curState = newState;
    }

    parsingFinished();
    return true;
}