compiles cleanly without qt3_support. Needs more testing
This commit is contained in:
+113
-163
@@ -6,37 +6,11 @@ static char rcsid[] = "@(#$Id: confgui.cpp,v 1.9 2008-05-21 07:21:37 dockes Exp
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <qglobal.h>
|
||||
#if QT_VERSION < 0x040000
|
||||
#define QFRAME_INCLUDE <qframe.h>
|
||||
#define QFILEDIALOG_INCLUDE <qfiledialog.h>
|
||||
#define QLISTBOX_INCLUDE <qlistbox.h>
|
||||
#define QFILEDIALOG QFileDialog
|
||||
#define QFRAME QFrame
|
||||
#define QHBOXLAYOUT QHBoxLayout
|
||||
#define QLISTBOX QListBox
|
||||
#define QLISTBOXITEM QListBoxItem
|
||||
#define QLBEXACTMATCH Qt::ExactMatch
|
||||
#define QVBOXLAYOUT QVBoxLayout
|
||||
#else
|
||||
#include <Q3HBoxLayout>
|
||||
#include <Q3VBoxLayout>
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QFrame>
|
||||
#define QFRAME_INCLUDE <q3frame.h>
|
||||
|
||||
#include <QFileDialog>
|
||||
#define QFILEDIALOG_INCLUDE <q3filedialog.h>
|
||||
|
||||
#define QLISTBOX_INCLUDE <q3listbox.h>
|
||||
|
||||
#define QFILEDIALOG Q3FileDialog
|
||||
#define QFRAME Q3Frame
|
||||
#define QHBOXLAYOUT Q3HBoxLayout
|
||||
#define QLISTBOX Q3ListBox
|
||||
#define QLISTBOXITEM Q3ListBoxItem
|
||||
#define QLBEXACTMATCH Q3ListBox::ExactMatch
|
||||
#define QVBOXLAYOUT Q3VBoxLayout
|
||||
#endif
|
||||
#include <QListWidget>
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qlayout.h>
|
||||
@@ -47,13 +21,10 @@ static char rcsid[] = "@(#$Id: confgui.cpp,v 1.9 2008-05-21 07:21:37 dockes Exp
|
||||
#include <qtooltip.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qcheckbox.h>
|
||||
#include QFILEDIALOG_INCLUDE
|
||||
#include <qinputdialog.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qstringlist.h>
|
||||
#include QLISTBOX_INCLUDE
|
||||
#include <qcombobox.h>
|
||||
#include QFRAME_INCLUDE
|
||||
|
||||
#include "confgui.h"
|
||||
#include "smallut.h"
|
||||
@@ -65,15 +36,15 @@ using std::list;
|
||||
|
||||
namespace confgui {
|
||||
|
||||
const static int spacing = 4;
|
||||
const static int margin = 6;
|
||||
const static int spacing = 2;
|
||||
const static int margin = 2;
|
||||
|
||||
void ConfParamW::setValue(const QString& value)
|
||||
{
|
||||
if (m_fsencoding)
|
||||
m_cflink->set(string((const char *)value.local8Bit()));
|
||||
m_cflink->set(string((const char *)value.toLocal8Bit()));
|
||||
else
|
||||
m_cflink->set(string((const char *)value.utf8()));
|
||||
m_cflink->set(string((const char *)value.toUtf8()));
|
||||
}
|
||||
|
||||
void ConfParamW::setValue(int value)
|
||||
@@ -89,19 +60,26 @@ void ConfParamW::setValue(bool value)
|
||||
m_cflink->set(string(buf));
|
||||
}
|
||||
|
||||
void setSzPol(QWidget *w, QSizePolicy::Policy hpol,
|
||||
QSizePolicy::Policy vpol,
|
||||
int hstretch, int vstretch)
|
||||
{
|
||||
QSizePolicy policy(hpol, vpol);
|
||||
policy.setHorizontalStretch(hstretch);
|
||||
policy.setVerticalStretch(vstretch);
|
||||
policy.setHeightForWidth(w->sizePolicy().hasHeightForWidth());
|
||||
w->setSizePolicy(policy);
|
||||
}
|
||||
|
||||
bool ConfParamW::createCommon(const QString& lbltxt, const QString& tltptxt)
|
||||
{
|
||||
m_hl = new QHBOXLAYOUT(this);
|
||||
m_hl = new QHBoxLayout(this);
|
||||
m_hl->setSpacing(spacing);
|
||||
|
||||
QLabel *tl = new QLabel(this);
|
||||
tl->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Fixed,
|
||||
0, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
tl->sizePolicy().hasHeightForWidth() ) );
|
||||
setSzPol(tl, QSizePolicy::Preferred, QSizePolicy::Fixed, 0, 0);
|
||||
tl->setText(lbltxt);
|
||||
QToolTip::add(tl, tltptxt);
|
||||
tl->setToolTip(tltptxt);
|
||||
|
||||
m_hl->addWidget(tl);
|
||||
|
||||
@@ -120,21 +98,13 @@ ConfParamIntW::ConfParamIntW(QWidget *parent, ConfLink cflink,
|
||||
return;
|
||||
|
||||
m_sb = new QSpinBox(this);
|
||||
m_sb->setMinValue(minvalue);
|
||||
m_sb->setMaxValue(maxvalue);
|
||||
m_sb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
|
||||
QSizePolicy::Fixed,
|
||||
0, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
m_sb->sizePolicy().hasHeightForWidth()));
|
||||
m_sb->setMinimum(minvalue);
|
||||
m_sb->setMaximum(maxvalue);
|
||||
setSzPol(m_sb, QSizePolicy::Fixed, QSizePolicy::Fixed, 0, 0);
|
||||
m_hl->addWidget(m_sb);
|
||||
|
||||
QFRAME *fr = new QFRAME(this);
|
||||
fr->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Fixed,
|
||||
1, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
fr->sizePolicy().hasHeightForWidth() ) );
|
||||
QFrame *fr = new QFrame(this);
|
||||
setSzPol(fr, QSizePolicy::Preferred, QSizePolicy::Fixed, 0, 0);
|
||||
m_hl->addWidget(fr);
|
||||
|
||||
loadValue();
|
||||
@@ -158,12 +128,10 @@ ConfParamStrW::ConfParamStrW(QWidget *parent, ConfLink cflink,
|
||||
{
|
||||
if (!createCommon(lbltxt, tltptxt))
|
||||
return;
|
||||
|
||||
m_le = new QLineEdit(this);
|
||||
m_le->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Fixed,
|
||||
1, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
m_le->sizePolicy().hasHeightForWidth()));
|
||||
setSzPol(m_le, QSizePolicy::Preferred, QSizePolicy::Fixed, 1, 0);
|
||||
|
||||
m_hl->addWidget(m_le);
|
||||
|
||||
loadValue();
|
||||
@@ -190,14 +158,12 @@ ConfParamCStrW::ConfParamCStrW(QWidget *parent, ConfLink cflink,
|
||||
{
|
||||
if (!createCommon(lbltxt, tltptxt))
|
||||
return;
|
||||
m_cmb = new QComboBox(false, this);
|
||||
m_cmb->insertStringList(sl);
|
||||
// m_cmb->setEditable(false);
|
||||
m_cmb->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Fixed,
|
||||
1, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
m_cmb->sizePolicy().hasHeightForWidth()));
|
||||
m_cmb = new QComboBox(this);
|
||||
m_cmb->setEditable(FALSE);
|
||||
m_cmb->insertItems(0, sl);
|
||||
|
||||
setSzPol(m_cmb, QSizePolicy::Preferred, QSizePolicy::Fixed, 1, 0);
|
||||
|
||||
m_hl->addWidget(m_cmb);
|
||||
|
||||
loadValue();
|
||||
@@ -216,8 +182,8 @@ void ConfParamCStrW::loadValue()
|
||||
cs = QString::fromUtf8(s.c_str());
|
||||
|
||||
for (int i = 0; i < m_cmb->count(); i++) {
|
||||
if (!cs.compare(m_cmb->text(i))) {
|
||||
m_cmb->setCurrentItem(i);
|
||||
if (!cs.compare(m_cmb->itemText(i))) {
|
||||
m_cmb->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -229,29 +195,20 @@ ConfParamBoolW::ConfParamBoolW(QWidget *parent, ConfLink cflink,
|
||||
: ConfParamW(parent, cflink)
|
||||
{
|
||||
// No createCommon because the checkbox has a label
|
||||
m_hl = new QHBOXLAYOUT(this);
|
||||
m_hl = new QHBoxLayout(this);
|
||||
m_hl->setSpacing(spacing);
|
||||
|
||||
m_cb = new QCheckBox(lbltxt, this);
|
||||
m_cb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
|
||||
QSizePolicy::Fixed,
|
||||
0, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
m_cb->sizePolicy().hasHeightForWidth()));
|
||||
QToolTip::add(m_cb, tltptxt);
|
||||
setSzPol(m_cb, QSizePolicy::Fixed, QSizePolicy::Fixed, 0, 0);
|
||||
m_cb->setToolTip(tltptxt);
|
||||
m_hl->addWidget(m_cb);
|
||||
|
||||
QFRAME *fr = new QFRAME(this);
|
||||
fr->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Fixed,
|
||||
1, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
fr->sizePolicy().hasHeightForWidth()));
|
||||
QFrame *fr = new QFrame(this);
|
||||
setSzPol(fr, QSizePolicy::Preferred, QSizePolicy::Fixed, 1, 0);
|
||||
m_hl->addWidget(fr);
|
||||
|
||||
loadValue();
|
||||
QObject::connect(m_cb, SIGNAL(toggled(bool)),
|
||||
this, SLOT(setValue(bool)));
|
||||
QObject::connect(m_cb, SIGNAL(toggled(bool)), this, SLOT(setValue(bool)));
|
||||
}
|
||||
|
||||
void ConfParamBoolW::loadValue()
|
||||
@@ -272,22 +229,14 @@ ConfParamFNW::ConfParamFNW(QWidget *parent, ConfLink cflink,
|
||||
return;
|
||||
|
||||
m_fsencoding = true;
|
||||
|
||||
m_le = new QLineEdit(this);
|
||||
m_le->setMinimumSize(QSize(150, 0 ));
|
||||
m_le->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Fixed,
|
||||
1, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
m_le->sizePolicy().hasHeightForWidth()));
|
||||
setSzPol(m_le, QSizePolicy::Preferred, QSizePolicy::Fixed, 1, 0);
|
||||
m_hl->addWidget(m_le);
|
||||
|
||||
m_pb = new QPushButton(this);
|
||||
m_pb->setText(tr("Browse"));
|
||||
m_pb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
|
||||
QSizePolicy::Fixed,
|
||||
0, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
m_pb->sizePolicy().hasHeightForWidth()));
|
||||
setSzPol(m_pb, QSizePolicy::Fixed, QSizePolicy::Fixed, 1, 0);
|
||||
m_hl->addWidget(m_pb);
|
||||
|
||||
loadValue();
|
||||
@@ -306,68 +255,56 @@ void ConfParamFNW::loadValue()
|
||||
void ConfParamFNW::showBrowserDialog()
|
||||
{
|
||||
QString s = m_isdir ?
|
||||
QFILEDIALOG::getExistingDirectory() : QFILEDIALOG::getSaveFileName();
|
||||
QFileDialog::getExistingDirectory() : QFileDialog::getSaveFileName();
|
||||
if (!s.isEmpty())
|
||||
m_le->setText(s);
|
||||
}
|
||||
|
||||
class SmallerListWidget: public QListWidget
|
||||
{
|
||||
public:
|
||||
SmallerListWidget(QWidget *parent)
|
||||
: QListWidget(parent) {}
|
||||
virtual QSize sizeHint() {return QSize(150, 40);}
|
||||
};
|
||||
|
||||
ConfParamSLW::ConfParamSLW(QWidget *parent, ConfLink cflink,
|
||||
const QString& lbltxt,
|
||||
const QString& tltptxt)
|
||||
: ConfParamW(parent, cflink)
|
||||
{
|
||||
// Can't use createCommon here cause we want the buttons below the label
|
||||
m_hl = new QHBOXLAYOUT(this);
|
||||
m_hl = new QHBoxLayout(this);
|
||||
m_hl->setSpacing(spacing);
|
||||
|
||||
QVBOXLAYOUT *vl1 = new QVBOXLAYOUT();
|
||||
QHBOXLAYOUT *hl1 = new QHBOXLAYOUT();
|
||||
QVBoxLayout *vl1 = new QVBoxLayout();
|
||||
QHBoxLayout *hl1 = new QHBoxLayout();
|
||||
|
||||
QLabel *tl = new QLabel(this);
|
||||
tl->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Fixed,
|
||||
0, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
tl->sizePolicy().hasHeightForWidth()));
|
||||
setSzPol(tl, QSizePolicy::Preferred, QSizePolicy::Fixed, 0, 0);
|
||||
tl->setText(lbltxt);
|
||||
QToolTip::add(tl, tltptxt);
|
||||
tl->setToolTip(tltptxt);
|
||||
vl1->addWidget(tl);
|
||||
|
||||
QPushButton *pbA = new QPushButton(this);
|
||||
pbA->setText(tr("+"));
|
||||
pbA->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
|
||||
QSizePolicy::Fixed,
|
||||
0, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
pbA->sizePolicy().hasHeightForWidth()));
|
||||
setSzPol(pbA, QSizePolicy::Fixed, QSizePolicy::Fixed, 0, 0);
|
||||
hl1->addWidget(pbA);
|
||||
|
||||
QPushButton *pbD = new QPushButton(this);
|
||||
setSzPol(pbD, QSizePolicy::Fixed, QSizePolicy::Fixed, 0, 0);
|
||||
pbD->setText(tr("-"));
|
||||
pbD->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
|
||||
QSizePolicy::Fixed,
|
||||
0, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
pbD->sizePolicy().hasHeightForWidth()));
|
||||
hl1->addWidget(pbD);
|
||||
|
||||
vl1->addLayout(hl1);
|
||||
m_hl->addLayout(vl1);
|
||||
|
||||
m_lb = new QLISTBOX(this);
|
||||
m_lb->setSelectionMode(QLISTBOX::Extended);
|
||||
m_lb->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Preferred,
|
||||
1, // Horizontal stretch
|
||||
1, // Vertical stretch
|
||||
m_lb->sizePolicy().hasHeightForWidth()));
|
||||
m_lb = new SmallerListWidget(this);
|
||||
m_lb->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
setSzPol(m_lb, QSizePolicy::Preferred, QSizePolicy::Preferred, 1, 1);
|
||||
m_hl->addWidget(m_lb);
|
||||
|
||||
this->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Preferred,
|
||||
1, // Horizontal stretch
|
||||
1, // Vertical stretch
|
||||
this->sizePolicy().hasHeightForWidth()));
|
||||
|
||||
setSzPol(this, QSizePolicy::Preferred, QSizePolicy::Preferred, 1, 1);
|
||||
loadValue();
|
||||
QObject::connect(pbA, SIGNAL(clicked()), this, SLOT(showInputDialog()));
|
||||
QObject::connect(pbD, SIGNAL(clicked()), this, SLOT(deleteSelected()));
|
||||
@@ -387,22 +324,25 @@ void ConfParamSLW::loadValue()
|
||||
qls.push_back(QString::fromUtf8(it->c_str()));
|
||||
}
|
||||
m_lb->clear();
|
||||
m_lb->insertStringList(qls);
|
||||
m_lb->insertItems(0, qls);
|
||||
}
|
||||
|
||||
void ConfParamSLW::showInputDialog()
|
||||
{
|
||||
bool ok;
|
||||
QString s = QInputDialog::getText("", // Caption
|
||||
"", // Label
|
||||
QLineEdit::Normal, // Mode
|
||||
QString::null, // text
|
||||
&ok,
|
||||
this);
|
||||
QString s = QInputDialog::getText (this,
|
||||
"", // title
|
||||
"", // label,
|
||||
QLineEdit::Normal, // EchoMode mode
|
||||
"", // const QString & text
|
||||
&ok);
|
||||
|
||||
if (ok && !s.isEmpty()) {
|
||||
if (m_lb->findItem(s, QLBEXACTMATCH) == 0) {
|
||||
m_lb->insertItem(s);
|
||||
m_lb->sort();
|
||||
QList<QListWidgetItem *>items =
|
||||
m_lb->findItems(s, Qt::MatchFixedString|Qt::MatchCaseSensitive);
|
||||
if (items.empty()) {
|
||||
m_lb->insertItem(0, s);
|
||||
m_lb->sortItems();
|
||||
listToConf();
|
||||
}
|
||||
}
|
||||
@@ -411,14 +351,15 @@ void ConfParamSLW::showInputDialog()
|
||||
void ConfParamSLW::listToConf()
|
||||
{
|
||||
list<string> ls;
|
||||
for (unsigned int i = 0; i < m_lb->count(); i++) {
|
||||
for (int i = 0; i < m_lb->count(); i++) {
|
||||
// General parameters are encoded as utf-8. File names as
|
||||
// local8bit There is no hope for 8bit file names anyway
|
||||
// except for luck: the original encoding is unknown.
|
||||
QString text = m_lb->item(i)->text();
|
||||
if (m_fsencoding)
|
||||
ls.push_back((const char *)(m_lb->text(i).local8Bit()));
|
||||
ls.push_back((const char *)(text.toLocal8Bit()));
|
||||
else
|
||||
ls.push_back((const char *)(m_lb->text(i).utf8()));
|
||||
ls.push_back((const char *)(text.toUtf8()));
|
||||
}
|
||||
string s;
|
||||
stringsToString(ls, s);
|
||||
@@ -430,10 +371,11 @@ void ConfParamSLW::deleteSelected()
|
||||
bool didone;
|
||||
do {
|
||||
didone = false;
|
||||
for (unsigned int i = 0; i < m_lb->count(); i++) {
|
||||
if (m_lb->isSelected(i)) {
|
||||
emit entryDeleted(m_lb->text(i));
|
||||
m_lb->removeItem(i);
|
||||
for (int i = 0; i < m_lb->count(); i++) {
|
||||
if (m_lb->item(i)->isSelected()) {
|
||||
emit entryDeleted(m_lb->item(i)->text());
|
||||
QListWidgetItem *item = m_lb->takeItem(i);
|
||||
delete item;
|
||||
didone = true;
|
||||
break;
|
||||
}
|
||||
@@ -445,14 +387,18 @@ void ConfParamSLW::deleteSelected()
|
||||
// "Add entry" dialog for a file name list
|
||||
void ConfParamDNLW::showInputDialog()
|
||||
{
|
||||
QString s = QFILEDIALOG::getExistingDirectory();
|
||||
QString s = QFileDialog::getExistingDirectory();
|
||||
if (!s.isEmpty()) {
|
||||
if (m_lb->findItem(s, QLBEXACTMATCH) == 0) {
|
||||
m_lb->insertItem(s);
|
||||
m_lb->sort();
|
||||
QLISTBOXITEM *item = m_lb->findItem(s, QLBEXACTMATCH);
|
||||
if (m_lb->selectionMode() == QLISTBOX::Single && item)
|
||||
m_lb->setSelected(item, true);
|
||||
QList<QListWidgetItem *>items =
|
||||
m_lb->findItems(s, Qt::MatchFixedString|Qt::MatchCaseSensitive);
|
||||
if (items.empty()) {
|
||||
m_lb->insertItem(0, s);
|
||||
m_lb->sortItems();
|
||||
QList<QListWidgetItem *>items =
|
||||
m_lb->findItems(s, Qt::MatchFixedString|Qt::MatchCaseSensitive);
|
||||
if (m_lb->selectionMode() == QAbstractItemView::SingleSelection &&
|
||||
!items.empty())
|
||||
(*items.begin())->setSelected(TRUE);
|
||||
listToConf();
|
||||
}
|
||||
}
|
||||
@@ -462,16 +408,20 @@ void ConfParamDNLW::showInputDialog()
|
||||
void ConfParamCSLW::showInputDialog()
|
||||
{
|
||||
bool ok;
|
||||
QString s = QInputDialog::getItem("", // Caption
|
||||
"", // Label
|
||||
m_sl, // List
|
||||
0, // current
|
||||
false, // editable,
|
||||
&ok);
|
||||
QString s = QInputDialog::getItem (this, // parent
|
||||
"", // title
|
||||
"", // label,
|
||||
m_sl, // items,
|
||||
0, // current = 0
|
||||
FALSE, // editable = true,
|
||||
&ok);
|
||||
|
||||
if (ok && !s.isEmpty()) {
|
||||
if (m_lb->findItem(s, QLBEXACTMATCH) == 0) {
|
||||
m_lb->insertItem(s);
|
||||
m_lb->sort();
|
||||
QList<QListWidgetItem *>items =
|
||||
m_lb->findItems(s, Qt::MatchFixedString|Qt::MatchCaseSensitive);
|
||||
if (items.empty()) {
|
||||
m_lb->insertItem(0, s);
|
||||
m_lb->sortItems();
|
||||
listToConf();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,21 +27,14 @@
|
||||
#include <qglobal.h>
|
||||
#include <qstring.h>
|
||||
#include <qwidget.h>
|
||||
#if QT_VERSION < 0x040000
|
||||
#define QHBOXLAYOUT QHBoxLayout
|
||||
#define QLISTBOX QListBox
|
||||
#else
|
||||
#define QHBOXLAYOUT Q3HBoxLayout
|
||||
#define QLISTBOX Q3ListBox
|
||||
#endif
|
||||
|
||||
#include "refcntr.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
class QHBOXLAYOUT;
|
||||
class QHBoxLayout;
|
||||
class QLineEdit;
|
||||
class QLISTBOX;
|
||||
class QListWidget;
|
||||
class QSpinBox;
|
||||
class QComboBox;
|
||||
class QCheckBox;
|
||||
@@ -84,7 +77,7 @@ namespace confgui {
|
||||
virtual void setFsEncoding(bool onoff) {m_fsencoding = onoff;}
|
||||
protected:
|
||||
ConfLink m_cflink;
|
||||
QHBOXLAYOUT *m_hl;
|
||||
QHBoxLayout *m_hl;
|
||||
// File names are encoded as local8bit in the config files. Other
|
||||
// are encoded as utf-8
|
||||
bool m_fsencoding;
|
||||
@@ -192,7 +185,7 @@ namespace confgui {
|
||||
const QString& lbltxt,
|
||||
const QString& tltptxt);
|
||||
virtual void loadValue();
|
||||
QLISTBOX *getListBox() {return m_lb;}
|
||||
QListWidget *getListBox() {return m_lb;}
|
||||
|
||||
public slots:
|
||||
virtual void setEnabled(bool i) {if(m_lb) ((QWidget*)m_lb)->setEnabled(i);}
|
||||
@@ -202,7 +195,7 @@ namespace confgui {
|
||||
signals:
|
||||
void entryDeleted(QString);
|
||||
protected:
|
||||
QLISTBOX *m_lb;
|
||||
QListWidget *m_lb;
|
||||
void listToConf();
|
||||
};
|
||||
|
||||
@@ -237,6 +230,10 @@ namespace confgui {
|
||||
protected:
|
||||
const QStringList m_sl;
|
||||
};
|
||||
|
||||
extern void setSzPol(QWidget *w, QSizePolicy::Policy hpol,
|
||||
QSizePolicy::Policy vpol,
|
||||
int hstretch, int vstretch);
|
||||
}
|
||||
|
||||
#endif /* _confgui_h_included_ */
|
||||
|
||||
@@ -3,49 +3,18 @@ static char rcsid[] = "@(#$Id: confguiindex.cpp,v 1.13 2008-09-30 12:38:29 docke
|
||||
#endif
|
||||
|
||||
#include <qglobal.h>
|
||||
#if QT_VERSION < 0x040000
|
||||
#define QFRAME_INCLUDE <qframe.h>
|
||||
#define QFILEDIALOG_INCLUDE <qfiledialog.h>
|
||||
#define QLISTBOX_INCLUDE <qlistbox.h>
|
||||
#define QFILEDIALOG QFileDialog
|
||||
#define QFRAME QFrame
|
||||
#define QHBOXLAYOUT QHBoxLayout
|
||||
#define QLISTBOX QListBox
|
||||
#define QLISTBOXITEM QListBoxItem
|
||||
#define QLBEXACTMATCH Qt::ExactMatch
|
||||
#define QVBOXLAYOUT QVBoxLayout
|
||||
#define QGROUPBOX QGroupBox
|
||||
#include <qgroupbox.h>
|
||||
#else
|
||||
#include <Q3HBoxLayout>
|
||||
#include <Q3VBoxLayout>
|
||||
#include <Q3GroupBox>
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QFrame>
|
||||
#define QFRAME_INCLUDE <q3frame.h>
|
||||
|
||||
#include <QFileDialog>
|
||||
#define QFILEDIALOG_INCLUDE <q3filedialog.h>
|
||||
|
||||
#define QLISTBOX_INCLUDE <q3listbox.h>
|
||||
|
||||
#define QFILEDIALOG Q3FileDialog
|
||||
#define QFRAME Q3Frame
|
||||
#define QHBOXLAYOUT Q3HBoxLayout
|
||||
#define QLISTBOX Q3ListBox
|
||||
#define QLISTBOXITEM Q3ListBoxItem
|
||||
#define QLBEXACTMATCH Q3ListBox::ExactMatch
|
||||
#define QVBOXLAYOUT Q3VBoxLayout
|
||||
#define QGROUPBOX Q3GroupBox
|
||||
#endif
|
||||
#include <qlayout.h>
|
||||
#include QFRAME_INCLUDE
|
||||
#include <qwidget.h>
|
||||
#include <qlabel.h>
|
||||
#include QLISTBOX_INCLUDE
|
||||
#include <qtimer.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <QListWidget>
|
||||
|
||||
#include <list>
|
||||
using std::list;
|
||||
@@ -62,20 +31,28 @@ using std::list;
|
||||
#include "rclconfig.h"
|
||||
|
||||
namespace confgui {
|
||||
const static int spacing = 6;
|
||||
const static int margin = 6;
|
||||
const static int spacing = 3;
|
||||
const static int margin = 3;
|
||||
|
||||
ConfIndexW::ConfIndexW(QWidget *parent, RclConfig *config)
|
||||
: QTABDIALOG(parent), m_rclconf(config)
|
||||
: QDialog(parent), m_rclconf(config)
|
||||
{
|
||||
setCaption(QString::fromLocal8Bit(config->getConfDir().c_str()));
|
||||
setOkButton();
|
||||
setCancelButton();
|
||||
|
||||
setWindowTitle(QString::fromLocal8Bit(config->getConfDir().c_str()));
|
||||
tabWidget = new QTabWidget;
|
||||
reloadPanels();
|
||||
resize(QSize(600, 500).expandedTo(minimumSizeHint()));
|
||||
connect(this, SIGNAL(applyButtonPressed()), this, SLOT(acceptChanges()));
|
||||
connect(this, SIGNAL(cancelButtonPressed()), this, SLOT(rejectChanges()));
|
||||
|
||||
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
|
||||
| QDialogButtonBox::Cancel);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addWidget(tabWidget);
|
||||
mainLayout->addWidget(buttonBox);
|
||||
setLayout(mainLayout);
|
||||
|
||||
resize(QSize(600, 450).expandedTo(minimumSizeHint()));
|
||||
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(acceptChanges()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(rejectChanges()));
|
||||
}
|
||||
|
||||
void ConfIndexW::acceptChanges()
|
||||
@@ -101,6 +78,7 @@ void ConfIndexW::acceptChanges()
|
||||
startIndexingAfterConfig = 0;
|
||||
start_indexing(true);
|
||||
}
|
||||
hide();
|
||||
}
|
||||
|
||||
void ConfIndexW::rejectChanges()
|
||||
@@ -110,6 +88,7 @@ void ConfIndexW::rejectChanges()
|
||||
delete m_conf;
|
||||
m_conf = 0;
|
||||
QTimer::singleShot(0, this, SLOT(reloadPanels()));
|
||||
hide();
|
||||
}
|
||||
|
||||
void ConfIndexW::reloadPanels()
|
||||
@@ -117,31 +96,26 @@ void ConfIndexW::reloadPanels()
|
||||
if ((m_conf = m_rclconf->cloneMainConfig()) == 0)
|
||||
return;
|
||||
m_conf->holdWrites(true);
|
||||
for (list<QWidget *>::iterator it = m_widgets.begin();
|
||||
it != m_widgets.end(); it++) {
|
||||
removePage(*it);
|
||||
delete *it;
|
||||
}
|
||||
tabWidget->clear();
|
||||
m_widgets.clear();
|
||||
|
||||
QWidget *w = new ConfTopPanelW(this, m_conf);
|
||||
m_widgets.push_back(w);
|
||||
addTab(w, QObject::tr("Global parameters"));
|
||||
tabWidget->addTab(w, QObject::tr("Global parameters"));
|
||||
|
||||
w = new ConfSubPanelW(this, m_conf);
|
||||
m_widgets.push_back(w);
|
||||
addTab(w, QObject::tr("Local parameters"));
|
||||
tabWidget->addTab(w, QObject::tr("Local parameters"));
|
||||
|
||||
w = new ConfBeaglePanelW(this, m_conf);
|
||||
m_widgets.push_back(w);
|
||||
addTab(w, QObject::tr("Beagle web history"));
|
||||
|
||||
tabWidget->addTab(w, QObject::tr("Beagle web history"));
|
||||
}
|
||||
|
||||
ConfBeaglePanelW::ConfBeaglePanelW(QWidget *parent, ConfNull *config)
|
||||
: QWidget(parent)
|
||||
{
|
||||
QVBOXLAYOUT *vboxLayout = new QVBOXLAYOUT(this);
|
||||
QVBoxLayout *vboxLayout = new QVBoxLayout(this);
|
||||
vboxLayout->setSpacing(spacing);
|
||||
vboxLayout->setMargin(margin);
|
||||
|
||||
@@ -161,7 +135,7 @@ ConfBeaglePanelW::ConfBeaglePanelW(QWidget *parent, ConfNull *config)
|
||||
"for visited web pages.<br>"
|
||||
"A non-absolute path is taken relative to the "
|
||||
"configuration directory."), true);
|
||||
cp2->setEnabled(cp1->m_cb->isOn());
|
||||
cp2->setEnabled(cp1->m_cb->isChecked());
|
||||
connect(cp1->m_cb, SIGNAL(toggled(bool)), cp2, SLOT(setEnabled(bool)));
|
||||
vboxLayout->addWidget(cp2);
|
||||
|
||||
@@ -170,7 +144,7 @@ ConfBeaglePanelW::ConfBeaglePanelW(QWidget *parent, ConfNull *config)
|
||||
new ConfParamIntW(this, lnk3, tr("Max. size for the web cache (MB)"),
|
||||
tr("Entries will be recycled once the size is reached"),
|
||||
-1, 1000);
|
||||
cp3->setEnabled(cp1->m_cb->isOn());
|
||||
cp3->setEnabled(cp1->m_cb->isChecked());
|
||||
connect(cp1->m_cb, SIGNAL(toggled(bool)), cp3, SLOT(setEnabled(bool)));
|
||||
vboxLayout->addWidget(cp3);
|
||||
vboxLayout->insertStretch(-1);
|
||||
@@ -188,11 +162,8 @@ ConfTopPanelW::ConfTopPanelW(QWidget *parent, ConfNull *config)
|
||||
ConfParamDNLW(this, lnktopdirs, tr("Top directories"),
|
||||
tr("The list of directories where recursive "
|
||||
"indexing starts. Default: your home."));
|
||||
#if QT_VERSION < 0x040000
|
||||
gl1->addMultiCellWidget(etopdirs, 0, 0, 0, 1);
|
||||
#else
|
||||
setSzPol(etopdirs, QSizePolicy::Preferred, QSizePolicy::Preferred, 1, 3);
|
||||
gl1->addWidget(etopdirs, 0, 0, 1, 2);
|
||||
#endif
|
||||
|
||||
ConfLink lnkskp(new ConfLinkRclRep(config, "skippedPaths"));
|
||||
ConfParamSLW *eskp = new
|
||||
@@ -205,11 +176,8 @@ ConfTopPanelW::ConfTopPanelW(QWidget *parent, ConfNull *config)
|
||||
"to '/usr/home', a correct skippedPath entry "
|
||||
"would be '/home/me/tmp*', not '/usr/home/me/tmp*')"));
|
||||
eskp->setFsEncoding(true);
|
||||
#if QT_VERSION < 0x040000
|
||||
gl1->addMultiCellWidget(eskp, 1, 1, 0, 1);
|
||||
#else
|
||||
setSzPol(eskp, QSizePolicy::Preferred, QSizePolicy::Preferred, 1, 3);
|
||||
gl1->addWidget(eskp, 1, 0, 1, 2);
|
||||
#endif
|
||||
|
||||
list<string> cstemlangs = Rcl::Db::getStemmerNames();
|
||||
QStringList stemlangs;
|
||||
@@ -222,22 +190,15 @@ ConfTopPanelW::ConfTopPanelW(QWidget *parent, ConfNull *config)
|
||||
ConfParamCSLW(this, lnkidxsl, tr("Stemming languages"),
|
||||
tr("The languages for which stemming expansion<br>"
|
||||
"dictionaries will be built."), stemlangs);
|
||||
#if QT_VERSION < 0x040000
|
||||
gl1->addMultiCellWidget(eidxsl, 2, 2, 0, 1);
|
||||
#else
|
||||
setSzPol(eidxsl, QSizePolicy::Preferred, QSizePolicy::Preferred, 1, 1);
|
||||
gl1->addWidget(eidxsl, 2, 0, 1, 2);
|
||||
#endif
|
||||
|
||||
ConfLink lnk4(new ConfLinkRclRep(config, "logfilename"));
|
||||
ConfParamFNW *e4 = new
|
||||
ConfParamFNW(this, lnk4, tr("Log file name"),
|
||||
tr("The file where the messages will be written.<br>"
|
||||
"Use 'stderr' for terminal output"), false);
|
||||
#if QT_VERSION < 0x040000
|
||||
gl1->addMultiCellWidget(e4, 3, 3, 0, 1);
|
||||
#else
|
||||
gl1->addWidget(e4, 3, 0, 1, 2);
|
||||
#endif
|
||||
|
||||
QWidget *w = 0;
|
||||
|
||||
@@ -289,7 +250,7 @@ ConfTopPanelW::ConfTopPanelW(QWidget *parent, ConfNull *config)
|
||||
"To get an idea of what is installed on your system, "
|
||||
"type 'aspell config' and look for .dat files inside "
|
||||
"the 'data-dir' directory. "));
|
||||
cpaspl->setEnabled(!cpasp->m_cb->isOn());
|
||||
cpaspl->setEnabled(!cpasp->m_cb->isChecked());
|
||||
connect(cpasp->m_cb, SIGNAL(toggled(bool)), cpaspl,SLOT(setDisabled(bool)));
|
||||
gl1->addWidget(cpaspl, 6, 1);
|
||||
|
||||
@@ -300,17 +261,13 @@ ConfTopPanelW::ConfTopPanelW(QWidget *parent, ConfNull *config)
|
||||
"A non-absolute path is taken relative to the "
|
||||
" configuration directory. The default is 'xapiandb'."
|
||||
), true);
|
||||
#if QT_VERSION < 0x040000
|
||||
gl1->addMultiCellWidget(edbd, 7, 7, 0, 1);
|
||||
#else
|
||||
gl1->addWidget(edbd, 7, 0, 1, 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
: QWidget(parent), m_config(config)
|
||||
{
|
||||
QVBOXLAYOUT *vboxLayout = new QVBOXLAYOUT(this);
|
||||
QVBoxLayout *vboxLayout = new QVBoxLayout(this);
|
||||
vboxLayout->setSpacing(spacing);
|
||||
vboxLayout->setMargin(margin);
|
||||
|
||||
@@ -321,9 +278,11 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
QObject::tr("The list of subdirectories in the indexed "
|
||||
"hierarchy <br>where some parameters need "
|
||||
"to be redefined. Default: empty."));
|
||||
m_subdirs->getListBox()->setSelectionMode(QLISTBOX::Single);
|
||||
connect(m_subdirs->getListBox(), SIGNAL(selectionChanged()),
|
||||
this, SLOT(subDirChanged()));
|
||||
m_subdirs->getListBox()->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
connect(m_subdirs->getListBox(),
|
||||
SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
|
||||
this,
|
||||
SLOT(subDirChanged(QListWidgetItem *, QListWidgetItem *)));
|
||||
connect(m_subdirs, SIGNAL(entryDeleted(QString)),
|
||||
this, SLOT(subDirDeleted(QString)));
|
||||
list<string> allkeydirs = config->getSubKeys();
|
||||
@@ -332,12 +291,12 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
it != allkeydirs.end(); it++) {
|
||||
qls.push_back(QString::fromUtf8(it->c_str()));
|
||||
}
|
||||
m_subdirs->getListBox()->insertStringList(qls);
|
||||
m_subdirs->getListBox()->insertItems(0, qls);
|
||||
vboxLayout->addWidget(m_subdirs);
|
||||
|
||||
QFRAME *line2 = new QFRAME(this);
|
||||
line2->setFrameShape(QFRAME::HLine);
|
||||
line2->setFrameShadow(QFRAME::Sunken);
|
||||
QFrame *line2 = new QFrame(this);
|
||||
line2->setFrameShape(QFrame::HLine);
|
||||
line2->setFrameShadow(QFrame::Sunken);
|
||||
vboxLayout->addWidget(line2);
|
||||
|
||||
QLabel *explain = new QLabel(this);
|
||||
@@ -352,31 +311,22 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
vboxLayout->addWidget(explain);
|
||||
|
||||
|
||||
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()));
|
||||
m_groupbox = new QGroupBox(this);
|
||||
setSzPol(m_groupbox, QSizePolicy::Preferred, QSizePolicy::Preferred, 1, 3);
|
||||
|
||||
QWidget *w = new QWidget(m_groupbox);
|
||||
QGridLayout *gl1 = new QGridLayout(w);
|
||||
QGridLayout *gl1 = new QGridLayout(m_groupbox);
|
||||
gl1->setSpacing(spacing);
|
||||
gl1->setMargin(margin);
|
||||
|
||||
ConfLink lnkskn(new ConfLinkRclRep(config, "skippedNames", &m_sk));
|
||||
ConfParamSLW *eskn = new
|
||||
ConfParamSLW(w, lnkskn,
|
||||
ConfParamSLW(m_groupbox, lnkskn,
|
||||
QObject::tr("Skipped names"),
|
||||
QObject::tr("These are patterns for file or directory "
|
||||
" names which should not be indexed."));
|
||||
eskn->setFsEncoding(true);
|
||||
m_widgets.push_back(eskn);
|
||||
#if QT_VERSION < 0x040000
|
||||
gl1->addMultiCellWidget(eskn, 0, 0, 0, 1);
|
||||
#else
|
||||
gl1->addWidget(eskn, 0, 0, 1, 2);
|
||||
#endif
|
||||
|
||||
list<string> args;
|
||||
args.push_back("-l");
|
||||
@@ -399,7 +349,7 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
|
||||
ConfLink lnk21(new ConfLinkRclRep(config, "defaultcharset", &m_sk));
|
||||
ConfParamCStrW *e21 = new
|
||||
ConfParamCStrW(w, lnk21,
|
||||
ConfParamCStrW(m_groupbox, lnk21,
|
||||
QObject::tr("Default character set"),
|
||||
QObject::tr("This is the character set used for reading files "
|
||||
"which do not identify the character set "
|
||||
@@ -408,15 +358,11 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
"and the value from the NLS environnement is used."
|
||||
), charsets);
|
||||
m_widgets.push_back(e21);
|
||||
#if QT_VERSION < 0x040000
|
||||
gl1->addMultiCellWidget(e21, 1, 1, 0, 1);
|
||||
#else
|
||||
gl1->addWidget(e21, 1, 0, 1, 2);
|
||||
#endif
|
||||
|
||||
ConfLink lnk3(new ConfLinkRclRep(config, "followLinks", &m_sk));
|
||||
ConfParamBoolW *e3 = new
|
||||
ConfParamBoolW(w, lnk3,
|
||||
ConfParamBoolW(m_groupbox, lnk3,
|
||||
QObject::tr("Follow symbolic links"),
|
||||
QObject::tr("Follow symbolic links while "
|
||||
"indexing. The default is no, "
|
||||
@@ -426,7 +372,7 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
|
||||
ConfLink lnkafln(new ConfLinkRclRep(config, "indexallfilenames", &m_sk));
|
||||
ConfParamBoolW *eafln = new
|
||||
ConfParamBoolW(w, lnkafln,
|
||||
ConfParamBoolW(m_groupbox, lnkafln,
|
||||
QObject::tr("Index all file names"),
|
||||
QObject::tr("Index the names of files for which the contents "
|
||||
"cannot be identified or processed (no or "
|
||||
@@ -436,7 +382,7 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
|
||||
ConfLink lnkzfmaxkbs(new ConfLinkRclRep(config, "compressedfilemaxkbs"));
|
||||
ConfParamIntW *ezfmaxkbs = new
|
||||
ConfParamIntW(w, lnkzfmaxkbs,
|
||||
ConfParamIntW(m_groupbox, lnkzfmaxkbs,
|
||||
tr("Max. compressed file size (KB)"),
|
||||
tr("This value sets a threshold beyond which compressed"
|
||||
"files will not be processed. Set to -1 for no "
|
||||
@@ -447,7 +393,7 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
|
||||
ConfLink lnktxtmaxmbs(new ConfLinkRclRep(config, "textfilemaxmbs"));
|
||||
ConfParamIntW *etxtmaxmbs = new
|
||||
ConfParamIntW(w, lnktxtmaxmbs,
|
||||
ConfParamIntW(m_groupbox, lnktxtmaxmbs,
|
||||
tr("Max. text file size (MB)"),
|
||||
tr("This value sets a threshold beyond which text "
|
||||
"files will not be processed. Set to -1 for no "
|
||||
@@ -459,7 +405,7 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
|
||||
ConfLink lnktxtpagekbs(new ConfLinkRclRep(config, "textfilepagekbs"));
|
||||
ConfParamIntW *etxtpagekbs = new
|
||||
ConfParamIntW(w, lnktxtpagekbs,
|
||||
ConfParamIntW(m_groupbox, lnktxtpagekbs,
|
||||
tr("Text file page size (KB)"),
|
||||
tr("If this value is set (not equal to -1), text "
|
||||
"files will be split in chunks of this size for "
|
||||
@@ -471,7 +417,7 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
|
||||
ConfLink lnkfiltmaxsecs(new ConfLinkRclRep(config, "filtermaxseconds"));
|
||||
ConfParamIntW *efiltmaxsecs = new
|
||||
ConfParamIntW(w, lnkfiltmaxsecs,
|
||||
ConfParamIntW(m_groupbox, lnkfiltmaxsecs,
|
||||
tr("Max. filter exec. time (S)"),
|
||||
tr("External filters working longer than this will be "
|
||||
"aborted. This is for the rare case (ie: postscript) "
|
||||
@@ -482,7 +428,7 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
||||
gl1->addWidget(efiltmaxsecs, 4, 1);
|
||||
|
||||
vboxLayout->addWidget(m_groupbox);
|
||||
subDirChanged();
|
||||
subDirChanged(0, 0);
|
||||
}
|
||||
|
||||
void ConfSubPanelW::reloadAll()
|
||||
@@ -493,16 +439,16 @@ void ConfSubPanelW::reloadAll()
|
||||
}
|
||||
}
|
||||
|
||||
void ConfSubPanelW::subDirChanged()
|
||||
void ConfSubPanelW::subDirChanged(QListWidgetItem *current, QListWidgetItem *)
|
||||
{
|
||||
LOGDEB(("ConfSubPanelW::subDirChanged\n"));
|
||||
QLISTBOXITEM *item = m_subdirs->getListBox()->selectedItem();
|
||||
if (item == 0 || item->text() == "") {
|
||||
|
||||
if (current == 0 || current->text() == "") {
|
||||
m_sk = "";
|
||||
m_groupbox->setTitle(tr("Global"));
|
||||
} else {
|
||||
m_sk = (const char *)item->text().utf8();
|
||||
m_groupbox->setTitle(item->text());
|
||||
m_sk = (const char *) current->text().toUtf8();
|
||||
m_groupbox->setTitle(current->text());
|
||||
}
|
||||
LOGDEB(("ConfSubPanelW::subDirChanged: now [%s]\n", m_sk.c_str()));
|
||||
reloadAll();
|
||||
@@ -510,20 +456,20 @@ void ConfSubPanelW::subDirChanged()
|
||||
|
||||
void ConfSubPanelW::subDirDeleted(QString sbd)
|
||||
{
|
||||
LOGDEB(("ConfSubPanelW::subDirDeleted(%s)\n", (const char *)sbd.utf8()));
|
||||
LOGDEB(("ConfSubPanelW::subDirDeleted(%s)\n", (const char *)sbd.toUtf8()));
|
||||
if (sbd == "") {
|
||||
// Can't do this, have to reinsert it
|
||||
QTimer::singleShot(0, this, SLOT(restoreEmpty()));
|
||||
return;
|
||||
}
|
||||
// Have to delete all entries for submap
|
||||
m_config->eraseKey((const char *)sbd.utf8());
|
||||
m_config->eraseKey((const char *)sbd.toUtf8());
|
||||
}
|
||||
|
||||
void ConfSubPanelW::restoreEmpty()
|
||||
{
|
||||
LOGDEB(("ConfSubPanelW::restoreEmpty()\n"));
|
||||
m_subdirs->getListBox()->insertItem("", 0);
|
||||
m_subdirs->getListBox()->insertItem(0, "");
|
||||
}
|
||||
|
||||
} // Namespace confgui
|
||||
|
||||
@@ -7,17 +7,13 @@
|
||||
* confgui elements, linked to configuration parameters, into panels.
|
||||
*/
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qstring.h>
|
||||
#if QT_VERSION < 0x040000
|
||||
#include <qgroupbox.h>
|
||||
#include <qtabdialog.h>
|
||||
#define QTABDIALOG QTabDialog
|
||||
#else // Qt4 ->
|
||||
#include <Q3GroupBox>
|
||||
#include <Q3TabDialog>
|
||||
#define QTABDIALOG Q3TabDialog
|
||||
#endif // QT 3/4
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QGroupBox>
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QTabWidget>
|
||||
#include <QListWidgetItem>
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
@@ -31,7 +27,7 @@ class ConfParamDNLW;
|
||||
|
||||
namespace confgui {
|
||||
|
||||
class ConfIndexW : public QTABDIALOG {
|
||||
class ConfIndexW : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfIndexW(QWidget *parent, RclConfig *config);
|
||||
@@ -43,6 +39,8 @@ private:
|
||||
RclConfig *m_rclconf;
|
||||
ConfNull *m_conf;
|
||||
list<QWidget *> m_widgets;
|
||||
QTabWidget *tabWidget;
|
||||
QDialogButtonBox *buttonBox;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -64,7 +62,7 @@ public:
|
||||
ConfSubPanelW(QWidget *parent, ConfNull *config);
|
||||
|
||||
private slots:
|
||||
void subDirChanged();
|
||||
void subDirChanged(QListWidgetItem *, QListWidgetItem *);
|
||||
void subDirDeleted(QString);
|
||||
void restoreEmpty();
|
||||
private:
|
||||
@@ -72,11 +70,7 @@ private:
|
||||
ConfParamDNLW *m_subdirs;
|
||||
list<ConfParamW*> m_widgets;
|
||||
ConfNull *m_config;
|
||||
#if QT_VERSION < 0x040000
|
||||
QGroupBox *m_groupbox;
|
||||
#else
|
||||
Q3GroupBox *m_groupbox;
|
||||
#endif
|
||||
void reloadAll();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user