1 #pragma once
2 
3 #ifndef PSDSETTINGSPOPUP_H
4 #define PSDSETTINGSPOPUP_H
5 
6 #include "toonzqt/dvdialog.h"
7 #include "tfilepath.h"
8 #include "../common/psdlib/psd.h"
9 
10 #include <QButtonGroup>
11 #include <QTextEdit>
12 //#include <QTreeWidget>
13 
14 // forward declaration
15 class QPushButton;
16 class QComboBox;
17 
18 namespace DVGui {
19 class CheckBox;
20 }
21 
22 //=============================================================================
23 // PsdSettingsPopup
24 //-----------------------------------------------------------------------------
25 
26 class PsdSettingsPopup final : public DVGui::Dialog {
27   Q_OBJECT
28   // Loading Mode
29   // FLAT: psd flat image
30   // FRAMES: all psd layers are frames of a single Tlevel
31   // COLUMNS: each psd layer is a TLevel with only one frame.
32   // FOLDER: each psd layer is a TLevel and
33   //				 each psd folder is a TLevel where each psd
34   // layer
35   // contained
36   // into folder is a frame of TLevel
37 
38   enum Mode { FLAT, FRAMES, COLUMNS, FOLDER };
39 
40   TFilePath m_path;
41   std::vector<TFilePath> m_psdLevelPaths;
42   std::vector<int> loadedLevelId;
43 
44   Mode m_mode;
45   QPushButton *m_okBtn;
46   QPushButton *m_cancelBtn;
47   QComboBox *m_loadMode, *m_levelNameType;
48   DVGui::CheckBox *m_createSubXSheet;
49   QButtonGroup *m_psdFolderOptions;
50 
51   // QTreeWidget *m_psdTree;	// per adesso non serve. Servirà in un secondo
52   // momento quando implemento la scelta dei livelli
53   // da caricare
54   QTextEdit *m_modeDescription;
55   TPSDParser *m_psdparser;
56   QLabel *m_filename;   // Name
57   QLabel *m_parentDir;  // Path
58 
59 public slots:
60   void onOk();
61 
62 public:
63   PsdSettingsPopup();
64 
65   void setPath(const TFilePath &path);
getPsdLevelCount()66   int getPsdLevelCount() { return m_psdLevelPaths.size(); };
67   TFilePath getPsdPath(int levelIndex);
68   TFilePath getPsdFramePath(int levelIndex, int frameIndex);
69   int getFramesCount(int levelIndex);
70   bool isFolder(int levelIndex);
71   bool isSubFolder(int levelIndex, int frameIndex);
72   bool subxsheet();
73   int levelNameType();
74 
75   int getFolderOption();
76   int getSubfolderLevelIndex(int psdLevelIndex, int frameIndex);
77 
78 private:
79   void doPsdParser();
80 
81 protected slots:
82   void onModeChanged();
83   void onFolderOptionChange(int id);
84 };
85 
86 #endif  // PsdSettingsPopup_H
87