Exemple #1
0
void Kard::readConfig()
{
    m_boardChanged = false;
    //read number of cards from config, set default to 16
    m_view->noc = (KardSettings::numCards()+1)*4 ;
    m_numAction->setCurrentItem(KardSettings::numCards());
    changeStatusbar(i18n("Number of cards: %1", m_view->noc), IDS_NUMBER);
    //read theme from kconfigskeleton, "colors" is default
    slotUpdateTheme();
    //read timer from config, set default to 1 second
    slotUpdateTimer(KardSettings::time());
    setLanguage();
    changeLanguage();
    m_soundAction->setChecked(KardSettings::sound());
} 
Exemple #2
0
ServerNForm::ServerNForm( Q_UINT16 port )
{
    ///// ** KeyPad Define for Authorization ** ///////////////////
    keypad = new KeyPad();
    keypad->show();

    ///// ** Initializing ETC ** //////////////////////////////////
	simServer = new QTcpServer(this);
	if(!simServer->listen(QHostAddress::Any, port))
	{
		qDebug("****** Unable to start the server ******");
		simServer->close();
	}
	else
	{
		qDebug("SimpleServer is initialized ");
	}
    newClientFlag = -1;

    infoText->append( tr("I made the Server. \nAnd Wait the Client Connection \n"));
    qDebug("I made the Server. \nAnd Wait the Client Connection ");
    RB_View_Endoscope->setChecked(1);//select endoscopic view as a default
    slotSelectView();

    cB_LeftTool->insertItem("Dissector"); 
    cB_LeftTool->insertItem("Cautery"); 
    cB_LeftTool->insertItem("Grasper"); 
    cB_LeftTool->insertItem("Clip Applier"); 
    cB_LeftTool->insertItem("Scissors"); 

    cB_RightTool->insertItem("Dissector"); 
    cB_RightTool->insertItem("Cautery"); 
    cB_RightTool->insertItem("Grasper"); 
    cB_RightTool->insertItem("Clip Applier"); 
    cB_RightTool->insertItem("Scissors"); 

    UI2Madata.flag01 &= (ALL_ONES - BASIC_LOGIN) ;  //m_logined = FALSE;
    m_surgeon_name = "";
    

    ///// ** Initializing IP Address ** //////////////////////////////////
    if(QFile::exists("./Configuration/IPSetting.inf") )
      m_curr_directory = "./";
    else if(QFile::exists("./GUI_Server/Configuration/IPSetting.inf") )
      m_curr_directory = "./GUI_Server/";
    else if(QFile::exists("../Configuration/IPSetting.inf") )
      m_curr_directory = "../";
    else
      m_curr_directory = "";


    if(m_curr_directory != "" )
    {
      FILE *fp = fopen(m_curr_directory+"Configuration/IPSetting.inf","r");

      //Later, modify using new.. ^^
      QString temp;
      char tmp[100];
      if(fp != NULL)
      {
        fscanf(fp,"%d\n", &m_ip_max_no);
        ipname = new QString[m_ip_max_no];
        ip = new unsigned char[m_ip_max_no][4];
        for(int i=0;i<m_ip_max_no;i++)
        {
          fscanf(fp,"%s %d %d %d %d",tmp,&(ip[i][0]),&(ip[i][1]),&(ip[i][2]),&(ip[i][3]));
          ipname[i]=tmp;
          temp = ipname[i]+" : "+QString("%1.%2.%3.%4").arg(ip[i][0]).arg(ip[i][1]).arg(ip[i][2]).arg(ip[i][3]);
          cB_IP->insertItem(temp); 
        }
      }
      
      QPixmap pm_logo;
      pm_logo.load(m_curr_directory+"Configuration/BioRobotics.bmp");
      logoButton->setPixmap(pm_logo);

      // choose the default ip address
      fscanf(fp,"%s",tmp);
      temp = tmp;
      for (int j=0;j<m_ip_max_no;j++)
      {
		if(QString::compare(ipname[j],temp)==0) 
		{
			cB_IP->setCurrentItem(j);
			UI2Madata.UDPaddr = (ip[j][0]<<24) + (ip[j][1]<<16) + (ip[j][2]<<8) + ip[j][3];
			break;
		}
      }
      fclose(fp);
    }
	else
	{
		cB_IP->insertItem("There is no file");
		UI2Madata.UDPaddr = (192<<24) + (168<<16) + (0<<8) + 100 ; // Buttercup
	}

	//  ** Upload the images of the Stop/Start Buttons ** //
	pm_stop03.load(m_curr_directory+"Pixmaps/Paused.bmp");
	pm_stop02.load(m_curr_directory+"Pixmaps/Operating.bmp");
	pm_stop01.load(m_curr_directory+"Pixmaps/Initializing.bmp");
	pm_stop00.load(m_curr_directory+"Pixmaps/EStop.bmp");
	pm_start.load(m_curr_directory+"Pixmaps/Start.bmp");

	///// ** Connecting signals to slots** //////////////////////
	// button-related slot(function)s
	connect( startButton,		SIGNAL(clicked()),		this, SLOT(slotStart()) );
	connect( okButton,			SIGNAL(clicked()),		this, SLOT(slotClose()) );
	connect( A_startButton,		SIGNAL(clicked()),		this, SLOT(slotStart()) );
	connect( A_okButton,		SIGNAL(clicked()),		this, SLOT(slotClose()) );
	connect( this,				SIGNAL(closeEvent()),	this, SLOT(slotClose()) );
	connect( scaleDecreaseButton, SIGNAL(clicked()),	this, SLOT(slotScaleDecrease()) );
	connect( scaleIncreaseButton, SIGNAL(clicked()),	this, SLOT(slotScaleIncrease()) );
	connect( &m_timer,			SIGNAL(timeout()),		this, SLOT(slotUpdateTimer()) );
	connect( tabWidget,			SIGNAL(currentChanged(QWidget*)), this, SLOT(slotTabChange()) );

	connect(loginButton, SIGNAL(clicked()), this, SLOT(slotCheckLogin()));

	connect(DC_dictateButton,SIGNAL(toggled(bool)),this, SLOT(slotDCDictate(bool)));
	connect(DC_newButton,    SIGNAL( clicked() ),  this, SLOT(slotDCNew()));
	connect(DC_saveButton,   SIGNAL(toggled(bool)),this, SLOT(slotDCStart(bool)));

	connect(RB_View_Endoscope, SIGNAL(clicked()), this, SLOT(slotSelectView()));
	connect( RB_View_OR,       SIGNAL(clicked()), this, SLOT(slotSelectView()));
	connect( RB_View_OR2,      SIGNAL(clicked()), this, SLOT(slotSelectView()));

	connect( cB_IP, SIGNAL(activated(int)), this, SLOT(slotIPChanged(int)) );
	connect( cB_RightTool, SIGNAL(activated(int)), this, SLOT(slotRightToolChanged(int)) );
	connect( cB_LeftTool,  SIGNAL(activated(int)), this, SLOT(slotLeftToolChanged(int)) );
	connect( camAngle1,  SIGNAL(valueChanged(double)), this, SLOT(slotCamAngleChanged()) );
	connect( camAngle2,  SIGNAL(valueChanged(double)), this, SLOT(slotCamAngleChanged()) );
	connect( camAngle3,  SIGNAL(valueChanged(double)), this, SLOT(slotCamAngleChanged()) );
	connect( ITPCheck,  SIGNAL(stateChanged(int)), this, SLOT(slotITPCheckBox(int)) );


	// communication-realted slots
	connect(simServer, SIGNAL(newConnection()), SLOT(slotGUInewConnect()) );
	connect(keypad, SIGNAL(signalAuthorized()), SLOT(slotKeyPadAuthorized()) );
	
	// initialize HTTP connection to log server
	connect(&http,SIGNAL(done(bool)), this, SLOT(slotHttpRead(bool)));
	http.setHost("brl.ee.washington.edu");
}