ApiTrace::ApiTrace() : m_needsSaving(false) { m_loader = new TraceLoader(); connect(this, SIGNAL(loadTrace(QString)), m_loader, SLOT(loadTrace(QString))); connect(this, SIGNAL(requestFrame(ApiTraceFrame*)), m_loader, SLOT(loadFrame(ApiTraceFrame*))); connect(m_loader, SIGNAL(framesLoaded(const QList<ApiTraceFrame*>)), this, SLOT(addFrames(const QList<ApiTraceFrame*>))); connect(m_loader, SIGNAL(frameContentsLoaded(ApiTraceFrame*,QVector<ApiTraceCall*>, QVector<ApiTraceCall*>,quint64)), this, SLOT(loaderFrameLoaded(ApiTraceFrame*,QVector<ApiTraceCall*>,QVector<ApiTraceCall*>,quint64))); connect(m_loader, SIGNAL(guessedApi(int)), this, SLOT(guessedApi(int))); connect(m_loader, SIGNAL(finishedParsing()), this, SLOT(finishedParsing())); connect(this, SIGNAL(loaderSearch(ApiTrace::SearchRequest)), m_loader, SLOT(search(ApiTrace::SearchRequest))); connect(m_loader, SIGNAL(searchResult(ApiTrace::SearchRequest,ApiTrace::SearchResult,ApiTraceCall*)), this, SLOT(loaderSearchResult(ApiTrace::SearchRequest,ApiTrace::SearchResult,ApiTraceCall*))); connect(this, SIGNAL(loaderFindFrameStart(ApiTraceFrame*)), m_loader, SLOT(findFrameStart(ApiTraceFrame*))); connect(this, SIGNAL(loaderFindFrameEnd(ApiTraceFrame*)), m_loader, SLOT(findFrameEnd(ApiTraceFrame*))); connect(m_loader, SIGNAL(foundFrameStart(ApiTraceFrame*)), this, SIGNAL(foundFrameStart(ApiTraceFrame*))); connect(m_loader, SIGNAL(foundFrameEnd(ApiTraceFrame*)), this, SIGNAL(foundFrameEnd(ApiTraceFrame*))); connect(this, SIGNAL(loaderFindCallIndex(int)), m_loader, SLOT(findCallIndex(int))); connect(m_loader, SIGNAL(foundCallIndex(ApiTraceCall*)), this, SIGNAL(foundCallIndex(ApiTraceCall*))); connect(m_loader, SIGNAL(startedParsing()), this, SIGNAL(startedLoadingTrace())); connect(m_loader, SIGNAL(parsed(int)), this, SIGNAL(loaded(int))); connect(m_loader, SIGNAL(finishedParsing()), this, SIGNAL(finishedLoadingTrace())); m_saver = new SaverThread(this); connect(m_saver, SIGNAL(traceSaved()), this, SLOT(slotSaved())); connect(m_saver, SIGNAL(traceSaved()), this, SIGNAL(saved())); m_loaderThread = new QThread(); m_loader->moveToThread(m_loaderThread); m_loaderThread->start(); }
void ApiTrace::setFileName(const QString &name) { if (m_fileName != name) { m_fileName = name; m_tempFileName = QString(); m_frames.clear(); m_errors.clear(); m_editedCalls.clear(); m_queuedErrors.clear(); m_needsSaving = false; emit invalidated(); emit loadTrace(m_fileName); } }
void MainWindow::createActions() /*菜单选项*/ { /*文件菜单*/ openAction = new QAction(tr("打开"),this); openAction->setStatusTip(tr("打开新文件")); connect(openAction,SIGNAL(triggered()),this,SLOT(openFile())); importAction = new QAction(tr("导入"),this); importAction->setStatusTip(tr("导入数据")); connect(importAction,SIGNAL(triggered()),this,SLOT(importFile())); importAction->setDisabled(true); sortAction = new QAction(tr("分类数据"),this); sortAction->setStatusTip(tr("处理分类数据")); connect(sortAction,SIGNAL(triggered()),this,SLOT(sortFile())); sortAction->setDisabled(true); exitAction = new QAction(tr("退出"),this); exitAction->setStatusTip(tr("退出程序")); connect(exitAction,SIGNAL(triggered()),this,SLOT(close())); /*导入菜单*/ ebdicAction = new QAction(tr("显示EBDIC码"),this); ebdicAction->setStatusTip(tr("显示EBDIC码")); connect(ebdicAction,SIGNAL(triggered()),this,SLOT(loadEBDIC())); ebdicAction->setDisabled(true); reelAction = new QAction(tr("显示卷头"),this); reelAction->setStatusTip(tr("显示卷头信息")); connect(reelAction,SIGNAL(triggered()),this,SLOT(loadReel())); reelAction->setDisabled(true); traceAction = new QAction(tr("显示道头"),this); traceAction->setStatusTip(tr("显示选定位置道头信息")); connect(traceAction,SIGNAL(triggered()),this,SLOT(loadTrace())); traceAction->setDisabled(true); dataAction = new QAction(tr("地震数据"),this); dataAction->setStatusTip(tr("显示选定位置的地震记录")); connect(dataAction,SIGNAL(triggered()),this,SLOT(loadData())); dataAction->setDisabled(true); /*画图菜单*/ waveAction = new QAction(tr("波形显示"),this); waveAction->setStatusTip(tr("波形显示剖面")); connect(waveAction,SIGNAL(triggered()),this,SLOT(drawWave())); waveAction->setDisabled(true); grayAction = new QAction(tr("灰度显示"),this); grayAction->setStatusTip(tr("显示灰度图像")); connect(grayAction,SIGNAL(triggered()),this,SLOT(drawGray())); grayAction->setDisabled(true); colorAction = new QAction(tr("彩色显示"),this); colorAction->setStatusTip(tr("显示彩色图像")); connect(colorAction,SIGNAL(triggered()),this,SLOT(drawColor())); colorAction->setDisabled(true); //操作openGL图像 bigAction = new QAction(tr("放大"),this); bigAction->setStatusTip(tr("放大图像")); connect(bigAction,SIGNAL(triggered()),this,SLOT(bigger())); bigAction->setDisabled(true); littleAction = new QAction(tr("缩小"),this); littleAction->setStatusTip(tr("缩小图像")); connect(littleAction,SIGNAL(triggered()),this,SLOT(little())); littleAction->setDisabled(true); moveleftAction = new QAction(tr("左移"),this); moveleftAction->setStatusTip(tr("左移图像")); connect(moveleftAction,SIGNAL(triggered()),this,SLOT(moveleft())); moveleftAction->setDisabled(true); moverightAction = new QAction(tr("右移"),this); moverightAction->setStatusTip(tr("图像右移")); connect(moverightAction,SIGNAL(triggered()),this,SLOT(moveright())); moverightAction->setDisabled(true); moveupAction = new QAction(tr("上移"),this); moveupAction->setStatusTip(tr("上移图像")); connect(moveupAction,SIGNAL(triggered()),this,SLOT(moveup())); moveupAction->setDisabled(true); movedownAction = new QAction(tr("下移"),this); movedownAction->setStatusTip(tr("下移图像")); connect(movedownAction,SIGNAL(triggered()),this,SLOT(movedown())); movedownAction->setDisabled(true); moveMouseAction = new QAction(tr("移动"),this); moveMouseAction->setStatusTip(tr("使用鼠标移动图像")); connect(moveMouseAction,SIGNAL(triggered()),this,SLOT(moveMouse())); moveMouseAction->setDisabled(true); rotateMouseAction = new QAction(tr("旋转"),this); rotateMouseAction->setStatusTip(tr("旋转图像")); connect(rotateMouseAction,SIGNAL(triggered()),this,SLOT(rotateMouse())); rotateMouseAction->setDisabled(true); nextSliceAction = new QAction(tr("下一条剖面"),this); nextSliceAction->setStatusTip(tr("选择下一条剖面")); connect(nextSliceAction,SIGNAL(triggered()),this,SLOT(nextSlice())); nextSliceAction->setDisabled(true); preSliceAction = new QAction(tr("上一条剖面"),this); preSliceAction->setStatusTip(tr("选择上一条剖面")); connect(preSliceAction,SIGNAL(triggered()),this,SLOT(preSlice())); preSliceAction->setDisabled(true); drawGridAction = new QAction(tr("关闭网格"),this); drawGridAction->setStatusTip(tr("打开/关闭剖面图像上的网格")); connect(drawGridAction,SIGNAL(triggered()),this,SLOT(drawGrid())); drawGridAction->setDisabled(true); }
void CulistGui::on_actionLoad_Trace_triggered() { QString tf = QFileDialog::getOpenFileName( this, tr("Select trace file") ); loadTrace(tf); }