qt4 port
This commit is contained in:
parent
569d96c43f
commit
419deb4b22
@ -1,9 +1,42 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: confgui.cpp,v 1.4 2007-10-01 06:19:21 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: confgui.cpp,v 1.5 2007-10-01 06:35:31 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
|
||||
#include <stdio.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 <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 <qobject.h>
|
||||
#include <qlayout.h>
|
||||
#include <qsize.h>
|
||||
@ -13,13 +46,13 @@ static char rcsid[] = "@(#$Id: confgui.cpp,v 1.4 2007-10-01 06:19:21 dockes Exp
|
||||
#include <qtooltip.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qfiledialog.h>
|
||||
#include QFILEDIALOG_INCLUDE
|
||||
#include <qinputdialog.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qlistbox.h>
|
||||
#include QLISTBOX_INCLUDE
|
||||
#include <qcombobox.h>
|
||||
#include <qframe.h>
|
||||
#include QFRAME_INCLUDE
|
||||
|
||||
#include "confgui.h"
|
||||
#include "smallut.h"
|
||||
@ -59,7 +92,7 @@ void ConfParamW::loadValue()
|
||||
|
||||
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);
|
||||
@ -99,7 +132,7 @@ ConfParamIntW::ConfParamIntW(QWidget *parent, ConfLink cflink,
|
||||
m_sb->sizePolicy().hasHeightForWidth() ) );
|
||||
m_hl->addWidget(m_sb);
|
||||
|
||||
QFrame *fr = new QFrame(this);
|
||||
QFRAME *fr = new QFRAME(this);
|
||||
fr->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Fixed,
|
||||
1, // Horizontal stretch
|
||||
@ -198,7 +231,7 @@ 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);
|
||||
@ -211,7 +244,7 @@ ConfParamBoolW::ConfParamBoolW(QWidget *parent, ConfLink cflink,
|
||||
QToolTip::add(m_cb, tltptxt);
|
||||
m_hl->addWidget(m_cb);
|
||||
|
||||
QFrame *fr = new QFrame(this);
|
||||
QFRAME *fr = new QFRAME(this);
|
||||
fr->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Fixed,
|
||||
1, // Horizontal stretch
|
||||
@ -274,7 +307,7 @@ 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);
|
||||
}
|
||||
@ -285,11 +318,11 @@ ConfParamSLW::ConfParamSLW(QWidget *parent, ConfLink cflink,
|
||||
: 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,
|
||||
@ -323,11 +356,11 @@ ConfParamSLW::ConfParamSLW(QWidget *parent, ConfLink cflink,
|
||||
m_hl->addLayout(vl1);
|
||||
|
||||
|
||||
m_lb = new QListBox(this);
|
||||
m_lb = new QLISTBOX(this);
|
||||
|
||||
loadValue();
|
||||
|
||||
m_lb->setSelectionMode(QListBox::Extended);
|
||||
m_lb->setSelectionMode(QLISTBOX::Extended);
|
||||
|
||||
m_lb->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Preferred,
|
||||
@ -371,7 +404,7 @@ void ConfParamSLW::showInputDialog()
|
||||
&ok,
|
||||
this);
|
||||
if (ok && !s.isEmpty()) {
|
||||
if (m_lb->findItem(s, Qt::ExactMatch) == 0) {
|
||||
if (m_lb->findItem(s, QLBEXACTMATCH) == 0) {
|
||||
m_lb->insertItem(s);
|
||||
m_lb->sort();
|
||||
listToConf();
|
||||
@ -410,13 +443,13 @@ 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, Qt::ExactMatch) == 0) {
|
||||
if (m_lb->findItem(s, QLBEXACTMATCH) == 0) {
|
||||
m_lb->insertItem(s);
|
||||
m_lb->sort();
|
||||
QListBoxItem *item = m_lb->findItem(s, Qt::ExactMatch);
|
||||
if (m_lb->selectionMode() == QListBox::Single && item)
|
||||
QLISTBOXITEM *item = m_lb->findItem(s, QLBEXACTMATCH);
|
||||
if (m_lb->selectionMode() == QLISTBOX::Single && item)
|
||||
m_lb->setSelected(item, true);
|
||||
listToConf();
|
||||
}
|
||||
@ -434,7 +467,7 @@ void ConfParamCSLW::showInputDialog()
|
||||
false, // editable,
|
||||
&ok);
|
||||
if (ok && !s.isEmpty()) {
|
||||
if (m_lb->findItem(s, Qt::ExactMatch) == 0) {
|
||||
if (m_lb->findItem(s, QLBEXACTMATCH) == 0) {
|
||||
m_lb->insertItem(s);
|
||||
m_lb->sort();
|
||||
listToConf();
|
||||
|
||||
@ -1,19 +1,27 @@
|
||||
#ifndef _confgui_h_included_
|
||||
#define _confgui_h_included_
|
||||
/* @(#$Id: confgui.h,v 1.3 2007-09-29 09:06:53 dockes Exp $ (C) 2007 J.F.Dockes */
|
||||
/* @(#$Id: confgui.h,v 1.4 2007-10-01 06:35:31 dockes Exp $ (C) 2007 J.F.Dockes */
|
||||
|
||||
#include <string>
|
||||
|
||||
#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 QLISTBOX;
|
||||
class RclConfig;
|
||||
class QSpinBox;
|
||||
class QComboBox;
|
||||
@ -24,6 +32,7 @@ namespace confgui {
|
||||
// A class to isolate the gui widget from the config storage mechanism
|
||||
class ConfLinkRep {
|
||||
public:
|
||||
virtual ~ConfLinkRep() {}
|
||||
virtual bool set(const string& val) = 0;
|
||||
virtual bool get(string& val) = 0;
|
||||
};
|
||||
@ -31,6 +40,7 @@ namespace confgui {
|
||||
|
||||
class ConfLinkNullRep : public ConfLinkRep {
|
||||
public:
|
||||
virtual ~ConfLinkNullRep() {}
|
||||
virtual bool set(const string&)
|
||||
{
|
||||
//fprintf(stderr, "Setting value to [%s]\n", val.c_str());
|
||||
@ -52,7 +62,7 @@ namespace confgui {
|
||||
|
||||
protected:
|
||||
ConfLink m_cflink;
|
||||
QHBoxLayout *m_hl;
|
||||
QHBOXLAYOUT *m_hl;
|
||||
|
||||
virtual bool createCommon(const QString& lbltxt,
|
||||
const QString& tltptxt);
|
||||
@ -135,7 +145,7 @@ namespace confgui {
|
||||
const QString& lbltxt,
|
||||
const QString& tltptxt);
|
||||
virtual void loadValue();
|
||||
QListBox *getListBox() {return m_lb;}
|
||||
QLISTBOX *getListBox() {return m_lb;}
|
||||
|
||||
protected slots:
|
||||
virtual void showInputDialog();
|
||||
@ -143,7 +153,7 @@ namespace confgui {
|
||||
signals:
|
||||
void entryDeleted(QString);
|
||||
protected:
|
||||
QListBox *m_lb;
|
||||
QLISTBOX *m_lb;
|
||||
void listToConf();
|
||||
|
||||
};
|
||||
@ -175,6 +185,7 @@ namespace confgui {
|
||||
}
|
||||
protected slots:
|
||||
virtual void showInputDialog();
|
||||
protected:
|
||||
const QStringList m_sl;
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,12 +1,44 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: confguiindex.cpp,v 1.2 2007-09-29 09:06:53 dockes Exp $ (C) 2007 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: confguiindex.cpp,v 1.3 2007-10-01 06:35:31 dockes Exp $ (C) 2007 J.F.Dockes";
|
||||
#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
|
||||
#else
|
||||
#include <Q3HBoxLayout>
|
||||
#include <Q3VBoxLayout>
|
||||
|
||||
#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 <qlayout.h>
|
||||
#include <qframe.h>
|
||||
#include QFRAME_INCLUDE
|
||||
#include <qwidget.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlistbox.h>
|
||||
#include QLISTBOX_INCLUDE
|
||||
#include <qtimer.h>
|
||||
|
||||
#include <list>
|
||||
@ -27,7 +59,7 @@ const static int margin = 6;
|
||||
ConfTopPanelW::ConfTopPanelW(QWidget *parent, RclConfig *config)
|
||||
: QWidget(parent)
|
||||
{
|
||||
QVBoxLayout *vboxLayout = new QVBoxLayout(this);
|
||||
QVBOXLAYOUT *vboxLayout = new QVBOXLAYOUT(this);
|
||||
vboxLayout->setSpacing(spacing);
|
||||
vboxLayout->setMargin(margin);
|
||||
|
||||
@ -137,7 +169,7 @@ ConfTopPanelW::ConfTopPanelW(QWidget *parent, RclConfig *config)
|
||||
ConfSubPanelW::ConfSubPanelW(QWidget *parent, RclConfig *config)
|
||||
: QWidget(parent), m_config(config)
|
||||
{
|
||||
QVBoxLayout *vboxLayout = new QVBoxLayout(this);
|
||||
QVBOXLAYOUT *vboxLayout = new QVBOXLAYOUT(this);
|
||||
vboxLayout->setSpacing(spacing);
|
||||
vboxLayout->setMargin(margin);
|
||||
|
||||
@ -149,7 +181,7 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, RclConfig *config)
|
||||
"hierarchy where some parameters need to be "
|
||||
"customised. "
|
||||
"Default: empty."));
|
||||
m_subdirs->getListBox()->setSelectionMode(QListBox::Single);
|
||||
m_subdirs->getListBox()->setSelectionMode(QLISTBOX::Single);
|
||||
connect(m_subdirs->getListBox(), SIGNAL(selectionChanged()),
|
||||
this, SLOT(subDirChanged()));
|
||||
connect(m_subdirs, SIGNAL(entryDeleted(QString)),
|
||||
@ -174,9 +206,9 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, RclConfig *config)
|
||||
"the +/- buttons."));
|
||||
vboxLayout->addWidget(explain);
|
||||
|
||||
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);
|
||||
|
||||
ConfLink lnkskn(new ConfLinkRclRep(config, "skippedNames", &m_sk));
|
||||
@ -252,7 +284,7 @@ void ConfSubPanelW::reloadAll()
|
||||
void ConfSubPanelW::subDirChanged()
|
||||
{
|
||||
LOGDEB(("ConfSubPanelW::subDirChanged\n"));
|
||||
QListBoxItem *item = m_subdirs->getListBox()->selectedItem();
|
||||
QLISTBOXITEM *item = m_subdirs->getListBox()->selectedItem();
|
||||
if (item == 0) {
|
||||
m_sk = "";
|
||||
} else {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: main.cpp,v 1.3 2007-09-29 09:06:53 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: main.cpp,v 1.4 2007-10-01 06:35:31 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -27,6 +27,37 @@ using namespace std;
|
||||
|
||||
#include <unistd.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 QVBOXLAYOUT QVBoxLayout
|
||||
#else
|
||||
#include <Q3HBoxLayout>
|
||||
#include <Q3VBoxLayout>
|
||||
|
||||
#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 QVBOXLAYOUT Q3VBoxLayout
|
||||
#endif
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qapplication.h>
|
||||
#include <qtranslator.h>
|
||||
@ -34,7 +65,7 @@ using namespace std;
|
||||
#include <qthread.h>
|
||||
#include <qtimer.h>
|
||||
#include <qlayout.h>
|
||||
#include <qframe.h>
|
||||
#include QFRAME_INCLUDE
|
||||
#include <qwidget.h>
|
||||
#include <qlabel.h>
|
||||
|
||||
@ -126,15 +157,15 @@ int main(int argc, char **argv)
|
||||
|
||||
QWidget w;
|
||||
|
||||
QVBoxLayout *vboxLayout = new QVBoxLayout(&w);
|
||||
QVBOXLAYOUT *vboxLayout = new QVBOXLAYOUT(&w);
|
||||
vboxLayout->setSpacing(6);
|
||||
vboxLayout->setMargin(11);
|
||||
|
||||
vboxLayout->addWidget(new ConfTopPanelW(&w, config));
|
||||
|
||||
QFrame *line1 = new QFrame(&w);
|
||||
line1->setFrameShape(QFrame::HLine);
|
||||
line1->setFrameShadow(QFrame::Sunken);
|
||||
QFRAME *line1 = new QFRAME(&w);
|
||||
line1->setFrameShape(QFRAME::HLine);
|
||||
line1->setFrameShadow(QFRAME::Sunken);
|
||||
vboxLayout->addWidget(line1);
|
||||
|
||||
vboxLayout->addWidget(new ConfSubPanelW(&w, config));
|
||||
|
||||
@ -14,7 +14,7 @@ unix {
|
||||
MOC_DIR = .moc
|
||||
OBJECTS_DIR = .obj
|
||||
|
||||
DEFINES += RECOLL_DATADIR=\"/usr/local/share/recoll\"
|
||||
DEFINES += RECOLL_DATADIR='\\"/usr/local/share/recoll\\"'
|
||||
LIBS += ../../lib/librcl.a -lxapian -liconv -lz
|
||||
|
||||
INCLUDEPATH += ../../common ../../utils ../../rcldb
|
||||
@ -28,3 +28,5 @@ contains( UNAME, [lL]inux ) {
|
||||
LIBS -= -liconv
|
||||
}
|
||||
|
||||
#The following line was inserted by qt3to4
|
||||
QT += qt3support
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user