示例#1
0
void RMTony::endStatic(CORO_PARAM, CharacterTalkType nTalk) {
	CORO_BEGIN_CONTEXT;
	int bodyEndPat;
	int finalPat;
	int headEndPat;
	CORO_END_CONTEXT(_ctx);

	CORO_BEGIN_CODE(_ctx);

	_ctx->bodyEndPat = 0;
	_ctx->finalPat = 0;
	_ctx->headEndPat = 0;

	endStaticCalculate(nTalk, _ctx->bodyEndPat, _ctx->finalPat, _ctx->headEndPat);

	if (_ctx->headEndPat != 0) {
		setPattern(_ctx->headEndPat);

		CORO_INVOKE_0(waitForEndPattern);
	} else {
		// Play please
		_body.setPattern(_ctx->bodyEndPat);

		CORO_INVOKE_0(_body.waitForEndPattern);
	}

	setPattern(_ctx->finalPat);
	_body.setPattern(0);

	_bIsStaticTalk = false;

	CORO_END_CODE;
}
示例#2
0
void RMTony::startStatic(CORO_PARAM, CharacterTalkType nTalk) {
	CORO_BEGIN_CONTEXT;
	int headPat, headLoopPat;
	int bodyStartPat, bodyLoopPat;
	CORO_END_CONTEXT(_ctx);

	CORO_BEGIN_CODE(_ctx);

	_ctx->headPat = _ctx->headLoopPat = 0;
	_ctx->bodyStartPat = _ctx->bodyLoopPat = 0;

	startStaticCalculate(nTalk, _ctx->headPat, _ctx->headLoopPat,
		_ctx->bodyStartPat, _ctx->bodyLoopPat);

	// e vai con i pattern
	_bIsStaticTalk = true;

	setPattern(_ctx->headPat);
	_body.setPattern(_ctx->bodyStartPat);

	CORO_INVOKE_0(_body.waitForEndPattern);
	CORO_INVOKE_0(waitForEndPattern);

	if (_ctx->headLoopPat != -1)
		setPattern(_ctx->headLoopPat);
	_body.setPattern(_ctx->bodyLoopPat);

	CORO_END_CODE;
}
示例#3
0
void RMTony::startTalk(CORO_PARAM, CharacterTalkType nTalkType) {
	CORO_BEGIN_CONTEXT;
	int headStartPat, bodyStartPat;
	int headLoopPat, bodyLoopPat;
	CORO_END_CONTEXT(_ctx);

	CORO_BEGIN_CODE(_ctx);

	_ctx->headStartPat = _ctx->bodyStartPat = 0;
	_ctx->headLoopPat = _ctx->bodyLoopPat = 0;

	if (!startTalkCalculate(nTalkType, _ctx->headStartPat, _ctx->bodyStartPat,
	                        _ctx->headLoopPat, _ctx->bodyLoopPat))
		return;

	// Perform the set pattern
	if (_ctx->headStartPat != 0 || _ctx->bodyStartPat != 0) {
		setPattern(_ctx->headStartPat);
		_body.setPattern(_ctx->bodyStartPat);

		if (_ctx->bodyStartPat != 0)
			CORO_INVOKE_0(_body.waitForEndPattern);
		if (_ctx->headStartPat != 0)
			CORO_INVOKE_0(waitForEndPattern);
	}

	setPattern(_ctx->headLoopPat);
	if (_ctx->bodyLoopPat)
		_body.setPattern(_ctx->bodyLoopPat);

	CORO_END_CODE;
}
示例#4
0
void TilePattern::setPreset(int preset) {
	switch (preset) {
		case 0: setPattern(L"0, 1, 1"); break; // Stack
		case 1: setPattern(L"0, 1, 1 / 0.5, 1, 1"); break; // Stretcher
		case 2: setPattern(L".25, 1, 1, .5 / -.5, 1, 1 / -.5, 1, 1 / -.5, 1, 1 / -.5, 1, 1"); break; // Flemish Strecher
		case 3: setPattern(L".25, 1, .5 / -.5, 1, 1 / -.5, 1, 1 / -.5, 1, 1 / -.5, 1, 1"); break; // Common
		case 4: setPattern(L"0, 1, 1, .5 / .75, 1, 1, .5"); break; // Flemish
		case 5: setPattern(L"0, 1, 1, 1, .5 / 1.25, 1, 1, 1, .5"); break; // Monk Bond
		case 6: setPattern(L"0, 1, 1, 1, 1, .5 / 1.75, 1, 1, 1, 1, .5"); break; // Flemish Garden Wall
		case 7: setPattern(L".25, 1, .5 / 0, 1, 1"); break; // English
		case 8: setPattern(L"0,1,1 / -.25,1,.5 / -.25,1,1 / -.25,1,.5"); break; // English Cross
		case 9: setPattern(L"0,1,.5 / -.25,1,.5 / -.25,1,1 / -.25,1,1"); break; // Double English Cross
	}
}
示例#5
0
RegularExpression::RegularExpression(const XMLCh* const pattern,
									 const XMLCh* const options,
                                     MemoryManager* const manager)
	:fHasBackReferences(false),
	 fFixedStringOnly(false),
	 fNoGroups(0),
	 fMinLength(0),
	 fNoClosures(0),
	 fOptions(0),
	 fBMPattern(0),
	 fPattern(0),
	 fFixedString(0),
	 fOperations(0),
	 fTokenTree(0),
	 fFirstChar(0),
     fOpFactory(manager),
     fTokenFactory(0),
     fMemoryManager(manager)
{
	try {

		setPattern(pattern, options);
	}
    catch(const OutOfMemoryException&)
    {
        throw;
    }
    catch (...) {

		cleanUp();
		throw;
	}
}
示例#6
0
UnicodeSet& UnicodeSet::applyPattern(const UnicodeString& pattern,
                              ParsePosition& pos,
                              uint32_t options,
                              const SymbolTable* symbols,
                              UErrorCode& status) {
    if (U_FAILURE(status)) {
        return *this;
    }
    if (isFrozen()) {
        status = U_NO_WRITE_PERMISSION;
        return *this;
    }
    // Need to build the pattern in a temporary string because
    // _applyPattern calls add() etc., which set pat to empty.
    UnicodeString rebuiltPat;
    RuleCharacterIterator chars(pattern, symbols, pos);
    applyPattern(chars, symbols, rebuiltPat, options, &UnicodeSet::closeOver, status);
    if (U_FAILURE(status)) return *this;
    if (chars.inVariable()) {
        // syntaxError(chars, "Extra chars in variable value");
        status = U_MALFORMED_SET;
        return *this;
    }
    setPattern(rebuiltPat);
    return *this;
}
示例#7
0
文件: matrix.c 项目: Elive/effectv
effect *matrixRegister(void)
{
	effect *entry;
	
	sharedbuffer_reset();
	mapW = video_width / FONT_W;
	mapH = video_height / FONT_H;
	cmap = (unsigned char *)sharedbuffer_alloc(mapW * mapH);
	vmap = (unsigned char *)sharedbuffer_alloc(mapW * mapH);
	img = (unsigned char *)sharedbuffer_alloc(mapW * mapH);
	if(cmap == NULL || vmap == NULL || img == NULL) {
		return NULL;
	}

	blips = (Blip *)sharedbuffer_alloc(mapW * sizeof(Blip));
	if(blips == NULL) {
		return NULL;
	}

	setPattern();
	setPalette();

	entry = (effect *)malloc(sizeof(effect));
	if(entry == NULL) {
		return NULL;
	}
	
	entry->name = effectname;
	entry->start = start;
	entry->stop = stop;
	entry->draw = draw;
	entry->event = event;

	return entry;
}
示例#8
0
/* configureGPRS() - configures GPRS connection with login, password and some other parameters
 *
 * This function creates a GPRS connection with the carrier server to get access to the internet
 *
 * It modifies 'flag' if expected answer is not received after sending a command to GPRS module
 *
 * Returns '1' on success and '0' if error
*/
uint8_t WaspGPRS::configureGPRS()
{
	char command[100];
	char aux='"';
	uint8_t answer=0;
	
	flag &= ~(GPRS_ERROR_CONF);

	sprintf(command,"%s0,%c%s%c,%c%s%c,%c%s%c,%c%s%c,%c%s%c",AT_GPRS_CONN_CFG,aux,
		AT_GPRS,aux,aux,AT_GPRS_APN,aux,aux,AT_GPRS_LOGIN,aux,aux,AT_GPRS_PASSW,aux,aux,AT_GPRS_IP,aux);
	
	answer=sendATCommand(command,AT_GPRS_CONN_CFG_R);
	switch(answer)
	{
		case	0	:	flag |= GPRS_ERROR_CONF;
					return 0;
					break;
		case	2	:	flag |= GPRS_ERROR_CONF;
					return 0;
					break;
	}
	
	if(!setConnectionTimer()) return 0;
	
	if(!setConnectionProfile()) return 0;
	
	if(!checkGPRS()) return 0;
	
	if(!setPattern(GPRS_PATTERN)) return 0;
	
	if(flag & GPRS_ERROR_CONF) return 0;
	return 1;
}
示例#9
0
// ---------------------------------------------------------------------------
//  RegularExpression: Constructors and Destructors
// ---------------------------------------------------------------------------
RegularExpression::RegularExpression(const char* const pattern,
                                     MemoryManager* const manager)
	:fHasBackReferences(false),
	 fFixedStringOnly(false),
	 fNoGroups(0),
	 fMinLength(0),
	 fNoClosures(0),
	 fOptions(0),
	 fBMPattern(0),
	 fPattern(0),
	 fFixedString(0),
	 fOperations(0),
	 fTokenTree(0),
	 fFirstChar(0),
     fOpFactory(manager),
     fTokenFactory(0),
     fMemoryManager(manager)
{
	try {

		XMLCh* tmpBuf = XMLString::transcode(pattern, fMemoryManager);
        ArrayJanitor<XMLCh> janBuf(tmpBuf, fMemoryManager);
		setPattern(tmpBuf);
	}
    catch(const OutOfMemoryException&)
    {
        throw;
    }
    catch (...) {

		cleanUp();
		throw;
	}
}
示例#10
0
paramform::paramform(QComm *com, QWidget *parent) :
    QWidget(parent,Qt::FramelessWindowHint),patterndata(NULL),paramadata(NULL),dmzmodel(NULL),llmodel(NULL),
        zdjmodel(NULL),ssmodel(NULL),sztfmodel(NULL),ytxszxzmodel(NULL),
        ytxsztfmodel(NULL),cjpmodel(NULL),pzkmodel(NULL),
        szkbmodel(NULL),dmbcmodel(NULL),ycwzxzmodel(NULL),
        fzycwzxzmodel(NULL),formjqgzcs(NULL),formxtcs(NULL),
        pcomm(com){
    //qDebug()<<"enter paramform construction fuc"<<QTime::currentTime().toString("ss-zzz");
    setupUi(this);
    //qDebug()<<"setupUi(this)"<<QTime::currentTime().toString("ss-zzz");
    ////////////////////////////
    setPattern(&patternData);
    //qDebug()<<"setPattern:"<<QTime::currentTime().toString("ss-zzz");
    setParama(&paramaData);
    label_13->setText(patterndata->wrkFileName);
    label_11->setText(paramadata->spafilename);
    //qDebug()<<"patterndata.loadfile"<<QTime::currentTime().toString("ss-zzz");
    //qDebug()<<"set model"<<QTime::currentTime().toString("ss-zzz");
    ///////////////////////////////
    connect(this,SIGNAL(indexchanged(int)),stackedWidget,SLOT(setCurrentIndex(int)));
    connect(this,SIGNAL(indexchanged(int)),SLOT(indexchange(int)));
    //connect(paramadata,SIGNAL(dirty(bool)),pushButton_spareset,SLOT(setEnabled(bool)));

    timer.setInterval(400); //timer for read absolute pin position
    timer.setSingleShot(FALSE);
    connect(&timer,SIGNAL(timeout()),SLOT(readabspinpos())); //when in xtcs form timer start,
                                                             //otherwise timer stop

    //QStatusBar *statusbar = new QStatusBar;
    //statusbar->
}
示例#11
0
文件: FileDialog.cpp 项目: tindzk/Xfe
// Change pattern for pattern number patno
void FileSelector::setPatternText(FXint patno,const FXString& text)
{
	if ((unsigned int)patno >= (unsigned int)filefilter->getNumItems())
        fxerror("%s::setPatternText: index out of range.\n",getClassName());
    filefilter->setItemText(patno,text);
    if(patno==filefilter->getCurrentItem())
        setPattern(patternFromText(text));
}
示例#12
0
TextSearcherICU::~TextSearcherICU() {
  // Leave the static object pointing to valid strings (pattern=target,
  // text=buffer). Otheriwse, usearch_reset() will results in 'use-after-free'
  // error.
  setPattern(&newlineCharacter, 1);
  setText(&newlineCharacter, 1);
  ICULockableSearcher::releaseSearcher();
}
示例#13
0
PatternLoggingLayout::PatternLoggingLayout() 
{
    try 
    {
        setPattern(DEFAULT_CONVERSION_PATTERN);
    }
    catch(InvalidConfigException&) 
    {
    }
}
示例#14
0
void
RegexScan::setPattern(
  const char *	pattern,
  bool	    	fast,
  size_t    	bufSize,
  const char *	tranTable
  )
{
  setPattern( defaultSyntax, pattern, fast, bufSize, tranTable );
}
示例#15
0
int TPerturbationBump::setAttribute (const string& rktNAME, NAttribute nVALUE, EAttribType eTYPE)
{

  if ( rktNAME == "source" )
  {
    if ( eTYPE == FX_PATTERN )
    {
      setPattern ((TPattern*) nVALUE.pvValue);
    }
    else
    {
      return FX_ATTRIB_WRONG_TYPE;
    }
  }
  else if ( rktNAME == "grad_disp" )
  {
    if ( eTYPE == FX_VECTOR2 )
    {
      tGradientDisplacement = (*((TVector2*) nVALUE.pvValue));
    }
    else
    {
      return FX_ATTRIB_WRONG_TYPE;
    }
  }
  else if ( rktNAME == "bump" )
  {
    if ( eTYPE == FX_REAL )
    {
      tBumpFactor = nVALUE.dValue;
    }
    else
    {
      return FX_ATTRIB_WRONG_TYPE;
    }
  }
  else if ( rktNAME == "samples" )
  {
    if ( eTYPE == FX_VECTOR2 )
    {
      tSamples = (*((TVector2*) nVALUE.pvValue));
    }
    else
    {
      return FX_ATTRIB_WRONG_TYPE;
    }
  }
  else
  {
    return TPerturbation::setAttribute (rktNAME, nVALUE, eTYPE);
  }

  return FX_ATTRIB_OK;

}  /* setAttribute() */
XERCES_CPP_NAMESPACE_BEGIN

// ---------------------------------------------------------------------------
//  Constructors and Destructor
// ---------------------------------------------------------------------------
BooleanDatatypeValidator::BooleanDatatypeValidator(
                          DatatypeValidator*            const baseValidator
                        , RefHashTableOf<KVStringPair>* const facets
                        , RefArrayVectorOf<XMLCh>*      const enums
                        , const int                           finalSet
                        , MemoryManager* const                manager)
:DatatypeValidator(baseValidator, facets, finalSet, DatatypeValidator::Boolean, manager)
{

    // Set Facets if any defined
    if ( facets )
    {

        // Boolean shall NOT have enumeration
        if (enums) {
            delete enums;
            ThrowXMLwithMemMgr1(InvalidDatatypeFacetException
                    , XMLExcepts::FACET_Invalid_Tag
                    , "enumeration"
                    , manager);
        }

        XMLCh* key;
        XMLCh* value;
        RefHashTableOfEnumerator<KVStringPair> e(facets, false, manager);

        while (e.hasMoreElements())
        {
            KVStringPair pair = e.nextElement();
            key = pair.getKey();
            value = pair.getValue();

            if (XMLString::equals(key, SchemaSymbols::fgELT_PATTERN))
            {
                setPattern(value);
                setFacetsDefined(DatatypeValidator::FACET_PATTERN);
            }
            else
            {
                ThrowXMLwithMemMgr1(InvalidDatatypeFacetException
                        , XMLExcepts::FACET_Invalid_Tag
                        , key
                        , manager);
            }

        }

    }// End of facet setting
}
示例#17
0
void PatternLoggingLayout::configure(Configurator& conf)
{
    if (conf.getMode() == Configurator::FROM_CONF)
    {
        std::string sPattern;
        conf.configure("pattern", sPattern, "");
        if (!sPattern.empty())
        {
            setPattern(sPattern);
        }
    }
}
示例#18
0
RegexScan::RegexScan(
  const char *	pattern,
  bool	    	fast,
  size_t    	bufSize,
  const char *	tranTable
  )
  : buf( 0 ),
    reg( 0 ),
    patternString( 0 ),
    re_msg( 0 )
{
  setPattern( defaultSyntax, pattern, fast, bufSize, tranTable );
}
示例#19
0
	void PropertyFilter::prepare(const string& aPattern, int aMethod, int aProperty) {
		WLock l(cs);
		setPattern(aPattern);
		setFilterMethod(static_cast<StringMatch::Method>(aMethod));
		setFilterProperty(aProperty);

		type = TYPE_TEXT;
		if (currentFilterProperty < 0 || currentFilterProperty >= propertyCount) {
			if (numComparisonMode != LAST) {
				// Attempt to detect the column type 

				type = TYPE_TIME;
				auto ret = prepareTime();

				if (!ret.second) {
					type = TYPE_SIZE;
					ret = prepareSize();
				}

				if (!ret.second) {
					type = TYPE_SPEED;
					ret = prepareSpeed();
				}

				if (!ret.second) {
					// Try generic columns
					type = TYPE_NUMERIC_OTHER;
					numericMatcher = Util::toDouble(matcher.pattern);
				} else {
					// Set the value if parsing succeed
					numericMatcher = ret.first;
				}
			} else {
				type = TYPE_TEXT;
				matcher.setMethod(static_cast<StringMatch::Method>(defMethod));
				matcher.prepare();
			}
		} else if (propertyTypes[currentFilterProperty].filterType == TYPE_SIZE) {
			type = TYPE_SIZE;
			numericMatcher = prepareSize().first;
		} else if (propertyTypes[currentFilterProperty].filterType == TYPE_TIME) {
			type = TYPE_TIME;
			numericMatcher = prepareTime().first;
		} else if (propertyTypes[currentFilterProperty].filterType == TYPE_SPEED) {
			type = TYPE_SPEED;
			numericMatcher = prepareSpeed().first;
		} else if (propertyTypes[currentFilterProperty].filterType == TYPE_NUMERIC_OTHER || propertyTypes[currentFilterProperty].filterType == TYPE_LIST_NUMERIC) {
			type = TYPE_NUMERIC_OTHER;
			numericMatcher = Util::toDouble(matcher.pattern);
		}
	}
示例#20
0
RegexScan::RegexScan(
  unsigned int	reSyntax,
  const char *	pattern,
  bool	    	fast,
  size_t    	bufSize,
  const char *	tranTable
  )
  : buf( 0 ),
    reg( 0 ),
    patternString( 0 ),
    re_msg( 0 )
{
  setPattern( reSyntax, pattern, fast, bufSize, tranTable );
}
示例#21
0
	LOVE_pattern(SimulationSharedData *sd, int t) :
		GridBasedPattern_Pattern(sd,t)
	{
		bool pattern[9][9] = {
			{0,0,1,1,0,1,1,0,0},
			{0,1,0,0,1,0,0,1,0},
			{1,0,0,0,0,0,0,0,1},
			{1,0,0,0,0,0,0,0,1},
			{0,1,0,0,0,0,0,1,0},
			{0,1,0,0,0,0,0,1,0},
			{0,0,1,0,0,0,1,0,0},
			{0,0,0,1,0,1,0,0,0},
			{0,0,0,0,1,0,0,0,0},
		};
		setPattern(pattern);
	}
示例#22
0
    void AbstractParam::readParameters(const YAML::Node &yamlNode)
    {
        for ( YAML::const_iterator it = yamlNode.begin(); it != yamlNode.end(); ++it )
        {
            std::string key = READ_NODE_AS_STRING(it->first);

            if (key == Keys::Description)
                setDescription(READ_NODE_AS_STRING(it->second));
            else if (key == Keys::Default)
                setDefaultValue(READ_NODE_AS_STRING(it->second));
            else if (key == Keys::DisplayName)
                setDisplayName(READ_NODE_AS_STRING(it->second));

            else if (key == Keys::Example)
                setExample(READ_NODE_AS_STRING(it->second));
            else if (key == Keys::Maximum)
                setMaximum(READ_NODE_AS_LONG(it->second));
            else if (key == Keys::Minimum)
                setMinimum(READ_NODE_AS_LONG(it->second));
            else if (key == Keys::MaxLength)
                setMaxLength(READ_NODE_AS_INT(it->second));
            else if (key == Keys::MinLength)
                setMinLength(READ_NODE_AS_INT(it->second));

            else if (key == Keys::Pattern)
                setPattern(READ_NODE_AS_STRING(it->second));
            else if (key == Keys::Repeat)
                setRepeat(READ_NODE_AS_BOOL(it->second));
            else if (key == Keys::Required)
                setRequired(READ_NODE_AS_BOOL(it->second));
            else if (key == Keys::Type)
                setType(READ_NODE_AS_STRING(it->second));
            else if (key == Keys::Enum)
            {
                YAML::Node enumNode = it->second;
                for ( YAML::const_iterator tt = enumNode.begin(); tt != enumNode.end(); ++tt )
                    setEnumeration(READ_NODE_AS_STRING(*tt));
            }
        }
    }
示例#23
0
void BaselinePattern::update(double elapsed)
{
    player->totalElapsed += elapsed;
    
    if (isFinished() && !stage->ground->isBlinking()) {
        updateLevel();
        saveData.push_back(getFinishedStageData());
        setPattern();
    }
    
    for (int i = 0; i < stage->poppies.size(); ++i)
        for (int j = 0; j < stage->pots.size(); ++j)
            updatePlayerChoice(stage->poppies[i], stage->pots[j]);
    
    updateFeedback();
    
    updatePoppyBlinks(elapsed);
    
    stage->update(elapsed);
    stage->handlePoppyCollisions(elapsed);
    
    stage->label1->setCaption("Time: " + toStringInt(player->totalElapsed));
}
示例#24
0
RegexScan &
RegexScan::operator =  ( const char * pattern )
{
  setPattern( pattern );
  return( *this );
}
示例#25
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    mScanner(nullptr)
{
    Messages::setHandler(this);

    setupUi(this);

    qApp->setWindowIcon(loadMainIcon());
    toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    toolBar->setIconSize(QSize(24,24));
    qApp->setAttribute(Qt::AA_DontShowIconsInMenus, true);
    qApp->setAttribute(Qt::AA_UseHighDpiPixmaps, true);

#ifdef Q_OS_MAC
    this->setUnifiedTitleAndToolBarOnMac(true);
    setWindowIcon(QIcon());

    trackView->setFrameShape(QFrame::NoFrame);
    splitter->setStyleSheet("::handle{ border-right: 1px solid #b6b6b6;}");
#endif

    setAcceptDrops(true);
    setAcceptDrops(true);
    this->setContextMenuPolicy(Qt::NoContextMenu);

    outPatternButton->setToolTip(outPatternEdit->toolTip());
    outDirEdit->setToolTip(actionSelectResultDir->toolTip());

    // TrackView ...............................................
    trackView->setRootIsDecorated(false);
    trackView->setItemsExpandable(false);
    trackView->hideColumn((int)TrackView::ColumnComment);
    trackView->setAlternatingRowColors(false);

    // Tag edits ...............................................
    tagGenreEdit->setTagId(TagId::Genre);
    connect(tagGenreEdit, SIGNAL(textEdited(QString)), this, SLOT(setTrackTag()));

    tagYearEdit->setTagId(TagId::Date);
    connect(tagYearEdit, SIGNAL(textEdited(QString)), this, SLOT(setTrackTag()));

    tagArtistEdit->setTagId(TagId::Artist);
    connect(tagArtistEdit, SIGNAL(textEdited(QString)), this, SLOT(setTrackTag()));
    connect(tagArtistEdit, SIGNAL(textEdited(QString)), this, SLOT(refreshEdits()));

    tagDiskPerformerEdit->setTagId(TagId::AlbumArtist);
    connect(tagDiskPerformerEdit, SIGNAL(textEdited(QString)), this, SLOT(setDiskTag()));
    connect(tagDiskPerformerEdit, SIGNAL(textEdited(QString)), this, SLOT(refreshEdits()));

    tagAlbumEdit->setTagId(TagId::Album);
    connect(tagAlbumEdit, SIGNAL(textEdited(QString)), this, SLOT(setTrackTag()));


    tagDiscIdEdit->setTagId(TagId::DiscId);
    connect(tagStartNumEdit, SIGNAL(editingFinished()), this, SLOT(setStartTrackNum()));
    connect(tagStartNumEdit, SIGNAL(valueChanged(int)), this, SLOT(setStartTrackNum()));

    connect(trackView->model(), SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)), this, SLOT(refreshEdits()));
    connect(trackView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(trackViewMenu(QPoint)));

    connect(editTagsButton, &QPushButton::clicked, this, &MainWindow::openEditTagsDialog);

    initActions();

    // Buttons .................................................
    outDirButton->setAutoRaise(true);
    outDirButton->setStyleSheet("border: none;");
    initOutDirButton();

    configureEncoderBtn->setDefaultAction(actionConfigureEncoder);
    configureEncoderBtn->setAutoRaise(true);
    configureEncoderBtn->setStyleSheet("border: none;");

    outPatternButton->addPattern("%n", tr("Insert \"Track number\""));
    outPatternButton->addPattern("%N", tr("Insert \"Total number of tracks\""));
    outPatternButton->addPattern("%a", tr("Insert \"Artist\""));
    outPatternButton->addPattern("%A", tr("Insert \"Album title\""));
    outPatternButton->addPattern("%t", tr("Insert \"Track title\""));
    outPatternButton->addPattern("%y", tr("Insert \"Year\""));
    outPatternButton->addPattern("%g", tr("Insert \"Genre\""));
    outPatternButton->addPattern("%d", tr("Insert \"Disk number\""));
    outPatternButton->addPattern("%D", tr("Insert \"Total number of disks\""));


    const QString patterns[] = {
        "%a/{%y - }%A/%n - %t",
        "%a -{ %y }%A/%n - %t",
        "{%y }%A - %a/%n - %t",
        "%a/%A/%n - %t",
        "%a - %A/%n - %t",
        "%A - %a/%n - %t" };

    for (QString pattern: patterns)
    {
        outPatternButton->addFullPattern(pattern,
                                         tr("Use \"%1\"", "Predefined out file pattern, string like 'Use \"%a/%A/%n - %t\"'")
                                         .arg(pattern)
                                         + "  ( " + PatternExpander::example(pattern)  + ".flac )");
    }

    outPatternButton->menu()->addSeparator();

    outPatternEdit->deleteItemAction()->setText(tr("Delete current pattern from history"));
    outPatternButton->menu()->addAction(outPatternEdit->deleteItemAction());

    connect(outPatternButton, SIGNAL(paternSelected(QString)),
            this, SLOT(insertOutPattern(QString)));

    connect(outPatternButton, SIGNAL(fullPaternSelected(QString)),
            this, SLOT(replaceOutPattern(QString)));

    outPatternButton->setIcon(Icon("pattern-button"));

    // Format combo ............................................
    initOutFormatCombo();

    loadSettings();

    outDirEdit->setHistory(settings->value(Settings::OutFiles_DirectoryHistory).toStringList());
    outDirEdit->setCurrentText(settings->value(Settings::OutFiles_Directory).toString());

    outPatternEdit->setHistory(settings->value(Settings::OutFiles_PatternHistory).toStringList());

    // Signals .................................................
    connect(settings, SIGNAL(changed()), trackView->model(), SIGNAL(layoutChanged()));

    connect(outPatternEdit->lineEdit(), SIGNAL(editingFinished()), this, SLOT(setPattern()));
    connect(outPatternEdit, SIGNAL(currentIndexChanged(int)), this, SLOT(setPattern()));

    connect(outDirEdit->lineEdit(),     SIGNAL(editingFinished()), this, SLOT(setOutDir()));
    connect(outDirEdit,     SIGNAL(currentIndexChanged(int)), this, SLOT(setOutDir()));

    connect(outFormatCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setOutFormat()));
    connect(codepageCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setCodePage()));

    connect(trackView, SIGNAL(selectCueFile(Disk*)),     this, SLOT(setCueForDisc(Disk*)));
    connect(trackView, SIGNAL(selectAudioFile(Disk*)),   this, SLOT(setAudioForDisk(Disk*)));
    connect(trackView, SIGNAL(selectCoverImage(Disk*)),  this, SLOT(setCoverImage(Disk*)));
    connect(trackView, SIGNAL(downloadInfo(Disk*)),      this, SLOT(downloadDiskInfo(Disk*)));

    connect(trackView->model(), SIGNAL(layoutChanged()), this, SLOT(refreshEdits()));
    connect(trackView->model(), SIGNAL(layoutChanged()), this, SLOT(setControlsEnable()));

    connect(trackView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(refreshEdits()));
    connect(trackView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(setControlsEnable()));

    connect(project, SIGNAL(layoutChanged()), trackView, SLOT(layoutChanged()));
    connect(project, SIGNAL(layoutChanged()), this, SLOT(refreshEdits()));
    connect(project, SIGNAL(layoutChanged()), this, SLOT(setControlsEnable()));

    connect(project, SIGNAL(diskChanged(Disk*)), this, SLOT(refreshEdits()));
    connect(project, SIGNAL(diskChanged(Disk*)), this, SLOT(setControlsEnable()));

    connect(Application::instance(), &Application::visualModeChanged,
        [](){
            Icon::setDarkMode(Application::instance()->isDarkVisualMode());
    });

    Icon::setDarkMode(Application::instance()->isDarkVisualMode());

    refreshEdits();
    setControlsEnable();
}
示例#26
0
//================================================================================
// 目眩アクション復帰処理
//================================================================================
void CharacterStatus::recoveryGiddy(void)
{
    m_bGiddy = false;
    setPattern(m_pattern);
}
示例#27
0
文件: Regex.cpp 项目: 0790486/umundo
Regex::Regex(const std::string& pattern) : _re(NULL) {
	setPattern(pattern);
}
示例#28
0
文件: CLogger.cpp 项目: Romka1oz/vcmi
CLogFormatter::CLogFormatter(const std::string & pattern)
{
	setPattern(pattern);
}
//
//   Assign facets
//        assign common facets
//        assign additional facet
//
void AbstractNumericFacetValidator::assignFacet(MemoryManager* const manager)
{

    RefHashTableOf<KVStringPair>* facets = getFacets();

    if (!facets)     // no facets defined
        return;

    XMLCh* key;

    RefHashTableOfEnumerator<KVStringPair> e(facets, false, manager);

    while (e.hasMoreElements())
    {
        KVStringPair pair = e.nextElement();
        key = pair.getKey();
        XMLCh* value = pair.getValue();

        if (XMLString::equals(key, SchemaSymbols::fgELT_PATTERN))
        {
            setPattern(value);
            if (getPattern())
                setFacetsDefined(DatatypeValidator::FACET_PATTERN);
            // do not construct regex until needed
        }
        else if (XMLString::equals(key, SchemaSymbols::fgELT_MAXINCLUSIVE))
        {
            try
            {
                setMaxInclusive(value);
            }
            catch (NumberFormatException&)
            {
                ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_MaxIncl, value, manager);
            }
            setFacetsDefined(DatatypeValidator::FACET_MAXINCLUSIVE);
        }
        else if (XMLString::equals(key, SchemaSymbols::fgELT_MAXEXCLUSIVE))
        {
            try
            {
                setMaxExclusive(value);
            }
            catch (NumberFormatException&)
            {
                ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_MaxExcl, value, manager);
            }
            setFacetsDefined(DatatypeValidator::FACET_MAXEXCLUSIVE);
        }
        else if (XMLString::equals(key, SchemaSymbols::fgELT_MININCLUSIVE))
        {
            try
            {
                setMinInclusive(value);
            }
            catch (NumberFormatException&)
            {
                ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_MinIncl, value, manager);
            }
            setFacetsDefined(DatatypeValidator::FACET_MININCLUSIVE);
        }
        else if (XMLString::equals(key, SchemaSymbols::fgELT_MINEXCLUSIVE))
        {
            try
            {
                setMinExclusive(value);
            }
            catch (NumberFormatException&)
            {
                ThrowXMLwithMemMgr1(InvalidDatatypeFacetException, XMLExcepts::FACET_Invalid_MinExcl, value, manager);
            }
            setFacetsDefined(DatatypeValidator::FACET_MINEXCLUSIVE);
        }
        else if (XMLString::equals(key, SchemaSymbols::fgATT_FIXED))
        {
            unsigned int val;
            bool         retStatus;
            try
            {
                retStatus = XMLString::textToBin(value, val, fMemoryManager);
            }
            catch (RuntimeException&)
            {
                ThrowXMLwithMemMgr(InvalidDatatypeFacetException, XMLExcepts::FACET_internalError_fixed, manager);
            }

            if (!retStatus)
            {
                ThrowXMLwithMemMgr(InvalidDatatypeFacetException, XMLExcepts::FACET_internalError_fixed, manager);
            }

            setFixed(val);
            //no setFacetsDefined here

        }
        else
        {
            assignAdditionalFacet(key, value, manager);
        }

    }//while

}// end of assigneFacet()
示例#30
0
		explicit StringMatcher (const std::string &pattern) : _charsRead(0) {setPattern(pattern);}