Skip to content
Snippets Groups Projects
Select Git revision
  • 17d06d3003a796c76c7c5d8bfb0cab0aeb1bbf8f
  • ballinvoher default protected
  • client-http-server-for-token
  • master
  • gitlab-auth-issue
  • windows
  • microsoft
  • message
  • azure_auth
  • prometheus
  • permission-templates
  • no-datastore
  • save-public-keys
  • gitlab-group-level-start
  • v1.1.0
  • v1.0.0
  • v0.1
17 results

gitlab.go

Blame
  • plotter.cc 10.47 KiB
    // **************************************************************************
    // File: plotter.cc
    //
    // Author:    Phil Gillaspy
    //
    // Last Modified: 04/18/2012
    //
    // Description:
    //   This is the class which plots the GQ GMC's CPM data.
    //
    //   This code is virtually copied verbatim from the book "C++ GUI
    //   Programming with Qt4".
    //
    //
    // *************************************************************************
    
    #include <QtGui>
    #include <cmath>
    
    #include "plotter.hh"
    
    extern int numPoints;
    extern void getCPM(int i);
    
    const  int kSampleInterval = 10000;  // CPM every 10 seconds
    
    Plotter::Plotter(QWidget *parent)
        : QWidget(parent)
    {
        setBackgroundRole(QPalette::Dark);
        setAutoFillBackground(true);
        setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
        setFocusPolicy(Qt::StrongFocus);
        rubberBandIsShown = false;
    
        zoomInButton = new QToolButton(this);
        zoomInButton->setIcon(QIcon(":/images/zoomin.png"));
        zoomInButton->adjustSize();
        connect(zoomInButton, SIGNAL(clicked()), this, SLOT(zoomIn()));
    
        zoomOutButton = new QToolButton(this);
        zoomOutButton->setIcon(QIcon(":/images/zoomout.png"));
        zoomOutButton->adjustSize();
        connect(zoomOutButton, SIGNAL(clicked()), this, SLOT(zoomOut()));
    
        setPlotSettings(PlotSettings());
    
        sampleCnt = 0;
        myTimerID = 0;
        bScroll   = false;
    }
    
    void Plotter::startSample()
    {
      myTimerID = startTimer(1000);
    }
    
    void Plotter::timerEvent(QTimerEvent * event)
    {
      if (event->timerId() == myTimerID)
      {
        getCPM(sampleCnt);
        ++sampleCnt;
        if (sampleCnt >= numPoints)
        {
          bScroll   = true;
          sampleCnt = numPoints/2;
        }
        else
          bScroll   = false;