Example #1
0
void SYMBOL::formatDialog (QStringList &, QString &rv, QString &rs)
{
    rs.truncate(0);
    rv.truncate(0);
    QString pl = QObject::tr("Parms");
    QString vnl = QObject::tr("Variable Name");
    QString sl = QObject::tr("Symbol");
    PrefDialog *dialog = new PrefDialog(0);
    dialog->setCaption(QObject::tr("SYMBOL Format"));
    dialog->createPage (pl);
    dialog->setHelpFile(helpFile);

    QString s;
    Config config;
    dialog->addTextItem(vnl, pl, s);
    config.getData(Config::DataPath, s);
    dialog->addSymbolItem(sl, pl, s, symbol);

    int rc = dialog->exec();

    if (rc == QDialog::Accepted)
    {
        dialog->getText(vnl, rv);
        dialog->getSymbol(sl, rs);
    }

    delete dialog;
}
Example #2
0
bool Spread::prefDialog (QString &fs, QString &ss)
{
  QString pl = QObject::tr("Parms");
  QString fsl = QObject::tr("First Symbol");
  QString ssl = QObject::tr("Second Symbol");
  PrefDialog *dialog = new PrefDialog(0);
  dialog->setCaption(QObject::tr("Edit Spread"));
  dialog->createPage (pl);
  dialog->setHelpFile(helpFile);

  Config config;
  QString s;
  config.getData(Config::DataPath, s);
  dialog->addSymbolItem(fsl, pl, s, fs);
  dialog->addSymbolItem(ssl, pl, s, ss);

  int rc = dialog->exec();
  if (rc == QDialog::Accepted)
  {
    dialog->getSymbol(fsl, fs);
    dialog->getSymbol(ssl, ss);
    delete dialog;
    return TRUE;
  }
  delete dialog;
  return FALSE;
}
Example #3
0
int DbPlugin::spreadPref ()
{
  int rc = 0;
  QString pl = QObject::tr("Parms");
  QString fsl = QObject::tr("First Symbol");
  QString ssl = QObject::tr("Second Symbol");
  PrefDialog *dialog = new PrefDialog(0);
  dialog->setCaption(QObject::tr("Edit Spread"));
  dialog->createPage (pl);
  dialog->setHelpFile(helpFile);

  Config config;
  QString s, s3;
  config.getData(Config::DataPath, s);

  QString s2 = "FirstSymbol";
  getData(s2, s3);
  dialog->addSymbolItem(fsl, pl, s, s3);

  s2 = "SecondSymbol";
  getData(s2, s3);
  dialog->addSymbolItem(ssl, pl, s, s3);

  int trc = dialog->exec();
  if (trc == QDialog::Accepted)
  {
    dialog->getSymbol(fsl, s);
    s2 = "FirstSymbol";
    setData(s2, s);

    dialog->getSymbol(ssl, s);
    s2 = "SecondSymbol";
    setData(s2, s);
    rc = TRUE;
  }

  delete dialog;
  return rc;
}
Example #4
0
void IndexDialog::editItem ()
{
  QListViewItem *item = list->selectedItem();
  if (! item)
    return;

  QString s = item->text(0);
  double weight = item->text(1).toFloat();
  
  PrefDialog *dialog = new PrefDialog();
  dialog->setCaption(tr("Edit Index Item"));
  QString pl = tr("Details");
  dialog->createPage (pl);
  QString t = tr("Symbol");
  Config config;
  QString t2;
  config.getData(Config::DataPath, t2);
  dialog->addSymbolItem(t, pl, t2, s);
  t = tr("Weight");
  dialog->addDoubleItem(t, pl, weight);
  int rc = dialog->exec();
  
  if (rc == QDialog::Accepted)
  {
    t = tr("Symbol");
    dialog->getSymbol(t, s);
    if (! s.length())
    {
      delete dialog;
      return;
    }
    
    t = tr("Weight");
    weight = dialog->getDouble(t);
    
    symbolDict.remove(item->text(0));
    QStringList l = QStringList::split("/", s, FALSE);
    symbolDict.insert(l[l.count() - 1], new QString(s));
    
    item->setText(0, l[l.count() - 1]);
    item->setText(1, QString::number(weight));
   
    buttonStatus();
  }
  
  delete dialog;
}
Example #5
0
void IndexDialog::addItem ()
{
  double weight = 1;
  QString s;
  
  PrefDialog *dialog = new PrefDialog();
  dialog->setCaption(tr("Add Index Item"));
  QString pl = tr("Details");
  dialog->createPage (pl);
  QString t = tr("Symbol");
  Config config;
  QString t2;
  config.getData(Config::DataPath, t2);
  dialog->addSymbolItem(t, pl, t2, s);
  t = tr("Weight");
  dialog->addDoubleItem(t, pl, weight);
  int rc = dialog->exec();
  
  if (rc == QDialog::Accepted)
  {
    t = tr("Symbol");
    dialog->getSymbol(t, s);
    if (! s.length())
    {
      delete dialog;
      return;
    }
    
    t = tr("Weight");
    weight = dialog->getDouble(t);
    
    QStringList l = QStringList::split("/", s, FALSE);
    symbolDict.insert(l[l.count() - 1], new QString(s));
    
    new QListViewItem(list, l[l.count() - 1], QString::number(weight));
    
    buttonStatus();
  }
  
  delete dialog;
}