コード例 #1
0
ファイル: Keyb.cpp プロジェクト: TheProjecter/pockemul
bool KEYBMAPParser::startElement( const QString&, const QString&, const QString &name, const QXmlAttributes &attrs )
{
	QString desc = "";
    QString modifier="";
    int scancode,masterscancode,x,y,w,h;
	bool ok = false;
	
    scancode=masterscancode=x=y=w=h=0;
	
	if( inKeyboard && name == "KEY" )
	{
		
		for( int i=0; i<attrs.count(); i++ )
		{
			if( attrs.localName( i ) == "description" )
				desc = attrs.value( i );
			else if( attrs.localName( i ) == "scancode" )
				scancode = attrs.value( i ).toInt(&ok,16);
			else if( attrs.localName( i ) == "left" )
				x = attrs.value( i ).toInt(&ok,10);
			else if( attrs.localName( i ) == "top" )
				y = attrs.value( i ).toInt(&ok,10);
			else if( attrs.localName( i ) == "width" )
				w = attrs.value( i ).toInt(&ok,10);
			else if( attrs.localName( i ) == "height" )
				h = attrs.value( i ).toInt(&ok,10);
            else if( attrs.localName( i ) == "masterscancode" )
                masterscancode = attrs.value( i ).toInt(&ok,16);
            else if( attrs.localName( i ) == "modifier" )
                modifier = attrs.value( i );
		}
        Parent->Keys.append(CKey(scancode,desc,QRect(x,y,w,h),masterscancode,modifier));
        AddLog(LOG_KEYBOARD,mainwindow->tr("XML Read key : %1, scan=0x%2 , Rect=(%3,%4,%5,%6), mscan=0x%7, mod=%8").
               arg(desc).
               arg(scancode,2,16,QChar('0')).
               arg(x).arg(y).arg(w).arg(h).
               arg(masterscancode,2,16,QChar('0')).
               arg(modifier));
	}
	else if( name == "Keyboard" )
		inKeyboard = true;

	return true;
}
コード例 #2
0
ファイル: RippleAddress.cpp プロジェクト: Blizzard-/rippled
bool RippleAddress::verifyNodePublic (uint256 const& hash, Blob const& vchSig, ECDSA fullyCanonical) const
{
    CKey    pubkey  = CKey ();
    bool    bVerified;

    bVerified = isCanonicalECDSASig (vchSig, fullyCanonical);

    if (bVerified && !pubkey.SetPubKey (getNodePublic ()))
    {
        // Failed to set public key.
        bVerified   = false;
    }
    else
    {
        bVerified   = pubkey.Verify (hash, vchSig);
    }

    return bVerified;
}
コード例 #3
0
ファイル: Keyb.cpp プロジェクト: pockemul/PockEmul
bool Ckeyb::init(void)
{
    qWarning()<<"Ckeyb::init";
    isShift = false;
    isCtrl = false;
    LastKey = 0;

    if (fn_KeyMap.isEmpty()) return true;


    QFile file;
    file.setFileName(workDir+"res/"+pPC->getresName()+"/"+fn_KeyMap );

    if (!file.exists()) {
        file.setFileName(":/KEYMAP/keymap/"+fn_KeyMap);
    }

    if (file.exists()) {

        QXmlInputSource source(&file);
        QXmlSimpleReader reader;
        reader.setContentHandler( handler );

        bool result = reader.parse( source );
        return result;
    }


    // else load the struct
    for (int i = 0; i < pPC->KeyMapLenght; i++)
    {
        Keys.append(CKey(pPC->KeyMap[i].ScanCode,
                         pPC->KeyMap[i].KeyDescription,
                         QRect(	pPC->KeyMap[i].x1,
                                 pPC->KeyMap[i].y1,
                                 RIGHT[ pPC->KeyMap[i].Type - 1 ],
                                 BOTTOM[pPC->KeyMap[i].Type - 1 ])
                        )
                   );
    }
    return true;
}
コード例 #4
0
ファイル: CMathEventQueue.cpp プロジェクト: jonasfoe/COPASI
bool CMathEventQueue::addCalculation(const C_FLOAT64 & executionTime,
                                     const bool & equality,
                                     CMathEvent * pEvent)
{
  // It is not possible to proceed backwards in time.
  if (mpTime == NULL || executionTime < *mpTime) return false;

  size_t CascadingLevel = mCascadingLevel;

  // If the assignment is in the future or it has a priority the
  // cascading level must be zero.
  if (executionTime > *mpTime ||
      !isnan(* (C_FLOAT64 *) pEvent->getPriority()->getValuePointer()))
    CascadingLevel = 0;

  pEvent->addPendingAction(mActions.insert(std::make_pair(CKey(executionTime, equality, CascadingLevel),
                           CAction(pEvent, this))));

  return true;
}
コード例 #5
0
ファイル: Keyb.cpp プロジェクト: TheProjecter/pockemul
bool Ckeyb::init(void)
{
    isShift = false;
    isCtrl = false;
    LastKey = 0;
	QFile file( fn_KeyMap );
	QXmlInputSource source(&file);

	QXmlSimpleReader reader;
	reader.setContentHandler( handler );

	bool result = reader.parse( source );

	if (result) return true;

    // Else load from ressource
    QFile fileRes(":/KEYMAP/keymap/"+fn_KeyMap);
    QXmlInputSource sourceRes(&fileRes);
    result = reader.parse(sourceRes);
//    if (result) qWarning("success read key ressource\n");
    if (result) return true;

	// else load the struct
	for (int i = 0;i < pPC->KeyMapLenght;i++)
	{
		Keys.append(CKey(pPC->KeyMap[i].ScanCode,
						pPC->KeyMap[i].KeyDescription,
						QRect(	pPC->KeyMap[i].x1,
								pPC->KeyMap[i].y1,
								RIGHT[ pPC->KeyMap[i].Type - 1 ],
								BOTTOM[pPC->KeyMap[i].Type - 1 ])
						)
					);
	}
	return true;
}
コード例 #6
0
void RippleAddress::setAccountPublic(const RippleAddress& generator, int seq)
{
	CKey	pubkey	= CKey(generator, seq);

	setAccountPublic(pubkey.GetPubKey());
}
コード例 #7
0
ファイル: KeyDialog.cpp プロジェクト: Krabi/idkaart_public
void KeyAddDialog::addCardCert()
{ addKeys( QList<CKey>() << CKey( qApp->tokenData().cert() ) ); }