std::shared_ptr<SignalController> ctrl = sr->controllerAt(key);
GraphLayers gl = GraphLayers::GRAPH | GraphLayers::SCALE;
ImageDrawer::ReturnCode drwRet;
+ const double absFromX = m_graphToImageExportDialog.fromX();
+ const double absFromY = m_graphToImageExportDialog.fromY();
+ const double absToX = m_graphToImageExportDialog.toX();
+ const double absToY = m_graphToImageExportDialog.toY();
double relFromX, relFromY, relToX, relToY;
if (ctrl == nullptr) {
if (m_graphToImageExportDialog.includePeaks())
gl |= GraphLayers::INTEGRATION;
- relFromX = ctrl->timeToRel(m_graphToImageExportDialog.fromX());
- relToX = ctrl->timeToRel(m_graphToImageExportDialog.toX());
- relFromY = ctrl->valueToRel(m_graphToImageExportDialog.fromY());
- relToY = ctrl->valueToRel(m_graphToImageExportDialog.toY());
+ relFromX = ctrl->timeToRel(absFromX);
+ relToX = ctrl->timeToRel(absToX);
+ relFromY = ctrl->valueToRel(absFromY);
+ relToY = ctrl->valueToRel(absToY);
ImageDrawer imageDrawer(ctrl);
drwRet = imageDrawer.render(m_graphToImageExportDialog.path(), m_graphToImageExportDialog.imageFormat().toLatin1(),
double ExportGraphToImageDialog::fromX() const
{
try {
- return std::get<0>(m_bounds.at(m_curKey));
+ return m_bounds.at(m_curKey).fromX;
} catch (std::out_of_range&) {
return 0;
}
double ExportGraphToImageDialog::fromY() const
{
try {
- return std::get<1>(m_bounds.at(m_curKey));
+ return m_bounds.at(m_curKey).fromY;
} catch (std::out_of_range&) {
return 0;
}
double ExportGraphToImageDialog::toX() const
{
try {
- return std::get<2>(m_bounds.at(m_curKey));
+ return m_bounds.at(m_curKey).toX;
} catch (std::out_of_range&) {
return 0;
}
double ExportGraphToImageDialog::toY() const
{
try {
- return std::get<3>(m_bounds.at(m_curKey));
+ return m_bounds.at(m_curKey).toY;
} catch (std::out_of_range&) {
return 0;
}
oldBounds = m_bounds.at(m_curKey);
fX = ui->qle_fromX->text().toDouble(&ok);
- if (ok) std::get<0>(oldBounds) = fX;
+ if (ok) oldBounds.fromX = fX;
fY = ui->qle_fromY->text().toDouble(&ok);
- if (ok) std::get<1>(oldBounds) = fY;
+ if (ok) oldBounds.fromY = fY;
tX = ui->qle_toX->text().toDouble(&ok);
- if (ok) std::get<2>(oldBounds) = tX;
+ if (ok) oldBounds.toX = tX;
tY = ui->qle_toY->text().toDouble(&ok);
- if (ok) std::get<3>(oldBounds) = tY;
+ if (ok) oldBounds.toY = tY;
m_bounds[m_curKey] = oldBounds;
} catch (std::out_of_range&) {
try {
newBounds = m_bounds.at(skey);
- ui->qle_fromX->setText(l.toString(std::get<0>(newBounds)));
- ui->qle_fromY->setText(l.toString(std::get<1>(newBounds)));
- ui->qle_toX->setText(l.toString(std::get<2>(newBounds)));
- ui->qle_toY->setText(l.toString(std::get<3>(newBounds)));
+ ui->qle_fromX->setText(l.toString(newBounds.fromX));
+ ui->qle_fromY->setText(l.toString(newBounds.fromY));
+ ui->qle_toX->setText(l.toString(newBounds.toX));
+ ui->qle_toY->setText(l.toString(newBounds.toY));
m_curKey = skey;
} catch (std::out_of_range&) {
}
try {
double fX, fY, tX, tY;
bool ok;
+ QLocale l = QLocale::system();
const std::string key = ui->qcbox_signal->currentText().toStdString();
Bounds b = m_bounds.at(key);
- fX = ui->qle_fromX->text().toDouble(&ok);
- if (ok) std::get<0>(b) = fX;
- fY = ui->qle_fromY->text().toDouble(&ok);
- if (ok) std::get<1>(b) = fY;
- tX = ui->qle_toX->text().toDouble(&ok);
- if (ok) std::get<2>(b) = tX;
- tY = ui->qle_toY->text().toDouble(&ok);
- if (ok) std::get<3>(b) = tY;
+ fX = l.toDouble(ui->qle_fromX->text(), &ok);
+ if (ok) b.fromX = fX;
+ fY = l.toDouble(ui->qle_fromY->text(), &ok);
+ if (ok) b.fromY = fY;
+ tX = l.toDouble(ui->qle_toX->text(), &ok);
+ if (ok) b.toX = tX;
+ tY = l.toDouble(ui->qle_toY->text(), &ok);
+ if (ok) b.toY = tY;
m_bounds[key] = b;
} catch (std::out_of_range&) {
void ExportGraphToImageDialog::onBrowseClicked()
{
QFileDialog fdlg(this, "Pick destination", QString());
+ fdlg.setAcceptMode(QFileDialog::AcceptSave);
if (fdlg.exec() == QDialog::Accepted)
ui->qle_destPath->setText(fdlg.selectedFiles()[0]);
}
m_relYMax(constraints.toY),
m_relYMin(constraints.fromY),
m_leftGraphOffset(0),
+ m_validConstraints(false),
m_axisLabelFont(QFont("arial", 10)),
m_axisLabelFM(QFontMetrics(m_axisLabelFont)),
m_xAxisLabelText("[" + controller->signal()->xunitAsString() + "]"),
//qDebug() << __QFUNC__ << width << height << m_width << m_height;
- return draw(m_relXMin, m_relYMin, m_relXMax, m_relYMax);
+ if (m_validConstraints)
+ return draw(m_relXMin, m_relYMin, m_relXMax, m_relYMax);
+ return true;
}
/** Protected methods **/
m_relYMin = toY;
m_relYMax = fromY;
}
+
+ m_validConstraints = true;
}
double SignalDrawer::subStep(const double step)