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

View File

@ -104,16 +104,20 @@ namespace confgui {
class ConfParamIntW : public ConfParamW {
Q_OBJECT
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,
const QString& lbltxt,
const QString& tltptxt,
int minvalue = INT_MIN,
int maxvalue = INT_MAX);
int maxvalue = INT_MAX,
int defaultvalue = 0);
virtual void loadValue();
public slots:
virtual void setEnabled(bool i) {if(m_sb) ((QWidget*)m_sb)->setEnabled(i);}
protected:
QSpinBox *m_sb;
int m_defaultvalue;
};
// Arbitrary string

View File

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

View File

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