From 59545762213f67cbbadce49c048123e16c4f2950 Mon Sep 17 00:00:00 2001 From: dockes Date: Fri, 19 Oct 2007 14:31:40 +0000 Subject: [PATCH] small sizing adjustments --- src/qtgui/confgui/confgui.h | 29 +++++++++++++++++++++++++---- src/qtgui/confgui/confguiindex.cpp | 21 ++++++++++++++++----- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/qtgui/confgui/confgui.h b/src/qtgui/confgui/confgui.h index e628cb67..b0b54f87 100644 --- a/src/qtgui/confgui/confgui.h +++ b/src/qtgui/confgui/confgui.h @@ -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 #include @@ -37,19 +56,21 @@ namespace confgui { }; typedef RefCntr 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: diff --git a/src/qtgui/confgui/confguiindex.cpp b/src/qtgui/confgui/confguiindex.cpp index 8e3ec3ec..7f3e32f2 100644 --- a/src/qtgui/confgui/confguiindex.cpp +++ b/src/qtgui/confgui/confguiindex.cpp @@ -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 @@ -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.
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("Subdirectories with specific parameters"), + QObject::tr("Customised subtrees"), QObject::tr("The list of subdirectories in the indexed " "hierarchy
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,