small sizing adjustments

This commit is contained in:
dockes 2007-10-19 14:31:40 +00:00
parent 607da9bb5e
commit 5954576221
2 changed files with 41 additions and 9 deletions

View File

@ -1,7 +1,26 @@
#ifndef _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 <qglobal.h>
@ -37,19 +56,21 @@ namespace confgui {
};
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 {
public:
virtual ~ConfLinkNullRep() {}
virtual bool set(const string&)
{
//fprintf(stderr, "Setting value to [%s]\n", val.c_str());
return true;
}
virtual bool get(string& val) {val = ""; return true;}
};
// 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 {
Q_OBJECT
public:

View File

@ -1,5 +1,5 @@
#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
#include <qglobal.h>
@ -65,11 +65,12 @@ const static int margin = 6;
ConfIndexW::ConfIndexW(QWidget *parent, RclConfig *config)
: QTABDIALOG(parent), m_rclconf(config)
{
setCaption(QString::fromLocal8Bit(config->getConfDir().c_str()));
setOkButton();
setCancelButton();
reloadPanels();
resize(QSize(600, 500).expandedTo(minimumSizeHint()));
connect(this, SIGNAL(applyButtonPressed()), this, SLOT(acceptChanges()));
connect(this, SIGNAL(cancelButtonPressed()), this, SLOT(rejectChanges()));
}
@ -136,7 +137,7 @@ ConfTopPanelW::ConfTopPanelW(QWidget *parent, ConfNull *config)
ConfParamDNLW *etopdirs = new
ConfParamDNLW(this, lnktopdirs, tr("Top directories"),
tr("The list of directories where recursive "
"indexing starts.<br>Default: your home."));
"indexing starts. Default: your home."));
vboxLayout->addWidget(etopdirs);
ConfLink lnkskp(new ConfLinkRclRep(config, "skippedPaths"));
@ -245,10 +246,15 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
ConfLink lnksubkeydirs(new ConfLinkNullRep());
m_subdirs = new
ConfParamDNLW(this, lnksubkeydirs,
QObject::tr("<b>Subdirectories with specific parameters"),
QObject::tr("<b>Customised subtrees"),
QObject::tr("The list of subdirectories in the indexed "
"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);
connect(m_subdirs->getListBox(), SIGNAL(selectionChanged()),
this, SLOT(subDirChanged()));
@ -280,6 +286,11 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
vboxLayout->addWidget(line2);
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));
ConfParamSLW *eskn = new
ConfParamSLW(m_groupbox, lnkskn,