PlyOpenDlg.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. //##########################################################################
  2. //# #
  3. //# CLOUDCOMPARE #
  4. //# #
  5. //# This program is free software; you can redistribute it and/or modify #
  6. //# it under the terms of the GNU General Public License as published by #
  7. //# the Free Software Foundation; version 2 or later of the License. #
  8. //# #
  9. //# This program is distributed in the hope that it will be useful, #
  10. //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  11. //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  12. //# GNU General Public License for more details. #
  13. //# #
  14. //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) #
  15. //# #
  16. //##########################################################################
  17. #ifndef CC_PLY_OPEN_DIALOG
  18. #define CC_PLY_OPEN_DIALOG
  19. //GUIs generated by Qt Designer
  20. #include <ui_openPlyFileDlg.h>
  21. //Qt
  22. #include <QStringList>
  23. //system
  24. #include <vector>
  25. class QComboBox;
  26. struct PlyLoadingContext;
  27. //! Dialog for configuration of PLY files opening sequence
  28. class PlyOpenDlg : public QDialog, public Ui::PlyOpenDlg
  29. {
  30. Q_OBJECT
  31. public:
  32. explicit PlyOpenDlg(QWidget* parent = nullptr);
  33. void setDefaultComboItems(const QStringList& stdPropsText);
  34. void setListComboItems(const QStringList& listPropsText);
  35. void setSingleComboItems(const QStringList& singlePropsText);
  36. //! Standard comboboxes
  37. std::vector<QComboBox*> m_standardCombos;
  38. //! List-related comboboxes (faces, etc.)
  39. std::vector<QComboBox*> m_listCombos;
  40. //! Single-related comboboxes (texture index, etc.)
  41. std::vector<QComboBox*> m_singleCombos;
  42. //! SF comboboxes
  43. std::vector<QComboBox*> m_sfCombos;
  44. //! Returns whether the current configuration is valid or not
  45. bool isValid(bool displayErrors = true) const;
  46. //! Restores the previously saved configuration (if any)
  47. /** \param hasAPreviousContext returns whether a previous context is stored
  48. \return whether the previous context can be restored or not
  49. **/
  50. bool restorePreviousContext(bool& hasAPreviousContext);
  51. //! Resets the "apply all" flag (if set)
  52. static void ResetApplyAll();
  53. //! Returns whether the dialog can be 'skipped'
  54. /** i.e. 'Apply all' button has been previously clicked
  55. and the configuration is valid.
  56. **/
  57. bool canBeSkipped() const;
  58. public:
  59. void addSFComboBox(int selectedIndex = 0);
  60. protected:
  61. void apply();
  62. void applyAll();
  63. void addAllStdPropsAsSF();
  64. Q_SIGNALS:
  65. void fullyAccepted();
  66. protected:
  67. //! Saves current configuration (for internal use)
  68. void saveContext(PlyLoadingContext* context);
  69. //! Restore a previously saved configuration (for internal use)
  70. bool restoreContext(PlyLoadingContext* context, int& unassignedProps, int& mismatchProps);
  71. //! Standard comboboxes elements
  72. QStringList m_stdPropsText;
  73. //! List-related comboboxes elements
  74. QStringList m_listPropsText;
  75. //! Single-related comboboxes elements
  76. QStringList m_singlePropsText;
  77. };
  78. #endif