Beispiel #1
0
int main( int argc, char ** argv )
{
    
    QApplication a( argc, argv );
    
    puts("`````````````````````````````````````````````````");
    printf("RESHKA MAIN PROCESS ID - %d\n", getpid());
    printf("VERSION: %s\n", PROGRAMM_VERSION);
    puts("`````````````````````````````````````````````````");
    
    startHW();
    
    get_setup_params();
    
    hw->DSP_Up(UpStr);
    hw->DSP_Down(DownStr);   
    
    init_keyboard_device(&a);     
    
    bool flag = auth_request(false);
    if ( flag )    {	
	cfw = new mainmenuForm;
	cfw->setWindowState(Qt::WindowNoState);
	cfw->setWindowState(Qt::WindowFullScreen);
	//printf("Authorization::GetInstance()->GetUserName() = %s \n", Authorization::GetInstance()->GetUserName());
	cfw->textLabel2->setText(DBCodec->toUnicode((Authorization::GetInstance()->GetUserName())));
	applyRights();
	
	while ( true )	{
	    puts("------Main Menu------");	    
	    cfw->setWindowState(Qt::WindowNoState);
      	    cfw->setWindowState(Qt::WindowFullScreen);
	    cfw->exec();
	    //printf("Selected point  = %d \n", cfw->focus_num);
	    cfw->releaseKeyboard();
	    if  ( cfw->exec_flag )   {
		switch(cfw->focus_num)		{
		case 0 :
		    printf("--------lincash-------\n");
		    delete (hw);
		    ExecProgram(REG_PATH, REG_NAME, uid);//, REG_NAME);	///-------------------------23/10 16.41---------------
		    cfw->grabKeyboard();
		    //---(+)---Zuskin---27/02/2012---
		    sp.ReloadSections();
		    //-------------------------------
		    startHW();
		    hw->DSP_Up(UpStr);
		    hw->DSP_Down(DownStr); 
		    break;
		case 1 :
		    printf("-------service-----\n");
		    //delete (hw);
		    //QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) );
		    //ExecProgram(SERVICE_PATH, SERVICE_NAME, uid);//, SERVICE_NAME);
		    StartService();
		    cfw->exec_flag = false;
   		    cfw->grabKeyboard();
		    //QApplication::restoreOverrideCursor(); 
		    //startHW();
		    hw->DSP_Up(UpStr);
		    hw->DSP_Down(DownStr);      
		    break;
		case 2 :
		    printf("-------accessrights-------\n");
		    delete (hw);
		    //printf("RIGHTS_PATH = %s \n", RIGHTS_PATH);
		    ExecProgram(RIGHTS_PATH);//, RIGHTS_NAME);
		    Authorization::GetInstance()->GetRights(Authorization::GetInstance()->GetUid());
		    applyRights();
   		    cfw->grabKeyboard();
		    startHW();
		    hw->DSP_Up(UpStr);
		    hw->DSP_Down(DownStr); 
		    break;
		case 3 :
		    printf("--------ware------\n");
		    delete (hw);
		    ExecProgram(WARE_PATH);//, SETUP_NAME);
		    cfw->grabKeyboard();	
		    startHW();
		    hw->DSP_Up(UpStr);
		    hw->DSP_Down(DownStr);
		    break;			    
		case 4 :
		    printf("-------programsetup-----\n");
		    StartSetup();
		    cfw->grabKeyboard();	
		    get_setup_params();
		    cfw->exec_flag = false;
		    hw->DSP_Up(UpStr);
		    hw->DSP_Down(DownStr);
		    break;
		case 5 :
		    printf("--------devicesetup-------\n");		    
		    if ( kbcode_scaner != NULL ) {   delete (kbcode_scaner);    kbcode_scaner = NULL;    }
		    if ( kbcode_reader != NULL ) {   delete (kbcode_reader);    kbcode_reader = NULL;    }
		    
		    delete (hw);
		    ExecProgram(DCONF_PATH);//, DCONF_NAME);
    		    cfw->grabKeyboard();
		    startHW();
		    init_keyboard_device(&a); 
		    hw->DSP_Up(UpStr);
		    hw->DSP_Down(DownStr); 
		    break;
		case 6 :
		    printf("--------setuploadunload------\n");
		    delete (hw);
		    ExecProgram(EXCH_PATH);//, EXCH_NAME);
    		    cfw->grabKeyboard();
		    startHW();
		    hw->DSP_Up(UpStr);
		    hw->DSP_Down(DownStr);	      
		    break;
		case 7 :
		    printf("-------changeuser------\n");
		    bool auth = auth_request(true);
		    while ( !auth ) auth = auth_request(true);
    		    cfw->grabKeyboard();
		    cfw->exec_flag = false;
		    cfw->textLabel2->setText(DBCodec->toUnicode((Authorization::GetInstance()->GetUserName())));
		    applyRights();
		    break;	    
		}
		cfw->exec_flag = false;
		
	    }
	    else break;   
	}
	delete(cfw);
    }       
    if ( kbcode_scaner != NULL ) delete (kbcode_scaner);
    if ( kbcode_reader != NULL ) delete (kbcode_reader);
    if ( hw != NULL )  delete (hw);
    puts("END OF RESHKA");
    
    return 0;
}