small sizing adjustments
This commit is contained in:
parent
607da9bb5e
commit
5954576221
@ -1,7 +1,26 @@
|
|||||||
#ifndef _confgui_h_included_
|
#ifndef _confgui_h_included_
|
||||||
#define _confgui_h_included_
|
#define _confgui_h_included_
|
||||||
/* @(#$Id: confgui.h,v 1.5 2007-10-09 11:08:17 dockes Exp $ (C) 2007 J.F.Dockes */
|
/* @(#$Id: confgui.h,v 1.6 2007-10-19 14:31:40 dockes Exp $ (C) 2007 J.F.Dockes */
|
||||||
|
/**
|
||||||
|
* This file defines a number of simple classes (virtual base: ConfParamW)
|
||||||
|
* which let the user input configuration parameters.
|
||||||
|
*
|
||||||
|
* Subclasses are defined for entering different kind of data, ie a string,
|
||||||
|
* a file name, an integer, etc.
|
||||||
|
*
|
||||||
|
* Each configuration gui object is linked to the configuration data through
|
||||||
|
* a "link" object which knows the details of interacting with the actual
|
||||||
|
* configuration data, like the parameter name, the actual config object,
|
||||||
|
* the method to call etc.
|
||||||
|
*
|
||||||
|
* The link object is set when the input widget is created and cannot be
|
||||||
|
* changed.
|
||||||
|
*
|
||||||
|
* The widgets are typically linked to a temporary configuration object, which
|
||||||
|
* is then copied to the actual configuration if the data is accepted, or
|
||||||
|
* destroyed and recreated as a copy if Cancel is pressed (you have to
|
||||||
|
* delete/recreate the widgets in this case as the links are no longer valid).
|
||||||
|
*/
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <qglobal.h>
|
#include <qglobal.h>
|
||||||
@ -37,19 +56,21 @@ namespace confgui {
|
|||||||
};
|
};
|
||||||
typedef RefCntr<ConfLinkRep> ConfLink;
|
typedef RefCntr<ConfLinkRep> ConfLink;
|
||||||
|
|
||||||
|
// Useful to store/manage data which has no direct representation in
|
||||||
|
// the config, ie list of subkey directories
|
||||||
class ConfLinkNullRep : public ConfLinkRep {
|
class ConfLinkNullRep : public ConfLinkRep {
|
||||||
public:
|
public:
|
||||||
virtual ~ConfLinkNullRep() {}
|
virtual ~ConfLinkNullRep() {}
|
||||||
virtual bool set(const string&)
|
virtual bool set(const string&)
|
||||||
{
|
{
|
||||||
//fprintf(stderr, "Setting value to [%s]\n", val.c_str());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
virtual bool get(string& val) {val = ""; return true;}
|
virtual bool get(string& val) {val = ""; return true;}
|
||||||
};
|
};
|
||||||
|
|
||||||
// A widget to let the user change one configuration
|
// A widget to let the user change one configuration
|
||||||
// parameter. Subclassed for specific parameter types
|
// parameter. Subclassed for specific parameter types. Basically
|
||||||
|
// has a label and some kind of entry widget
|
||||||
class ConfParamW : public QWidget {
|
class ConfParamW : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: confguiindex.cpp,v 1.7 2007-10-18 10:15:53 dockes Exp $ (C) 2007 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: confguiindex.cpp,v 1.8 2007-10-19 14:31:40 dockes Exp $ (C) 2007 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <qglobal.h>
|
#include <qglobal.h>
|
||||||
@ -65,11 +65,12 @@ const static int margin = 6;
|
|||||||
ConfIndexW::ConfIndexW(QWidget *parent, RclConfig *config)
|
ConfIndexW::ConfIndexW(QWidget *parent, RclConfig *config)
|
||||||
: QTABDIALOG(parent), m_rclconf(config)
|
: QTABDIALOG(parent), m_rclconf(config)
|
||||||
{
|
{
|
||||||
|
setCaption(QString::fromLocal8Bit(config->getConfDir().c_str()));
|
||||||
setOkButton();
|
setOkButton();
|
||||||
setCancelButton();
|
setCancelButton();
|
||||||
|
|
||||||
reloadPanels();
|
reloadPanels();
|
||||||
|
resize(QSize(600, 500).expandedTo(minimumSizeHint()));
|
||||||
connect(this, SIGNAL(applyButtonPressed()), this, SLOT(acceptChanges()));
|
connect(this, SIGNAL(applyButtonPressed()), this, SLOT(acceptChanges()));
|
||||||
connect(this, SIGNAL(cancelButtonPressed()), this, SLOT(rejectChanges()));
|
connect(this, SIGNAL(cancelButtonPressed()), this, SLOT(rejectChanges()));
|
||||||
}
|
}
|
||||||
@ -136,7 +137,7 @@ ConfTopPanelW::ConfTopPanelW(QWidget *parent, ConfNull *config)
|
|||||||
ConfParamDNLW *etopdirs = new
|
ConfParamDNLW *etopdirs = new
|
||||||
ConfParamDNLW(this, lnktopdirs, tr("Top directories"),
|
ConfParamDNLW(this, lnktopdirs, tr("Top directories"),
|
||||||
tr("The list of directories where recursive "
|
tr("The list of directories where recursive "
|
||||||
"indexing starts.<br>Default: your home."));
|
"indexing starts. Default: your home."));
|
||||||
vboxLayout->addWidget(etopdirs);
|
vboxLayout->addWidget(etopdirs);
|
||||||
|
|
||||||
ConfLink lnkskp(new ConfLinkRclRep(config, "skippedPaths"));
|
ConfLink lnkskp(new ConfLinkRclRep(config, "skippedPaths"));
|
||||||
@ -245,10 +246,15 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
|||||||
ConfLink lnksubkeydirs(new ConfLinkNullRep());
|
ConfLink lnksubkeydirs(new ConfLinkNullRep());
|
||||||
m_subdirs = new
|
m_subdirs = new
|
||||||
ConfParamDNLW(this, lnksubkeydirs,
|
ConfParamDNLW(this, lnksubkeydirs,
|
||||||
QObject::tr("<b>Subdirectories with specific parameters"),
|
QObject::tr("<b>Customised subtrees"),
|
||||||
QObject::tr("The list of subdirectories in the indexed "
|
QObject::tr("The list of subdirectories in the indexed "
|
||||||
"hierarchy <br>where some parameters need "
|
"hierarchy <br>where some parameters need "
|
||||||
"to be customised. Default: empty."));
|
"to be redefined. Default: empty."));
|
||||||
|
m_subdirs->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||||
|
QSizePolicy::Preferred,
|
||||||
|
1, // Horizontal stretch
|
||||||
|
1, // Vertical stretch
|
||||||
|
m_subdirs->sizePolicy().hasHeightForWidth()));
|
||||||
m_subdirs->getListBox()->setSelectionMode(QLISTBOX::Single);
|
m_subdirs->getListBox()->setSelectionMode(QLISTBOX::Single);
|
||||||
connect(m_subdirs->getListBox(), SIGNAL(selectionChanged()),
|
connect(m_subdirs->getListBox(), SIGNAL(selectionChanged()),
|
||||||
this, SLOT(subDirChanged()));
|
this, SLOT(subDirChanged()));
|
||||||
@ -280,6 +286,11 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
|||||||
vboxLayout->addWidget(line2);
|
vboxLayout->addWidget(line2);
|
||||||
|
|
||||||
m_groupbox = new QGROUPBOX(1, Qt::Horizontal, this);
|
m_groupbox = new QGROUPBOX(1, Qt::Horizontal, this);
|
||||||
|
m_groupbox->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||||
|
QSizePolicy::Preferred,
|
||||||
|
1, // Horizontal stretch
|
||||||
|
3, // Vertical stretch
|
||||||
|
m_groupbox->sizePolicy().hasHeightForWidth()));
|
||||||
ConfLink lnkskn(new ConfLinkRclRep(config, "skippedNames", &m_sk));
|
ConfLink lnkskn(new ConfLinkRclRep(config, "skippedNames", &m_sk));
|
||||||
ConfParamSLW *eskn = new
|
ConfParamSLW *eskn = new
|
||||||
ConfParamSLW(m_groupbox, lnkskn,
|
ConfParamSLW(m_groupbox, lnkskn,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user