Pencil2D  ff90c0872e88be3bf81c548cd60f01983012ec49
Pencil2D is an animation software for both bitmap and vector graphics. It is free, multi-platform, and open source.
 All Classes Functions
exportimagedialog.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 "exportimagedialog.h"
19 #include "ui_exportimageoptions.h"
20 
21 ExportImageDialog::ExportImageDialog(QWidget *parent, bool seq) :
22  ImportExportDialog(parent),
23  ui(new Ui::ExportImageOptions),
24  m_fileType(seq ? FileType::IMAGE_SEQUENCE : FileType::IMAGE)
25 {
26  ui->setupUi( getOptionsGroupBox() );
27  init();
28  if (seq)
29  {
30  setWindowTitle( tr( "Export image sequence" ) );
31  }
32  else
33  {
34  setWindowTitle( tr( "Export image" ) );
35  }
36 
37  connect( ui->formatComboBox, &QComboBox::currentTextChanged, this, &ExportImageDialog::formatChanged );
38  formatChanged( getExportFormat() ); // Make sure file extension matches format combobox
39 }
40 
41 ExportImageDialog::~ExportImageDialog()
42 {
43  delete ui;
44 }
45 
46 void ExportImageDialog::setExportSize(QSize size)
47 {
48  ui->imgWidthSpinBox->setValue( size.width() );
49  ui->imgHeightSpinBox->setValue( size.height() );
50 }
51 
52 QSize ExportImageDialog::getExportSize()
53 {
54  return QSize( ui->imgWidthSpinBox->value(), ui->imgHeightSpinBox->value() );
55 }
56 
57 bool ExportImageDialog::getTransparency()
58 {
59  return ui->cbTransparency->checkState() == Qt::Checked;
60 }
61 
62 QString ExportImageDialog::getExportFormat()
63 {
64  return ui->formatComboBox->currentText();
65 }
66 
67 ImportExportDialog::Mode ExportImageDialog::getMode()
68 {
69  return ImportExportDialog::Export;
70 }
71 
72 FileType ExportImageDialog::getFileType()
73 {
74  return m_fileType;
75 }
76 
77 void ExportImageDialog::formatChanged(QString format)
78 {
79  setFileExtension( format.toLower() );
80 }