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; }
COBase::Status Text::pointerClick (QPoint &point, QDateTime &x, double y) { switch (status) { case None: if (isSelected(point)) { status = Selected; emit signalDraw(); } break; case Selected: if (isGrabSelected(point)) status = Moving; else { if (! isSelected(point)) { status = None; emit signalDraw(); } } break; case Moving: status = Selected; break; case ClickWait: setDate(x); setValue(y); setSaveFlag(TRUE); setColor(defaultColor); emit signalDraw(); status = None; emit message(""); emit signalSave(name); break; default: break; } return status; }
void VerticalLine::pointerMoving (QPixmap &, QPoint &, QDateTime &x, double) { if (status != Moving) return; setDate(x); setSaveFlag(TRUE); emit signalDraw(); QString s = x.toString("yyyy-MM-dd hh:mm:ss"); emit message(s); }
void ContextMenuGraphicsComponent::update(GameObject*) { DrawParamsMenuGraphics* dp = new DrawParamsMenuGraphics(); dp->scale = scaleFactor_; dp->degrees = 0; dp->pos = menuPos_; dp->animate = animate_; dp->pixmapIdx = getCurrentImage(); emit signalDraw(dp,this, LAYER_MENU); }
void HorizontalLine::pointerMoving (QPixmap &, QPoint &, QDateTime &, double y) { if (status != Moving) return; setValue(y); setSaveFlag(TRUE); emit signalDraw(); QString s = QString::number(y); emit message(s); }
void Text::pointerMoving (QPixmap &, QPoint &, QDateTime &x, double y) { if (status != Moving) return; setDate(x); setValue(y); setSaveFlag(TRUE); emit signalDraw(); QString s = x.toString("yyyy-MM-dd hh:mm:ss") + " " + QString::number(y); emit message(s); }
void CollectableGraphicsComponent::update(GameObject* obj) { bool visible; Collectable* collectable = (Collectable*)obj; int timeLeft = collectable->getDisappearCount(); if (timeLeft > FLICKER_POINT && !collectable->isDirty()) { return; } collectable->resetDirty(); DrawParams* dp = new DrawParams(); if (timeLeft <= FLICKER_POINT) { if (timeLeft % FLICKER_RATE == 0) { flickerShow_ = !flickerShow_; } if (!flickerShow_) { visible = false; dp->pos.setX(OFFSCREEN); dp->pos.setY(OFFSCREEN); } else { visible = true; dp->pos = collectable->getPos(); } } else { visible = true; dp->pos = collectable->getPos(); } if (oldstate_ != visible || oldPos_ != dp->pos) { oldstate_ = visible; oldPos_ = dp->pos; dp->scale = collectable->getScale(); dp->degrees = collectable->getOrientation(); dp->animate = animate_; emit signalDraw(dp, this, LAYER_DEFAULT); } else { delete dp; } }
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; }
void PlotWidget::addPlot (QString plugin, int row, QString name) { PluginFactory fac; Plugin *plug = fac.load(plugin); if (! plug) return; PluginData pd; pd.command = QString("settings"); if (! plug->command(&pd)) return; Entity *settings = pd.settings; settings->setName(name); _settings.insert(name, settings); addPlotSettings(settings); QVariant *tset = settings->get(QString("row")); if (tset) tset->setValue(row); Plot *plot = new Plot(name, 0); plot->setMinimumHeight(30); _plots.insert(name, plot); _csplitter->insertWidget(row, plot); plot->setStartIndex(_cw->scrollBarValue()); // connect all we need here connect(plot, SIGNAL(signalResizeScrollBar(Plot *)), _cw, SLOT(resizeScrollBar(Plot *))); connect(this, SIGNAL(signalClear()), plot, SLOT(clear())); connect(this, SIGNAL(signalDraw()), plot, SLOT(updatePlot())); connect(this, SIGNAL(signalSetDates()), plot, SLOT(setDates())); connect(this, SIGNAL(signalBarLength(int)), plot, SLOT(setBarLength(int))); connect(this, SIGNAL(signalIndex(int)), plot, SLOT(setStartIndex(int))); connect(plot, SIGNAL(signalMessage(QString)), this, SIGNAL(signalMessage(QString))); connect(plot, SIGNAL(signalDeleteMarkers(QStringList)), this, SLOT(deleteMarkers(QStringList))); }
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; }
void EndingGraphicsComponent::update(GameObject*) { if (timerID_ != 0) { killTimer(timerID_); } timerID_ = this->startTimer(timerLength_); if (currentIndex_++ > arrayIndexMax_ + 1) { this->killTimer(timerID_); this->deleteComponent(); return; } DrawParams* dp = new DrawParams(); dp->pos = pos_; dp->degrees = 90; dp->scale = 1; dp->animate = animate_; emit signalDraw(dp, this, LAYER_DEFAULT); }
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; }
void PlotWidget::addPlot (QString plugin, int row, QString name) { qWarning() << "PlotWidget::addPlot - " << name; IIndicatorPlugin *plug = dynamic_cast<IIndicatorPlugin*>(((PluginFactory*)PluginFactory::getPluginFactory())->loadPlugin(plugin)); if (! plug) return; Entity *settings = plug->querySettings(); settings->setName(name); _settings.insert(name, settings); addPlotSettings(settings); QVariant *tset = settings->get(QString("row")); if (tset) tset->setValue(row); Plot *plot = new Plot(name, 0); plot->setMinimumHeight(30); _plots.insert(name, plot); _csplitter->insertWidget(row, plot); plot->setStartIndex(_controlWidget->scrollBarValue()); // connect all we need here connect(plot, SIGNAL(signalResizePanScrollBar(Plot *)), _controlWidget, SLOT(resizePanScrollBar(Plot *))); connect(this, SIGNAL(signalClear()), plot, SLOT(clear())); connect(this, SIGNAL(signalDraw()), plot, SLOT(updatePlot())); connect(this, SIGNAL(signalSetDates()), plot, SLOT(setDates())); connect(this, SIGNAL(signalBarLength(int)), plot, SLOT(setBarLength(int))); connect(this, SIGNAL(signalIndex(int)), plot, SLOT(setStartIndex(int))); connect(plot, SIGNAL(signalMessage(QString)), this, SIGNAL(signalMessage(QString))); connect(plot, SIGNAL(signalDeleteMarkers(QStringList)), this, SLOT(deleteMarkers(QStringList))); connect(_controlWidget, SIGNAL(signalRange(int)), plot, SLOT(setPage(int))); }
void PlotWidget::refresh () { if (! _plots.size()) return; // load fresh symbol data if (! _cw->count()) return; PluginFactory fac; Plugin *qplug = fac.load(QString("DBSymbol")); if (! qplug) return; DataBase db(g_session); saveMarkers(db); Bars sym = _cw->currentSymbol(); g_symbol->clear(); g_symbol->setSymbol(sym.symbol()); g_symbol->setLength(_cw->length()); g_symbol->setRange(_cw->range()); PluginData pd; pd.command = QString("getBars"); pd.bars = g_symbol; if (! qplug->command(&pd)) return; else emit signalClear(); // refresh dates emit signalSetDates(); QHashIterator<QString, Plot *> it(_plots); while (it.hasNext()) { it.next(); Plot *plot = it.value(); Entity *e = _settings.value(it.key()); if (! e) continue; QVariant *plugin = e->get(QString("plugin")); if (! plugin) continue; Plugin *iplug = fac.load(plugin->toString()); if (! iplug) continue; PluginData tpd; tpd.command = QString("runIndicator"); tpd.settings = e; if (! iplug->command(&tpd)) continue; for (int tpos = 0; tpos < tpd.curves.size(); tpos++) plot->setCurve(tpd.curves.at(tpos)); for (int tpos = 0; tpos < tpd.markers.size(); tpos++) plot->setMarker(tpd.markers.at(tpos)); } loadMarkers(db); emit signalDraw(); setScrollBarSize(); QStringList tl; tl << "OTA" << "-" << sym.symbol() << "(" + sym.name() + ")" << _cw->lengthText() << _cw->rangeText(); emit signalTitle(tl.join(" ")); }
void PlotWidget::refresh () { qDebug() << "PlotWidget::refresh ()"; DataBase db(g_session); bool newData = loadSymbolData(); //Save all markers before clearing the plot saveMarkers(db); emit signalClear(); // refresh dates emit signalSetDates(); Bars sym = _toolbarWidget->currentSymbol(); //Plot all Indicators QHashIterator<QString, Plot *> it(_plots); while (it.hasNext()) { it.next(); Plot *plot = it.value(); Entity *pEntity = _settings.value(it.key()); if (! pEntity) continue; QVariant *plugin = pEntity->get(QString("plugin")); if (! plugin) continue; IIndicatorPlugin *pPlugin = dynamic_cast<IIndicatorPlugin*>(((PluginFactory*)PluginFactory::getPluginFactory())->loadPlugin(plugin->toString())); if (! pPlugin) continue; QList<Curve*> curves = pPlugin->runIndicator(pEntity); if(newData){ pPlugin->newDataLoaded(); } for (int tpos = 0; tpos < curves.size(); tpos++) plot->setCurve(curves.at(tpos)); // for (int tpos = 0; tpos < tpd.markers.size(); tpos++) // plot->setMarker(tpd.markers.at(tpos)); } //relaod all markers after plot have been updated loadMarkers(db); updateScrollBars(); emit signalDraw(); setPanScrollBarSize(); QStringList tl; tl << "QtTrader" << "-" << sym.symbol() << "(" + sym.name() + ")" << _toolbarWidget->lengthText(); emit signalTitle(tl.join(" ")); }