/*!
  \brief Enable autoscaling for a specified axis

  This member function is used to switch back to autoscaling mode
  after a fixed scale has been set. Autoscaling is enabled by default.

  \param axisId axis index
  \sa QwtPlot::setAxisScale(), QwtPlot::setAxisScaleDiv()
*/
void QwtPlot::setAxisAutoScale(int axisId)
{
    if (axisValid(axisId) && !d_axisData[axisId]->doAutoScale )
    {
        d_axisData[axisId]->doAutoScale = true;
        autoRefresh();
    }
}
예제 #2
0
//! Remove all curves
void QwtPlot::removeCurves()
{
    d_curves->clear();
#ifndef QWT_NO_LEGEND
    d_legend->clear();
#endif
    autoRefresh();
}
예제 #3
0
/*!
   \brief Set the background of the plot area

   The plot area is the circle around the pole. It's radius
   is defined by the radial scale.

   \param brush Background Brush
   \sa plotBackground(), plotArea()
*/
void QwtPolarPlot::setPlotBackground( const QBrush &brush )
{
  if ( brush != d_data->canvasBrush )
  {
    d_data->canvasBrush = brush;
    autoRefresh();
  }
}
예제 #4
0
/*!
  \brief Enable autoscaling for a specified axis

  This member function is used to switch back to autoscaling mode
  after a fixed scale has been set. Autoscaling is enabled by default.

  \param axisId axis index
  \param on On/Off
  \sa setAxisScale(), setAxisScaleDiv(), updateAxes()

  \note The autoscaling flag has no effect until updateAxes() is executed
        ( called by replot() ).
*/
void QwtPlot::setAxisAutoScale( int axisId, bool on )
{
    if ( axisValid( axisId ) && ( d_axisData[axisId]->doAutoScale != on ) )
    {
        d_axisData[axisId]->doAutoScale = on;
        autoRefresh();
    }
}
void QwtPlot::setAxisScaleDraw(int axisId, QwtScaleDraw *scaleDraw)
{
    if (axisValid(axisId))
    {
        axisWidget(axisId)->setScaleDraw(scaleDraw);
        autoRefresh();
    }
}
예제 #6
0
/*!
  \brief Change the origin of the azimuth scale

  The azimuth origin is the angle where the azimuth scale
  shows the value 0.0.  The default origin is 0.0.

  \param origin New origin
  \sa azimuthOrigin()
*/
void QwtPolarPlot::setAzimuthOrigin( double origin )
{
  origin = ::fmod( origin, 2 * M_PI );
  if ( origin != d_data->azimuthOrigin )
  {
    d_data->azimuthOrigin = origin;
    autoRefresh();
  }
}
예제 #7
0
/*!
   Unzoom the plot
   \sa zoom()
*/
void QwtPolarPlot::unzoom()
{
  if ( d_data->zoomFactor != 1.0 || d_data->zoomPos.isValid() )
  {
    d_data->zoomFactor = 1.0;
    d_data->zoomPos = QwtPolarPoint();
    autoRefresh();
  }
}
/*!
  \brief Remove the marker indexed by key
  \param key unique key
*/
bool QwtPlot::removeMarker(long key)
{
    if (d_markers->remove(key))
    {
        autoRefresh();
        return TRUE;
    }
    else
       return FALSE;
}
예제 #9
0
void XtalOptPlot::deselectCurrent()
{
  if (!m_selectedMarker)
    return;

  dehighlightMarker(m_selectedMarker);
  m_selectedMarker = nullptr;
  emit selectedMarkerChanged(m_selectedMarker);
  autoRefresh();
}
예제 #10
0
/*!
   \brief Translate and in/decrease the zoom factor

   In zoom mode the zoom position is in the center of the
   canvas. The radius of the circle depends on the size of the plot canvas,
   that is devided by the zoom factor. Thus a factor < 1.0 zoom in.

   Setting an invalid zoom position disables zooming.

   \param zoomPos Center of the translation
   \param zoomFactor Zoom factor

   \sa unzoom(), zoomPos(), zoomFactor()
*/
void QwtPolarPlot::zoom( const QwtPointPolar &zoomPos, double zoomFactor )
{
    zoomFactor = qAbs( zoomFactor );
    if ( zoomPos != d_data->zoomPos ||
            zoomFactor != d_data->zoomFactor )
    {
        d_data->zoomPos = zoomPos;
        d_data->zoomFactor = zoomFactor;
        updateLayout();
        autoRefresh();
    }
}
/*!
  \brief Disable autoscaling and specify a fixed scale for a selected axis.
  \param axisId axis index
  \param scaleDiv Scale division
  \sa QwtPlot::setAxisScale(), QwtPlot::setAxisAutoScale()
*/
void QwtPlot::setAxisScaleDiv(int axisId, const QwtScaleDiv &scaleDiv)
{
    if (axisValid(axisId))
    {
        AxisData &d = *d_axisData[axisId];

        d.doAutoScale = false;
        d.scaleDiv = scaleDiv;

        autoRefresh();
    }
}
예제 #12
0
/*!
  \brief Disable autoscaling and specify a fixed scale for a selected scale.
  \param scaleId Scale index
  \param scaleDiv Scale division
  \sa setScale(), setAutoScale()
*/
void QwtPolarPlot::setScaleDiv( int scaleId, const QwtScaleDiv &scaleDiv )
{
  if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
    return;

  ScaleData &scaleData = d_data->scaleData[scaleId];

  scaleData.scaleDiv = scaleDiv;
  scaleData.doAutoScale = false;

  autoRefresh();
}
예제 #13
0
/*!
  \brief Enable autoscaling

  This member function is used to switch back to autoscaling mode
  after a fixed scale has been set. Autoscaling calculates a useful
  scale division from the bounding interval of all plot items with
  the QwtPolarItem::AutoScale attribute.

  Autoscaling is only supported for the radial scale and enabled as default.

  \param scaleId Scale index

  \sa hasAutoScale(), setScale(), setScaleDiv(),
      QwtPolarItem::boundingInterval()
*/
void QwtPolarPlot::setAutoScale( int scaleId )
{
  if ( scaleId != QwtPolar::ScaleRadius )
    return;

  ScaleData &scaleData = d_data->scaleData[scaleId];
  if ( !scaleData.doAutoScale )
  {
    scaleData.doAutoScale = true;
    autoRefresh();
  }
}
예제 #14
0
QwtPlotMarker* XtalOptPlot::addPlotPoint(const QPointF& p,
                                         QwtSymbol::Style symbol,
                                         const QBrush& brush, const QPen& pen,
                                         const QSize& size)
{
  auto plotMarker(make_unique<QwtPlotMarker>());
  plotMarker->setSymbol(new QwtSymbol(symbol, brush, pen, size));
  plotMarker->setValue(p);
  plotMarker->setItemAttribute(QwtPlotItem::AutoScale, true);
  plotMarker->attach(this);
  m_markerList.push_back(std::move(plotMarker));
  autoRefresh();
  return m_markerList[m_markerList.size() - 1].get();
}
예제 #15
0
/*!
   \brief Translate and in/decrease the zoom factor

   In zoom mode the zoom position is in the center of the
   canvas. The radius of the circle depends on the size of the plot canvas,
   that is divided by the zoom factor. Thus a factor < 1.0 zoom in.

   Setting an invalid zoom position disables zooming.

   \param zoomPos Center of the translation
   \param zoomFactor Zoom factor

   \sa unzoom(), zoomPos(), zoomFactor()
*/
void QwtPolarPlot::zoom( const QwtPolarPoint &zoomPos, double zoomFactor )
{
  zoomFactor = qwtAbs( zoomFactor );
  if ( zoomPos != d_data->zoomPos ||
       zoomFactor != d_data->zoomFactor )
  {
    d_data->zoomPos = zoomPos;
    d_data->zoomFactor = zoomFactor;
#if 1
    updateLayout();
#endif
    autoRefresh();
  }
}
예제 #16
0
void QwtPlot::setAxisScaleEngine(int axisId, QwtScaleEngine *scaleEngine)
{
    if (axisValid(axisId) && scaleEngine != NULL )
    {
        AxisData &d = *d_axisData[axisId];

        delete d.scaleEngine;
        d.scaleEngine = scaleEngine;

        d.scaleDiv.invalidate();

        autoRefresh();
    }
}
예제 #17
0
/*!
  Set the maximum number of major scale intervals for a specified axis

  \param axisId axis index
  \param maxMajor maximum number of major steps
  \sa axisMaxMajor()
*/
void QwtPlot::setAxisMaxMajor( int axisId, int maxMajor )
{
    if ( axisValid( axisId ) )
    {
        maxMajor = qBound( 1, maxMajor, 10000 );

        AxisData &d = *d_axisData[axisId];
        if ( maxMajor != d.maxMajor )
        {
            d.maxMajor = maxMajor;
            d.isValid = false;
            autoRefresh();
        }
    }
}
예제 #18
0
void XtalOptPlot::selectMarker(QwtPlotMarker* newMarker)
{
  if (!newMarker)
    return;

  // If we are selecting the point we already have, just return
  if (newMarker == m_selectedMarker)
    return;

  deselectCurrent();
  highlightMarker(newMarker);
  m_selectedMarker = newMarker;
  emit selectedMarkerChanged(m_selectedMarker);
  autoRefresh();
}
예제 #19
0
/*!
  Change the scale engine for an axis

  \param scaleId Scale index
  \param scaleEngine Scale engine

  \sa axisScaleEngine()
*/
void QwtPolarPlot::setScaleEngine( int scaleId, QwtScaleEngine *scaleEngine )
{
  if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
    return;

  ScaleData &scaleData = d_data->scaleData[scaleId];
  if ( scaleEngine == NULL || scaleEngine == scaleData.scaleEngine )
    return;

  delete scaleData.scaleEngine;
  scaleData.scaleEngine = scaleEngine;

  scaleData.scaleDiv.invalidate();

  autoRefresh();
}
/*!
  \brief Insert a new marker
  \param marker Marker
  \return New key if the marker could be inserted, 0 if not.
*/
long QwtPlot::insertMarker(QwtPlotMarker *marker)
{
    if ( marker == 0 )
        return 0;

    long key = newMarkerKey();
    if ( key == 0 )
        return 0;

    marker->reparent(this);
    d_markers->insert(key, marker);

    autoRefresh();

    return key;
}
/*!
  \brief Disable autoscaling and specify a fixed scale for a selected axis.
  \param axisId axis index
  \param min
  \param max minimum and maximum of the scale
  \param stepSize Major step size. If <code>step == 0</code>, the step size is
            calculated automatically using the maxMajor setting.
  \sa QwtPlot::setAxisMaxMajor(), QwtPlot::setAxisAutoScale()
*/
void QwtPlot::setAxisScale(int axisId, double min, double max, double stepSize)
{
    if (axisValid(axisId))
    {
        AxisData &d = *d_axisData[axisId];

        d.doAutoScale = false;
        d.scaleDiv.invalidate();

        d.minValue = min;
        d.maxValue = max;
        d.stepSize = stepSize;
            
        autoRefresh();
    }
}
예제 #22
0
/*!
  \brief Disable autoscaling and specify a fixed scale for a selected scale.
  \param scaleId Scale index
  \param min
  \param max minimum and maximum of the scale
  \param stepSize Major step size. If <code>step == 0</code>, the step size is
            calculated automatically using the maxMajor setting.
  \sa setScaleMaxMajor(), setAutoScale()
*/
void QwtPolarPlot::setScale( int scaleId,
                             double min, double max, double stepSize )
{
  if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
    return;

  ScaleData &scaleData = d_data->scaleData[scaleId];

  scaleData.scaleDiv.invalidate();

  scaleData.minValue = min;
  scaleData.maxValue = max;
  scaleData.stepSize = stepSize;
  scaleData.doAutoScale = false;

  autoRefresh();
}
예제 #23
0
/*!
   Change the scale engine for an axis

  \param axisId axis index
  \param scaleEngine Scale engine

  \sa axisScaleEngine()
*/
void QwtPlot::setAxisScaleEngine( int axisId, QwtScaleEngine *scaleEngine )
{
    if ( axisValid( axisId ) && scaleEngine != NULL )
    {
        AxisData &d = *d_axisData[axisId];

        delete d.scaleEngine;
        d.scaleEngine = scaleEngine;

        d_axisData[axisId]->scaleWidget->setTransformation( 
            scaleEngine->transformation() );

        d.isValid = false;

        autoRefresh();
    }
}
/*!
  \brief Set the maximum number of major scale intervals for a specified axis
  \param axisId axis index
  \param maxMajor maximum number of major steps
  \sa QwtAutoScale::setMaxMajor
*/
void QwtPlot::setAxisMaxMajor(int axisId, int maxMajor)
{
    if (axisValid(axisId))
    {
        if ( maxMajor < 1 )
            maxMajor = 1;
        if ( maxMajor > 1000 )
            maxMajor = 10000;
            
        AxisData &d = *d_axisData[axisId];
        if ( maxMajor != d.maxMinor )
        {
            d.maxMajor = maxMajor;
            d.scaleDiv.invalidate();
            autoRefresh();
        }
    }
}
예제 #25
0
void XtalOptPlot::addVerticalPlotLine(double x, double yMin, double yMax)
{
  auto curve(make_unique<QwtPlotCurve>());
  curve->setStyle(QwtPlotCurve::Lines);

  double xData[2];
  double yData[2];
  xData[0] = x;
  xData[1] = x;
  yData[0] = yMin;
  yData[1] = yMax;

  curve->setSamples(xData, yData, 2);
  curve->attach(this);

  m_curveList.push_back(std::move(curve));
  autoRefresh();
}
예제 #26
0
/*!
  Set the maximum number of major scale intervals for a specified scale

  \param scaleId Scale index
  \param maxMajor maximum number of major steps
  \sa scaleMaxMajor()
*/
void QwtPolarPlot::setScaleMaxMajor( int scaleId, int maxMajor )
{
  if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
    return;

  if ( maxMajor < 1 )
    maxMajor = 1;
  if ( maxMajor > 1000 )
    maxMajor = 10000;

  ScaleData &scaleData = d_data->scaleData[scaleId];
  if ( maxMajor != scaleData.maxMinor )
  {
    scaleData.maxMajor = maxMajor;
    scaleData.scaleDiv.invalidate();
    autoRefresh();
  }
}
예제 #27
0
파일: LPMain.cpp 프로젝트: Jheengut/pcbsd
LPMain::LPMain(QWidget *parent) : QMainWindow(parent), ui(new Ui::LPMain){
  ui->setupUi(this); //load the Qt-designer UI file
  //Initialize the auto-refresh timer
  timer = new QTimer(this);
	timer->setSingleShot(true);
	timer->setInterval(60000); // 1 minute timer
	connect(timer, SIGNAL(timeout()), this, SLOT(updateTabs()) );
  //Initialize the system watcher
  watcher = new QFileSystemWatcher(this);
    //Make sure the lpreserver log directory exists and watch it
    if(!QFile::exists("/var/log/lpreserver")){
      qDebug() << "Creating the lpreserver log directory (/var/log/lpreserver)";
      QDir dir;
      dir.mkpath("/var/log/lpreserver");
    }
    watcher->addPath("/var/log/lpreserver/");
  //Initialize the waitbox pointer
  waitBox = 0;
  //Initialize the classic dialog pointer
  classicDLG = 0;
  //Create the basic/advanced view options
  viewBasic = new QRadioButton(tr("Basic"), ui->menuView);
	QWidgetAction *WABasic = new QWidgetAction(this); WABasic->setDefaultWidget(viewBasic);
	ui->menuView->addAction(WABasic);
  viewAdvanced = new QRadioButton(tr("Advanced"), ui->menuView);
	QWidgetAction *WAAdv = new QWidgetAction(this); WAAdv->setDefaultWidget(viewAdvanced);
	ui->menuView->addAction(WAAdv);
  connect(viewBasic, SIGNAL(toggled(bool)), this, SLOT(viewChanged()) );
  //Now set the default view type
  settings = new QSettings(QSettings::UserScope, "PC-BSD", "Life-Preserver-GUI", this);
  bool basicMode = settings->value("viewmode", true).toBool(); //basic by default
  if(basicMode){ viewBasic->setChecked(true); } //will automatically call the "viewChanged" function
  else{ viewAdvanced->setChecked(true); } //will automatically call the "viewChanged" function
  //Create the filesystem model and tie it to the treewidget
  fsModel = new QFileSystemModel(this);
	fsModel->setReadOnly(true);
	ui->treeView->setModel(fsModel);
  //Connect the UI to all the functions
  connect(ui->tool_refresh, SIGNAL(clicked()), this, SLOT(updatePoolList()) );
  connect(ui->combo_pools, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTabs()) );
  connect(ui->combo_datasets, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDataset()) );
  connect(ui->slider_snapshots, SIGNAL(valueChanged(int)), this, SLOT(updateSnapshot()) );
  connect(ui->push_prevsnap, SIGNAL(clicked()), this, SLOT(prevSnapshot()) );
  connect(ui->push_nextsnap, SIGNAL(clicked()), this, SLOT(nextSnapshot()) );
  connect(ui->check_hidden, SIGNAL(stateChanged(int)), this, SLOT(setFileVisibility()) );
  connect(ui->push_restore, SIGNAL(clicked()), this, SLOT(restoreFiles()) );
  connect(ui->push_configure, SIGNAL(clicked()), this, SLOT(openConfigGUI()) );
  //Connect the Menu buttons
  connect(ui->menuManage_Pool, SIGNAL(triggered(QAction*)), this, SLOT(menuAddPool(QAction*)) );
  connect(ui->menuUnmanage_Pool, SIGNAL(triggered(QAction*)), this, SLOT(menuRemovePool(QAction*)) );
  connect(ui->action_SaveKeyToUSB, SIGNAL(triggered()), this, SLOT(menuSaveSSHKey()) );
  connect(ui->actionClose_Window, SIGNAL(triggered()), this, SLOT(menuCloseWindow()) );
  connect(ui->menuCompress_Home_Dir, SIGNAL(triggered(QAction*)), this, SLOT(menuCompressHomeDir(QAction*)) );
  connect(ui->actionExtract_Home_Dir, SIGNAL(triggered()), this, SLOT(menuExtractHomeDir()) );
  connect(ui->actionAdd_Disk, SIGNAL(triggered()), this, SLOT(menuAddDisk()) );
  connect(ui->menuRemove_Disk, SIGNAL(triggered(QAction*)), this, SLOT(menuRemoveDisk(QAction*)) );
  connect(ui->menuSet_Disk_Offline, SIGNAL(triggered(QAction*)), this, SLOT(menuOfflineDisk(QAction*)) );
  connect(ui->menuSet_Disk_Online, SIGNAL(triggered(QAction*)), this, SLOT(menuOnlineDisk(QAction*)) );
  connect(ui->action_startScrub, SIGNAL(triggered()), this, SLOT(menuStartScrub()) );
  connect(ui->action_stopScrub, SIGNAL(triggered()), this, SLOT(menuStopScrub()) );
  connect(ui->action_newSnapshot, SIGNAL(triggered()), this, SLOT(menuNewSnapshot()) );
  connect(ui->menuDelete_Snapshot, SIGNAL(triggered(QAction*)), this, SLOT(menuRemoveSnapshot(QAction*)) );
  //Update the interface
  QTimer::singleShot(0,this,SLOT(updatePoolList()) );
  
  //Make sure the status tab is shown initially
  ui->tabWidget->setCurrentWidget(ui->tab_status);
  //Now connect the watcher to the update slot
  connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(autoRefresh()) );
}
예제 #28
0
//! Remove all markers
void QwtPlot::removeMarkers()
{
    d_markers->clear();
    autoRefresh();
}
예제 #29
0
//! Remove all curves
void QwtPlot::removeCurves()
{
    d_curves->clear();
    d_legend->clear();
    autoRefresh();
}