Ejemplo n.º 1
0
void Plot::deleteMarker2 ()
{
  if (! _plotSettings.selected)
    return;

  QString id = _plotSettings.selected->ID();
  _plotSettings.markers.remove(id);
  delete _plotSettings.selected;
  _plotSettings.selected = 0;

  setHighLow();
  replot();
  
  emit signalDeleteMarkers(QStringList() << id);
}
Ejemplo n.º 2
0
void
PlotWidget::addPlot (QString plugin, int row, QString name)
{
  PluginFactory fac;
  Plugin *plug = fac.load(plugin);
  if (! plug)
    return;

  PluginData pd;
  pd.command = QString("settings");
  if (! plug->command(&pd))
    return;
  
  Entity *settings = pd.settings;
  settings->setName(name);
  
  _settings.insert(name, settings);
  
  addPlotSettings(settings);

  QVariant *tset = settings->get(QString("row"));
  if (tset)
    tset->setValue(row);

  Plot *plot = new Plot(name, 0);
  plot->setMinimumHeight(30);
  _plots.insert(name, plot);
  
  _csplitter->insertWidget(row, plot);

  plot->setStartIndex(_cw->scrollBarValue());
  
  // connect all we need here
  connect(plot, SIGNAL(signalResizeScrollBar(Plot *)), _cw, SLOT(resizeScrollBar(Plot *)));
  connect(this, SIGNAL(signalClear()), plot, SLOT(clear()));
  connect(this, SIGNAL(signalDraw()), plot, SLOT(updatePlot()));
  connect(this, SIGNAL(signalSetDates()), plot, SLOT(setDates()));
  connect(this, SIGNAL(signalBarLength(int)), plot, SLOT(setBarLength(int)));
  connect(this, SIGNAL(signalIndex(int)), plot, SLOT(setStartIndex(int)));
  connect(plot, SIGNAL(signalMessage(QString)), this, SIGNAL(signalMessage(QString)));
  connect(plot, SIGNAL(signalDeleteMarkers(QStringList)), this, SLOT(deleteMarkers(QStringList)));
}
Ejemplo n.º 3
0
void PlotWidget::addPlot (QString plugin, int row, QString name)
{
  qWarning() << "PlotWidget::addPlot - " << name;
  IIndicatorPlugin *plug = dynamic_cast<IIndicatorPlugin*>(((PluginFactory*)PluginFactory::getPluginFactory())->loadPlugin(plugin));
  if (! plug)
    return;

  Entity *settings = plug->querySettings();

  settings->setName(name);
  _settings.insert(name, settings);
  
  addPlotSettings(settings);

  QVariant *tset = settings->get(QString("row"));
  if (tset)
    tset->setValue(row);

  Plot *plot = new Plot(name, 0);
  plot->setMinimumHeight(30);

  _plots.insert(name, plot);
  _csplitter->insertWidget(row, plot);

  plot->setStartIndex(_controlWidget->scrollBarValue());

  // connect all we need here
  connect(plot, SIGNAL(signalResizePanScrollBar(Plot *)), _controlWidget, SLOT(resizePanScrollBar(Plot *)));
  connect(this, SIGNAL(signalClear()), plot, SLOT(clear()));
  connect(this, SIGNAL(signalDraw()), plot, SLOT(updatePlot()));
  connect(this, SIGNAL(signalSetDates()), plot, SLOT(setDates()));
  connect(this, SIGNAL(signalBarLength(int)), plot, SLOT(setBarLength(int)));
  connect(this, SIGNAL(signalIndex(int)), plot, SLOT(setStartIndex(int)));
  connect(plot, SIGNAL(signalMessage(QString)), this, SIGNAL(signalMessage(QString)));
  connect(plot, SIGNAL(signalDeleteMarkers(QStringList)), this, SLOT(deleteMarkers(QStringList)));
  connect(_controlWidget, SIGNAL(signalRange(int)), plot, SLOT(setPage(int)));

}
Ejemplo n.º 4
0
void Plot::deleteAllMarkers ()
{
  QStringList dl;
  QHashIterator<QString, Marker *> it(_plotSettings.markers);
  while (it.hasNext())
  {
    it.next();
    Marker *co = it.value();

    if (co->readOnly())
      continue;

    delete co;
    
    dl << it.key();
    
    _plotSettings.markers.remove(it.key());
  }
  
  emit signalDeleteMarkers(dl);

  setHighLow();
  replot();
}