| #pragma once |
| |
| #ifndef FILEFIELD_H |
| #define FILEFIELD_H |
| |
| #include "tcommon.h" |
| #include <QWidget> |
| #include <QFileDialog> |
| #include "tfilepath.h" |
| #include "toonzqt/lineedit.h" |
| |
| #undef DVAPI |
| #undef DVVAR |
| #ifdef TOONZQT_EXPORTS |
| #define DVAPI DV_EXPORT_API |
| #define DVVAR DV_EXPORT_VAR |
| #else |
| #define DVAPI DV_IMPORT_API |
| #define DVVAR DV_IMPORT_VAR |
| #endif |
| |
| |
| class QPushButton; |
| |
| |
| |
| namespace DVGui { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| class DVAPI FileField : public QWidget { |
| Q_OBJECT |
| |
| LineEdit *m_field; |
| QStringList m_filters; |
| QFileDialog::FileMode m_fileMode; |
| QString m_windowTitle; |
| QString m_descriptionText; |
| |
| |
| protected: |
| QPushButton *m_fileBrowseButton; |
| QString m_lastSelectedPath; |
| |
| public: |
| |
| |
| class BrowserPopupController { |
| public: |
| BrowserPopupController() {} |
| virtual ~BrowserPopupController() {} |
| virtual bool isExecute() { return true; }; |
| virtual QString getPath() { return QString(); }; |
| virtual void openPopup(QStringList, bool, QString){}; |
| }; |
| |
| static BrowserPopupController *m_browserPopupController; |
| |
| FileField(QWidget *parent = 0, QString path = QString(), |
| bool readOnly = false, bool doNotBrowseInitialPath = false); |
| ~FileField() {} |
| |
| |
| |
| |
| |
| |
| void setFileMode(const QFileDialog::FileMode &fileMode); |
| |
| void setFilters(const QStringList &filters); |
| void setValidator(const QValidator *v) { m_field->setValidator(v); } |
| QString getPath(); |
| void setPath(const QString &path); |
| |
| static void setBrowserPopupController(BrowserPopupController *controller); |
| static BrowserPopupController *getBrowserPopupController(); |
| |
| protected slots: |
| |
| |
| |
| |
| virtual void browseDirectory(); |
| |
| signals: |
| |
| |
| void pathChanged(); |
| }; |
| |
| |
| } |
| |
| |
| #endif |