Exemplo n.º 1
0
void MainWindow::initConnections()
{
    connect(m_trace, SIGNAL(startedLoadingTrace()),
            this, SLOT(startedLoadingTrace()));
    connect(m_trace, SIGNAL(loaded(int)),
            this, SLOT(loadProgess(int)));
    connect(m_trace, SIGNAL(finishedLoadingTrace()),
            this, SLOT(finishedLoadingTrace()));
    connect(m_trace, SIGNAL(startedSaving()),
            this, SLOT(slotStartedSaving()));
    connect(m_trace, SIGNAL(saved()),
            this, SLOT(slotSaved()));
    connect(m_trace, SIGNAL(changed(ApiTraceEvent*)),
            this, SLOT(slotTraceChanged(ApiTraceEvent*)));
    connect(m_trace, SIGNAL(findResult(ApiTrace::SearchRequest,ApiTrace::SearchResult,ApiTraceCall*)),
            this, SLOT(slotSearchResult(ApiTrace::SearchRequest,ApiTrace::SearchResult,ApiTraceCall*)));
    connect(m_trace, SIGNAL(foundFrameStart(ApiTraceFrame*)),
            this, SLOT(slotFoundFrameStart(ApiTraceFrame*)));
    connect(m_trace, SIGNAL(foundFrameEnd(ApiTraceFrame*)),
            this, SLOT(slotFoundFrameEnd(ApiTraceFrame*)));
    connect(m_trace, SIGNAL(foundCallIndex(ApiTraceCall*)),
            this, SLOT(slotJumpToResult(ApiTraceCall*)));

    connect(m_retracer, SIGNAL(finished(const QString&)),
            this, SLOT(replayFinished(const QString&)));
    connect(m_retracer, SIGNAL(error(const QString&)),
            this, SLOT(replayError(const QString&)));
    connect(m_retracer, SIGNAL(foundState(ApiTraceState*)),
            this, SLOT(replayStateFound(ApiTraceState*)));
    connect(m_retracer, SIGNAL(foundProfile(trace::Profile*)),
            this, SLOT(replayProfileFound(trace::Profile*)));
    connect(m_retracer, SIGNAL(foundThumbnails(const QList<QImage>&)),
            this, SLOT(replayThumbnailsFound(const QList<QImage>&)));
    connect(m_retracer, SIGNAL(retraceErrors(const QList<ApiTraceError>&)),
            this, SLOT(slotRetraceErrors(const QList<ApiTraceError>&)));

    connect(m_ui.vertexInterpretButton, SIGNAL(clicked()),
            m_vdataInterpreter, SLOT(interpretData()));
    connect(m_ui.vertexTypeCB, SIGNAL(currentIndexChanged(const QString&)),
            m_vdataInterpreter, SLOT(setTypeFromString(const QString&)));
    connect(m_ui.vertexStrideSB, SIGNAL(valueChanged(int)),
            m_vdataInterpreter, SLOT(setStride(int)));
    connect(m_ui.vertexComponentsSB, SIGNAL(valueChanged(int)),
            m_vdataInterpreter, SLOT(setComponents(int)));
    connect(m_ui.startingOffsetSB, SIGNAL(valueChanged(int)),
            m_vdataInterpreter, SLOT(setStartingOffset(int)));


    connect(m_ui.actionNew, SIGNAL(triggered()),
            this, SLOT(createTrace()));
    connect(m_ui.actionOpen, SIGNAL(triggered()),
            this, SLOT(openTrace()));
    connect(m_ui.actionQuit, SIGNAL(triggered()),
            this, SLOT(close()));

    connect(m_ui.actionFind, SIGNAL(triggered()),
            this, SLOT(slotSearch()));
    connect(m_ui.actionGo, SIGNAL(triggered()),
            this, SLOT(slotGoTo()));
    connect(m_ui.actionGoFrameStart, SIGNAL(triggered()),
            this, SLOT(slotGoFrameStart()));
    connect(m_ui.actionGoFrameEnd, SIGNAL(triggered()),
            this, SLOT(slotGoFrameEnd()));

    connect(m_ui.actionReplay, SIGNAL(triggered()),
            this, SLOT(replayStart()));
    connect(m_ui.actionProfile, SIGNAL(triggered()),
            this, SLOT(replayProfile()));
    connect(m_ui.actionStop, SIGNAL(triggered()),
            this, SLOT(replayStop()));
    connect(m_ui.actionLookupState, SIGNAL(triggered()),
            this, SLOT(lookupState()));
    connect(m_ui.actionTrim, SIGNAL(triggered()),
            this, SLOT(trim()));
    connect(m_ui.actionShowThumbnails, SIGNAL(triggered()),
            this, SLOT(showThumbnails()));
    connect(m_ui.actionOptions, SIGNAL(triggered()),
            this, SLOT(showSettings()));

    connect(m_ui.callView->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
            this, SLOT(callItemSelected(const QModelIndex &)));
    connect(m_ui.callView, SIGNAL(doubleClicked(const QModelIndex &)),
            this, SLOT(callItemActivated(const QModelIndex &)));
    connect(m_ui.callView, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(customContextMenuRequested(QPoint)));

    connect(m_ui.surfacesTreeWidget,
            SIGNAL(customContextMenuRequested(const QPoint &)),
            SLOT(showSurfacesMenu(const QPoint &)));
    connect(m_ui.surfacesTreeWidget,
            SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)),
            SLOT(showSelectedSurface()));

    connect(m_ui.detailsWebView, SIGNAL(linkClicked(const QUrl&)),
            this, SLOT(openHelp(const QUrl&)));

    connect(m_ui.nonDefaultsCB, SIGNAL(toggled(bool)),
            this, SLOT(fillState(bool)));

    connect(m_jumpWidget, SIGNAL(jumpTo(int)),
            SLOT(slotJumpTo(int)));

    connect(m_searchWidget,
            SIGNAL(searchNext(const QString&, Qt::CaseSensitivity)),
            SLOT(slotSearchNext(const QString&, Qt::CaseSensitivity)));
    connect(m_searchWidget,
            SIGNAL(searchPrev(const QString&, Qt::CaseSensitivity)),
            SLOT(slotSearchPrev(const QString&, Qt::CaseSensitivity)));

    connect(m_traceProcess, SIGNAL(tracedFile(const QString&)),
            SLOT(createdTrace(const QString&)));
    connect(m_traceProcess, SIGNAL(error(const QString&)),
            SLOT(traceError(const QString&)));

    connect(m_trimProcess, SIGNAL(trimmedFile(const QString&)),
            SLOT(createdTrim(const QString&)));
    connect(m_trimProcess, SIGNAL(error(const QString&)),
            SLOT(trimError(const QString&)));

    connect(m_ui.errorsDock, SIGNAL(visibilityChanged(bool)),
            m_ui.actionShowErrorsDock, SLOT(setChecked(bool)));
    connect(m_ui.actionShowErrorsDock, SIGNAL(triggered(bool)),
            m_ui.errorsDock, SLOT(setVisible(bool)));
    connect(m_ui.errorsTreeWidget,
            SIGNAL(itemActivated(QTreeWidgetItem*, int)),
            this, SLOT(slotErrorSelected(QTreeWidgetItem*)));

    connect(m_ui.actionShowProfileDialog, SIGNAL(triggered(bool)),
            m_profileDialog, SLOT(show()));
    connect(m_profileDialog, SIGNAL(jumpToCall(int)),
            this, SLOT(slotJumpTo(int)));
}
Exemplo n.º 2
0
void NCPreview::initTools()
{
	/////////////////
	// ACTIONS
	/////////////////
	actionPrint = new QAction( this );
	actionPrint->setText( tr("Print...") );
	actionPrint->setIcon( iconFactory->findIcon("print") );
	actionPrint->setToolTip( tr("Print") );
	connect( actionPrint, SIGNAL( triggered() ), this, SLOT( slotPrint() ) );
	actionPrint->setEnabled( false );	// alapetelmezetten kikapcsolva

	actionZP = new QAction( this );
	actionZP->setText( tr("Zoom") );
	actionZP->setIcon( iconFactory->findIcon("zoom_plus")  );
	actionZP->setToolTip( tr("Zoom page") );
	actionZP->setShortcut( Qt::Key_Plus );
	connect( actionZP, SIGNAL( triggered() ), this, SLOT( zoomPlus() ) );

	actionZM = new QAction( this );
	actionZM->setText( tr("Unzoom") );
	actionZM->setIcon( iconFactory->findIcon("zoom_minus") );
	actionZM->setToolTip( tr("Unzoom page") );
	actionZM->setShortcut( Qt::Key_Minus );
	connect( actionZM, SIGNAL( triggered() ), this, SLOT( zoomMinus() ) );

	actionFrst = new QAction( this );
	actionFrst->setText( tr("First page") );
	actionFrst->setIcon( iconFactory->findIcon("firstpage") );
	actionFrst->setToolTip( tr("Go to first page") );
	actionFrst->setShortcut( Qt::CTRL+Qt::Key_Home );
	connect( actionFrst, SIGNAL( triggered() ), this, SLOT( slotFirst() ) );

	actionPrev = new QAction( this );
	actionPrev->setText( tr("Previous page") );
	actionPrev->setIcon( iconFactory->findIcon("prevpage") );
	actionPrev->setToolTip( tr("Go to previous page") );
	actionPrev->setShortcut( Qt::CTRL+Qt::Key_Left );
	connect( actionPrev, SIGNAL( triggered() ), this, SLOT( slotPrev() ) );

	actionNext = new QAction( this );
	actionNext->setText( tr("Next page") );
	actionNext->setIcon( iconFactory->findIcon("nextpage") );
	actionNext->setToolTip( tr("Go to next page") );
	actionNext->setShortcut( Qt::CTRL+Qt::Key_Right );
	connect( actionNext, SIGNAL( triggered() ), this, SLOT( slotNext() ) );

	actionLast = new QAction( this );
	actionLast->setText( tr("Last page") );
	actionLast->setIcon( iconFactory->findIcon("lastpage") );
	actionLast->setToolTip( tr("Go to final page") );
	actionLast->setShortcut( Qt::CTRL+Qt::Key_End );
	connect( actionLast, SIGNAL( triggered() ), this, SLOT( slotLast() ) );

	actionGo = new QAction( this );
	actionGo->setText( tr("Go to page...") );
	actionGo->setIcon( iconFactory->findIcon("gotopage") );
	actionGo->setToolTip( tr("Go to specified page") );
	actionGo->setShortcut( Qt::CTRL+Qt::Key_G );
	connect( actionGo, SIGNAL( triggered() ), this, SLOT( slotGoTo() ) );

	actionExit = new QAction( this );
	actionExit->setText( tr("Exit") );
	actionExit->setIcon( iconFactory->findIcon("exit") );
	actionExit->setToolTip( tr("Exit preview") );
	actionExit->setShortcut( Qt::Key_Escape );
	connect( actionExit, SIGNAL( triggered() ), this, SLOT( close() ) );

	/////////////////
	// MENUS
	/////////////////
	//QAction *actionPrint, *actionFrst, *actionNext, *actionPrev, *actionLast;
	//QAction *actionGo, *actionExit, *actionZP, *actionZM;

	mnFile = menuBar()->addMenu(tr("&File"));
	mnFile->addAction(actionPrint);
	mnFile->addAction(actionZP);
	mnFile->addAction(actionZM);
	mnFile->addSeparator();
	mnFile->addAction(actionExit);
	
	mnNav = menuBar()->addMenu(tr("&Navigate"));
	mnNav->addAction(actionFrst);
	mnNav->addAction(actionPrev);
	mnNav->addAction(actionNext);
	mnNav->addAction(actionLast);
	mnNav->addSeparator();
	mnNav->addAction(actionGo);	
	
	/////////////////
	// TOOLBAR
	/////////////////
	toolbar = addToolBar( tr("Tools") );
	//********************************************* combo
	cbZoom =  new QComboBox( toolbar );
	cbZoom->addItem( tr( " 10 %" ));
	cbZoom->addItem( tr( " 20 %" ));
	cbZoom->addItem( tr( " 50 %" ));
	cbZoom->addItem( tr( " 75 %" ));
	cbZoom->addItem( tr( "100 %" ));
	cbZoom->addItem( tr( "120 %" ));
	cbZoom->addItem( tr( "150 %" ));
	cbZoom->addItem( tr( "200 %" ));
	cbZoom->addItem( tr( "300 %" ));
	cbZoom->addItem( tr( "400 %" ));
	cbZoom->addItem( tr( "500 %" ));
	cbZoom->setFocusPolicy( Qt::NoFocus );
	cbZoom->setCurrentIndex( 4 );
	connect( cbZoom, SIGNAL(activated(const QString &) ), SLOT( slotZoom(const QString &) ) );
	
	toolbar->addAction(actionPrint);
	toolbar->addSeparator();
	toolbar->addAction(actionZP);
	toolbar->addAction(actionZM);
	toolbar->addSeparator();
	toolbar->addWidget(cbZoom);	
	toolbar->addSeparator();
	toolbar->addAction(actionFrst);
	toolbar->addAction(actionPrev);
	toolbar->addAction(actionNext);
	toolbar->addAction(actionLast);

	toolbar->setIconSize(QSize(16,16));
	statusBar();
	//statusBar()->showMessage(tr("Ready"));	
}