compressedfilemaxkbs had no default in the sample conf which created some weirdness in the index config GUI (but no actual problem). Add default in sample conf + a way to set a default value in the c++ code

This commit is contained in:
Jean-Francois Dockes 2010-08-31 09:48:26 +02:00
parent d6cd7dad78
commit 77211c0db3
4 changed files with 14 additions and 7 deletions

View File

@ -112,8 +112,9 @@ ConfParamIntW::ConfParamIntW(QWidget *parent, ConfLink cflink,
const QString& lbltxt, const QString& lbltxt,
const QString& tltptxt, const QString& tltptxt,
int minvalue, int minvalue,
int maxvalue) int maxvalue,
: ConfParamW(parent, cflink) int defaultvalue)
: ConfParamW(parent, cflink), m_defaultvalue(defaultvalue)
{ {
if (!createCommon(lbltxt, tltptxt)) if (!createCommon(lbltxt, tltptxt))
return; return;
@ -144,8 +145,10 @@ ConfParamIntW::ConfParamIntW(QWidget *parent, ConfLink cflink,
void ConfParamIntW::loadValue() void ConfParamIntW::loadValue()
{ {
string s; string s;
m_cflink->get(s); if (m_cflink->get(s))
m_sb->setValue(atoi(s.c_str())); m_sb->setValue(atoi(s.c_str()));
else
m_sb->setValue(m_defaultvalue);
} }
ConfParamStrW::ConfParamStrW(QWidget *parent, ConfLink cflink, ConfParamStrW::ConfParamStrW(QWidget *parent, ConfLink cflink,

View File

@ -104,16 +104,20 @@ namespace confgui {
class ConfParamIntW : public ConfParamW { class ConfParamIntW : public ConfParamW {
Q_OBJECT Q_OBJECT
public: public:
// The default value is only used if none exists in the sample
// configuration file. Defaults are normally set in there.
ConfParamIntW(QWidget *parent, ConfLink cflink, ConfParamIntW(QWidget *parent, ConfLink cflink,
const QString& lbltxt, const QString& lbltxt,
const QString& tltptxt, const QString& tltptxt,
int minvalue = INT_MIN, int minvalue = INT_MIN,
int maxvalue = INT_MAX); int maxvalue = INT_MAX,
int defaultvalue = 0);
virtual void loadValue(); virtual void loadValue();
public slots: public slots:
virtual void setEnabled(bool i) {if(m_sb) ((QWidget*)m_sb)->setEnabled(i);} virtual void setEnabled(bool i) {if(m_sb) ((QWidget*)m_sb)->setEnabled(i);}
protected: protected:
QSpinBox *m_sb; QSpinBox *m_sb;
int m_defaultvalue;
}; };
// Arbitrary string // Arbitrary string

View File

@ -439,7 +439,7 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
tr("This value sets a threshold beyond which compressed" tr("This value sets a threshold beyond which compressed"
"files will not be processed. Set to -1 for no " "files will not be processed. Set to -1 for no "
"limit, to 0 for no decompression ever."), "limit, to 0 for no decompression ever."),
-1, 1000000); -1, 1000000, -1);
m_widgets.push_back(ezfmaxkbs); m_widgets.push_back(ezfmaxkbs);
ConfLink lnktxtmaxmbs(new ConfLinkRclRep(config, "textfilemaxmbs")); ConfLink lnktxtmaxmbs(new ConfLinkRclRep(config, "textfilemaxmbs"));

View File

@ -106,7 +106,7 @@ indexallfilenames = 1
# temporary directory for identification, which can be wasteful in some # temporary directory for identification, which can be wasteful in some
# cases. Limit the waste. Negative means no limit. 0 results in no # cases. Limit the waste. Negative means no limit. 0 results in no
# processing of any compressed file # processing of any compressed file
# compressedfilemaxkbs = -1 compressedfilemaxkbs = -1
# Size limit for text files. This is for skipping monster logs # Size limit for text files. This is for skipping monster logs
textfilemaxmbs = 20 textfilemaxmbs = 20