//--------------------------------------------------------------------------- Plots::Plots( QWidget *parent, FileInformation* fileInformation ) : QWidget( parent ), m_zoomFactor ( 0 ), m_fileInfoData( fileInformation ), m_dataTypeIndex( Plots::AxisSeconds ) { setlocale(LC_NUMERIC, "C"); QGridLayout* layout = new QGridLayout( this ); layout->setSpacing( 1 ); layout->setContentsMargins( 0, 0, 0, 0 ); // bottom scale m_scaleWidget = new PlotScaleWidget(); m_scaleWidget->setFormat( Plots::AxisTime ); setVisibleFrames( 0, numFrames() - 1 ); // plots and legends m_plots = new Plot**[m_fileInfoData->Stats.size()]; m_plotsCount = 0; for ( size_t streamPos = 0; streamPos < m_fileInfoData->Stats.size(); streamPos++ ) { if (m_fileInfoData->Stats[streamPos]) { size_t type = m_fileInfoData->Stats[streamPos]->Type_Get(); size_t countOfGroups = PerStreamType[type].CountOfGroups; m_plots[streamPos] = new Plot*[countOfGroups + 1]; //+1 for axix for ( size_t group = 0; group < countOfGroups; group++ ) { if (m_fileInfoData->ActiveFilters[PerStreamType[type].PerGroup[group].ActiveFilterGroup]) { Plot* plot = new Plot( streamPos, type, group, fileInformation, this ); plot->addGuidelines(m_fileInfoData->BitsPerRawSample()); if(type == Type_Video) adjustGroupMax(group, m_fileInfoData->BitsPerRawSample()); // we allow to shrink the plot below height of the size hint plot->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Expanding ); plot->setAxisScaleDiv( QwtPlot::xBottom, m_scaleWidget->scaleDiv() ); initYAxis( plot ); updateSamples( plot ); connect( plot, SIGNAL( cursorMoved( int ) ), SLOT( onCursorMoved( int ) ) ); plot->canvas()->installEventFilter( this ); layout->addWidget( plot, m_plotsCount, 0 ); layout->addWidget( plot->legend(), m_plotsCount, 1 ); m_plots[streamPos][group] = plot; m_plotsCount++; qDebug() << "g: " << plot->group() << ", t: " << plot->type() << ", m_plotsCount: " << m_plotsCount; } else { m_plots[streamPos][group] = NULL; } } } else { m_plots[streamPos]=NULL; } } layout->addWidget( m_scaleWidget, m_plotsCount, 0, 1, 2 ); // combo box for the axis format XAxisFormatBox* xAxisBox = new XAxisFormatBox(); xAxisBox->setCurrentIndex( Plots::AxisTime ); connect( xAxisBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onXAxisFormatChanged( int ) ) ); int axisBoxRow = layout->rowCount() - 1; #if 1 // one row below to have space enough for bottom scale tick labels layout->addWidget( xAxisBox, m_plotsCount + 1, 1 ); #else layout->addWidget( xAxisBox, layout_y, 1 ); #endif layout->setColumnStretch( 0, 10 ); layout->setColumnStretch( 1, 0 ); m_scaleWidget->setScale( m_timeInterval.from, m_timeInterval.to); setCursorPos( framePos() ); }