confgui: shared change: add str defautls
This commit is contained in:
parent
9e2e73a995
commit
43f2692d1d
@ -475,7 +475,9 @@ void ConfParamStrW::storeValue()
|
|||||||
void ConfParamStrW::loadValue()
|
void ConfParamStrW::loadValue()
|
||||||
{
|
{
|
||||||
string s;
|
string s;
|
||||||
m_cflink->get(s);
|
if (!m_cflink->get(s)) {
|
||||||
|
s = m_strdefault;
|
||||||
|
}
|
||||||
if (m_fsencoding) {
|
if (m_fsencoding) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
m_le->setText(m_origvalue = QString::fromUtf8(s.c_str()));
|
m_le->setText(m_origvalue = QString::fromUtf8(s.c_str()));
|
||||||
@ -529,7 +531,9 @@ void ConfParamCStrW::storeValue()
|
|||||||
void ConfParamCStrW::loadValue()
|
void ConfParamCStrW::loadValue()
|
||||||
{
|
{
|
||||||
string s;
|
string s;
|
||||||
m_cflink->get(s);
|
if (!m_cflink->get(s)) {
|
||||||
|
s = m_strdefault;
|
||||||
|
}
|
||||||
QString cs;
|
QString cs;
|
||||||
if (m_fsencoding) {
|
if (m_fsencoding) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -640,7 +644,9 @@ void ConfParamFNW::storeValue()
|
|||||||
void ConfParamFNW::loadValue()
|
void ConfParamFNW::loadValue()
|
||||||
{
|
{
|
||||||
string s;
|
string s;
|
||||||
m_cflink->get(s);
|
if (!m_cflink->get(s)) {
|
||||||
|
s = m_strdefault;
|
||||||
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
m_le->setText(m_origvalue = QString::fromUtf8(s.c_str()));
|
m_le->setText(m_origvalue = QString::fromUtf8(s.c_str()));
|
||||||
#else
|
#else
|
||||||
@ -784,7 +790,9 @@ void ConfParamSLW::storeValue()
|
|||||||
void ConfParamSLW::loadValue()
|
void ConfParamSLW::loadValue()
|
||||||
{
|
{
|
||||||
m_origvalue.clear();
|
m_origvalue.clear();
|
||||||
m_cflink->get(m_origvalue);
|
if (!m_cflink->get(m_origvalue)) {
|
||||||
|
m_origvalue = m_strdefault;
|
||||||
|
}
|
||||||
vector<string> ls;
|
vector<string> ls;
|
||||||
stringToStrings(m_origvalue, ls);
|
stringToStrings(m_origvalue, ls);
|
||||||
QStringList qls;
|
QStringList qls;
|
||||||
|
|||||||
@ -235,6 +235,10 @@ public:
|
|||||||
const QString& getVarName() {
|
const QString& getVarName() {
|
||||||
return m_varname;
|
return m_varname;
|
||||||
}
|
}
|
||||||
|
void setStrDefault(const std::string& value) {
|
||||||
|
m_strdefault = value;
|
||||||
|
}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void setEnabled(bool) = 0;
|
virtual void setEnabled(bool) = 0;
|
||||||
virtual void storeValue() = 0;
|
virtual void storeValue() = 0;
|
||||||
@ -251,6 +255,8 @@ protected:
|
|||||||
// File names are encoded as local8bit in the config files. Other
|
// File names are encoded as local8bit in the config files. Other
|
||||||
// are encoded as utf-8
|
// are encoded as utf-8
|
||||||
bool m_fsencoding;
|
bool m_fsencoding;
|
||||||
|
// Bool and Int have constructor parameters for the default value. Others may use this
|
||||||
|
std::string m_strdefault;
|
||||||
virtual bool createCommon(const QString& lbltxt, const QString& tltptxt);
|
virtual bool createCommon(const QString& lbltxt, const QString& tltptxt);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user