Exemplo n.º 1
0
void StocksDialog::createDataPage ()
{
    QWidget *w = new QWidget(this);

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

    barEdit = new BarEdit(w);
    QString s = tr("Open");
    QString s2 = "Open";
    barEdit->createField(s, s2, FALSE);
    s = tr("High");
    s2 = "High";
    barEdit->createField(s, s2, FALSE);
    s = tr("Low");
    s2 = "Low";
    barEdit->createField(s, s2, FALSE);
    s = tr("Close");
    s2 = "Close";
    barEdit->createField(s, s2, FALSE);
    s = tr("Volume");
    s2 = "Volume";
    barEdit->createField(s, s2, FALSE);
    connect(barEdit, SIGNAL(signalDeleteRecord()), this, SLOT(deleteRecord()));
    connect(barEdit, SIGNAL(signalSaveRecord()), this, SLOT(saveRecord()));
    connect(barEdit, SIGNAL(signalSearch(QDateTime)), this, SLOT(slotDateSearch(QDateTime)));
    connect(barEdit, SIGNAL(signalFirstRecord()), this, SLOT(slotFirstRecord()));
    connect(barEdit, SIGNAL(signalLastRecord()), this, SLOT(slotLastRecord()));
    connect(barEdit, SIGNAL(signalPrevRecord()), this, SLOT(slotPrevRecord()));
    connect(barEdit, SIGNAL(signalNextRecord()), this, SLOT(slotNextRecord()));
    vbox->addWidget(barEdit);

    addTab(w, tr("Data"));
}
Exemplo n.º 2
0
TesterRulePage::TesterRulePage (QWidget *p) : QWidget (p)
{
    Q3VBoxLayout *vbox = new Q3VBoxLayout(this);
    vbox->setMargin(5);
    vbox->setSpacing(5);

    Q3GridLayout *grid = new Q3GridLayout(vbox, 2, 2);

    Q3VGroupBox *gbox = new Q3VGroupBox(tr("Enter Long"), this);
    grid->addWidget(gbox, 0, 0);

    enterLongEdit = new FormulaEdit(gbox, FormulaEdit::Logic);

    gbox = new Q3VGroupBox(tr("Exit Long"), this);
    grid->addWidget(gbox, 0, 1);

    exitLongEdit = new FormulaEdit(gbox, FormulaEdit::Logic);

    gbox = new Q3VGroupBox(tr("Enter Short"), this);
    grid->addWidget(gbox, 1, 0);

    enterShortEdit = new FormulaEdit(gbox, FormulaEdit::Logic);

    gbox = new Q3VGroupBox(tr("Exit Short"), this);
    grid->addWidget(gbox, 1, 1);

    exitShortEdit = new FormulaEdit(gbox, FormulaEdit::Logic);
}
Exemplo n.º 3
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"));
}
Exemplo n.º 4
0
ScannerPage::ScannerPage (QWidget *w, DBIndex *i) : QWidget (w)
{
  chartIndex = i;
  idir.setFilter(QDir::Files);

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

  search = new QLineEdit(this);
  search->setText("*");
  connect(search, SIGNAL(textChanged(const QString &)), this, SLOT(searchChanged(const QString &)));
  QToolTip::add(search, tr("List Filter, e.g. s* or sb*"));
  vbox->addWidget(search);

  list = new Q3ListBox(this);
  connect(list, SIGNAL(contextMenuRequested(Q3ListBoxItem *, const QPoint &)), this,
          SLOT(rightClick(Q3ListBoxItem *)));
  connect(list, SIGNAL(highlighted(const QString &)), this, SLOT(scannerSelected(const QString &)));
  connect(list, SIGNAL(doubleClicked(Q3ListBoxItem *)), this, SLOT(doubleClick(Q3ListBoxItem *)));
  vbox->addWidget(list);

  menu = new QMenu(this);
  menu->insertItem(QPixmap(newchart), tr("&New Scanner		Ctrl+N"), this, SLOT(newScanner()));
  menu->insertItem(QPixmap(openitem), tr("&Open Scanner		Ctrl+O"), this, SLOT(openScanner()));
  menu->insertItem(QPixmap(deleteitem), tr("&Delete Scanner	Ctrl+D"), this, SLOT(deleteScanner()));
  menu->insertItem(QPixmap(renameitem), tr("&Rename Scanner		Ctrl+R"), this, SLOT(renameScanner()));
  menu->insertItem(QPixmap(macro), tr("R&un Scanner		Ctrl+U"), this, SLOT(runScanner()));
  menu->insertSeparator(-1);
  menu->insertItem(QPixmap(help), tr("&Help		Ctrl+H"), this, SLOT(slotHelp()));

  Q3Accel *a = new Q3Accel(this);
  connect(a, SIGNAL(activated(int)), this, SLOT(slotAccel(int)));
  a->insertItem(Qt::CTRL+Qt::Key_N, NewScanner);
  a->insertItem(Qt::CTRL+Qt::Key_O, OpenScanner);
  a->insertItem(Qt::CTRL+Qt::Key_D, DeleteScanner);
  a->insertItem(Qt::CTRL+Qt::Key_R, RenameScanner);
  a->insertItem(Qt::CTRL+Qt::Key_U, RunScanner);
  a->insertItem(Qt::CTRL+Qt::Key_H, Help);

  refreshList();
  scannerSelected(QString());
}
Exemplo n.º 5
0
void StocksDialog::createSplitPage ()
{
    QWidget *w = new QWidget(this);

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

    Q3GridLayout *grid = new Q3GridLayout(vbox);
    grid->setMargin(0);
    grid->setSpacing(5);

    QLabel *label = new QLabel(tr("Split Date"), w);
    grid->addWidget(label, 0, 0);

    Bar bar;
    db->getLastBar(bar);
    QDateTime dt;
    bar.getDate(dt);
    if (! bar.getEmptyFlag())
        splitDate = new Q3DateEdit(dt.date(), w);
    else
        splitDate = new Q3DateEdit(QDate::currentDate(), w);
    splitDate->setOrder(Q3DateEdit::YMD);
    grid->addWidget(splitDate, 0, 1);

    label = new QLabel(tr("Split Ratio"), w);
    grid->addWidget(label, 1, 0);

    splitRatio = new QLineEdit("2:1", w);
    grid->addWidget(splitRatio, 1, 1);

    QPushButton *button = new QPushButton(tr("Perform Split"), w);
    connect(button, SIGNAL(clicked()), this, SLOT(split()));
    vbox->addWidget(button);

    vbox->addStretch(1);

    addTab(w, tr("Split"));
}
Exemplo n.º 6
0
TesterReport::TesterReport (QWidget *p) : QWidget (p)
{
  Q3VBoxLayout *vbox = new Q3VBoxLayout(this);
  vbox->setMargin(5);
  vbox->setSpacing(5);

  tradeTable = new Q3Table(0, 9, this);
  tradeTable->setSelectionMode(Q3Table::Single);
  tradeTable->setSorting(FALSE);
  Q3Header *header = tradeTable->horizontalHeader();
  header->setLabel(0, tr("Type"), 40);
  header->setLabel(1, tr("Entry"), 80);
  header->setLabel(2, tr("Entry Price"), 70);
  header->setLabel(3, tr("Exit"), 80);
  header->setLabel(4, tr("Exit Price"), 70);
  header->setLabel(5, tr("Signal"), -1);
  header->setLabel(6, tr("Profit"), -1);
  header->setLabel(7, tr("Balance"), -1);
  header->setLabel(8, tr("Vol"), -1);
  vbox->addWidget(tradeTable);

  int loop;
  for (loop = 0; loop < 9; loop++)
    tradeTable->setColumnReadOnly(loop, TRUE);

  // test summary
  Q3HBoxLayout *hbox = new Q3HBoxLayout(vbox);
  hbox->setSpacing(5);

  Q3VGroupBox *gbox = new Q3VGroupBox(tr("Test Summary"), this);
  gbox->setInsideSpacing(2);
  gbox->setColumns(2);
  hbox->addWidget(gbox);

  QLabel *label = new QLabel(tr("Account Balance "), gbox);
  summaryBalance = new QLabel(" ", gbox);

  label = new QLabel(tr("Net Profit "), gbox);
  summaryNetProfit = new QLabel(" ", gbox);

  label = new QLabel(tr("Net Profit % "), gbox);
  summaryNetPercentage = new QLabel(" ", gbox);

  label = new QLabel(tr("Initial Investment "), gbox);
  summaryInvestment = new QLabel(" ", gbox);

  label = new QLabel(tr("Commissions "), gbox);
  summaryCommission = new QLabel(" ", gbox);

  label = new QLabel(tr("Largest Drawdown "), gbox);
  summaryDrawdown = new QLabel(" ", gbox);

  label = new QLabel(tr("Trades "), gbox);
  summaryTrades = new QLabel(" ", gbox);

  label = new QLabel(tr("Long Trades "), gbox);
  summaryLongTrades = new QLabel(" ", gbox);

  label = new QLabel(tr("Short Trades "), gbox);
  summaryShortTrades = new QLabel(" ", gbox);

  // win summary
  gbox = new Q3VGroupBox(tr("Win Summary"), this);
  gbox->setInsideSpacing(2);
  gbox->setColumns(2);
  hbox->addWidget(gbox);

  label = new QLabel(tr("Trades "), gbox);
  summaryWinTrades = new QLabel(" ", gbox);

  label = new QLabel(tr("Profit "), gbox);
  summaryTotalWinTrades = new QLabel(" ", gbox);

  label = new QLabel(tr("Average "), gbox);
  summaryAverageWin = new QLabel(" ", gbox);

  label = new QLabel(tr("Largest "), gbox);
  summaryLargestWin = new QLabel(" ", gbox);

  label = new QLabel(tr("Long Trades "), gbox);
  summaryWinLongTrades = new QLabel(" ", gbox);

  label = new QLabel(tr("Short Trades "), gbox);
  summaryWinShortTrades = new QLabel(" ", gbox);

  // lose summary
  gbox = new Q3VGroupBox(tr("Lose Summary"), this);
  gbox->setInsideSpacing(2);
  gbox->setColumns(2);
  hbox->addWidget(gbox);

  label = new QLabel(tr("Trades "), gbox);
  summaryLoseTrades = new QLabel(" ", gbox);

  label = new QLabel(tr("Loss "), gbox);
  summaryTotalLoseTrades = new QLabel(" ", gbox);

  label = new QLabel(tr("Average "), gbox);
  summaryAverageLose = new QLabel(" ", gbox);

  label = new QLabel(tr("Largest "), gbox);
  summaryLargestLose = new QLabel(" ", gbox);

  label = new QLabel(tr("Long Trades "), gbox);
  summaryLoseLongTrades = new QLabel(" ", gbox);

  label = new QLabel(tr("Short Trades "), gbox);
  summaryLoseShortTrades = new QLabel(" ", gbox);
}
Exemplo n.º 7
0
ConstrDestrCopyDialog::ConstrDestrCopyDialog(UmlClass * cl, bool have_constructor,
        bool have_destructor, bool have_copy,
        bool have_const_copy, bool have_assignment,
        bool have_const_assignment)
    : QDialog(0, 0, TRUE), target(cl)
{
    Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
    Q3HGroupBox * g;
    Q3PtrList<QLabel> labels;
    QLabel * lbl;

    vbox->setSpacing(5);
    vbox->setMargin(5);

    lbl = new QLabel(QString("<big><b>C++ utilities for the class <i><tt>") +
                     (const char *) cl->name() + "</tt></i></b></big>",
                     this);
    lbl->setAlignment(Qt::AlignCenter);
    vbox->addWidget(lbl);

    // constructor

    g = new Q3HGroupBox(this);
    vbox->addWidget(g);

    labels.append(new QLabel((have_constructor)
                             ? "the class already have contructor  "
                             : "the class doesn't have contructor  ",
                             g));

    Q3HBox * h = new Q3HBox(g);

    add_constr = new QCheckBox("add constructor", h);
    constr_explicit = new QCheckBox("explicit", h);

    // destructor

    if (! have_destructor) {
        g = new Q3HGroupBox(this);
        vbox->addWidget(g);

        labels.append(new QLabel("the class doesn't have destructor  ",
                                 g));

        h = new Q3HBox(g);

        add_destr = new QCheckBox("add destructor", h);
        virtual_destr = new QCheckBox("virtual", h);
    }
    else
        add_destr = 0;

    // copy contructor

    if (have_copy) {
        add_copy = 0;

        if (!have_const_copy) {
            g = new Q3HGroupBox(this);
            vbox->addWidget(g);

            labels.append(new QLabel("the class doesn't have copy contructor  \nwith const argument  ",
                                     g));
            add_const_copy = new QCheckBox("add copy constructor\nwith const argument",
                                           g);
        }
        else
            add_const_copy = 0;
    }
    else if (!have_const_copy) {
        g = new Q3HGroupBox(this);
        vbox->addWidget(g);

        labels.append(new QLabel("the class doesn't have copy contructor  ",
                                 g));

        Q3VBox * v = new Q3VBox(g);

        add_const_copy = new QCheckBox("add copy constructor\nwith const argument",
                                       v);
        add_copy = new QCheckBox("add copy constructor\nwith non const argument",
                                 v);
    }
    else {
        g = new Q3HGroupBox(this);
        vbox->addWidget(g);

        labels.append(new QLabel("the class doesn't have copy contructor  \nwith non const argument  ",
                                 g));
        add_copy = new QCheckBox("add copy constructor\nwith non const argument",
                                 g);
        add_const_copy = 0;
    }

    // assignment

    if (have_assignment) {
        add_assign = 0;

        if (!have_const_assignment) {
            g = new Q3HGroupBox(this);
            vbox->addWidget(g);

            labels.append(new QLabel("the class doesn't have assignment\noperator with const argument  ",
                                     g));
            add_const_assign = new QCheckBox("add assignment\nwith const argument",
                                             g);
        }
        else
            add_const_assign = 0;
    }
    else if (!have_const_assignment) {
        g = new Q3HGroupBox(this);
        vbox->addWidget(g);

        labels.append(new QLabel("the class doesn't have assignment operator  ", g));

        Q3VBox * v = new Q3VBox(g);

        add_const_assign = new QCheckBox("add assignment\nwith const argument",
                                         v);
        add_assign = new QCheckBox("add assignment\nwith non const argument",
                                   v);
    }
    else {
        g = new Q3HGroupBox(this);
        vbox->addWidget(g);

        labels.append(new QLabel("the class doesn't have assignment operator  \nwith non const argument  ",
                                 g));
        add_assign = new QCheckBox("add assignment\nwith non const argument",
                                   g);
        add_const_assign = 0;
    }

    // use the same width for all the labels on the first column

    QSize sz(labels.first()->sizeHint());

    while ((lbl = labels.next()) != 0) {
        if (lbl->sizeHint().width() > sz.width())
            sz.setWidth(lbl->sizeHint().width());
    }

    for (lbl = labels.first(); lbl != 0; lbl = labels.next()) {
        sz.setHeight(lbl->sizeHint().height());
        lbl->setFixedSize(sz);
    }

    // ok & cancel buttons

    Q3HBox * hbox = new Q3HBox(this);

    vbox->addWidget(hbox);

    QPushButton * ok = new QPushButton("&OK", hbox);
    QPushButton * cancel = new QPushButton("&Cancel", hbox);

    QSize bs(cancel->sizeHint());

    ok->setDefault(TRUE);

    ok->setFixedSize(bs);
    cancel->setFixedSize(bs);

    connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
    connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
}
Exemplo n.º 8
0
void StocksDialog::createDetailsPage ()
{
    QWidget *w = new QWidget(this);

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

    Q3GridLayout *grid = new Q3GridLayout(vbox);
    grid->setMargin(0);
    grid->setSpacing(5);

    QLabel *label = new QLabel(tr("Symbol"), w);
    grid->addWidget(label, 0, 0);

    QString s;
    DBIndexItem item;
    index->getIndexItem(symbol, item);
    item.getSymbol(s);
    label = new QLabel(s, w);
    label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
    grid->addWidget(label, 0, 1);

    label = new QLabel(tr("Name"), w);
    grid->addWidget(label, 1, 0);

    item.getTitle(s);
    title = new QLineEdit(s, w);
    grid->addWidget(title, 1, 1);

    label = new QLabel(tr("Exchange"), w);
    grid->addWidget(label, 2, 0);

    item.getExchange(s);
    Exchange ex;
    ex.getExchange(s.toInt(), s);
    label = new QLabel(s, w);
    label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
    grid->addWidget(label, 2, 1);

    label = new QLabel(tr("Type"), w);
    grid->addWidget(label, 3, 0);

    item.getType(s);
    label = new QLabel(s, w);
    label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
    grid->addWidget(label, 3, 1);

    label = new QLabel(tr("First Date"), w);
    grid->addWidget(label, 4, 0);

    Bar bar;
    db->getFirstBar(bar);
    if (! bar.getEmptyFlag())
    {
        bar.getDateTimeString(TRUE, s);
        label = new QLabel(s, w);
        label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
        grid->addWidget(label, 4, 1);
    }

    label = new QLabel(tr("Last Date"), w);
    grid->addWidget(label, 5, 0);

    Bar bar2;
    db->getLastBar(bar2);
    if (! bar2.getEmptyFlag())
    {
        bar2.getDateTimeString(TRUE, s);
        label = new QLabel(s, w);
        label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
        grid->addWidget(label, 5, 1);
    }

    grid->expand(grid->numRows() + 1, grid->numCols());
    grid->setColStretch(1, 1);

    vbox->addStretch(1);

    addTab(w, tr("Details"));
}