All Classes Namespaces Functions Variables Enumerations Properties Pages
importimageseqdialog.h
1 /*
2 
3 Pencil2D - Traditional Animation Software
4 Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5 Copyright (C) 2012-2020 Matthew 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 #ifndef IMPORTIMAGESEQDIALOG_H
19 #define IMPORTIMAGESEQDIALOG_H
20 
21 #include "importexportdialog.h"
22 #include "pencilerror.h"
23 #include "predefinedsetmodel.h"
24 
25 class Editor;
26 
27 namespace Ui {
28 class ImportImageSeqOptions;
29 class ImportImageSeqPreviewGroupBox;
30 }
31 
33 {
34  int dot = 0;
35  int digits = 0;
36  QStringList filenames;
37  QStringList absolutePaths;
38  QString folderPath;
39  QString prefix;
40 };
41 
42 enum ImportCriteria { Arbitrary, PredefinedSet };
43 
45 {
46  Q_OBJECT
47 
48 public:
49  explicit ImportImageSeqDialog(QWidget *parent = nullptr,
50  Mode mode = ImportExportDialog::Import,
51  FileType fileType = FileType::IMAGE_SEQUENCE,
52  ImportCriteria importCriteria = ImportCriteria::Arbitrary);
53  ~ImportImageSeqDialog() override;
54 
55  void importArbitrarySequence();
56  void importPredefinedSet();
57  int getSpace();
58 
59  void setCore(Editor* editor) { mEditor = editor; }
60 
61 signals:
62  void notifyAnimationLengthChanged();
63 
64 protected:
65  Mode getMode();
66  FileType getFileType();
67 
68 private slots:
69  void setSpace(int number);
70  void updatePreviewList(const QStringList& list);
71 
72  const PredefinedKeySetParams predefinedKeySetParams() const;
73 
74 private:
75  int keyFramePosFromFilePath(const QString& path);
76 
77 private:
78  const PredefinedKeySet generatePredefinedKeySet() const;
79  void setPreviewModel(const PredefinedKeySet& predefinedKeySet);
80  void setupLayout();
81  void setupPredefinedLayout();
82  Status validateKeySet(const PredefinedKeySet& keySet, const QStringList& filepaths);
83  Status validateFiles(const QStringList& filepaths);
84 
85  Ui::ImportImageSeqOptions *uiOptionsBox;
86  Ui::ImportImageSeqPreviewGroupBox *uiGroupBoxPreview;
87 
88  QStringList getFilePaths();
89 
90  Editor* mEditor = nullptr;
91  QWidget* mParent = nullptr;
92  ImportCriteria mImportCriteria = ImportCriteria::Arbitrary;
93  FileType mFileType = FileType::IMAGE_SEQUENCE;
94 };
95 
96 #endif // IMPORTIMAGESEQDIALOG_H
Q_OBJECTQ_OBJECT
Definition: editor.h:55
QObject * parent() const const