void VdkCheckBox::DoDraw(wxDC &dc) { if (m_bToggled) { if (GetLastState() == VdkButton::NORMAL) { SetButtonState(CHECKED); } } VdkButton::DoDraw(dc); }
void RoomCLEntry::SendDirectedStatus (const EntryStatus& state, const QString&) { auto conn = Account_->GetClientConnection (); auto pres = XooxUtil::StatusToPresence (state.State_, state.StatusString_, conn->GetLastState ().Priority_); pres.setTo (RH_->GetRoomJID ()); const auto discoMgr = conn->GetClient ()->findExtension<QXmppDiscoveryManager> (); pres.setCapabilityHash ("sha-1"); pres.setCapabilityNode (discoMgr->clientCapabilitiesNode ()); pres.setCapabilityVer (discoMgr->capabilities ().verificationString ()); conn->GetClient ()->sendPacket (pres); }
void EntryBase::SendDirectedStatus (const EntryStatus& state, const QString& variant) { if (!CanSendDirectedStatusNow (variant)) return; auto conn = Account_->GetClientConnection (); auto pres = XooxUtil::StatusToPresence (state.State_, state.StatusString_, conn->GetLastState ().Priority_); QString to = GetJID (); if (!variant.isEmpty ()) to += '/' + variant; pres.setTo (to); auto discoMgr = conn->GetClient ()->findExtension<QXmppDiscoveryManager> (); pres.setCapabilityHash ("sha-1"); pres.setCapabilityNode (discoMgr->clientCapabilitiesNode ()); pres.setCapabilityVer (discoMgr->capabilities ().verificationString ()); conn->GetClient ()->sendPacket (pres); }
size_t LM::Evaluate( const Hypothesis& hypo, size_t prevState, Scores &scores) const { if (m_order <= 1) { return 0; // not sure if returning NULL is correct } if (hypo.targetPhrase.GetSize() == 0) { return 0; // not sure if returning NULL is correct } PhraseVec m_phraseVec(m_order); const size_t currEndPos = hypo.targetRange.endPos; const size_t startPos = hypo.targetRange.startPos; size_t index = 0; for (int currPos = (int) startPos - (int) m_order + 1 ; currPos <= (int) startPos ; currPos++) { if (currPos >= 0) m_phraseVec[index++] = &hypo.GetWord(currPos); else { m_phraseVec[index++] = &m_bos; } } SCORE lmScore = GetValueCache(m_phraseVec); // main loop size_t endPos = std::min(startPos + m_order - 2 , currEndPos); for (size_t currPos = startPos + 1 ; currPos <= endPos ; currPos++) { // shift all args down 1 place for (size_t i = 0 ; i < m_order - 1 ; i++) m_phraseVec[i] = m_phraseVec[i + 1]; // add last factor m_phraseVec.back() = &hypo.GetWord(currPos); lmScore += GetValueCache(m_phraseVec); } // end of sentence if (hypo.GetCoverage().IsComplete()) { const size_t size = hypo.GetSize(); m_phraseVec.back() = &m_eos; for (size_t i = 0 ; i < m_order - 1 ; i ++) { int currPos = (int)(size - m_order + i + 1); if (currPos < 0) m_phraseVec[i] = &m_bos; else m_phraseVec[i] = &hypo.GetWord((size_t)currPos); } lmScore += GetValueCache(m_phraseVec); } else { if (endPos < currEndPos) { //need to get the LM state (otherwise the last LM state is fine) for (size_t currPos = endPos+1; currPos <= currEndPos; currPos++) { for (size_t i = 0 ; i < m_order - 1 ; i++) m_phraseVec[i] = m_phraseVec[i + 1]; m_phraseVec.back() = &hypo.GetWord(currPos); } } } size_t state = GetLastState(); return state; }