void ItemHandlerCombobox::SetDataSource (const QString& prop, QAbstractItemModel *model, Util::XmlSettingsDialog *xsd) { QComboBox *box = Propname2Combobox_ [prop]; if (!box) { qWarning () << Q_FUNC_INFO << "combobox for property" << prop << "not found"; return; } box->setModel (model); const QVariant& data = xsd->GetValue (Propname2Item_ [prop]); int pos = box->findData (data); if (pos == -1) { QString text = data.toString (); if (!text.isNull ()) pos = box->findText (text); } if (pos != -1) box->setCurrentIndex (pos); else { qWarning () << Q_FUNC_INFO << box << box->count () << box->currentIndex () << data << "not found"; if (box->count ()) XSD_->GetManagerObject ()->setProperty (prop.toLatin1 (), GetObjectValue (box)); } if (!data.toString ().isEmpty ()) ChangedProperties_.remove (prop); }
void ThreadProc( void* param ) { CoInitialize(NULL); thread_id_accget_ = GetCurrentThreadId(); MSG msg; PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE); while(GetMessage(&msg, NULL, 0, 0)) { TCHAR buf[256]; CComPtr<IAccessible> acc; if (S_OK == AccessibleObjectFromWindow((HWND)msg.lParam, OBJID_WINDOW, IID_IAccessible, (void**)&acc)) { VARIANT id; id.vt = VT_I4; id.lVal = 0; GetObjectValue(acc, &id, buf, ARRAYSIZE(buf)); OutputDebugString(TEXT("WinRun Text : ")); OutputDebugString(buf); } } CoUninitialize(); }
bool MojoWhereMatcher::CheckClause(const MojObject& clause, const MojObject& response) const { MojLogTrace(s_log); bool result; if (clause.type() != MojObject::TypeObject) { throw std::runtime_error("Clause must be an object with prop, op, " "and val properties"); } bool found; MojObject prop; found = clause.get(_T("prop"), prop); if (!found) { throw std::runtime_error("Property specifier not present in where " "clause"); } /* Value not present causes clause to be skipped. * XXX allow missing behaviour to be specified? */ MojObject propValue; found = GetObjectValue(prop, response, propValue); if (found) { MojObject clauseValue; found = clause.get(_T("val"), clauseValue); if (!found) { throw std::runtime_error("Value to compare against not present in " "where clause"); } found = false; MojString op; MojErr err = clause.get(_T("op"), op, found); if (err) { throw std::runtime_error("Error retrieving operation to use for " "where clause"); } else if (!found) { throw std::runtime_error("operation to use for comparison not " "present in where clause"); } if (op == "<") { result = (propValue < clauseValue); } else if (op == "<=") { result = (propValue <= clauseValue); } else if (op == "=") { result = (propValue == clauseValue); } else if (op == "!=") { result = (propValue != clauseValue); } else if (op == ">=") { result = (propValue >= clauseValue); } else if (op == ">") { result = (propValue > clauseValue); } else { throw std::runtime_error("Unknown comparison operator in where " "clause"); } } else { result = false; } MojLogInfo(s_log, _T("Where Trigger: Clause %s %s"), MojoObjectJson(clause).c_str(), result ? "matched" : "did not match"); return result; }