X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetFileSelector.h;h=ae2d0daa761f50dd0babda225424567baef38f16;hb=3bf561d1ad1773939ae43ffbe0b4c3df03d747e8;hp=2133fe786aebda828553e6972886b9be34879b1d;hpb=38afbd899a8645c83e17f2c24a17a2b7414911b4;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetFileSelector.h b/src/ModuleBase/ModuleBase_WidgetFileSelector.h index 2133fe786..ae2d0daa7 100644 --- a/src/ModuleBase/ModuleBase_WidgetFileSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetFileSelector.h @@ -20,27 +20,35 @@ class QWidget; class QLineEdit; +/** +* \ingroup GUI +* Implementation of model widget for open file widget. +* It can be defined as following: +* \code +* +* +* +* \endcode +*/ class MODULEBASE_EXPORT ModuleBase_WidgetFileSelector : public ModuleBase_ModelWidget { Q_OBJECT public: + /// Constructor + /// \param theParent the parent object + /// \param theData the widget configuation. The attribute of the model widget is obtained from + /// \param theParentId is Id of a parent of the current attribute ModuleBase_WidgetFileSelector(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId); virtual ~ModuleBase_WidgetFileSelector(); - /// Saves the internal parameters to the given feature - /// \param theObject a model feature to be changed - virtual bool storeValue() const; - virtual bool restoreValue(); - /// Returns the internal parent wiget control, that can be shown anywhere - /// \returns the widget - QWidget* getControl() const; - - /// Returns list of widget controls - /// \return a control list virtual QList getControls() const; /// Returns true if a file on the current path in the line edit @@ -48,18 +56,49 @@ class MODULEBASE_EXPORT ModuleBase_WidgetFileSelector : public ModuleBase_ModelW bool isCurrentPathValid(); public slots: + /// Processing of path selection button press void onPathSelectionBtn(); + + /// Processing of path changing void onPathChanged(); - protected: - QString formatsString() const; +protected: + /// Saves the internal parameters to the given feature + /// \return True in success + virtual bool storeValueCustom() const; + +protected: + /// Converts format to filter string + static QString formatToFilter(const QString & theFormat); + + /// Returns a short format string of theFilter string + static QString filterToShortFormat(const QString & theFilter); + + /// Returns a list of extensions from theFilter + static QStringList filterToExtensions(const QString & theFilter); + + /// Returns list of validator formats QStringList getValidatorFormats() const; - private: + /// Returns string containing formats + QString filterString() const; + + static QString applyExtension(const QString& theFileName, const QString& theFilter); + +protected: + /// A control for path input QLineEdit* myPathField; - QWidget* myMainWidget; + /// A title of open file dialog box QString myTitle; + + /// A current format + QString mySelectedFilter; + + /// A title of open file dialog box + enum { WFS_OPEN, WFS_SAVE } myType; + + /// Default path QString myDefaultPath; };