18#include "exportimagedialog.h"
19#include "ui_exportimageoptions.h"
22ExportImageDialog::ExportImageDialog(
QWidget* parent, FileType eFileType) :
24 ui(new Ui::ExportImageOptions)
26 ui->
setupUi(getOptionsGroupBox());
27 if (eFileType == FileType::IMAGE_SEQUENCE)
29 setWindowTitle(tr(
"Export image sequence"));
33 setWindowTitle(tr(
"Export image"));
34 ui->frameRangeGroupBox->hide();
38 formatChanged(getExportFormat());
41ExportImageDialog::~ExportImageDialog()
46void ExportImageDialog::setCamerasInfo(
const std::vector<std::pair<QString, QSize>>& cameraInfo)
48 Q_ASSERT(ui->cameraCombo);
50 ui->cameraCombo->clear();
51 for (
const std::pair<QString, QSize>& it : cameraInfo)
53 ui->cameraCombo->addItem(it.first, it.second);
57 connect(ui->cameraCombo, indexChanged,
this, &ExportImageDialog::cameraComboChanged);
59 cameraComboChanged(0);
62void ExportImageDialog::setDefaultRange(
int startFrame,
int endFrame,
int endFrameWithSounds)
65 mEndFrameWithSounds = endFrameWithSounds;
70 ui->startSpinBox->setValue( startFrame );
71 ui->endSpinBox->setValue( endFrame );
76int ExportImageDialog::getStartFrame()
const
78 return ui->startSpinBox->value();
81int ExportImageDialog::getEndFrame()
const
83 return ui->endSpinBox->value();
86void ExportImageDialog::frameCheckboxClicked(
bool checked)
88 int e = (checked) ? mEndFrameWithSounds : mEndFrame;
89 ui->endSpinBox->setValue(e);
92void ExportImageDialog::setExportSize(
QSize size)
94 ui->imgWidthSpinBox->setValue(
size.width());
95 ui->imgHeightSpinBox->setValue(
size.height());
98QSize ExportImageDialog::getExportSize()
const
100 return QSize(ui->imgWidthSpinBox->value(), ui->imgHeightSpinBox->value());
103bool ExportImageDialog::getTransparency()
const
105 return ui->cbTransparency->checkState() ==
Qt::Checked;
108bool ExportImageDialog::getExportKeyframesOnly()
const
110 return ui->cbExportKeyframesOnly->checkState() ==
Qt::Checked;
113QString ExportImageDialog::getExportFormat()
const
115 return ui->formatComboBox->currentText();
118QString ExportImageDialog::getCameraLayerName()
const
120 return ui->cameraCombo->currentText();
123void ExportImageDialog::formatChanged(
const QString& format)
125 setFileExtension(format.
toLower());
126 setTransparencyOptionVisibility(format);
129void ExportImageDialog::cameraComboChanged(
int index)
131 const QSize cameraSize = ui->cameraCombo->itemData(index).toSize();
133 ui->imgWidthSpinBox->setValue(cameraSize.
width());
134 ui->imgHeightSpinBox->setValue(cameraSize.
height());
137void ExportImageDialog::setTransparencyOptionVisibility(
const QString &format)
139 if (format ==
"JPG" || format ==
"BMP")
140 ui->cbTransparency->setDisabled(
true);
142 ui->cbTransparency->setDisabled(
false);
void currentIndexChanged(int index)
void currentTextChanged(const QString &text)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QString toLower() const const