GUI config: propose default name for log file
This commit is contained in:
parent
a68350c5a6
commit
57298d98be
@ -236,9 +236,12 @@ void ConfParamBoolW::loadValue()
|
|||||||
ConfParamFNW::ConfParamFNW(QWidget *parent, ConfLink cflink,
|
ConfParamFNW::ConfParamFNW(QWidget *parent, ConfLink cflink,
|
||||||
const QString& lbltxt,
|
const QString& lbltxt,
|
||||||
const QString& tltptxt,
|
const QString& tltptxt,
|
||||||
bool isdir
|
bool isdir,
|
||||||
|
QString dirloc,
|
||||||
|
QString dfltnm
|
||||||
)
|
)
|
||||||
: ConfParamW(parent, cflink), m_isdir(isdir)
|
: ConfParamW(parent, cflink), m_isdir(isdir), m_dirloc(dirloc),
|
||||||
|
m_dfltnm(dfltnm)
|
||||||
{
|
{
|
||||||
if (!createCommon(lbltxt, tltptxt))
|
if (!createCommon(lbltxt, tltptxt))
|
||||||
return;
|
return;
|
||||||
@ -274,7 +277,7 @@ void ConfParamFNW::loadValue()
|
|||||||
|
|
||||||
void ConfParamFNW::showBrowserDialog()
|
void ConfParamFNW::showBrowserDialog()
|
||||||
{
|
{
|
||||||
QString s = myGetFileName(m_isdir);
|
QString s = myGetFileName(m_isdir, "", false, m_dirloc, m_dfltnm);
|
||||||
if (!s.isEmpty())
|
if (!s.isEmpty())
|
||||||
m_le->setText(s);
|
m_le->setText(s);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -166,7 +166,11 @@ namespace confgui {
|
|||||||
const QString& tltptxt);
|
const QString& tltptxt);
|
||||||
virtual void loadValue();
|
virtual void loadValue();
|
||||||
public slots:
|
public slots:
|
||||||
virtual void setEnabled(bool i) {if(m_cb) ((QWidget*)m_cb)->setEnabled(i);}
|
virtual void setEnabled(bool i) {
|
||||||
|
if(m_cb) {
|
||||||
|
((QWidget*)m_cb)->setEnabled(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
QCheckBox *m_cb;
|
QCheckBox *m_cb;
|
||||||
};
|
};
|
||||||
@ -176,14 +180,16 @@ namespace confgui {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ConfParamFNW(QWidget *parent, ConfLink cflink,
|
ConfParamFNW(QWidget *parent, ConfLink cflink,
|
||||||
const QString& lbltxt,
|
const QString& lbltxt,
|
||||||
const QString& tltptxt, bool isdir = false);
|
const QString& tltptxt, bool isdir = false,
|
||||||
|
QString dirloc = QString(),
|
||||||
|
QString dfltnm = QString()
|
||||||
|
);
|
||||||
virtual void loadValue();
|
virtual void loadValue();
|
||||||
protected slots:
|
protected slots:
|
||||||
void showBrowserDialog();
|
void showBrowserDialog();
|
||||||
public slots:
|
public slots:
|
||||||
virtual void setEnabled(bool i)
|
virtual void setEnabled(bool i) {
|
||||||
{
|
|
||||||
if(m_le) ((QWidget*)m_le)->setEnabled(i);
|
if(m_le) ((QWidget*)m_le)->setEnabled(i);
|
||||||
if(m_pb) ((QWidget*)m_pb)->setEnabled(i);
|
if(m_pb) ((QWidget*)m_pb)->setEnabled(i);
|
||||||
}
|
}
|
||||||
@ -191,6 +197,8 @@ namespace confgui {
|
|||||||
QLineEdit *m_le;
|
QLineEdit *m_le;
|
||||||
QPushButton *m_pb;
|
QPushButton *m_pb;
|
||||||
bool m_isdir;
|
bool m_isdir;
|
||||||
|
QString m_dirloc;
|
||||||
|
QString m_dfltnm;
|
||||||
};
|
};
|
||||||
|
|
||||||
// String list
|
// String list
|
||||||
|
|||||||
@ -394,7 +394,9 @@ ConfTopPanelW::ConfTopPanelW(QWidget *parent, ConfNull *config)
|
|||||||
ConfLink(new ConfLinkRclRep(config, "logfilename")),
|
ConfLink(new ConfLinkRclRep(config, "logfilename")),
|
||||||
tr("Log file name"),
|
tr("Log file name"),
|
||||||
tr("The file where the messages will be written.<br>"
|
tr("The file where the messages will be written.<br>"
|
||||||
"Use 'stderr' for terminal output"), false);
|
"Use 'stderr' for terminal output"), false,
|
||||||
|
u8s2qs(tmplocation()),
|
||||||
|
"log-recoll.txt");
|
||||||
gl1->addWidget(w, gridrow++, 1);
|
gl1->addWidget(w, gridrow++, 1);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -418,7 +418,8 @@ int main(int argc, char **argv)
|
|||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString myGetFileName(bool isdir, QString caption, bool filenosave)
|
QString myGetFileName(bool isdir, QString caption, bool filenosave,
|
||||||
|
QString dirloc, QString dfltnm)
|
||||||
{
|
{
|
||||||
LOGDEB1("myFileDialog: isdir " << isdir << "\n");
|
LOGDEB1("myFileDialog: isdir " << isdir << "\n");
|
||||||
QFileDialog dialog(0, caption);
|
QFileDialog dialog(0, caption);
|
||||||
@ -436,7 +437,12 @@ QString myGetFileName(bool isdir, QString caption, bool filenosave)
|
|||||||
QUrl("clsid:B4BFCC3A-DB2C-424C-B029-7FE99A87C641"));
|
QUrl("clsid:B4BFCC3A-DB2C-424C-B029-7FE99A87C641"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (!dirloc.isEmpty()) {
|
||||||
|
dialog.setDirectory(dirloc);
|
||||||
|
}
|
||||||
|
if (!dfltnm.isEmpty()) {
|
||||||
|
dialog.selectFile(dfltnm);
|
||||||
|
}
|
||||||
if (isdir) {
|
if (isdir) {
|
||||||
dialog.setFileMode(QFileDialog::Directory);
|
dialog.setFileMode(QFileDialog::Directory);
|
||||||
dialog.setOptions(QFileDialog::ShowDirsOnly);
|
dialog.setOptions(QFileDialog::ShowDirsOnly);
|
||||||
@ -460,4 +466,3 @@ QString myGetFileName(bool isdir, QString caption, bool filenosave)
|
|||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -62,6 +62,9 @@ inline QString u8s2qs(const std::string us)
|
|||||||
/** Specialized version of the qt file dialog. Can't use getOpenFile()
|
/** Specialized version of the qt file dialog. Can't use getOpenFile()
|
||||||
etc. cause they hide dot files... */
|
etc. cause they hide dot files... */
|
||||||
extern QString myGetFileName(bool isdir, QString caption = QString(),
|
extern QString myGetFileName(bool isdir, QString caption = QString(),
|
||||||
bool filenosave = false);
|
bool filenosave = false,
|
||||||
|
QString dirlocation = QString(),
|
||||||
|
QString dlftnm = QString()
|
||||||
|
);
|
||||||
|
|
||||||
#endif /* _RECOLL_H_INCLUDED_ */
|
#endif /* _RECOLL_H_INCLUDED_ */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user