Pencil2D  ff90c0872e88be3bf81c548cd60f01983012ec49
Pencil2D is an animation software for both bitmap and vector graphics. It is free, multi-platform, and open source.
 All Classes Functions
exportmoviedialog.cpp
1 /*
2 
3 Pencil - Traditional Animation Software
4 Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5 Copyright (C) 2013-2017 Matt Chiawen Chang
6 
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; version 2 of the License.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 */
17 
18 #include "exportmoviedialog.h"
19 #include "ui_exportmovieoptions.h"
20 #include "util.h"
21 
22 ExportMovieDialog::ExportMovieDialog(QWidget *parent) :
23  ImportExportDialog(parent),
24  ui(new Ui::ExportMovieOptions)
25 {
26  ui->setupUi(getOptionsGroupBox());
27  init();
28  setWindowTitle(tr("Export Movie"));
29  ui->rangeGroupBox->hide();
30 }
31 
32 ExportMovieDialog::~ExportMovieDialog()
33 {
34  delete ui;
35 }
36 
37 void ExportMovieDialog::setCamerasInfo( std::vector< std::pair< QString, QSize > > camerasInfo )
38 {
39  if ( ui->cameraCombo->count() > 0 )
40  {
41  ui->cameraCombo->clear();
42  }
43 
44  for ( std::pair< QString, QSize >& camera : camerasInfo )
45  {
46  ui->cameraCombo->addItem( camera.first, camera.second );
47  }
48 
49  auto indexChanged = static_cast< void(QComboBox::*)( int i ) >( &QComboBox::currentIndexChanged );
50  connect( ui->cameraCombo, indexChanged, this, &ExportMovieDialog::updateResolutionCombo );
51 
52  updateResolutionCombo( 0 );
53 }
54 
55 void ExportMovieDialog::updateResolutionCombo( int index )
56 {
57  QSize camSize = ui->cameraCombo->itemData( index ).toSize();
58 
59  SignalBlocker b1( ui->widthSpinBox );
60  SignalBlocker b2( ui->heightSpinBox );
61 
62  ui->widthSpinBox->setValue( camSize.width() );
63  ui->heightSpinBox->setValue( camSize.height() );
64 }
65 
66 void ExportMovieDialog::setDefaultRange( int startFrame, int endFrame )
67 {
68  ui->startSpinbox->setValue( startFrame );
69  ui->endSpinBox->setValue( endFrame );
70 }
71 
72 QString ExportMovieDialog::getSelectedCameraName()
73 {
74  return ui->cameraCombo->currentText();
75 }
76 
77 QSize ExportMovieDialog::getExportSize()
78 {
79  return QSize( ui->widthSpinBox->value(), ui->heightSpinBox->value() );
80 }
81 
82 int ExportMovieDialog::getStartFrame()
83 {
84  return ui->startSpinbox->value();
85 }
86 
87 int ExportMovieDialog::getEndFrame()
88 {
89  return ui->endSpinBox->value();
90 }
91 
92 ImportExportDialog::Mode ExportMovieDialog::getMode()
93 {
94  return ImportExportDialog::Export;
95 }
96 
97 FileType ExportMovieDialog::getFileType()
98 {
99  return FileType::MOVIE;
100 }