export: move exportProfile() function to exportfuncs.cpp

The exportProfile function uses the UI and therefore was
supposed to be declared in backend-shared/* but defined
separately for desktop and mobile. Currently, only the
desktop version exists.

The goal however should be that there is no need of the
UI for this function. In a first step, move the function
to the common backend-shared/* code and conditionally
compile for desktop. In upcoming commits, the function
will be made independent of the UI.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-04-07 08:35:35 +02:00 committed by Dirk Hohndel
parent 811c8a441e
commit 8f0e2245c2
3 changed files with 28 additions and 32 deletions

View file

@ -253,22 +253,3 @@ void DiveLogExportDialog::on_buttonBox_accepted()
}
}
}
void exportProfile(const struct dive *dive, const QString filename)
{
ProfileWidget2 *profile = MainWindow::instance()->graphics;
profile->setToolTipVisibile(false);
profile->setPrintMode(true);
double scale = profile->getFontPrintScale();
profile->setFontPrintScale(4 * scale);
profile->plotDive(dive, 0, false, true);
QImage image = QImage(profile->size() * 4, QImage::Format_RGB32);
QPainter paint;
paint.begin(&image);
profile->render(&paint);
image.save(filename);
profile->setToolTipVisibile(true);
profile->setFontPrintScale(scale);
profile->setPrintMode(false);
profile->plotDive(dive, 0); // TODO: Shouldn't this plot the current dive?
}