Ejemplo n.º 1
0
void
BlockAnalyzer::resizeEvent( QResizeEvent *e )
{
   DEBUG_BLOCK

   Analyzer::Base2D::resizeEvent( e );

   const uint oldRows = m_rows;

   //all is explained in analyze()..
   //+1 to counter -1 in maxSizes, trust me we need this!
   m_columns = myMax( uint(double(width()+1) / (WIDTH+1)), MAX_COLUMNS );
   m_rows    = uint(double(height()+1) / (HEIGHT+1));

   //this is the y-offset for drawing from the top of the widget
   m_y = (height() - (m_rows * (HEIGHT+1)) + 2) / 2;

   m_scope.resize( m_columns );

   if( m_rows != oldRows ) {
      m_barPixmap = QPixmap( WIDTH, m_rows*(HEIGHT+1) );

      for ( uint i = 0; i < FADE_SIZE; ++i )
         m_fade_bars[i] = QPixmap( WIDTH, m_rows*(HEIGHT+1) );

      m_yscale.resize( m_rows + 1 );

      const float PRE = 1, PRO = 1; //PRE and PRO allow us to restrict the range somewhat

      for( uint z = 0; z < m_rows; ++z )
         m_yscale[z] = 1 - (log10( PRE+z ) / log10( PRE+m_rows+PRO ));

      m_yscale[m_rows] = 0;

      determineStep();
      paletteChange( palette() );
   }
   else if( width() > e->oldSize().width() || height() > e->oldSize().height() )
      drawBackground();

   analyze( m_scope );
}
Ejemplo n.º 2
0
void BlockAnalyzer::resizeEvent(QResizeEvent* e) {
  QWidget::resizeEvent(e);

  m_background = QPixmap(size());
  canvas_ = QPixmap(size());

  const uint oldRows = m_rows;

  // all is explained in analyze()..
  // +1 to counter -1 in maxSizes, trust me we need this!
  m_columns = qMin(static_cast<uint>(static_cast<double>(width() + 1) / (WIDTH + 1)) + 1, MAX_COLUMNS);
  m_rows = static_cast<uint>(static_cast<double>(height() + 1) / (HEIGHT + 1));

  // this is the y-offset for drawing from the top of the widget
  m_y = (height() - (m_rows * (HEIGHT + 1)) + 2) / 2;

  m_scope.resize(m_columns);

  if (m_rows != oldRows) {
    m_barPixmap = QPixmap(WIDTH, m_rows * (HEIGHT + 1));

    for (uint i = 0; i < FADE_SIZE; ++i)
      m_fade_bars[i] = QPixmap(WIDTH, m_rows * (HEIGHT + 1));

    m_yscale.resize(m_rows + 1);

    const uint PRE = 1,
               PRO = 1;  // PRE and PRO allow us to restrict the range somewhat

    for (uint z = 0; z < m_rows; ++z)
      m_yscale[z] = 1 - (log10(PRE + z) / log10(PRE + m_rows + PRO));

    m_yscale[m_rows] = 0;

    determineStep();
    paletteChange(palette());
  }

  drawBackground();
}
Ejemplo n.º 3
0
void BlockAnalyzer::framerateChanged() {  // virtual
  determineStep();
}