예제 #1
0
파일: VenusDlg.cpp 프로젝트: fatway/Venus
BOOL CVenusDlg::PreTranslateMessage(MSG* pMsg)
{
	// TODO: 在此添加专用代码和/或调用基类
	if(pMsg->wParam==VK_RETURN || pMsg->wParam==VK_ESCAPE)
	{
		// 隐藏窗体
		SetShowStatus(false);

		CString txt;
		GetDlgItemText(IDC_EDIT1, txt);

		if (pMsg->wParam == VK_RETURN)
		{
			// ctrl + enter 百度搜索输入的关键字
			if (GetAsyncKeyState(VK_CONTROL)<0)
			{
				CString url;
				url.Format("www.baidu.com/s?wd=%s", txt);
				ShellExecute(NULL, _T("open"), _T(url), NULL, NULL, SW_SHOWNORMAL);
			}
			// shift + enter 查询DICT字典
			else if (GetAsyncKeyState(VK_SHIFT)<0)
			{
				CString url;
				url.Format("dict.cn/%s", txt);
				ShellExecute(NULL, _T("open"), _T(url), NULL, NULL, SW_SHOWNORMAL);
			}
			// 仅回车时执行当前匹配到快捷程序
			else
			{
				if (!lastKey.IsEmpty())
				{
					CString exePath = myIndex->GetLocalPath(lastKey);
					if (lastKey == ";lnk")
					{
						system(exePath);
					}
					else
					{
						RunLnkFile((LPSTR)(LPCSTR)exePath);
					}
				}

			}
		}

		// 清空输入内容
		CEdit *myInput = (CEdit *)GetDlgItem(IDC_EDIT1);
		myInput->SetSel(0, -1);
		myInput->Clear();

		return FALSE;
	}
	return CDialogEx::PreTranslateMessage(pMsg);
}
void VirtualTerminalWidget::Update(ConstTerminalPointer terminal) {
  uri_ = terminal->uri;
  virtual_uri_ = terminal->virtual_uri;
  virtual_index_ = terminal->virtual_index;
  name_ = terminal->name;

  bool is_available = terminal->is_available;
  ui_.stopReceiveVideoAction->setEnabled(is_available);
  ui_.videoShowedLabel->setEnabled(is_available);

  image_url_ = QString(":/image/video%1.png").arg(terminal->virtual_index + 1);
  ui_.videoShowedLabel->setPixmap(QPixmap(image_url_));
  ui_.videoShowedLabel->setScaledContents(true);
  SetShowStatus(false);
  setToolTip(name_);
}