Exemplo n.º 1
0
 /////////////////////////////////////////////////////////////////////////////
// CKeyboardEdit message handlers
BOOL CKeyboardEdit::PreTranslateMessage (MSG* pMsg) 
{
  bool bPressed;
  if ((bPressed = (pMsg->message == WM_KEYDOWN)) || pMsg->message == WM_KEYUP || (bPressed = (pMsg->message == WM_SYSKEYDOWN)) || pMsg->message == WM_SYSKEYUP) {
		
    if (bPressed && m_bKeyDefined && !((1 << 30) & pMsg->lParam))
      ResetKey ();
    if (pMsg->wParam == VK_SHIFT && !m_bKeyDefined)
      m_bShiftPressed = bPressed;
    else if (pMsg->wParam == VK_CONTROL &&!m_bKeyDefined) {
      m_bCtrlPressed = bPressed;
    }
    else if (pMsg->wParam == VK_MENU && !m_bKeyDefined)
      m_bAltPressed = bPressed;
    else {
      if (!m_bKeyDefined) {
        m_wVirtKey = (WORD)pMsg->wParam;
        if (bPressed)
          m_bKeyDefined = true;
      }
    }
    DisplayKeyboardString ();
    return TRUE;
  }
        
  return CEdit::PreTranslateMessage(pMsg);
}
Exemplo n.º 2
0
//---------------------------------------------------------------------------
void __fastcall TKeyGenerator::ProgressUpdate(int Range, int Position,
  TKeyGenerationComplete Complete)
{
  DebugAssert(FState == kgGenerating);
  if (Complete == kgSuccess)
  {
    FState = kgComplete;
    ResetKey();
  }
  FGenerationRange = Range;
  FGenerationPosition = Position;
  if (FOnGenerating) FOnGenerating(this, Range, Position, Complete);
}
Exemplo n.º 3
0
	OBSHotkeyEdit(obs_key_combination_t original,
			QWidget *parent=nullptr)
		: QLineEdit(parent),
		  original(original)
	{
#ifdef __APPLE__
		// disable the input cursor on OSX, focus should be clear
		// enough with the default focus frame
		setReadOnly(true);
#endif
		setAttribute(Qt::WA_MacShowFocusRect, true);
		InitSignalHandler();
		ResetKey();
	}
Exemplo n.º 4
0
void IccTmkInject(void)
{
  BYTE key;

  DispLineMW("ICC TMK INJECT:", MW_LINE1, MW_CLRDISP|MW_BIGFONT);
  DispLineMW("[ENTER] - Normal", MW_LINE3, MW_BIGFONT);
  DispLineMW("[CLEAR] - DUKPT", MW_LINE5, MW_BIGFONT);
  switch (key=APM_WaitKey(9000, 0)) {
    case MWKEY_ENTER:
      ResetKey(MKEY_IDX);// Daniel Jacome 28 de Febrero de 2013
      KDLL_IccMKeyInject(MKEY_IDX, 0);    // Terminal Master Key
      break;
    case MWKEY_CLR:
      KDLL_IccMKeyInject(MKEY_IDX, 1);    // DUKPT Initial Key
      break;
    default:
      break;
  }
  WaitICCRemove();
}
Exemplo n.º 5
0
/*
*@功能:在空闲状态的几个任务
*1.检测是否有按键按下
*2.检测是否读到RFID
*3.检测是否接受到串口传来的指令
*4.检测是否有USB连接到计算机上
*5.检测锂电池电压是否低电
   
共5个任务按各自的时间轴转动,基本上无冲突
*/
void ST_Idle(void)
{
  
  uint16_t ss_num=0;
	uint16_t power_num=0;
	uint16_t usb_bit;
	
  uint8_t key_r=KEYNO;
	uint8_t usb_r=0;
	uint8_t bt_r=0;
	
	uint8_t time_num=0;
	uint8_t p_c=0;
  uint8_t ss_flag=0;
	
	
  ResetKey();		//KeyNum是一个全局变量
	//Init_KeyNumuber();		//Key_Num =KEYINIT
	
	//根据flsah中的信息,更改主菜单中的信息
	SPI_FLASH_Read(HsMenu[1].Name,GROUP_INFORMATION,10);
	SPI_FLASH_Read(HsMenu[2].Name,KEY_INFORMATION,8);	
	
	

// 	//for debug
// 	SPI_FLASH_Read(item,GROUP_INFORMATION,10);
// 	UART1nSendChar(1,item,10);
// 	delay_ms(1000);



// 	//for dedug
// 	SPI_FLASH_Read(item,KEY_INFORMATION,8);
// 	UART1nSendChar(1,item,8);			
// 	delay_ms(1000);		
	
	
	
	
	//for dedug
// 	UART1nSendChar(1,HsMenu[1].Name,10);			
// 	delay_ms(1000);				
// 	UART1nSendChar(1,HsMenu[2].Name,8);			
// 	delay_ms(1000);		
	
	
	
  OLED_Clear();	
	ShowMenuNoInverse(HsMenu);	
	Main_Oled_Power();
	Main_Oled_Time();
  //Choose_MenuOp1();   //主界面显示	


  while(1)
  {
// 		if(g_State!=ST_IDLE)
// 			return;
		
		if(time_num==20)
		{
			Main_Oled_Time();
			time_num=0;
		}
		++time_num;
		delay_ms(50);
		
		
		//按键按下检测,如果有按键就按下就进入菜单操作
    key_r =GetKey();	 //判断是否有按键操作		
		if(ss_flag==0&&key_r==KEYNO)  //超时关屏
		{
			ss_num++;

			if(ss_num>=choosetime*6)//按下超过10秒钟  300/50=6
			{
				OLED_Display_Off();
				ss_flag=1;
				ss_num=0;
			}
		}
		if(ss_flag==1&&(key_r ==KEYCLEAR||key_r ==KEYSURE||key_r ==KEYDOWN||key_r == KEYUP))
		{
			OLED_Display_On();
			ss_flag=0;
			ResetKey();
			key_r=KEYNO;
		}		
    if(key_r !=KEYNO&&key_r !=KEYINIT)
    {
       //ResetKey();  //读完按键值后,将按键值复位

		   g_State =ST_LCDMENU;
		   return; 
							//按任意按键进入可选择菜单
    }

		
				
// 		//RFID检测
// 		nChar =Read_RfidData(2,Rfid_Buff,0xff);			//非常重要的一点,是理解Trismit()的关键
// 		if(nChar >=3)
// 		{
// 		 g_State =ST_KEY;return;	//检测ID信息数据,如果读到了rfid数据,则将g_State置为st_key
// 		}
		
		
		
		
		//检测上位机连接下位机命令,从菜单界面进入USB通信中
		usb_r =UART1ReadFrm(1,g_Buff,MAX_BUFF);		//USB串口1,g_Buff是一个全局变量;#define  MAX_BUFF   520 
		if(usb_r==7&&g_Buff[0]==0xaa&&g_Buff[1]==0x75&&g_Buff[2]==0x0d&&g_Buff[3]==0x02&&g_Buff[4]==0x00&&g_Buff[5]==0x01&&g_Buff[6]==0xD1)//如果返回0x00就发下一条授权
		{	
			usb_bit=(USB_CHEAK&(GPIO_Pin_1))>>1;
			if(usb_bit==1)			//USB插上
			{
				bluetooth_uart_switch=0;				
				pc_to_slave();			//上位机连接下位机的处理
			  g_State =ST_USB; 		//进入USB通信

				return;		  
			}
		}		


	
		
		bt_r =UART3ReadFrm(3,g_Buff,MAX_BUFF);		//蓝牙串口2,g_Buff是一个全局变量;#define  MAX_BUFF   520 
		if(bt_r==7&&g_Buff[0]==0xaa&&g_Buff[1]==0x75&&g_Buff[2]==0x0d&&g_Buff[3]==0x02&&g_Buff[4]==0x00&&g_Buff[5]==0x01&&g_Buff[6]==0xD1)//如果返回0x00就发下一条授权
		{	
				bluetooth_uart_switch=1;				
				pc_to_slave();			//上位机连接下位机的处理;使用接受到的g_Buff
						
// 				m_UB3;
// 				m_UB3.RBuff;
	
				
			  g_State =ST_USB; 		//进入USB通信

				return;		  
		}	


	 usb_bit=(USB_CHEAK&(GPIO_Pin_1))>>1;
	 if(usb_bit==1)     //USB已经插上,即从蓝牙切换到USB
		 bluetooth_uart_switch=0;				
		
		
		
		//电池电量检测
		
		power_num++;		
		if( power_num==0x15)		//0x15*20时Power_Cheak()才会返回有效值 
		{
			power_num =0;
			IWDG_Feed();
			
			Main_Oled_Power();		//更新电池电量
			
			p_c=Power_Cheak();		//此函数运行20次才返回有效值
			if(p_c==4)  //检测电池电压,如果电池电压过低,则进入关机模式,并进行提示
			{
				
// 				Main_Oled_Time();
// 				Main_Oled_Power();				
				
				OLED_Show_LowBattry();  
				
				//延时1s后关机
				g_WaitTimeOut = 0;
				SetTimer(TIMER_TIMEOUT,100,Do_TimeOut,THREE_MIN);   
				while( g_WaitTimeOut == 0 )
				{
					IWDG_Feed();
				}
				KillTimer(TIMER_TIMEOUT);
					
				Sys_Enter_Standby();
			}
		}


  }
Exemplo n.º 6
0
CKeyboardEdit::CKeyboardEdit()
{
  m_bKeyDefined = false;
  ResetKey ();
}
Exemplo n.º 7
0
QString MenuCommands::Get(int ind, What w) const
{
    int cur = 0;

    if (cur++ == ind)
        return (w == Key ? FileKey() : (w == Title? FileTitle() : ""));

    if (cur++ == ind)
        return (w == Key ? NewWinKey() : (w == Title? NewWinTitle() : GetStr(NewWinShortcuts())));

    if (cur++ == ind)
        return (w == Key ? OpenFileKey() : (w == Title? OpenFileTitle() : GetStr(OpenFileShortcuts())));

    if (cur++ == ind)
        return (w == Key ? OpenLocKey() : (w == Title? OpenLocTitle() : GetStr(OpenLocShortcuts())));

    if (cur++ == ind)
        return (w == Key ? SaveAsKey() : (w == Title? SaveAsTitle() : GetStr(SaveAsShortcuts())));

    if (cur++ == ind)
        return (w == Key ? SavePdfKey() : (w == Title? SavePdfTitle() : GetStr(SavePdfShortcuts())));

    if (cur++ == ind)
        return (w == Key ? ImportKey() : (w == Title? ImportTitle() : ""));

    if (cur++ == ind)
        return (w == Key ? ImportIEKey() : (w == Title? ImportIETitle() : GetStr(ImportIEShortcuts())));

    if (cur++ == ind)
        return (w == Key ? ImportFFKey() : (w == Title? ImportFFTitle() : GetStr(ImportFFShortcuts())));

    if (cur++ == ind)
        return (w == Key ? ImportHtmlKey() : (w == Title? ImportHtmlTitle() : GetStr(ImportHtmlShortcuts())));

    if (cur++ == ind)
        return (w == Key ? ImportXmlKey() : (w == Title? ImportXmlTitle() : GetStr(ImportXmlShortcuts())));

    if (cur++ == ind)
        return (w == Key ? ExportKey() : (w == Title? ExportTitle() : GetStr(ExportShortcuts())));

    if (cur++ == ind)
        return (w == Key ? PrintKey() : (w == Title? PrintTitle() : GetStr(PrintShortcuts())));

    if (cur++ == ind)
        return (w == Key ? PreviewKey() : (w == Title? PreviewTitle() : GetStr(PreviewShortcuts())));

    if (cur++ == ind)
        return (w == Key ? QuitKey() : (w == Title? QuitTitle() : GetStr(QuitShortcuts())));

    if (cur++ == ind)
        return (w == Key ? EditKey() : (w == Title? EditTitle() : ""));

    if (cur++ == ind)
        return (w == Key ? UndoKey() : (w == Title? UndoTitle() : GetStr(UndoShortcuts())));

    if (cur++ == ind)
        return (w == Key ? RedoKey() : (w == Title? RedoTitle() : GetStr(RedoShortcuts())));

    if (cur++ == ind)
        return (w == Key ? CutKey() : (w == Title? CutTitle() : GetStr(CutShortcuts())));

    if (cur++ == ind)
        return (w == Key ? CopyKey() : (w == Title? CopyTitle() : GetStr(CopyShortcuts())));

    if (cur++ == ind)
        return (w == Key ? PasteKey() : (w == Title? PasteTitle() : GetStr(PasteShortcuts())));

    if (cur++ == ind)
        return (w == Key ? FindKey() : (w == Title? FindTitle() : GetStr(FindShortcuts())));

    if (cur++ == ind)
        return (w == Key ? NextKey() : (w == Title? NextTitle() : GetStr(NextShortcuts())));

    if (cur++ == ind)
        return (w == Key ? PrevKey() : (w == Title? PrevTitle() : GetStr(PrevShortcuts())));

    if (cur++ == ind)
        return (w == Key ? PrefsKey() : (w == Title? PrefsTitle() : GetStr(PrefsShortcuts())));

    if (cur++ == ind)
        return (w == Key ? ViewKey() : (w == Title? ViewTitle() : ""));

    if (cur++ == ind)
        return (w == Key ? AppStylesKey() : (w == Title? AppStylesTitle() : ""));

    if (cur++ == ind)
        return (w == Key ? StatusKey() : (w == Title? StatusTitle() : GetStr(StatusShortcuts())));

    if (cur++ == ind)
        return (w == Key ? MenuKey() : (w == Title? MenuTitle() : GetStr(MenuShortcuts())));

    if (cur++ == ind)
        return (w == Key ? TabKey() : (w == Title? TabTitle() : GetStr(TabShortcuts())));

    if (cur++ == ind)
        return (w == Key ? NavKey() : (w == Title? NavTitle() : GetStr(NavShortcuts())));

    if (cur++ == ind)
        return (w == Key ? BooksKey() : (w == Title? BooksTitle() : GetStr(BooksShortcuts())));

//  if (cur++ == ind)
//      return (w == Key ? Key() : (w == Title? Title() : GetStr(Shortcuts())));

    if (cur++ == ind)
        return (w == Key ? StopKey() : (w == Title? StopTitle() : GetStr(StopShortcuts())));

    if (cur++ == ind)
        return (w == Key ? ReloadKey() : (w == Title? ReloadTitle() : GetStr(ReloadShortcuts())));

    if (cur++ == ind)
        return (w == Key ? LargerKey() : (w == Title? LargerTitle() : GetStr(LargerShortcuts())));

    if (cur++ == ind)
        return (w == Key ? NormalKey() : (w == Title? NormalTitle() : GetStr(NormalShortcuts())));

    if (cur++ == ind)
        return (w == Key ? SmallerKey() : (w == Title? SmallerTitle() : GetStr(SmallerShortcuts())));

    if (cur++ == ind)
        return (w == Key ? TextOnlyKey() : (w == Title? TextOnlyTitle() : GetStr(TextOnlyShortcuts())));

    if (cur++ == ind)
        return (w == Key ? EncodeKey() : (w == Title? EncodeTitle() : ""));

    if (cur++ == ind)
        return (w == Key ? SourceKey() : (w == Title? SourceTitle() : GetStr(SourceShortcuts())));

    if (cur++ == ind)
        return (w == Key ? FullKey() : (w == Title? FullTitle() : GetStr(FullShortcuts())));

    if (cur++ == ind)
        return (w == Key ? HistoryKey() : (w == Title? HistoryTitle() : ""));

    if (cur++ == ind)
        return (w == Key ? BackKey() : (w == Title? BackTitle() : GetStr(BackShortcuts())));

    if (cur++ == ind)
        return (w == Key ? ForwKey() : (w == Title? ForwTitle() : GetStr(ForwShortcuts())));

    if (cur++ == ind)
        return (w == Key ? HomeKey() : (w == Title? HomeTitle() : GetStr(HomeShortcuts())));

    if (cur++ == ind)
        return (w == Key ? LastTabKey() : (w == Title? LastTabTitle() : GetStr(LastTabShortcuts())));

    if (cur++ == ind)
        return (w == Key ? LastTabsKey() : (w == Title? LastTabsTitle() : GetStr(LastTabsShortcuts())));

    if (cur++ == ind)
        return (w == Key ? SessionKey() : (w == Title? SessionTitle() : GetStr(SessionShortcuts())));

    if (cur++ == ind)
        return (w == Key ? AllHistKey() : (w == Title? AllHistTitle() : GetStr(AllHistShortcuts())));

    if (cur++ == ind)
        return (w == Key ? ClearKey() : (w == Title? ClearTitle() : GetStr(ClearShortcuts())));

    if (cur++ == ind)
        return (w == Key ? BookmarksKey() : (w == Title? BookmarksTitle() : ""));

    if (cur++ == ind)
        return (w == Key ? AllBooksKey() : (w == Title? AllBooksTitle() : GetStr(AllBooksShortcuts())));

    if (cur++ == ind)
        return (w == Key ? AddBookKey() : (w == Title? AddBookTitle() : GetStr(AddBookShortcuts())));
    
    if (cur++ == ind)
        return (w == Key ? PrivacyKey() : (w == Title? PrivacyTitle() : ""));
    
    if (cur++ == ind)
        return (w == Key ? PrivateKey() : (w == Title? PrivateTitle() : GetStr(PrivateShortcuts())));
    
    if (cur++ == ind)
        return (w == Key ? JavaScriptKey() : (w == Title? JavaScriptTitle() : GetStr(JavaScriptShortcuts())));
    
    if (cur++ == ind)
        return (w == Key ? ImagesKey() : (w == Title? ImagesTitle() : GetStr(ImagesShortcuts())));
    
    if (cur++ == ind)
        return (w == Key ? CookiesKey() : (w == Title? CookiesTitle() : GetStr(CookiesShortcuts())));
    
    if (cur++ == ind)
        return (w == Key ? PlugInsKey() : (w == Title? PlugInsTitle() : GetStr(PlugInsShortcuts())));
    
    if (cur++ == ind)
        return (w == Key ? AgentKey() : (w == Title? AgentTitle() : GetStr(AgentShortcuts())));
    
    if (cur++ == ind)
        return (w == Key ? PopUpsKey() : (w == Title? PopUpsTitle() : GetStr(PopUpsShortcuts())));

    if (cur++ == ind)
        return (w == Key ? ProxyKey() : (w == Title? ProxyTitle() : GetStr(ProxyShortcuts())));

    if (cur++ == ind)
        return (w == Key ? EmptyKey() : (w == Title? EmptyTitle() : GetStr(EmptyShortcuts())));

    if (cur++ == ind)
        return (w == Key ? ResetKey() : (w == Title? ResetTitle() : GetStr(ResetShortcuts())));

    if (cur++ == ind)
        return (w == Key ? FullResetKey() : (w == Title? FullResetTitle() : GetStr(FullResetShortcuts())));

    if (cur++ == ind)
        return (w == Key ? ToolsKey() : (w == Title? ToolsTitle() : ""));

    if (cur++ == ind)
        return (w == Key ? CompatKey() : (w == Title? CompatTitle() : ""));

    if (cur++ == ind)
        return (w == Key ? SearchKey() : (w == Title? SearchTitle() : GetStr(SearchShortcuts())));

    if (cur++ == ind)
        return (w == Key ? KeyboardKey() : (w == Title? KeyboardTitle() : GetStr(KeyboardShortcuts())));

    if (cur++ == ind)
        return (w == Key ? InspectorKey() : (w == Title? InspectorTitle() : GetStr(InspectorShortcuts())));

    if (cur++ == ind)
        return (w == Key ? InspectKey() : (w == Title? InspectTitle() : GetStr(InspectShortcuts())));

    if (cur++ == ind)
        return (w == Key ? OptionsKey() : (w == Title? OptionsTitle() : GetStr(OptionsShortcuts())));

    if (cur++ == ind)
        return (w == Key ? WindowKey() : (w == Title? WindowTitle() : ""));

    if (cur++ == ind)
        return (w == Key ? NextTabKey() : (w == Title? NextTabTitle() : GetStr(NextTabShortcuts())));

    if (cur++ == ind)
        return (w == Key ? PrevTabKey() : (w == Title? PrevTabTitle() : GetStr(PrevTabShortcuts())));

    if (cur++ == ind)
        return (w == Key ? NewTabKey() : (w == Title? NewTabTitle() : GetStr(NewTabShortcuts())));

    if (cur++ == ind)
        return (w == Key ? CloseTabKey() : (w == Title? CloseTabTitle() : GetStr(CloseTabShortcuts())));

    if (cur++ == ind)
        return (w == Key ? CloseOtherKey() : (w == Title? CloseOtherTitle() : GetStr(CloseOtherShortcuts())));

    if (cur++ == ind)
        return (w == Key ? CloneTabKey() : (w == Title? CloneTabTitle() : GetStr(CloneTabShortcuts())));

    if (cur++ == ind)
        return (w == Key ? ReloadTabKey() : (w == Title? ReloadTabTitle() : GetStr(ReloadTabShortcuts())));

    if (cur++ == ind)
        return (w == Key ? ReloadAllKey() : (w == Title? ReloadAllTitle() : GetStr(ReloadAllShortcuts())));

    if (cur++ == ind)
        return (w == Key ? OpenNewTabKey() : (w == Title? OpenNewTabTitle() : GetStr(OpenNewTabShortcuts())));

    if (cur++ == ind)
        return (w == Key ? OpenAdBlockKey() : (w == Title? OpenAdBlockTitle() : GetStr(OpenAdBlockShortcuts())));

    if (cur++ == ind)
        return (w == Key ? SwapFocusKey() : (w == Title? SwapFocusTitle() : GetStr(SwapFocusShortcuts())));

    if (cur++ == ind)
        return (w == Key ? CopyAddrKey() : (w == Title? CopyAddrTitle() : ""));

    if (cur++ == ind)
        return (w == Key ? DownsKey() : (w == Title? DownsTitle() : GetStr(DownsShortcuts())));

    if (cur++ == ind)
        return (w == Key ? TorrentsKey() : (w == Title? TorrentsTitle() : GetStr(TorrentsShortcuts())));

    if (cur++ == ind)
        return (w == Key ? HelpKey() : (w == Title? HelpTitle() : GetStr(HelpShortcuts())));

    if (cur++ == ind)
        return (w == Key ? OnlineKey() : (w == Title? OnlineTitle() : GetStr(OnlineShortcuts())));

    if (cur++ == ind)
        return (w == Key ? UpdatesKey() : (w == Title? UpdatesTitle() : GetStr(UpdatesShortcuts())));

    if (cur++ == ind)
        return (w == Key ? AboutKey() : (w == Title? AboutTitle() : GetStr(AboutShortcuts())));

    return "";
}