* \param theDefaultValue - default value of the property. This is an initial property value
*/
Config_Prop(const std::string& theSection, const std::string& theName,
- const std::string& theTitle, PropType theType, const std::string& theDefaultValue)
+ const std::string& theTitle, PropType theType,
+ const std::string& theDefaultValue,
+ const std::string& theMin, const std::string& theMax)
{
mySection = theSection;
myName = theName;
myType = theType;
myValue = theDefaultValue;
myDefaultValue = theDefaultValue;
+ myMin = theMin;
+ myMax = theMax;
}
/// Get name of section
return (mySection == theProp->section()) && (myName == theProp->name());
}
+ /// Returns minimal value
+ std::string min() const { return myMin; }
+
+ void setMin(const std::string& theMin) {
+ myMin = theMin;
+ }
+
+ /// Returns maximal value
+ std::string max() const { return myMax; }
+
+ void setMax(const std::string& theMax) {
+ myMax = theMax;
+ }
+
private:
std::string mySection; ///< Name of section
std::string myName; ///< Name of property
PropType myType; ///< Type of property
std::string myValue; // Value in string format
std::string myDefaultValue; // Default value
+ std::string myMin; // Minimal value
+ std::string myMax; // Maximal value
};
typedef std::list<Config_Prop*> Config_Properties;
const std::string& theName,
const std::string& theTitle,
Config_Prop::PropType theType,
- const std::string& theDefaultValue)
+ const std::string& theDefaultValue,
+ const std::string& theMin,
+ const std::string& theMax)
{
Config_Prop* aProp = findProp(theSection, theName);
aProp->setType(theType);
aProp->setTitle(theTitle);
}
+ aProp->setMin(theMin);
+ aProp->setMax(theMax);
}
else {
- aProp = new Config_Prop(theSection, theName, theTitle, theType, theDefaultValue);
+ aProp =
+ new Config_Prop(theSection, theName, theTitle, theType, theDefaultValue, theMin, theMax);
myProps.push_back(aProp);
}
return aProp;
* \param theTitle - title of the value.
* \param theType - type of the value.
* \param theDefValue - default and initial value of the property
+ * \param theMin - minimal value
+ * \param theMax - minimal value
* Returns True if the property succesfully registered
*/
CONFIG_EXPORT static Config_Prop* registerProp(const std::string& theSection,
const std::string& theName,
const std::string& theTitle, Config_Prop::PropType theType,
- const std::string& theDefValue = "");
+ const std::string& theDefValue = "",
+ const std::string& theMin = "",
+ const std::string& theMax = "");
+
//! Finds property in the given section by the given name, if property not found returns NULL
CONFIG_EXPORT static Config_Prop* findProp(
const std::string& theSection, const std::string& theName);
+
//! Returns std::list of all existing properies
CONFIG_EXPORT static Config_Properties getProperties();
+
//! Returns list of registered section names.
CONFIG_EXPORT static std::list<std::string> getSections();
+
//! Returns list of properties by its owner and section.
CONFIG_EXPORT static Config_Properties getProperties(const std::string& theSection);
const std::string& theName);
//! Returns boolean by given section and name
CONFIG_EXPORT static bool boolean(const std::string& theSection,
- const std::string& theName);
+ const std::string& theName);
+
//! Returns convertion of the string to double value. Temporary changes locale to process
//! values contained "," or "." separator.
//! \param theDouble a value to be converted
new ConstructionPlugin_ValidatorPointThreeNonParallelPlanes());
Config_PropManager::registerProp(SKETCH_TAB_NAME, "planes_size", "Size", Config_Prop::DblSpin,
- PLANE_SIZE);
+ PLANE_SIZE, "0", "1000");
Config_PropManager::registerProp(SKETCH_TAB_NAME, "planes_thickness", "Thickness",
Config_Prop::IntSpin, SKETCH_WIDTH);
Config_PropManager::registerProp(SKETCH_TAB_NAME, "rotate_to_plane",
if(aProp->type() == Config_Prop::Directory) {
thePref->setItemProperty("path_type", Qtx::PT_Directory, anId);
}
+ if (aPrefType == SUIT_PreferenceMgr::DblSpin) {
+ if (aProp->min() != "") {
+ double aMin = QString(aProp->min().c_str()).toDouble();
+ thePref->setItemProperty("min", aMin, anId);
+ }
+ if (aProp->max() != "") {
+ double aMax = QString(aProp->max().c_str()).toDouble();
+ thePref->setItemProperty("max", aMax, anId);
+ }
+ }
}
}
}