Skip to content
Snippets Groups Projects
Commit b23379dd authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

ShortHelp -> Label

parent c8f37212
No related branches found
No related tags found
No related merge requests found
...@@ -660,8 +660,10 @@ void Msg::ExchangeOnelabParameter(const std::string &key, ...@@ -660,8 +660,10 @@ void Msg::ExchangeOnelabParameter(const std::string &key,
} }
if(fopt.count("Step")) ps[0].setStep(fopt["Step"][0]); if(fopt.count("Step")) ps[0].setStep(fopt["Step"][0]);
if(fopt.count("Choices")) ps[0].setChoices(fopt["Choices"]); if(fopt.count("Choices")) ps[0].setChoices(fopt["Choices"]);
if(fopt.count("Visible")) ps[0].setVisible(fopt["Visible"][0] ? true : false);
if(copt.count("Help")) ps[0].setHelp(copt["Help"][0]); if(copt.count("Help")) ps[0].setHelp(copt["Help"][0]);
if(copt.count("ShortHelp")) ps[0].setShortHelp(copt["ShortHelp"][0]); if(copt.count("Label")) ps[0].setLabel(copt["Label"][0]);
if(copt.count("ShortHelp")) ps[0].setLabel(copt["ShortHelp"][0]);
if(copt.count("Loop")) ps[0].setAttribute("Loop", copt["Loop"][0]); if(copt.count("Loop")) ps[0].setAttribute("Loop", copt["Loop"][0]);
if(copt.count("Graph")) ps[0].setAttribute("Graph", copt["Graph"][0]); if(copt.count("Graph")) ps[0].setAttribute("Graph", copt["Graph"][0]);
if(copt.count("Hightlight")) ps[0].setAttribute("Highlight", copt["Hightlight"][0]); if(copt.count("Hightlight")) ps[0].setAttribute("Highlight", copt["Hightlight"][0]);
......
...@@ -40,15 +40,17 @@ namespace onelab{ ...@@ -40,15 +40,17 @@ namespace onelab{
// The base parameter class. // The base parameter class.
class parameter{ class parameter{
private: private:
// the name of the parameter, including its '/'-separated path in // the name of the parameter, including its '/'-separated path in the
// the parameter hierarchy. Parameters or subpaths can start with // parameter hierarchy. Parameters or subpaths can start with numbers to
// numbers to force their relative ordering (such numbers are // force their relative ordering (such numbers are automatically hidden in
// automatically hidden in the interface). // the interface).
std::string _name; std::string _name;
// help strings (if provided, the short help serves as a better // the parameter label: if provided it serves as a better way to display the
// way to display the parameter in the interface). Richer encoding // parameter in the interface (richer encoding (UTF? HTML?) might be used in
// (UTF? HTML?) might be used in the future. // the future)
std::string _shortHelp, _help; std::string _label;
// a help string (richer encoding (UTF? HTML?) might be used in the future)
std::string _help;
// clients that use this parameter // clients that use this parameter
std::set<std::string> _clients; std::set<std::string> _clients;
// flag to check if the parameter has been changed since the last // flag to check if the parameter has been changed since the last
...@@ -60,12 +62,13 @@ namespace onelab{ ...@@ -60,12 +62,13 @@ namespace onelab{
// optional additional attributes // optional additional attributes
std::map<std::string, std::string> _attributes; std::map<std::string, std::string> _attributes;
public: public:
parameter(const std::string &name="", const std::string &shortHelp="", parameter(const std::string &name="", const std::string &label="",
const std::string &help="") const std::string &help="")
: _name(name), _shortHelp(shortHelp), _help(help), _changed(true), : _name(name), _label(label), _help(help), _changed(true),
_visible(true) {} _visible(true) {}
void setName(const std::string &name){ _name = name; } void setName(const std::string &name){ _name = name; }
void setShortHelp(const std::string &shortHelp){ _shortHelp = shortHelp; } void setLabel(const std::string &label){ _label = label; }
void setShortHelp(const std::string &label){ _label = label; } // deprecated
void setHelp(const std::string &help){ _help = help; } void setHelp(const std::string &help){ _help = help; }
void setChanged(bool changed){ _changed = changed; } void setChanged(bool changed){ _changed = changed; }
void setVisible(bool visible){ _visible = visible; } void setVisible(bool visible){ _visible = visible; }
...@@ -89,11 +92,12 @@ namespace onelab{ ...@@ -89,11 +92,12 @@ namespace onelab{
} }
virtual std::string getType() const = 0; virtual std::string getType() const = 0;
const std::string &getName() const { return _name; } const std::string &getName() const { return _name; }
const std::string &getShortHelp() const { return _shortHelp; } const std::string &getLabel() const { return _label; }
const std::string &getShortHelp() const { return _label; } // deprecated
const std::string &getHelp() const { return _help; } const std::string &getHelp() const { return _help; }
std::string getShortName() const std::string getShortName() const
{ {
if(_shortHelp.size()) return _shortHelp; if(_label.size()) return _label;
std::string s = _name; std::string s = _name;
// remove path // remove path
std::string::size_type last = _name.find_last_of('/'); std::string::size_type last = _name.find_last_of('/');
...@@ -141,7 +145,7 @@ namespace onelab{ ...@@ -141,7 +145,7 @@ namespace onelab{
std::ostringstream sstream; std::ostringstream sstream;
sstream << version() << charSep() << getType() << charSep() sstream << version() << charSep() << getType() << charSep()
<< sanitize(getName()) << charSep() << sanitize(getName()) << charSep()
<< sanitize(getShortHelp()) << charSep() << sanitize(getLabel()) << charSep()
<< sanitize(getHelp()) << charSep() << sanitize(getHelp()) << charSep()
<< (getVisible() ? 1 : 0) << charSep() << (getVisible() ? 1 : 0) << charSep()
<< _attributes.size() << charSep(); << _attributes.size() << charSep();
...@@ -161,7 +165,7 @@ namespace onelab{ ...@@ -161,7 +165,7 @@ namespace onelab{
if(getNextToken(msg, pos) != version()) return 0; if(getNextToken(msg, pos) != version()) return 0;
if(getNextToken(msg, pos) != getType()) return 0; if(getNextToken(msg, pos) != getType()) return 0;
setName(getNextToken(msg, pos)); setName(getNextToken(msg, pos));
setShortHelp(getNextToken(msg, pos)); setLabel(getNextToken(msg, pos));
setHelp(getNextToken(msg, pos)); setHelp(getNextToken(msg, pos));
setVisible(atoi(getNextToken(msg, pos).c_str())); setVisible(atoi(getNextToken(msg, pos).c_str()));
int numAttributes = atoi(getNextToken(msg, pos).c_str()); int numAttributes = atoi(getNextToken(msg, pos).c_str());
...@@ -205,8 +209,8 @@ namespace onelab{ ...@@ -205,8 +209,8 @@ namespace onelab{
std::vector<double> _choices; std::vector<double> _choices;
public: public:
number(const std::string &name="", double value=0., number(const std::string &name="", double value=0.,
const std::string &shortHelp="", const std::string &help="") const std::string &label="", const std::string &help="")
: parameter(name, shortHelp, help), _value(value), : parameter(name, label, help), _value(value),
_min(-maxNumber()), _max(maxNumber()), _step(0.) {} _min(-maxNumber()), _max(maxNumber()), _step(0.) {}
void setValue(double value){ _value = value; } void setValue(double value){ _value = value; }
void setMin(double min){ _min = min; } void setMin(double min){ _min = min; }
...@@ -222,8 +226,9 @@ namespace onelab{ ...@@ -222,8 +226,9 @@ namespace onelab{
void update(const number &p) void update(const number &p)
{ {
addClients(p.getClients()); // complete the list addClients(p.getClients()); // complete the list
setShortHelp(p.getShortHelp()); setLabel(p.getLabel());
setHelp(p.getHelp()); setHelp(p.getHelp());
setVisible(p.getVisible());
setAttributes(p.getAttributes()); setAttributes(p.getAttributes());
if(p.getValue() != getValue()){ if(p.getValue() != getValue()){
setValue(p.getValue()); setValue(p.getValue());
...@@ -233,7 +238,6 @@ namespace onelab{ ...@@ -233,7 +238,6 @@ namespace onelab{
setMax(p.getMax()); setMax(p.getMax());
setStep(p.getStep()); setStep(p.getStep());
setChoices(p.getChoices()); setChoices(p.getChoices());
setVisible(p.getVisible());// FIXME Why not?
} }
std::string toChar() const std::string toChar() const
{ {
...@@ -273,8 +277,8 @@ namespace onelab{ ...@@ -273,8 +277,8 @@ namespace onelab{
std::vector<std::string> _choices; std::vector<std::string> _choices;
public: public:
string(const std::string &name="", const std::string &value="", string(const std::string &name="", const std::string &value="",
const std::string &shortHelp="", const std::string &help="") const std::string &label="", const std::string &help="")
: parameter(name, shortHelp, help), _value(value), _kind("generic") {} : parameter(name, label, help), _value(value), _kind("generic") {}
void setValue(const std::string &value){ _value = value; } void setValue(const std::string &value){ _value = value; }
void setKind(const std::string &kind){ _kind = kind; } void setKind(const std::string &kind){ _kind = kind; }
void setChoices(const std::vector<std::string> &choices){ _choices = choices; } void setChoices(const std::vector<std::string> &choices){ _choices = choices; }
...@@ -285,8 +289,9 @@ namespace onelab{ ...@@ -285,8 +289,9 @@ namespace onelab{
void update(const string &p) void update(const string &p)
{ {
addClients(p.getClients()); addClients(p.getClients());
setShortHelp(p.getShortHelp()); setLabel(p.getLabel());
setHelp(p.getHelp()); setHelp(p.getHelp());
setVisible(p.getVisible());
setAttributes(p.getAttributes()); setAttributes(p.getAttributes());
if(p.getValue() != getValue()){ if(p.getValue() != getValue()){
setValue(p.getValue()); setValue(p.getValue());
...@@ -297,7 +302,6 @@ namespace onelab{ ...@@ -297,7 +302,6 @@ namespace onelab{
setChanged(true); setChanged(true);
} }
setChoices(p.getChoices()); setChoices(p.getChoices());
setVisible(p.getVisible());// FIXME Why not?
} }
std::string toChar() const std::string toChar() const
{ {
...@@ -334,15 +338,15 @@ namespace onelab{ ...@@ -334,15 +338,15 @@ namespace onelab{
public: public:
region(const std::string &name="", region(const std::string &name="",
const std::set<std::string> &value = std::set<std::string>(), const std::set<std::string> &value = std::set<std::string>(),
const std::string &shortHelp="", const std::string &help="") const std::string &label="", const std::string &help="")
: parameter(name, shortHelp, help), _value(value) {} : parameter(name, label, help), _value(value) {}
void setValue(const std::set<std::string> &value){ _value = value; } void setValue(const std::set<std::string> &value){ _value = value; }
std::string getType() const { return "region"; } std::string getType() const { return "region"; }
const std::set<std::string> &getValue() const { return _value; } const std::set<std::string> &getValue() const { return _value; }
void update(const region &p) void update(const region &p)
{ {
addClients(p.getClients()); addClients(p.getClients());
setShortHelp(p.getShortHelp()); setLabel(p.getLabel());
setHelp(p.getHelp()); setHelp(p.getHelp());
setAttributes(p.getAttributes()); setAttributes(p.getAttributes());
if(p.getValue() != getValue()){ if(p.getValue() != getValue()){
...@@ -375,8 +379,8 @@ namespace onelab{ ...@@ -375,8 +379,8 @@ namespace onelab{
std::vector<std::string> _choices; std::vector<std::string> _choices;
public: public:
function(const std::string &name="", const std::string &value="", function(const std::string &name="", const std::string &value="",
const std::string &shortHelp="", const std::string &help="") const std::string &label="", const std::string &help="")
: parameter(name, shortHelp, help), _value(value) {} : parameter(name, label, help), _value(value) {}
void setValue(const std::string &value, const std::string &region="") void setValue(const std::string &value, const std::string &region="")
{ {
if(region.empty()) if(region.empty())
...@@ -402,7 +406,7 @@ namespace onelab{ ...@@ -402,7 +406,7 @@ namespace onelab{
void update(const function &p) void update(const function &p)
{ {
addClients(p.getClients()); addClients(p.getClients());
setShortHelp(p.getShortHelp()); setLabel(p.getLabel());
setHelp(p.getHelp()); setHelp(p.getHelp());
setAttributes(p.getAttributes()); setAttributes(p.getAttributes());
if(p.getValue() != getValue()){ if(p.getValue() != getValue()){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment