| #pragma once |
| |
| #ifndef CAMERASETTINGSWIDGET_H |
| #define CAMERASETTINGSWIDGET_H |
| |
| #ifdef _WIN32 |
| #pragma warning(disable : 4251) |
| #endif |
| |
| #include "tcommon.h" |
| #include "tgeometry.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 |
| |
| #include <QFrame> |
| #include <QPushButton> |
| #include <QValidator> |
| #include <QLineEdit> |
| |
| class TCamera; |
| class QRadioButton; |
| class QComboBox; |
| class ResListManager; |
| class TFilePath; |
| class TXshSimpleLevel; |
| class TXshLevel; |
| |
| namespace DVGui |
| { |
| class LineEdit; |
| class DoubleLineEdit; |
| class IntLineEdit; |
| class MeasuredDoubleLineEdit; |
| class CheckBox; |
| } |
| |
| |
| |
| class SimpleExpValidator : public QValidator |
| { |
| public: |
| SimpleExpValidator(QObject *parent) : QValidator(parent){}; |
| State validate(QString &input, int &pos) const; |
| }; |
| |
| |
| |
| class SimpleExpField : public QLineEdit |
| { |
| SimpleExpValidator *m_validator; |
| QString m_previousValue; |
| |
| public: |
| SimpleExpField(QWidget *parent); |
| |
| void setValue(double); |
| void setValue(double, int, int); |
| double getValue(); |
| |
| protected: |
| void focusInEvent(QFocusEvent *event); |
| void focusOutEvent(QFocusEvent *event); |
| }; |
| |
| |
| |
| class DVAPI CameraSettingsWidget : public QFrame |
| { |
| Q_OBJECT |
| |
| bool m_forCleanup; |
| |
| QRadioButton *m_xPrev, *m_yPrev, *m_arPrev; |
| QRadioButton *m_inchPrev, *m_dotPrev; |
| |
| DVGui::MeasuredDoubleLineEdit *m_lxFld, *m_lyFld; |
| SimpleExpField *m_arFld; |
| double m_arValue; |
| DVGui::IntLineEdit *m_xResFld, *m_yResFld; |
| DVGui::DoubleLineEdit *m_xDpiFld, *m_yDpiFld; |
| |
| QPushButton *m_fspChk; |
| |
| QPushButton *m_useLevelSettingsBtn; |
| QComboBox *m_presetListOm; |
| QPushButton *m_addPresetBtn, *m_removePresetBtn; |
| |
| DVGui::MeasuredDoubleLineEdit *m_offsX, *m_offsY; |
| |
| QString m_presetListFile; |
| |
| |
| TXshSimpleLevel *m_currentLevel; |
| |
| void savePresetList(); |
| void loadPresetList(); |
| bool parsePresetString(const QString &str, QString &name, int &xres, int &yres, QString &ar); |
| |
| bool parsePresetString(const QString &str, |
| QString &name, |
| int &xres, |
| int &yres, |
| double &fx, |
| double &fy, |
| QString &xoffset, |
| QString &yoffset, |
| double &ar, |
| bool forCleanup = false); |
| |
| public: |
| CameraSettingsWidget(bool forCleanup = false); |
| ~CameraSettingsWidget(); |
| |
| void setPresetListFile(const TFilePath &fp); |
| |
| |
| |
| void setCurrentLevel(TXshLevel *); |
| |
| |
| void setFields(const TCamera *camera); |
| |
| |
| void getFields(TCamera *camera); |
| |
| QSize sizeHint() const { return minimumSize(); } |
| |
| |
| |
| static double aspectRatioStringToValue(const QString &s); |
| |
| static QString aspectRatioValueToString(double ar, int width = 0, int height = 0); |
| |
| |
| TDimensionD getSize() const; |
| |
| |
| TDimension getRes() const; |
| |
| |
| void setOffsetWidgetPointers(DVGui::MeasuredDoubleLineEdit *offsX, DVGui::MeasuredDoubleLineEdit *offsY) |
| { |
| m_offsX = offsX; |
| m_offsY = offsY; |
| } |
| |
| protected: |
| bool eventFilter(QObject *obj, QEvent *e); |
| |
| void hComputeLx(); |
| void hComputeLy(); |
| void vComputeLx(); |
| void vComputeLy(); |
| void computeAr(); |
| void computeXRes(); |
| void computeYRes(); |
| void computeXDpi(); |
| void computeYDpi(); |
| void computeResOrDpi(); |
| |
| void updatePresetListOm(); |
| |
| void setArFld(double ar); |
| |
| protected slots: |
| void onLxChanged(); |
| void onLyChanged(); |
| void onArChanged(); |
| void onXResChanged(); |
| void onYResChanged(); |
| void onXDpiChanged(); |
| void onYDpiChanged(); |
| void onFspChanged(bool checked); |
| void onPrevToggled(bool checked); |
| void onPresetSelected(const QString &); |
| void addPreset(); |
| void removePreset(); |
| void useLevelSettings(); |
| |
| signals: |
| void changed(); |
| void levelSettingsUsed(); |
| |
| }; |
| |
| #endif |