// 获取动态升压的命令 QString PackageSendCmd::getBoostMeasureCmd(const int &nRightArm, const int &nLeftArm, const int &nRightAnkle, const int &nLeftAnkle) { // 消息头 QString strStart(m_strHeader); // 开始命令 strStart += QString::number(2, 16).rightJustified(2,'0'); strStart += QString::number(3, 16).rightJustified(2,'0'); int nArm = qMax(nRightArm, nLeftArm); int nAnkle = qMax(nRightAnkle, nLeftAnkle); strStart += QString::number(nArm, 16).rightJustified(2,'0'); strStart += QString::number(nAnkle, 16).rightJustified(2,'0'); strStart += "0000000000"; short nSum = getSum(strStart); // 校验位SUM strStart += QString::number(nSum, 16).rightJustified(2,'0'); // 消息末尾 strStart += m_strTail; return strStart; }
void WelcomeDialog::on_webView_linkClicked(const QUrl& url) { CString strUrl = url.toString(); strUrl.MakeLower(); CString strStart("http://wiz.cn/cmd/"); if (strUrl.startsWith(strStart)) { strUrl.remove(0, strStart.length()); if (strUrl == "view_guide") { QDesktopServices::openUrl(QUrl("http://www.wiz.cn/")); } else if (strUrl == "create_account") { CreateAccountDialog dlg(this); if (QDialog::Accepted != dlg.exec()) return; QString strUserId = dlg.userId(); QString strPassword = dlg.password(); ui->comboUsers->insertItem(0, strUserId); ui->comboUsers->setCurrentIndex(0); ui->editPassword->setText(strPassword); } } else { QDesktopServices::openUrl(url); } }
// 获取阀4的慢速放气命令 // 参数:[IN] bIsOn 若为true,则闭气,否则泄气 QString PackageSendCmd::getSlowSwitch4(bool bIsOn) { // 消息头 QString strStart(m_strHeader); // 开始命令 strStart += QString::number(4, 16).rightJustified(2,'0'); int nCmd = 0x1a; // 泄气 if(bIsOn) { nCmd = 0x19; } strStart += QString::number(nCmd, 16).rightJustified(2,'0'); strStart += "00000000000000"; short nSum = getSum(strStart); // 校验位SUM strStart += QString::number(nSum, 16).rightJustified(2,'0'); // 消息末尾 strStart += m_strTail; return strStart; }
/******************************************************************************************** > String_256 HTMLExportFilter::GetCloseTagString(UINT32 uiResource) Author: Graham_Walmsley (Xara Group Ltd) <*****@*****.**> Created: 9/4/97 Inputs: uiResource The resource to convert to a tag Returns: The resource string enclosed in < and >. Purpose: Gets the specified UI resource enclosed by < and >. ********************************************************************************************/ String_256 HTMLExportFilter::GetCloseTagString(UINT32 uiResource) { String_256 strStart(_R(IDS_HTMLEXPORT_CLOSETAGSTART)); strStart+=String_256(uiResource); strStart+=String_256(_R(IDS_HTMLEXPORT_TAGEND)); return strStart; }
// 寿命测试结束 QString PackageSendCmd::getLifeSpanEnd() { // 消息头 QString strStart(m_strHeader); // 开始命令 strStart += QString::number(3, 16).rightJustified(2,'0'); // 数据 strStart += QString::number(2, 16).rightJustified(2,'0'); strStart += "00000000000000"; short nSum = getSum(strStart); // 校验位SUM strStart += QString::number(nSum, 16).rightJustified(2,'0'); // 消息末尾 strStart += m_strTail; return strStart; }
QString PackageSendCmd::getHandleCmd() { // 消息头 QString strStart(m_strHeader); // 握手标志 strStart += QString::number(5, 16).rightJustified(2,'0'); strStart += QString::number(1, 16).rightJustified(2,'0'); strStart += "00000000000000"; short nSum = getSum(strStart); // 校验位SUM strStart += QString::number(nSum, 16).rightJustified(2,'0'); // 消息末尾 strStart += m_strTail; return strStart; }
// 根据传入的压力值,获取慢速放气的命令 // 参数:[IN] strPressure 压力值 QString PackageSendCmd::getSlowStart(const QString &strPressure) const { // 消息头 QString strStart(m_strHeader); // 开始命令 strStart += QString::number(3, 16).rightJustified(2,'0'); // 数据 strStart += QString::number(2, 16).rightJustified(2,'0'); strStart += strPressure; strStart += "000000000000"; short nSum = getSum(strStart); // 校验位SUM strStart += QString::number(nSum, 16).rightJustified(2,'0'); // 消息末尾 strStart += m_strTail; return strStart; }
// 获取要发送的启动命令 QString PackageSendCmd::getNoramlStart() const { // 消息头 QString strStart(m_strHeader); // 开始命令 strStart += QString::number(2, 16).rightJustified(2,'0'); // 启动的数据 strStart += QString::number(1, 16).rightJustified(2,'0'); strStart += "00000000000000"; // 校验位SUM short nSum = getSum(strStart); // 校验位SUM strStart += QString::number(nSum, 16).rightJustified(2,'0'); // 消息末尾 strStart += m_strTail; return strStart; }
void EnumFiles(VMenu2& Menu, const string& Str) { if(!Str.empty()) { string strStr(Str); size_t Pos = 0; if(std::count(ALL_CONST_RANGE(strStr), L'"') & 1) // odd quotes count { Pos = strStr.rfind(L'"'); } else { for(Pos=strStr.size()-1; Pos!=static_cast<size_t>(-1); Pos--) { if(strStr[Pos]==L'"') { Pos--; while(strStr[Pos]!=L'"' && Pos!=static_cast<size_t>(-1)) { Pos--; } } else if(strStr[Pos]==L' ') { Pos++; break; } } } if(Pos==static_cast<size_t>(-1)) { Pos=0; } bool StartQuote=false; if(Pos < strStr.size() && strStr[Pos]==L'"') { Pos++; StartQuote=true; } string strStart(strStr.data(),Pos); Unquote(strStr.erase(0, Pos)); if(!strStr.empty()) { string strExp = os::env::expand_strings(strStr); os::fs::enum_file Find(strExp+L"*"); bool Separator=false; std::for_each(CONST_RANGE(Find, i) { const wchar_t* FileName=PointToName(strStr); bool NameMatch=!StrCmpNI(FileName, i.strFileName.data(), StrLength(FileName)), AltNameMatch = NameMatch? false : !StrCmpNI(FileName, i.strAlternateFileName.data(), StrLength(FileName)); if(NameMatch || AltNameMatch) { strStr.resize(FileName-strStr.data()); string strAdd (strStr + (NameMatch ? i.strFileName : i.strAlternateFileName)); if (!StartQuote) QuoteSpace(strAdd); string strTmp(strStart+strAdd); if(StartQuote) strTmp += L'"'; if(!Separator) { if(Menu.GetItemCount()) { MenuItemEx Item; Item.strName = MSG(MCompletionFilesTitle); Item.Flags=LIF_SEPARATOR; Menu.AddItem(Item); } else { Menu.SetTitle(MSG(MCompletionFilesTitle)); } Separator=true; } Menu.AddItem(strTmp); } });