Exemplo n.º 1
0
void Register::Commit()
{
	int choice(0);
	if(nameEdit->text().isEmpty())
	{
		choice =  QMessageBox::warning(this,tr("Not input name"),tr("you havn't input your username.\nDo you want to cancel the process?"),QMessageBox::Yes|QMessageBox::No);
		if(choice == QMessageBox::Yes)
			whenexit();	
	}
	else
	{
		QString usrname = nameEdit->text();
		if(rmanager->searchuser(usrname))
		{
			choice = QMessageBox::warning(this,tr("Same name"),tr("the is already registed\nDo you want to try again"),QMessageBox::Yes|QMessageBox::No);
			if(choice == QMessageBox::No)
				whenexit();	
		}
		else if(keyEdit->text().isEmpty())
			QMessageBox::warning(this,tr("Not Finished"),tr("you haven't input your key"),QMessageBox::Ok);
		else
		{
		rmanager->addusr(nameEdit->text(),studentNumberEdit->text(),emailEdit->text(),keyEdit->text());
		QMessageBox::information(this,tr("Successful"),tr("Congratulations!"),QMessageBox::Ok);
		fresh();
		whenexit();
		}
	}
}
Exemplo n.º 2
0
	VARIABLE_NAME* fresh_var_name (string prefix)
	{
		VARIABLE_NAME* result = new VARIABLE_NAME (fresh (prefix));
		result->attrs->set_true ("phc.codegen.st_entry_not_required");
		result->attrs->set_true ("phc.codegen.compiler_generated");
		return result;
	}
Exemplo n.º 3
0
//$B%3%s%9%H%i%/%?4X?t(B
Kprint::Kprint() {

    charMonitor=(u16_t *)CharMonitorAddr;//$B%b%K%?$N%"%I%l%9$r$$$l$k(B
    color=0x0f;
    fleshdata=(color<<8)|0x20;
    fresh();
}
Exemplo n.º 4
0
QVariant FeedItem::data(int role) const
{
    switch(role) {
    case UidRole:
        return uid();
    case TitleRole:
        return title();
    case ContentRole:
        return content();
    case LinkRole:
        return link();
    case UrlRole:
        return url();
    case IconRole:
        return icon();
    case StreamIdRole:
        return streamId();
    case UnreadRole:
        return unread();
    case ReadRole:
        return read();
    case ReadlaterRole:
        return readlater();
    case FreshRole:
        return fresh();
    default:
        return QVariant();
    }
}
Exemplo n.º 5
0
Object::Reference Entity::retrieve(const Schema::Key& key){
    Object::Reference result;
    if(!result){
        Object::Reference fresh(NULL);// = Object::Factory::Registry.find(&Datum::staticMetaObject)->produce(NULL);
        setKey(fresh, key);
        if(Adapter->select(fresh)){
            result = fresh;
        }
    }

    return result;
}
Exemplo n.º 6
0
TEST(SMARTPOINTER, copy)
	{
	double remember = 15.2;
	spointer<double> empty;
		{
		double* test = new double[1];
		test[0] = remember;
		spointer<double> fresh(test);
		EXPECT_EQ(fresh.use_count(), 1);
		empty = fresh;
		EXPECT_EQ(fresh.use_count(), 2);
		}
	EXPECT_EQ(*empty, remember);
	}
Exemplo n.º 7
0
void startwindowbf::timerEvent(QTimerEvent *event)
{   if(portOn&&(pdnshowcountp>0))
        fresh();
    else if(pdnshowcountp==0)
    {
        if(portOn)
            opi_closeucd_com(&com);
        portOn=false;
        *comPortUserp = BFCOMPORTFREE;
        if(!firsttimer)
            this->killTimer(timeid);
        if(!firstfile)
            fclose(file);
        firsttimer=true;
        firstfile=true;
        ui->checkWriteFileBox->setDisabled(false);
    }
}
Exemplo n.º 8
0
WizualizacjaWahadla::WizualizacjaWahadla( QWidget *wRodzic ): QWidget( wRodzic ){

  param.q[0] = -90; param.q[1] = -90; param.q[2] = 0; param.q[3] = 0;
  param.l[0] = 6; param.l[1] = 3;
  param.m[0] = 5; param.m[1] = 4;

  S = new Wahadlo( this );

  B = new QPushButton( this );
  B->resize( 100, 30 );
  B->move( 500, 300 );
  B->setText("Apply Force");

  connect(S, SIGNAL(UpdateAngles(PendulumParameters)), this, SLOT(fresh(PendulumParameters)));
  connect(B, SIGNAL(pressed()), S, SLOT(ApplyForce()));
  connect(B, SIGNAL(released()), S, SLOT(ReleaseForce()));

  setPalette( QPalette(Qt::white) );
  setAutoFillBackground( true );
  update();

}
Exemplo n.º 9
0
 size_t
 operator()()
 {
   return fresh();
 }
Exemplo n.º 10
0
void Kprint::fresh(u8_t nextcolor) {
    color=nextcolor;
    fleshdata=(color<<8)|0x20;
    fresh();
}
Exemplo n.º 11
0
	CLASS_NAME* fresh_class_name (string prefix)
	{
		return new CLASS_NAME (fresh (prefix));
	}
Exemplo n.º 12
0
int main(int argc,char** argv){  
  int sockfd;
  struct sockaddr_in servaddr;  
  char recvBuf[MAXBUF];
  char getInput[MAXBUF];  

  struct recvLine *recvline;
  struct sendLine sendline;  
  
  if((sockfd=socket(AF_INET,SOCK_STREAM,0))<0){
    perror("failed to create the socket!");
    exit(errno);
  }

  memset(&servaddr,0,sizeof(servaddr));
  servaddr.sin_family = AF_INET;
  servaddr.sin_port = htons(SERVER_PORT);
  servaddr.sin_addr.s_addr = inet_addr("127.0.0.1");    

  if(connect(sockfd,(struct sockaddr*)&servaddr,sizeof(servaddr))<0){
    perror("failed to connet the server!");
    exit(errno);
  }

  freshCity();
  char headSign[2] = {0x01,0x00};
  char tailSign = 0x00;
  int endSign = 0;

  /*input the city name*/
  while(fgets(getInput,MAXBUF,stdin)!=NULL){
    getInput[strlen(getInput)-1] = '\0';    
    trim(getInput);
    endSign=0;
    
    if(getInput[0]==0x63 && strlen(getInput)==1){              //input 'c' to clear
      freshCity();
    }
    else if(strlen(getInput)==0){       //just enter
      continue;
    }
    else if(getInput[0]==0x23 && strlen(getInput)==1){         //input '#' to end program running
      break;      
    }
    else{
      sendline = makeSendline(getInput,headSign,tailSign);

      send(sockfd,(char*)&sendline,sizeof(sendline),0);

      if(recv(sockfd,recvBuf,MAXBUF,0)==0){
        perror("the server terminated prematurely!");
        exit(errno);
      }          
      recvline = (struct recvLine*)recvBuf;      
      display(recvline);        

      if(recvline->lineHead[0]==0x03){        //the city name is correct            
          char dayNum[MAXBUF];

          char packHead[2] = {0x02,0x01};
          char packTail = 0x01;

          int backSign = 0;
          int sendSign = 1;

          /*input the number to request the weather message*/
          while(fgets(dayNum,MAXBUF,stdin)!=NULL){          
            dayNum[strlen(dayNum)-1] = '\0';
            trim(dayNum);
            backSign = 0;
            sendSign = 1;
            if(strlen(dayNum)==0){
              continue;
            }
            else if(strlen(dayNum)!=1){
              printf("%s\n","input error");
              sendSign = 0;
            }          
            else{
              switch(dayNum[0]){
                case 0x31:
                  packHead[0]=0x02; packHead[1]=0x01; packTail=0x01; break;
                case 0x32:
                  packHead[0]=0x02; packHead[1]=0x02; packTail=0x03; break;
                case 0x33:
                  printf("%s","Please enter the day number(below 10, e.g. 1 means today):");                  
                  while(fgets(dayNum,MAXBUF,stdin)!=NULL){                                  
                    dayNum[strlen(dayNum)-1] = '\0';                                                                        
                    if(strlen(dayNum)==0){
                      continue;
                    }
                    else if(strlen(dayNum)!=1){
                      printf("%s\n","input error");
                      printf("%s","Please enter the day number(below 10, e.g. 1 means today):");                                          
                    }                  
                    else{
                      packHead[0]=0x02; packHead[1]=0x01;
                      if(dayNum[0]>=0x31 && dayNum[0]<=0x39){
                        packTail = dayNum[0] - 0x30;
                        break;
                      }
                      else{
                        printf("%s\n","input error");                    
                        printf("%s","Please enter the day number(below 10, e.g. 1 means today):");
                      }                                  
                    }
                  }              
                break;
                case 0x72: backSign=1;freshCity(); sendSign = 0; break;    //input 'r' to turn back 
                case 0x63: fresh(); sendSign = 0; break;          //input 'c' to clear
                case 0x23: endSign =1; sendSign = 0; break;            //input '#' to end the program     
                default:
                  printf("%s\n","input error"); 
                  sendSign=0; break;
              }

              if(backSign==1 || endSign==1){
                break;
              } 

              if(sendSign==1){
                sendline = makeSendline(recvline->city,packHead,packTail);    
                send(sockfd,(char*)&sendline,sizeof(sendline),0);
                if(recv(sockfd,recvBuf,MAXBUF,0) ==0){
                   perror("the server terminated prematurely!");
                   exit(errno);
                };
                recvline = (struct recvLine*)recvBuf;
                WeathMsgDisp(recvline);  //display the weather message!              
              }
            }

          }
          if(endSign==1){
            break;
          }
      } 
  }
        
   memset(recvBuf,0,MAXBUF);
  }
}
Exemplo n.º 13
0
	LABEL_NAME* fresh_label_name ()
	{
		return new LABEL_NAME (fresh ("L"));
	}
Exemplo n.º 14
0
	HT_ITERATOR* fresh_iter ()
	{
		return new HT_ITERATOR (fresh ("ht_iterator"));
	}
Exemplo n.º 15
0
	METHOD_NAME* fresh_method_name (string prefix)
	{
		return new METHOD_NAME (fresh (prefix));
	}
Exemplo n.º 16
0
	INTERFACE_NAME* fresh_interface_name (string prefix)
	{
		return new INTERFACE_NAME (fresh (prefix));
	}
Exemplo n.º 17
0
void Register::whenexit()
{
	emit isexit();
	fresh();
	close();
}
Exemplo n.º 18
0
void startwindow::on_pushButton_2_clicked()
{
    //re open the comport
    int i;
    OPIPKT_t opipkttmp;
    quint8 tempui8arr[512];
    if(*comPortUserp==PDCCOMPORTFREE||*comPortUserp==PDCCOMPORTUSER)
    {
        if(portOn)
            opi_closeucd_com(&com);
        if(!firstfile)
            fclose(file);
        firstfile=true;
        *comPortUserp = PDCCOMPORTFREE;
        hide_check_pdn();
        portOn = false;
        if(opi_openucd_com(&com)==0)
        {
            portOn = true;
            *comPortUserp = PDCCOMPORTUSER;
            get_opipkt_total=opiucd_getPDN();
            if(!get_opipkt_total)
            {
                show_message.setText("there is no pdn devices");
                show_message.show();
                show_message.exec();
                return ;
            }
            else
                show_check_pdn();
        }
        else
        {
            portOn = false;
            *comPortUserp = PDCCOMPORTFREE;
            show_message.setText("Connect the Device again");
            show_message.show();
            show_message.exec();
            return ;
        }
    }//other device doesnt use comport
    else
    {
        show_message.setText("Comport is busy,try again later");
        show_message.show();
        show_message.exec();
        return ;
    }


    //re open the comport end
    if(!(portOn))
    {
        *comPortUserp = PDCCOMPORTFREE;
        show_message.setText("You have to connect a Device");
        show_message.show();
        show_message.exec();
        return ;
    }
    else if(Show_count==0)
    {
        show_message.setText("You have to choose Devices");
        show_message.show();
        show_message.exec();
        return ;
    }
    else
    {
        *comPortUserp = PDCCOMPORTUSER;
        //if user show the showdatawindow,user can't control whether write file or not
        ui->checkWriteFileBox->setDisabled(true);
        if(!firstfile)
            fclose(file);
        //regulatefilename = userfilename;
        opiucd_status(&com, &opipkttmp);    // should have opened device successfully before
        QDateTime stDT = QDateTime::currentDateTime();
        regulatefilename = QString("D%1_ALL").arg(stDT.toString("yyyyMMdd_hhmmss"));
        if(ui->checkWriteFileBox->isChecked()) //if true then write it
        {
            firstfile=false;
            file = fopen(regulatefilename.append(".opi").toLatin1().data(), "wb+");
            // write opihdr information
            fwrite(opipkttmp.payload, 1, OPIUCDSTLEN-1, file);
            for(i = 0; i < (512-(OPIUCDSTLEN-1)); i++) tempui8arr[i] = 0xFF;
            fwrite(tempui8arr, 1, (512-(OPIUCDSTLEN-1)), file);
        }
        else
            firstfile=true;
        //check which the pdn the user what to show
        for(i=1; i<OPIWANT_MAX+1; i++)
        {
            if(pdnOn[i])  //if the user choose the pdn then we open the showdatawindow
            {
                if(!sdw[i]->already_open)  //if already open we will not open and reset again
                {
                    firstpdn[i]=false;
                    sdw[i]->setPdnNum(PDN_NUMBER[i]);
                    sdw[i]->show();
                }
            }
            else  //if the user don't choose the pdn then we close the showdatawindow
            {
                if(sdw[i]->isVisible())
                {
                    sdw[i]->close();
                    sdw[i]->already_open=false;
                }
            }
        }
        //to avoid reopening timer
        if(firsttimer)
        {
            timeid=QObject::startTimer(startwindow_fresh_time);
            firsttimer=false;
        }
        fresh();
    }
}