예제 #1
0
void StocksDialog::createFundamentalsPage ()
{
    QWidget *w = new QWidget(this);

    Q3VBoxLayout *vbox = new Q3VBoxLayout(w);
    vbox->setMargin(5);
    vbox->setSpacing(5);

    Setting fund;
    QString s, s2;
    index->getFundamentals(symbol, s2);
    fund.parse(s2);

    s = tr("Fundamentals: last updated ");
    s2 = "updateDate";
    QString s3;
    fund.getData(s2, s3);
    s.append(s3);
    fund.remove(s2);
    QStringList key;
    fund.getKeyList(key);
    key.sort();

    vbox->addSpacing(10);
    QLabel *label = new QLabel(s, w);
    vbox->addWidget(label);

    fundView = new Q3ListView(w);
    fundView->addColumn(tr("Description"));
    fundView->addColumn(tr("Value"));
    vbox->addWidget(fundView);

    int loop;
    for (loop = 0; loop < (int) key.count(); loop++)
    {
        fund.getData(key[loop], s);
        new Q3ListViewItem(fundView, key[loop], s);
    }

    if (! key.count())
        new Q3ListViewItem(fundView, tr("No data available."));

    addTab(w, tr("Fundamentals"));
}
예제 #2
0
void IndicatorPlugin::saveFile (QString &file, Setting &dict)
{
  QFile f(file);
  if (! f.open(IO_WriteOnly))
  {
    qDebug("IndicatorPlugin:can't save file %s", file.latin1());
    return;
  }
  QTextStream stream(&f);
  
  QStringList key;
  dict.getKeyList(key);
  
  int loop;
  QString s;
  for(loop = 0; loop < (int) key.count(); loop++)
  {
    dict.getData(key[loop], s);
    stream << key[loop] << "=" << s << "\n";
  }
  
  f.close();
}