Exemplo n.º 1
0
void VerticalLine::prefDialog ()
{
  QString pl = tr("Details");
  QString cl = tr("Color");
  QString sd = tr("Set Default");

  PrefDialog *dialog = new PrefDialog();
  dialog->setCaption(tr("Edit VerticalLine"));
  dialog->createPage (pl);
  dialog->setHelpFile (helpFile);
  dialog->addColorPrefItem(cl, pl, color);
  dialog->addCheckItem(sd, pl, FALSE);

  int rc = dialog->exec();

  if (rc == QDialog::Accepted)
  {
    dialog->getColor(cl, color);

    bool f = dialog->getCheck(sd);
    if (f)
    {
      defaultColor = color;
      saveDefaults();
    }

    emit signalDraw();
  }

  delete dialog;
}
Exemplo n.º 2
0
int DbPlugin::ccPref ()
{
  int rc = 0;
  QString pl = QObject::tr("Parms");
  QString gl = QObject::tr("Gapless");
  PrefDialog *dialog = new PrefDialog(0);
  dialog->setCaption(QObject::tr("Edit CC"));
  dialog->createPage (pl);
  dialog->setHelpFile(helpFile);

  QString s = "Adjustment";
  QString s2;
  getData(s, s2);
  dialog->addCheckItem(gl, pl, s2.toInt());

  int trc = dialog->exec();
  if (trc == QDialog::Accepted)
  {
    s2 = QString::number(dialog->getCheck(gl));
    setData(s, s2);
    rc = TRUE;
  }

  delete dialog;
  return rc;
}
Exemplo n.º 3
0
void Text::prefDialog ()
{
  QString pl = tr("Details");
  QString cl = tr("Color");
  QString sd = tr("Set Default");
  QString fl = tr("Font");
  QString ll = tr("Label");
  QString vl = tr("Value");

  PrefDialog *dialog = new PrefDialog();
  dialog->setCaption(tr("Edit Text"));
  dialog->createPage (pl);
  dialog->setHelpFile (helpFile);
  dialog->addColorPrefItem(cl, pl, color);
  dialog->addFontItem(fl, pl, font);
  dialog->addTextItem(ll, pl, label);
  dialog->addDoubleItem(vl, pl, getValue());
  dialog->addCheckItem(sd, pl, FALSE);
  
  int rc = dialog->exec();
  
  if (rc == QDialog::Accepted)
  {
    dialog->getColor(cl, color);
    dialog->getText(ll, label);
    dialog->getFont(fl, font);
    value = dialog->getDouble(vl);
    
    setSaveFlag(TRUE);
    
    bool f = dialog->getCheck(sd);
    if (f)
    {
      dialog->getColor(cl, defaultColor);
      dialog->getFont(fl, dfont);
      saveDefaults();
    }
    
    emit signalDraw();
  }
  
  delete dialog;
}
Exemplo n.º 4
0
void SellArrow::prefDialog ()
{
  QString pl = tr("Details");
  QString cl = tr("Color");
  QString vl = tr("Value");
  QString il = tr("Identifier");
  QString bl = tr("Price");
  QString sd = tr("Set Default");

  PrefDialog *dialog = new PrefDialog();
  dialog->setCaption(tr("Edit SellArrow"));
  dialog->createPage (pl);
  dialog->setHelpFile (helpFile);
  dialog->addColorPrefItem(cl, pl, color);
  dialog->addDoubleItem(vl, pl, getValue());
  dialog->addTextItem(il, pl, identifier);
  dialog->addTextItem(bl, pl, price);
  dialog->addCheckItem(sd, pl, FALSE);
  
  int rc = dialog->exec();
  
  if (rc == QDialog::Accepted)
  {
    dialog->getColor(cl, color);
    value = dialog->getDouble(vl);
    dialog->getText(il, identifier);
    dialog->getText(bl, price);
    
    setSaveFlag(TRUE);
    
    bool f = dialog->getCheck(sd);
    if (f)
    {
      defaultColor = color;
      saveDefaults();
    }
    
    emit signalDraw();
  }
  
  delete dialog;
}
Exemplo n.º 5
0
void HorizontalLine::prefDialog ()
{
  QString pl = tr("Details");
  QString cl = tr("Color");
  QString sd = tr("Set Default");
  QString vl = tr("Value");
  QString tx = tr("Text");

  PrefDialog *dialog = new PrefDialog();
  dialog->setCaption(tr("Edit HorizontalLine"));
  dialog->createPage (pl);
  dialog->setHelpFile (helpFile);
  dialog->addColorPrefItem(cl, pl, color);
  dialog->addDoubleItem(vl, pl, getValue());
  dialog->addTextItem(tx, pl, text);  //cz odkazy na objekty definovane nahore
  dialog->addCheckItem(sd, pl, FALSE);
  
  int rc = dialog->exec();
  
  if (rc == QDialog::Accepted)
  {
    dialog->getColor(cl, color);
    value = dialog->getDouble(vl);
    dialog->getText(tx, text);
    setSaveFlag(TRUE);
    
    bool f = dialog->getCheck(sd);
    if (f)
    {
      defaultColor = color;
      saveDefaults();
    }
    
    emit signalDraw();
  }
  
  delete dialog;
}
Exemplo n.º 6
0
bool DbPlugin::createNewCC (DBIndex *i)
{
  FuturesData fd;
  QStringList l;
  fd.getSymbolList(l);

  QString pl = QObject::tr("Parms");
  QString fsl = QObject::tr("Futures Symbol");
  QString gl = QObject::tr("Gapless");

  PrefDialog *dialog = new PrefDialog(0);
  dialog->setCaption(QObject::tr("New CC"));
  dialog->createPage (pl);
  dialog->setHelpFile(helpFile);

  dialog->addComboItem(fsl, pl, l, 0);
  dialog->addCheckItem(gl, pl, TRUE);

  int rc = dialog->exec();
  if (rc != QDialog::Accepted)
  {
    delete dialog;
    return TRUE;
  }

  QString sym;
  dialog->getCombo(fsl, sym);
  bool f = dialog->getCheck(gl);

  delete dialog;

  QDir dir;
  Config config;
  QString s;
  config.getData(Config::DataPath, s);
  s.append("/CC");
  if (! dir.exists(s))
  {
    if (! dir.mkdir(s, TRUE))
    {
      QMessageBox::information(0,
                               QObject::tr("Qtstalker: Error"),
                               QObject::tr("Could not create ~/.qtstalker/data/CC directory."));
      return TRUE;
    }
  }

  DBIndexItem item;
  QString ts;
  chartIndex->getIndexItem(sym, item);
  item.getSymbol(ts);
  if (ts.length())
  {
    qDebug("DbPlugin::createNewStock: duplicate symbol %s", ts.latin1());
    return TRUE;
  }

  
  s.append("/" + sym);
  if (open(s, i))
  {
    QMessageBox::information(0,
                             QObject::tr("Qtstalker: Error"),
                             QObject::tr("Disk error, cannot create chart"));
    return TRUE;
  }

  type = CC1;
  item.setSymbol(sym);
  s = "CC";
  item.setType(s);
  s = sym + " - " + QObject::tr("Continuous Adjusted");
  item.setTitle(s);
  chartIndex->setIndexItem(indexKey, item);

  s = QString::number(f);
  sym = "Adjustment";
  setData(sym, s);

  return FALSE;
}
Exemplo n.º 7
0
void ExScript::formatDialog (QStringList &, QString &rv, QString &rs)
{
  rs.truncate(0);
  rv.truncate(0);
  QString pl = QObject::tr("Parms");
  QString vnl = QObject::tr("Variable Name");
  QString spl = QObject::tr("Script Path");
  QString clsl = QObject::tr("Switches");
  QString dl = QObject::tr("Date");
  QString ol = QObject::tr("Open");
  QString hl = QObject::tr("High");
  QString lol = QObject::tr("Low");
  QString cll = QObject::tr("Close");
  QString vl = QObject::tr("Volume");
  QString oil = QObject::tr("Open Interest");

  PrefDialog *dialog = new PrefDialog(0);
  dialog->setCaption(QObject::tr("ExScript Format"));
  dialog->createPage (pl);
  dialog->setHelpFile(helpFile);

  QString s;
  dialog->addTextItem(vnl, pl, s);
  QStringList l;
  dialog->addFileItem(spl, pl, l, scriptPath);
  dialog->addTextItem(clsl, pl, comlineParms);
  dialog->addCheckItem(dl, pl, dateFlag);
  dialog->addCheckItem(ol, pl, openFlag);
  dialog->addCheckItem(hl, pl, highFlag);
  dialog->addCheckItem(lol, pl, lowFlag);
  dialog->addCheckItem(cll, pl, closeFlag);
  dialog->addCheckItem(vl, pl, volumeFlag);
  dialog->addCheckItem(oil, pl, oiFlag);

  int rc = dialog->exec();
  
  if (rc == QDialog::Accepted)
  {
    dialog->getText(vnl, rv);
    dialog->getFile(spl, l);
    if (l.count())
      rs = l[0];
    dialog->getText(clsl, comlineParms);
    rs.append("," + comlineParms);

    bool t = dialog->getCheck(dl);
    if (t)
      rs.append(",TRUE");
    else
      rs.append(",FALSE");
    
    t = dialog->getCheck(ol);
    if (t)
      rs.append(",TRUE");
    else
      rs.append(",FALSE");

    t = dialog->getCheck(hl);
    if (t)
      rs.append(",TRUE");
    else
      rs.append(",FALSE");

    t = dialog->getCheck(lol);
    if (t)
      rs.append(",TRUE");
    else
      rs.append(",FALSE");

    t = dialog->getCheck(cll);
    if (t)
      rs.append(",TRUE");
    else
      rs.append(",FALSE");

    t = dialog->getCheck(vl);
    if (t)
      rs.append(",TRUE");
    else
      rs.append(",FALSE");

    t = dialog->getCheck(oil);
    if (t)
      rs.append(",TRUE");
    else
      rs.append(",FALSE");
  }

  delete dialog;
}
Exemplo n.º 8
0
int ExScript::indicatorPrefDialog (QWidget *w)
{
  QString pl2 = QObject::tr("Output");
  QString cl = QObject::tr("Color");
  QString ll = QObject::tr("Label");
  QString ltl = QObject::tr("Line Type");
  QString spl = QObject::tr("Script Path");
  QString clsl = QObject::tr("Switches");
  QString pl = QObject::tr("Input");
  QString dl = QObject::tr("Date");
  QString ol = QObject::tr("Open");
  QString hl = QObject::tr("High");
  QString lol = QObject::tr("Low");
  QString cll = QObject::tr("Close");
  QString vl = QObject::tr("Volume");
  QString oil = QObject::tr("Open Interest");
  QString tol = QObject::tr("Timeout Seconds");

  PrefDialog *dialog = new PrefDialog(w);
  dialog->setCaption(QObject::tr("ExScript Indicator"));
  dialog->setHelpFile(helpFile);

  dialog->createPage (pl);
  QStringList l;
  l.append(scriptPath);
  dialog->addFileItem(spl, pl, l, scriptPath);
  dialog->addTextItem(clsl, pl, comlineParms);
  dialog->addIntItem(tol, pl, seconds, 1, 999);
  dialog->addCheckItem(dl, pl, dateFlag);
  dialog->addCheckItem(ol, pl, openFlag);
  dialog->addCheckItem(hl, pl, highFlag);
  dialog->addCheckItem(lol, pl, lowFlag);
  dialog->addCheckItem(cll, pl, closeFlag);
  dialog->addCheckItem(vl, pl, volumeFlag);
  dialog->addCheckItem(oil, pl, oiFlag);

  dialog->createPage(pl2);
  dialog->addColorItem(cl, pl2, color);
  dialog->addTextItem(ll, pl2, label);
  dialog->addComboItem(ltl, pl2, lineTypes, lineType);
  
  int rc = dialog->exec();
  
  if (rc == QDialog::Accepted)
  {
    dialog->getFile(spl, l);
    if (l.count())
      scriptPath = l[0];
    dialog->getText(clsl, comlineParms);
    seconds = dialog->getInt(tol);
    dateFlag = dialog->getCheck(dl);
    openFlag = dialog->getCheck(ol);
    highFlag = dialog->getCheck(hl);
    lowFlag = dialog->getCheck(lol);
    closeFlag = dialog->getCheck(cll);
    volumeFlag = dialog->getCheck(vl);
    oiFlag = dialog->getCheck(oil);

    dialog->getColor(cl, color);
    dialog->getText(ll, label);
    lineType = (PlotLine::LineType) dialog->getComboIndex(ltl);
    rc = TRUE;
  }
  else
    rc = FALSE;
  
  delete dialog;
  return rc;
}