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; }
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; }