2014-04-23 03:17:19 +00:00
|
|
|
#ifndef CSMSETTINGS_SETTING_HPP
|
|
|
|
#define CSMSETTINGS_SETTING_HPP
|
|
|
|
|
|
|
|
#include <QStringList>
|
|
|
|
#include <QMap>
|
|
|
|
#include "support.hpp"
|
|
|
|
|
|
|
|
namespace CSMSettings
|
|
|
|
{
|
2014-05-07 02:58:50 +00:00
|
|
|
//QString is the setting id in the form of "page/name"
|
|
|
|
//QList is a list of stringlists of proxy values.
|
|
|
|
//Order is important! Proxy stringlists are matched against
|
|
|
|
//master values by their position in the QList.
|
2014-04-23 03:17:19 +00:00
|
|
|
typedef QMap <QString, QList <QStringList> > ProxyValueMap;
|
|
|
|
|
2014-05-07 02:58:50 +00:00
|
|
|
///Setting class is the interface for the User Settings. It contains
|
|
|
|
///a great deal of boiler plate to provide the core API functions, as
|
|
|
|
///well as the property() functions which use enumeration to be iterable.
|
|
|
|
///This makes the Setting class capable of being manipulated by script.
|
|
|
|
///See CSMSettings::support.hpp for enumerations / string values.
|
2014-04-23 03:17:19 +00:00
|
|
|
class Setting
|
|
|
|
{
|
|
|
|
QList <QStringList> mProperties;
|
|
|
|
QStringList mDefaults;
|
|
|
|
|
|
|
|
bool mIsEditorSetting;
|
|
|
|
|
|
|
|
ProxyValueMap mProxies;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2014-10-15 11:39:53 +00:00
|
|
|
Setting(SettingType typ, const QString &settingName,
|
|
|
|
const QString &pageName, const QString& label = "");
|
2014-04-23 03:17:19 +00:00
|
|
|
|
|
|
|
void addProxy (const Setting *setting, const QStringList &vals);
|
|
|
|
void addProxy (const Setting *setting, const QList <QStringList> &list);
|
|
|
|
|
|
|
|
const QList <QStringList> &properties() const { return mProperties; }
|
|
|
|
const ProxyValueMap &proxies() const { return mProxies; }
|
|
|
|
|
|
|
|
void setColumnSpan (int value);
|
|
|
|
int columnSpan() const;
|
|
|
|
|
|
|
|
void setDeclaredValues (QStringList list);
|
|
|
|
QStringList declaredValues() const;
|
|
|
|
|
2014-05-04 03:02:16 +00:00
|
|
|
void setDefaultValue (int value);
|
|
|
|
void setDefaultValue (double value);
|
2014-04-23 03:17:19 +00:00
|
|
|
void setDefaultValue (const QString &value);
|
|
|
|
|
|
|
|
void setDefaultValues (const QStringList &values);
|
|
|
|
QStringList defaultValues() const;
|
|
|
|
|
|
|
|
void setDelimiter (const QString &value);
|
|
|
|
QString delimiter() const;
|
|
|
|
|
|
|
|
void setEditorSetting (bool state);
|
|
|
|
bool isEditorSetting() const;
|
|
|
|
|
|
|
|
void setIsMultiLine (bool state);
|
|
|
|
bool isMultiLine() const;
|
|
|
|
|
|
|
|
void setIsMultiValue (bool state);
|
|
|
|
bool isMultiValue() const;
|
|
|
|
|
2014-05-03 23:58:43 +00:00
|
|
|
void setMask (const QString &value);
|
|
|
|
QString mask() const;
|
|
|
|
|
2014-10-15 10:13:22 +00:00
|
|
|
void setRange (int min, int max);
|
|
|
|
void setRange (double min, double max);
|
|
|
|
|
2014-05-04 02:50:08 +00:00
|
|
|
QString maximum() const;
|
|
|
|
|
|
|
|
QString minimum() const;
|
|
|
|
|
2014-04-23 03:17:19 +00:00
|
|
|
void setName (const QString &value);
|
|
|
|
QString name() const;
|
|
|
|
|
|
|
|
void setPage (const QString &value);
|
|
|
|
QString page() const;
|
|
|
|
|
2014-09-22 02:19:18 +00:00
|
|
|
void setStyleSheet (const QString &value);
|
|
|
|
QString styleSheet() const;
|
|
|
|
|
2014-05-03 23:58:43 +00:00
|
|
|
void setPrefix (const QString &value);
|
|
|
|
QString prefix() const;
|
|
|
|
|
2014-04-23 03:17:19 +00:00
|
|
|
void setRowSpan (const int value);
|
|
|
|
int rowSpan() const;
|
|
|
|
|
|
|
|
const ProxyValueMap &proxyLists() const;
|
|
|
|
|
|
|
|
void setSerializable (bool state);
|
|
|
|
bool serializable() const;
|
|
|
|
|
2014-05-03 23:58:43 +00:00
|
|
|
void setSpecialValueText (const QString &text);
|
|
|
|
QString specialValueText() const;
|
|
|
|
|
|
|
|
void setSingleStep (int value);
|
|
|
|
void setSingleStep (double value);
|
|
|
|
QString singleStep() const;
|
|
|
|
|
|
|
|
void setSuffix (const QString &value);
|
|
|
|
QString suffix() const;
|
|
|
|
|
2014-05-04 02:50:08 +00:00
|
|
|
void setTickInterval (int value);
|
|
|
|
int tickInterval() const;
|
2014-05-03 23:58:43 +00:00
|
|
|
|
2014-05-04 02:50:08 +00:00
|
|
|
void setTicksAbove (bool state);
|
|
|
|
bool ticksAbove() const;
|
|
|
|
|
|
|
|
void setTicksBelow (bool state);
|
|
|
|
bool ticksBelow() const;
|
2014-05-03 23:58:43 +00:00
|
|
|
|
2014-04-23 03:17:19 +00:00
|
|
|
void setViewColumn (int value);
|
|
|
|
int viewColumn() const;
|
|
|
|
|
|
|
|
void setViewLocation (int row = -1, int column = -1);
|
|
|
|
|
|
|
|
void setViewRow (int value);
|
|
|
|
int viewRow() const;
|
|
|
|
|
2014-05-03 23:58:43 +00:00
|
|
|
void setType (int settingType);
|
|
|
|
CSMSettings::SettingType type() const;
|
|
|
|
|
2014-04-23 03:17:19 +00:00
|
|
|
CSVSettings::ViewType viewType() const;
|
|
|
|
|
2014-05-03 23:58:43 +00:00
|
|
|
void setWrapping (bool state);
|
|
|
|
bool wrapping() const;
|
|
|
|
|
2014-04-23 03:17:19 +00:00
|
|
|
void setWidgetWidth (int value);
|
|
|
|
int widgetWidth() const;
|
|
|
|
|
2014-10-15 11:39:53 +00:00
|
|
|
/// This is the text the user gets to see.
|
|
|
|
void setLabel (const QString& label);
|
|
|
|
QString getLabel() const;
|
|
|
|
|
2014-10-16 13:11:07 +00:00
|
|
|
void setToolTip (const QString& toolTip);
|
|
|
|
QString getToolTip() const;
|
|
|
|
|
2014-04-23 03:17:19 +00:00
|
|
|
///returns the specified property value
|
|
|
|
QStringList property (SettingProperty prop) const;
|
|
|
|
|
|
|
|
///boilerplate code to convert setting values of common types
|
|
|
|
void setProperty (SettingProperty prop, bool value);
|
|
|
|
void setProperty (SettingProperty prop, int value);
|
2014-05-03 23:58:43 +00:00
|
|
|
void setProperty (SettingProperty prop, double value);
|
2014-04-23 03:17:19 +00:00
|
|
|
void setProperty (SettingProperty prop, const QString &value);
|
|
|
|
void setProperty (SettingProperty prop, const QStringList &value);
|
|
|
|
|
|
|
|
void addProxy (Setting* setting,
|
|
|
|
QMap <QString, QStringList> &proxyMap);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void buildDefaultSetting();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // CSMSETTINGS_SETTING_HPP
|