void VisionMainFrame::out_tips_ary(const QStringList &tips_ary) { for (const QString &tips : tips_ary) { if (tips.length() <= 0) { continue; } if (tips[0] == QChar('?')) { out_info(PZ_DEBUG, tips); } else if (tips[0] == QChar('.')) { out_info(PZ_INFO, tips); } else if (tips[0] == QChar(':')) { out_info(PZ_WARNNING, tips); } else if (tips[0] == QChar('!')) { out_info(PZ_ERROR, tips); } else { out_info(PZ_INFO, tips); } } }
VisionMainFrame::VisionMainFrame(QWidget *parent) : QMainWindow(parent) { setup_ui(); setup_action(); out_info(PZ_INFO, QString::fromLocal8Bit("好吧,欢迎实用illusion配置转换工具,用于读取转换配置。")); out_info(PZ_INFO, QString::fromLocal8Bit("这个图标来自illusion 公司的一个著名软件。")); }
void VisionMainFrame::create_excel() { QStringList noexcel_ary; illlusion_widget_->noexcel_list(noexcel_ary); if (noexcel_ary.size() <= 0) { QMessageBox::critical(VisionMainFrame::instance(), QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("所有的文件都有对应的EXCEL文件存在,所以无需生产EXCEL文件。请检查")); out_info(PZ_ERROR, QString::fromLocal8Bit("!所有的文件都有对应的EXCEL文件存在,所以无需生产EXCEL文件。请检查。咩咩咩")); return; } int ret = 0; for (int i = 0; i < noexcel_ary.size(); ++i) { QStringList tips_ary; ret |= Biko_Read_Config::instance()->save_excel_tablehead(noexcel_ary[i], tips_ary); out_tips_ary(tips_ary); } if (0 != ret) { QMessageBox::critical(VisionMainFrame::instance(), QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("保存EXCEL表头存在错误, 请检查输入参数,留意输出信息区的提示。" "命运就算颠沛流离 命运就算曲折离奇 命运就算恐吓着你做人没趣味 别流泪 心酸 更不应舍弃")); return; } QMessageBox::information(VisionMainFrame::instance(), QString::fromLocal8Bit("成功"), QString::fromLocal8Bit("您选择的表格已经转表成功,我要带你到处去飞翔 走遍世界各地去观赏.")); }
//!PROTO TAB页面 void VisionMainFrame::proto_read_all() { QStringList selected_msgary; illlusion_widget_->selected_list(selected_msgary); if (selected_msgary.size() <= 0) { QMessageBox::critical(VisionMainFrame::instance(), QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("没有选择Message或者还咩有初始化导入Proto文件。请检查")); out_info(PZ_ERROR, QString::fromLocal8Bit("!没有选择Message或者还咩有初始化导入Proto文件。请检查。咩咩咩")); return; } //!读取 int ret = 0; for (int i = 0; i < selected_msgary.size(); ++i) { QStringList tips_ary; ret |= Biko_Read_Config::instance()->read_one_message(selected_msgary[i], tips_ary); out_tips_ary(tips_ary); } if (0 != ret) { QMessageBox::critical(VisionMainFrame::instance(), QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("导出过程存在错误, 请检查输入参数,留意输出信息区的提示。" "命运就算颠沛流离 命运就算曲折离奇 命运就算恐吓着你做人没趣味 别流泪 心酸 更不应舍弃")); return; } QMessageBox::information(VisionMainFrame::instance(), QString::fromLocal8Bit("成功"), QString::fromLocal8Bit("您选择的表格已经转表成功,胆似铁打骨似精钢,胸襟百千丈眼光万里长.")); }
// --------------------------------------------------------------------------------- void KReportTable::export_data_to_file() { Uuid const&id = _M_data_model->report().reportType().id(); //fetching the target file name from the most recent representation of the report type (instead of using the cached report type definition): QString filename = context()->reportManager()->load ( id ).exportDataFileName ( _M_data_model->report() ); filename = KFileDialog::getSaveFileName ( detail::url ( filename ), QString(), 0, i18n ( "Export Report Data to" ) ); if ( filename.isEmpty() ) {return;} QFile out ( filename ); QFileInfo out_info ( out ); if ( out_info.exists() ) { if ( KMessageBox::questionYesNo ( 0, i18n ( "The target file <b>'%1'</b> already exists. Do you really want to overwrite it?" ).arg ( filename ), i18n ( "File already exists - Don't Panik" ) ) == KMessageBox::No ) { return; } } if ( !out.open ( QIODevice::WriteOnly ) ) { KMessageBox::error ( 0, i18n ( "Unable to export Report Data to file <b>'%1'</b>." ).arg ( filename ), i18n ( "Report Export Error" ) ); return; } out.write ( _M_data_model->report().reportData().exportDataString().toAscii() ); out.close(); KDialog *dlg = new ReportExportedSuccessfullyDialog ( out_info, this ); int result = KMessageBox::createKMessageBox ( dlg , QMessageBox::Information , i18n ( "Report exported successfully to <b>'%1'</b>." ).arg ( filename ) , QStringList() , QString ( "" ) , 0 , KMessageBox::Notify ); if ( result == KDialog::User1 ) { Mail mail; mail.setSubject ( out_info.fileName() ); mail.addAttachement ( out_info.absoluteFilePath() ); MailInterface interface; interface.send ( mail ); } }
/* * * @vara * @return * * */ int main(int argc, char *argv[]) { int id1 = 0, id2 = 1; int framerate = 5; char ip[16] = "127.0.0.1"; int port1 = 8000, port2 = 8001; int agc = -1; //struct cam c1, c2; struct vd_capture* c1; struct vd_capture* c2; struct net nc1, nc2; //open log mylog_init(&logfd,"log_version.txt"); for (;;) { int t = getopt(argc, argv, "d:f:a:p:h:g:?"); if (t == -1) { break; } switch (t) { case 'd': if (sscanf(optarg, "%d,%d", &id1, &id2) != 2) { mylogfd(2,"[Version] Error optarg: %s\n", optarg); exit(-1); } break; case 'f': if (sscanf(optarg, "%d", &t) != 1) { mylogfd(2,"[Version] Error optarg: %s\n", optarg); exit(-1); } if (t <= 0 || t > 30) { mylogfd(2,"[Version] Framerate should be (0, 30]: not %d\n",t); exit(-1); } framerate = t; break; case 'a': if (sscanf(optarg, "%s", ip) != 1) { mylogfd(2,"[Version] Error optarg: %s\n", optarg); exit(-1); } break; case 'p': if (sscanf(optarg, "%d,%d", &port1, &port2) != 2) { mylogfd(2,"[Version] Error optarg: %s\n", optarg); exit(-1); } break; case 'h': mylogfd(1,"[Version] Usage: %s [option]\n" "-d n,m\tset cam id n (default 0,1)\n" "-f n\tset framerate n (default 5)\n" "-a s\tset addr s (default 127.0.0.1)\n" "-p n,m\tset port n (default 8000,8001)\n" "-h\tprint this help\n", argv[0]); return 0; case 'g': agc = atoi(optarg); break; case '?': break; default: mylogfd(2,"[Version] Option error: %d\n", t); exit(-1); } } if (optind != argc) { mylogfd(2,"[Version] Command line error\n"); exit(-1); } //start the init work //init video instrument c1 = (struct vd_capture*) calloc(1, sizeof(struct vd_capture)); //init_video_work(c1, framerate, "/dev/video1"); init_video_work(c1, framerate, "/dev/video2");//just to make in my notebook c2 = (struct vd_capture*) calloc(1, sizeof(struct vd_capture)); //init_video_work(c2, framerate, "/dev/video2"); init_video_work(c2, framerate, "/dev/video1"); mylogfd(1,"[Version] Using video%d video%d (framerate %d)\n",id1, id2, framerate); //init net work netc_init(&nc1, ip, port1); netc_init(&nc2, ip, port2); mylogfd(1,"[Version] Using ip %s port %d %d\n", ip, port1, port2); //init image deal process_init(); //begin to capture int captured1=0, captured2=0; //int index=0; mylogfd(1,"[Version] Begin to capture\n"); while (!c1->quit && !c2->quit) { //开始采集视频数据 //waiting if ((captured1=capture(c1)) < 0) { mylogfd(2,"[Version/Cap/main] Error occurs when capturing video0\n"); break; } if ((captured2=capture(c2)) < 0) { mylogfd(2,"[Version/Cap/main] Error occurs when capturing video1\n"); break; } //posting /*if(index%10==0){ mylogfd(logfd,"\r%d size: %d",index,captured1); mylogfd(logfd,"\r%d size: %d",index,captured2); } index++;*/ //mylogfd(1,"[Version] send pic\n"); if (net_send(c1->framebuffer, captured1, &nc1)==-1) { mylogfd(2,"[Version|Cap|main] The image file is too large: size %d.\n", captured1); continue; } process(c1, 0); if (net_send(c2->framebuffer, captured2, &nc2)==-1) { mylogfd(2,"[Version|Cap|main] The image file is too large: size %d.\n", captured2); continue; } process(c2, 1); //mylogfd(1,"[Version] send pic over\n"); out_info(); //susleep(1000000); } mylogfd(1,"[Version|Cap|main] End capture\n"); return 0; }