⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form.cpp

📁 此源码包是在linux系统中运行的网络电话界面程序。
💻 CPP
📖 第 1 页 / 共 2 页
字号:
void Form::button2slot(){  LEdit->insert("2");}void Form::button3slot(){  LEdit->insert("3");}void Form::button4slot(){  LEdit->insert("4");}void Form::button5slot(){  LEdit->insert("5");}void Form::button6slot(){  LEdit->insert("6");}void Form::button7slot(){  LEdit->insert("7");}void Form::button8slot(){  LEdit->insert("8");}void Form::button9slot(){  LEdit->insert("9");}void Form::button10slot(){  LEdit->insert("*");}void Form::button11slot(){  LEdit->insert("#");}void Form::proxy_add(){ // proxy *dialog=new proxy(0,"register server"); // dialog->exec();  int fd;  QString str="proxy add";  if((fd=open(FIFO,O_WRONLY,0))<0)  {    perror("open fifo error\n");    exit(0);  }  if(write(fd,str,strlen(str))<0)  {    perror("write error\n");    exit(0);  }  proxy *dialog=new proxy(0,"register server");  dialog->exec();}void Form::proxy_remove(){  server *dialog=new server(0,"servergraphic");  dialog->show();}  void Form::proxy_list(){  QString str="proxy list";  int fd;  if((fd=open(FIFO,O_WRONLY,0))<0)  {    perror("open fifo error\n");    exit(0);  }  if(write(fd,str,strlen(str))<0)  {    perror("write error\n");    exit(0);  }  printf("proxy list\n");  usleep(200000);  QFile qfile(LIST);  printf("list000\n");  if(qfile.exists())  {    printf("list.txt exist\n");    if (qfile.open(IO_ReadOnly))    {      printf("open list.txt sucess\n");      while(!qfile.atEnd())      {        QTextView *tview = new QTextView(qfile.readAll());        tview->show();        printf("show list.txt sucess\n");      }      qfile.close();    }  }  else    printf("list.txt not exist\n");}void Form::msgshow(){     QString output;     output.append(proc->readStdout());     TextLabel->setText(output);	}void Form::send_callanswer(){/*  FILE *fs;  char ser[128];  if((fs=fopen(SERVER,"r"))==NULL)      printf("Read open file SERVER error!\n");   else      {        rewind(fs);        fgets(ser,127,fs);        printf("%s\n",ser);      }   fclose(fs); */  //QString str=LEdit->text(); //add by leo   const char* str="c "; //  const char* str0="@";   QString strip = LEdit->text();   if(strip.isNull())      exit(0);  // str = "c ";//rec_command;   QString tmp0,tmp;   tmp = tmp0.fromLocal8Bit(str,-1)+strip;   str = tmp.ascii();   printf("003\n");   if((fd=open(FIFO,O_WRONLY,0))<0)   {      printf("004\n");      perror("open fifo error\n");      exit(0);    }      if(write(fd,str,strlen(str))<0)   {      perror("write error\n");      exit(0);    }printf("005\n");char *buf="answer";  if((fd=open(FIFO,O_WRONLY,0))<0)  {    perror("open fifo error\n");    exit(0);  }  if(write(fd,buf,strlen(buf))<0)  {    perror("write error\n");    exit(0);  }//  close(fd);}/*void Form::alarm(){   printf("006\n");   char r_buf[150];   int cd,num;    printf("007\n");   if((cd=open(ALARM,O_RDONLY,0))<0)     {      perror("open alarm fifo error!");      exit(0);   }   else      {         memset(r_buf,0,sizeof(r_buf));         printf("008\n");         if((num=read(cd,r_buf,sizeof(r_buf)))<0)            printf("read data from alarm\n ");         else if(num < 60)              {                printf("device is busy!\n");                okcontrol *dialog = new okcontrol(0,"DSP");                dialog->exec();              }                 else                printf("device is free!\n");      }// close(cd);}*///void Form::send_quit()//{    	/*struct flock lock;        lock.l_type = F_UNLCK;        fcntl(STDIN_FILENO,F_SETLK,&lock);*/	/*QString str="quit";	proc->writeToStdin(str);*///	char *buf = "quit";  //      printf("010\n");    //    if((fd=open(FIFO,O_WRONLY,0))<0)      //   {        //         perror("open fifo error\n");          //       exit(0);        // } //       printf("011\n");   //     if(write(fd,buf,strlen(buf))<0)     //   {       //         perror("write error\n");         //       exit(0);      // }//	qApp->quit();//}void Form::send_terminate(){	/*QString str="terminate";	proc->writeToStdin(str);*/	char *buf = "terminate";	if((fd=open(FIFO,O_WRONLY,0))<0)         {                 perror("open fifo error\n");                 exit(0);         }        if(write(fd,buf,strlen(buf))<0)        {                perror("write error\n");                exit(0);       }   //   qApp->quit(); 	}/*void Form::send_answer(){	char *buf="answer";	if((fd=open(FIFO,O_WRONLY,0))<0)                {                        perror("open fifo error\n");                        exit(0);                }		if(write(fd,buf,strlen(buf))<0)		{			perror("write error\n");			exit(0);		}	    		exit(0);                                                                                                               }*/void Form::help(){ /* QFile qfile(HELP);  printf("help000\n");  if(qfile.exists())  {    printf("help.txt exist\n");    if (qfile.open(IO_ReadOnly))    {      printf("open help.txt sucess\n");      while(!qfile.atEnd())      {        QTextView *tview = new QTextView(qfile.readAll());        tview->show();        printf("show help.txt sucess\n");      }      qfile.close();    }  }  else    printf("help.txt not exist\n");  printf("help001\n");*/  char c[100000]="******************网络电话使用帮助文档******************** 1.呼叫:在上方的文本框中输入:电话号码,例如:01062760056; 2.服务器:点击此按钮进入服务器操作界面,包括注册,移除,列表按钮。2.1注册:点击注册按钮进入注册界面,依次输入注册服务器IP,注册帐号,密码,路由网关(一般不需要),点击确定,注册服务器;2.2列表:点击显示当前所有的注册信息; 2.3移除:在文本框内输入列表中看到的注册信息对应的序列号,点击此按钮移除相应的注册。直接点击按钮移除默认的注册; 3.挂断:点击挂断通话; 4.接听:点击接听来电; 5.帮助:点击显示使用帮助文档; ";  QMessageBox *message=new QMessageBox(this,"help");  message->resize(360,300);  message->setText(QString::fromLocal8Bit(c));  message->setTextFormat(Qt::RichText);  message->show();}/*void Form::reg(){  printf("012\n");  server *dialog=new server(0,"servergraphic");  dialog->show();  printf("015\n");}*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -