| #pragma once |
| |
| #ifndef DVDIALOG_INCLUDED |
| #define DVDIALOG_INCLUDED |
| |
| |
| #include "tcommon.h" |
| #include "tmsgcore.h" |
| |
| |
| #include <QDialog> |
| #include <QVBoxLayout> |
| #include <QString> |
| #include <QProgressBar> |
| #include <QFrame> |
| #include <QSettings> |
| |
| #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 QAbstractButton; |
| class QHBoxLayout; |
| class QVBoxLayout; |
| class QLayout; |
| class QLabel; |
| class TXsheetHandle; |
| class TPalette; |
| |
| #ifdef _WIN32 |
| #pragma warning(disable : 4251) |
| #endif |
| |
| |
| namespace DVGui { |
| |
| |
| const int WidgetHeight = 20; |
| |
| class Dialog; |
| class MessageAndCheckboxDialog; |
| |
| |
| |
| |
| |
| void DVAPI setDialogTitle(const QString &dialogTitle); |
| |
| |
| |
| void DVAPI MsgBoxInPopup(MsgType type, const QString &text); |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| int DVAPI MsgBox(MsgType type, const QString &text, |
| const std::vector<QString> &buttons, |
| int defaultButtonIndex = 0, QWidget *parent = 0); |
| |
| |
| int DVAPI MsgBox(const QString &text, const QString &button1, |
| const QString &button2, int defaultButtonIndex = 0, |
| QWidget *parent = 0); |
| |
| |
| int DVAPI MsgBox(const QString &text, const QString &button1, |
| const QString &button2, const QString &button3, |
| int defaultButtonIndex = 0, QWidget *parent = 0); |
| |
| |
| int DVAPI MsgBox(const QString &text, const QString &button1, |
| const QString &button2, const QString &button3, |
| const QString &button4, int defaultButtonIndex = 0, |
| QWidget *parent = 0); |
| |
| Dialog DVAPI *createMsgBox(MsgType type, const QString &text, |
| const QStringList &buttons, int defaultButtonIndex, |
| QWidget *parent = 0); |
| |
| MessageAndCheckboxDialog DVAPI *createMsgandCheckbox( |
| MsgType type, const QString &text, const QString &checkBoxText, |
| const QStringList &buttons, int defaultButtonIndex, QWidget *parent = 0); |
| |
| |
| |
| |
| |
| |
| QString DVAPI getText(const QString &title, const QString &label, |
| const QString &text = QString(), bool *ok = 0); |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| class DVAPI Separator final : public QFrame { |
| Q_OBJECT |
| |
| QString m_name; |
| bool m_isHorizontal; |
| |
| public: |
| Separator(QString name = "", QWidget *parent = 0); |
| ~Separator(); |
| |
| |
| |
| void setName(const QString &name) { m_name = name; } |
| QString getName() { return m_name; } |
| |
| |
| |
| |
| void setOrientation(bool isHorizontal) { m_isHorizontal = isHorizontal; } |
| |
| |
| bool isHorizontal() { return m_isHorizontal; } |
| |
| protected: |
| void paintEvent(QPaintEvent *event) override; |
| }; |
| |
| |
| |
| class DVAPI Dialog : public QDialog { |
| Q_OBJECT |
| static QSettings *m_settings; |
| |
| bool m_hasButton; |
| QString m_name; |
| |
| |
| |
| |
| protected: |
| QHBoxLayout *m_buttonLayout; |
| QList<QLabel *> m_labelList; |
| void resizeEvent(QResizeEvent *e) override; |
| void moveEvent(QMoveEvent *e) override; |
| |
| public: |
| QVBoxLayout *m_topLayout; |
| QFrame *m_mainFrame, *m_buttonFrame; |
| |
| QHBoxLayout *m_mainHLayout; |
| bool m_isMainHLayout; |
| |
| QVBoxLayout *m_leftVLayout, *m_rightVLayout; |
| bool m_isMainVLayout; |
| |
| int m_layoutSpacing; |
| int m_layoutMargin; |
| int m_labelWidth; |
| |
| std::vector<QWidget *> m_buttonBarWidgets; |
| |
| public: |
| |
| |
| Dialog(QWidget *parent = 0, bool hasButton = false, bool hasFixedSize = true, |
| const QString &name = QString()); |
| ~Dialog(); |
| |
| void beginVLayout(); |
| void endVLayout(); |
| |
| void beginHLayout(); |
| void endHLayout(); |
| |
| void addWidget(QWidget *widget, bool isRight = true); |
| void addWidgets(QWidget *firstW, QWidget *secondW); |
| void addWidget(QString labelName, QWidget *widget); |
| |
| void addLayout(QLayout *layout, bool isRight = true); |
| void addWidgetLayout(QWidget *widget, QLayout *layout); |
| void addLayout(QString labelName, QLayout *layout); |
| void addLayouts(QLayout *firstL, QLayout *secondL); |
| |
| void addSpacing(int spacing); |
| void addSeparator(QString name = QString()); |
| |
| void setAlignment(Qt::Alignment alignment); |
| |
| void setTopMargin(int margin); |
| void setTopSpacing(int spacing); |
| |
| void setLabelWidth(int labelWidth); |
| int getLabelWidth() const { return m_labelWidth; }; |
| |
| void setLayoutInsertedSpacing(int spacing); |
| int getLayoutInsertedSpacing(); |
| |
| void setButtonBarMargin(int margin); |
| void setButtonBarSpacing(int spacing); |
| |
| void addButtonBarWidget(QWidget *widget); |
| void addButtonBarWidget(QWidget *first, QWidget *second); |
| void addButtonBarWidget(QWidget *first, QWidget *second, QWidget *third); |
| void addButtonBarWidget(QWidget *first, QWidget *second, QWidget *third, |
| QWidget *fourth); |
| |
| void hideEvent(QHideEvent *event) override; |
| |
| void clearButtonBar(); |
| signals: |
| void dialogClosed(); |
| }; |
| |
| |
| |
| class DVAPI MessageAndCheckboxDialog final : public DVGui::Dialog { |
| Q_OBJECT |
| |
| int m_checked = 0; |
| |
| public: |
| MessageAndCheckboxDialog(QWidget *parent = 0, bool hasButton = false, |
| bool hasFixedSize = true, |
| const QString &name = QString()); |
| int getChecked() { return m_checked; } |
| |
| public slots: |
| void onCheckboxChanged(int checked); |
| void onButtonPressed(int id); |
| }; |
| |
| |
| |
| |
| |
| |
| |
| class DVAPI RadioButtonDialog final : public DVGui::Dialog { |
| Q_OBJECT |
| |
| int m_result; |
| |
| public: |
| RadioButtonDialog(const QString &labelText, |
| const QList<QString> &radioButtonList, QWidget *parent = 0, |
| Qt::WindowFlags f = 0); |
| |
| public Q_SLOTS: |
| void onButtonClicked(int id); |
| void onCancel(); |
| void onApply(); |
| }; |
| |
| |
| |
| int DVAPI RadioButtonMsgBox(MsgType type, const QString &labelText, |
| const QList<QString> &buttons, QWidget *parent = 0); |
| |
| |
| |
| class DVAPI ProgressDialog : public DVGui::Dialog { |
| Q_OBJECT |
| |
| QLabel *m_label; |
| QProgressBar *m_progressBar; |
| QPushButton *m_cancelButton; |
| |
| protected: |
| bool m_isCanceled; |
| |
| public: |
| ProgressDialog(const QString &labelText, const QString &cancelButtonText, |
| int minimum, int maximum, QWidget *parent = 0, |
| Qt::WindowFlags f = 0); |
| |
| void setLabelText(const QString &text); |
| void setCancelButton(QPushButton *cancelButton); |
| |
| int maximum(); |
| void setMaximum(int maximum); |
| |
| int minimum(); |
| void setMinimum(int minimum); |
| |
| void reset(); |
| int value(); |
| |
| bool wasCanceled() const; |
| |
| public Q_SLOTS: |
| void setValue(int progress); |
| virtual void onCancel(); |
| |
| Q_SIGNALS: |
| void canceled(); |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| int eraseStylesInDemand(TPalette *palette, const TXsheetHandle *xsheetHandle, |
| TPalette *newPalette = 0); |
| |
| int eraseStylesInDemand(TPalette *palette, std::vector<int> styleIds, |
| const TXsheetHandle *xsheetHandle); |
| |
| |
| |
| |
| } |
| |
| |
| #endif // DVDIALOG_INCLUDED |