void MainWindow::set() { setDialog->show(); setDialog->saveSetPath = projectPath; isConfigured = true; connect(setDialog,SIGNAL(outputSet()),this,SLOT(getSetInfo())); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { /*****生成主窗口UI*****/ ui->setupUi(this); /*****声明全局变量*****/ saveCount = 1;//Save calib images start with 1 scanSN = -1; isConfigured = false; isProjectorOpened = true; /****生成计时器并连接*****/ timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(readframe())); /****声明相机****/ usebc = false; DHC = new DaHengCamera(this); /****生成对焦辅助窗口****/ fa = new FocusAssistant(); showFocus = false; /*****生成OpenGL窗口并加载*****/ displayModel = new GLWidget(ui->displayWidget); ui->displayLayout->addWidget(displayModel); /*****生成设置窗口并输出默认设置*****/ setDialog = new Set(this);//Initialize the set dialog getSetInfo(); /*****获取屏幕尺寸信息*****/ getScreenGeometry();//Get mian screen and projector screen geometry QDesktopWidget* desktopWidget = QApplication::desktop(); QRect projRect = desktopWidget->screenGeometry(1);//1 represent projector int xOffSet = (projRect.width() - scanWidth)/2 + screenWidth; int yOffSet = (projRect.height() - scanHeight)/2; /*****初始化投影窗口*****/ pj = new Projector(NULL, scanWidth, scanHeight, projectorWidth, projectorHeight, xOffSet, yOffSet);//Initialize the projector pj->move(screenWidth,0);//make the window displayed by the projector pj->showFullScreen(); /*****建立连接*****/ createConnections(); /*****初始化圆点探测*****/ blob = new BlobDetector(); }
/* * Set - set editor control variable */ vi_rc Set( char *name ) { char fn[MAX_STR]; vi_rc rc = ERR_NO_ERR; int j, i; #ifndef VICOMP #ifndef __WIN__ int tmp, tc; char **vals = NULL; char **list; int longest; #endif #endif /* * get item to set */ #ifndef VICOMP msgFlag = FALSE; if( !EditFlags.ScriptIsCompiled ) { #endif RemoveLeadingSpaces( name ); j = strlen( name ); for( i = 0; i < j; i++ ) { if( name[i] == '=' || name[i] == ',' ) { name[i] = ' '; } } #ifndef VICOMP } #endif if( NextWord1( name, fn ) <=0 ) { #ifndef VICOMP if( !EditFlags.WindowsStarted ) { return( ERR_NO_ERR ); } #ifndef __WIN__ tc = getSetInfo( &vals, &list, &longest ); tmp = setw_info.y2; i = setw_info.y2 - setw_info.y1 + 1; if( setw_info.has_border ) { i -= 2; } if( tc < i ) { setw_info.y2 -= (i - tc); } rc = SelectItemAndValue( &setw_info, "Settings", list, tc, SettingSelected, 1, vals, longest + 3 ); setw_info.y2 = tmp; MemFreeList( tc, vals ); MemFreeList( tc, list ); ReDisplayScreen(); #endif #endif /* VICOMP */ return( rc ); } else { #ifndef VICOMP if( !EditFlags.Starting) { msgFlag = TRUE; } #endif do { #ifndef VICOMP if( !EditFlags.ScriptIsCompiled ) { #endif if( tolower( fn[0] ) == 'n' && tolower( fn[1] ) == 'o' ) { EliminateFirstN( fn, 2 ); i = -1; } else { i = 1; } j = Tokenize( SetTokens1, fn, FALSE ); if( j == TOK_INVALID ) { j = Tokenize( SetTokens2a, fn, FALSE ); if( j == TOK_INVALID ) { j = Tokenize( SetTokens2, fn, FALSE ); if( j == TOK_INVALID ) { return( ERR_INVALID_SET_COMMAND ); } } j += SET1_T_; } j *= i; #ifndef VICOMP } else { j = atoi( fn ); } #endif i = TRUE; rc = processSetToken( j, name, &i, FALSE ); if( rc > ERR_NO_ERR ) { break; } RemoveLeadingSpaces( name ); } while( NextWord1( name, fn ) > 0 ); #ifndef VICOMP if( msgFlag ) { putMessage(); } #endif return( rc ); } } /* Set */
int main(int argc, char **argv) { rtsNr = 0; validFuCnt = 0; invalidFuCnt = 0; char *docname; int nextOption; // Opciones validas, formato corto const char *shortOpts = "vhu:d:l:"; // Opciones en formato largo const struct option longOpts[] = { {"verbose", 0, NULL, 'v'}, {"help", 0, NULL, 'h'}, {"fu", 1, NULL, 'u'}, {"delta", 1, NULL, 'd'}, {"limit", 1, NULL, 'l'}, {NULL, 0, NULL, 0} }; progName = argv[0]; if (argc <= 1) { printUsage(stderr, EXIT_FAILURE); } delta = DFLT_DELTA; verbose = 0; cont = 0; do { nextOption = getopt_long(argc, argv, shortOpts, longOpts, NULL); switch (nextOption) { case 'v': // -s o --verbose verbose = 1; break; case 'h': // -h o --help printUsage(stdout, EXIT_SUCCESS); case 'u': // -u o --fu setGlobalExpFu(atof(optarg)); break; case 'd': // -d o --delta setDelta(atof(optarg)); break; case 'l': // -l o --limit setLimit(atoi(optarg)); break; case '?': // opcion invalida printUsage(stderr, EXIT_FAILURE); case -1: // no ha más opciones break; default: // inesperado abort(); } } while (nextOption != -1); docname = argv[optind]; xmlTextReaderPtr reader = getDoc(docname); getSetInfo(reader); streamRtsFile(reader); free(fuArray); xmlFreeTextReader(reader); return(EXIT_SUCCESS); }