18#include "exportmoviedialog.h"
19#include "ui_exportmovieoptions.h"
22ExportMovieDialog::ExportMovieDialog(
QWidget *parent, Mode mode, FileType fileType) :
24 ui(new Ui::ExportMovieOptions)
26 ui->
setupUi(getOptionsGroupBox());
28 if (fileType == FileType::GIF) {
29 setWindowTitle(tr(
"Export Animated GIF"));
30 ui->exporterGroupBox->hide();
32 setWindowTitle(tr(
"Export Movie"));
34 connect(
this, &ExportMovieDialog::filePathsChanged,
this, &ExportMovieDialog::onFilePathsChanged);
37ExportMovieDialog::~ExportMovieDialog()
42void ExportMovieDialog::setCamerasInfo(
const std::vector<std::pair<QString, QSize>> camerasInfo)
44 if ( ui->cameraCombo->count() > 0 )
46 ui->cameraCombo->clear();
49 for (
const std::pair<QString, QSize>& camera : camerasInfo)
51 ui->cameraCombo->addItem( camera.first, camera.second );
55 connect( ui->cameraCombo, indexChanged,
this, &ExportMovieDialog::updateResolutionCombo );
57 updateResolutionCombo( 0 );
60void ExportMovieDialog::updateResolutionCombo(
int index )
62 QSize camSize = ui->cameraCombo->itemData( index ).toSize();
67 ui->widthSpinBox->setValue( camSize.
width() );
68 ui->heightSpinBox->setValue( camSize.
height() );
71void ExportMovieDialog::setDefaultRange(
int startFrame,
int endFrame,
int endFrameWithSounds)
74 mEndFrameWithSounds = endFrameWithSounds;
79 ui->startSpinBox->setValue( startFrame );
80 ui->endSpinBox->setValue( endFrame );
85QString ExportMovieDialog::getSelectedCameraName()
87 return ui->cameraCombo->currentText();
90QSize ExportMovieDialog::getExportSize()
92 return QSize( ui->widthSpinBox->value(), ui->heightSpinBox->value() );
95bool ExportMovieDialog::getTransparency()
const
97 return ui->transparencyCheckBox->isChecked() && supportsTransparency(getFilePath());
100int ExportMovieDialog::getStartFrame()
102 return ui->startSpinBox->value();
105int ExportMovieDialog::getEndFrame()
107 return ui->endSpinBox->value();
110bool ExportMovieDialog::getLoop()
112 return ui->loopCheckBox->isChecked();
115void ExportMovieDialog::frameCheckboxClicked(
bool checked)
117 int e = (checked) ? mEndFrameWithSounds : mEndFrame;
118 ui->endSpinBox->setValue(e);
121void ExportMovieDialog::onFilePathsChanged(
QStringList filePaths)
124 bool canLoop = supportsLooping(filePath);
125 ui->loopCheckBox->setEnabled(canLoop);
128 ui->loopCheckBox->setChecked(
false);
130 ui->transparencyCheckBox->setEnabled(supportsTransparency(filePath));
133bool ExportMovieDialog::supportsLooping(
QString filePath)
const
139bool ExportMovieDialog::supportsTransparency(
QString filePath)
const
void currentIndexChanged(int index)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const const