*** empty log message ***
This commit is contained in:
parent
ea7d3cd26e
commit
f8b7432280
395
src/qtgui/confgui/confgui.cpp
Normal file
395
src/qtgui/confgui/confgui.cpp
Normal file
@ -0,0 +1,395 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: confgui.cpp,v 1.1 2007-09-26 12:16:48 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qlayout.h>
|
||||
#include <qsize.h>
|
||||
#include <qsizepolicy.h>
|
||||
#include <qlabel.h>
|
||||
#include <qspinbox.h>
|
||||
#include <qtooltip.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qfiledialog.h>
|
||||
#include <qinputdialog.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qlistbox.h>
|
||||
#include <qcombobox.h>
|
||||
|
||||
#include "confgui.h"
|
||||
#include "smallut.h"
|
||||
#include "debuglog.h"
|
||||
|
||||
#include <list>
|
||||
using std::list;
|
||||
|
||||
namespace confgui {
|
||||
|
||||
|
||||
void ConfParamW::setValue(const QString& value)
|
||||
{
|
||||
m_cflink.set(string((const char *)value.utf8()));
|
||||
}
|
||||
|
||||
void ConfParamW::setValue(int value)
|
||||
{
|
||||
char buf[30];
|
||||
sprintf(buf, "%d", value);
|
||||
m_cflink.set(string(buf));
|
||||
}
|
||||
void ConfParamW::setValue(bool value)
|
||||
{
|
||||
char buf[30];
|
||||
sprintf(buf, "%d", value);
|
||||
m_cflink.set(string(buf));
|
||||
}
|
||||
|
||||
bool ConfParamW::createCommon(const QString& lbltxt, const QString& tltptxt)
|
||||
{
|
||||
m_hl = new QHBoxLayout(this);
|
||||
m_hl->setSpacing(6);
|
||||
|
||||
QLabel *tl = new QLabel(this);
|
||||
tl->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Fixed,
|
||||
0, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
tl->sizePolicy().hasHeightForWidth() ) );
|
||||
tl->setText(lbltxt);
|
||||
QToolTip::add(tl, tltptxt);
|
||||
/* qt4 tl->setProperty("toolTip", tltptxt);*/
|
||||
|
||||
m_hl->addWidget(tl);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ConfParamIntW::ConfParamIntW(QWidget *parent, ConfLink &cflink,
|
||||
const QString& lbltxt,
|
||||
const QString& tltptxt,
|
||||
int minvalue,
|
||||
int maxvalue)
|
||||
: ConfParamW(parent, cflink)
|
||||
{
|
||||
if (!createCommon(lbltxt, tltptxt))
|
||||
return;
|
||||
|
||||
|
||||
QSpinBox *sb = new QSpinBox(this);
|
||||
// sb->setMinimum(minvalue);
|
||||
sb->setMinValue(minvalue);
|
||||
// sb->setMaximum(maxvalue);
|
||||
sb->setMaxValue(maxvalue);
|
||||
sb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
|
||||
QSizePolicy::Fixed,
|
||||
0, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
sb->sizePolicy().hasHeightForWidth() ) );
|
||||
|
||||
|
||||
string s;
|
||||
m_cflink.get(s);
|
||||
sb->setValue(atoi(s.c_str()));
|
||||
|
||||
m_hl->addWidget(sb);
|
||||
|
||||
QObject::connect(sb, SIGNAL(valueChanged(int)),
|
||||
this, SLOT(setValue(int)));
|
||||
}
|
||||
|
||||
ConfParamStrW::ConfParamStrW(QWidget *parent, ConfLink& cflink,
|
||||
const QString& lbltxt,
|
||||
const QString& tltptxt)
|
||||
: ConfParamW(parent, cflink)
|
||||
{
|
||||
if (!createCommon(lbltxt, tltptxt))
|
||||
return;
|
||||
QLineEdit *le = new QLineEdit(this);
|
||||
// le->setMinimumSize( QSize( 200, 0 ) );
|
||||
|
||||
string s;
|
||||
m_cflink.get(s);
|
||||
le->setText(QString::fromUtf8(s.c_str()));
|
||||
le->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Fixed,
|
||||
1, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
le->sizePolicy().hasHeightForWidth() ) );
|
||||
|
||||
m_hl->addWidget(le);
|
||||
|
||||
QObject::connect(le, SIGNAL(textChanged(const QString&)),
|
||||
this, SLOT(setValue(const QString&)));
|
||||
}
|
||||
|
||||
ConfParamCStrW::ConfParamCStrW(QWidget *parent, ConfLink& cflink,
|
||||
const QString& lbltxt,
|
||||
const QString& tltptxt,
|
||||
const QStringList &sl
|
||||
)
|
||||
: ConfParamW(parent, cflink)
|
||||
{
|
||||
if (!createCommon(lbltxt, tltptxt))
|
||||
return;
|
||||
QComboBox *cmb = new QComboBox(this);
|
||||
cmb->insertStringList(sl);
|
||||
cmb->setEditable(false);
|
||||
string s;
|
||||
m_cflink.get(s);
|
||||
QString cs = QString::fromUtf8(s.c_str());
|
||||
for (int i = 0; i < cmb->count(); i++) {
|
||||
if (!cs.compare(cmb->text(i))) {
|
||||
cmb->setCurrentItem(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cmb->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Fixed,
|
||||
1, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
cmb->sizePolicy().hasHeightForWidth() ) );
|
||||
|
||||
m_hl->addWidget(cmb);
|
||||
|
||||
QObject::connect(cmb, SIGNAL(activated(const QString&)),
|
||||
this, SLOT(setValue(const QString&)));
|
||||
}
|
||||
|
||||
ConfParamBoolW::ConfParamBoolW(QWidget *parent, ConfLink& cflink,
|
||||
const QString& lbltxt,
|
||||
const QString& tltptxt)
|
||||
: ConfParamW(parent, cflink)
|
||||
{
|
||||
if (!createCommon(lbltxt, tltptxt))
|
||||
return;
|
||||
QCheckBox *cb = new QCheckBox(this);
|
||||
|
||||
string s;
|
||||
m_cflink.get(s);
|
||||
cb->setChecked(stringToBool(s));
|
||||
cb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
|
||||
QSizePolicy::Fixed,
|
||||
0, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
cb->sizePolicy().hasHeightForWidth() ) );
|
||||
|
||||
m_hl->addWidget(cb);
|
||||
|
||||
QObject::connect(cb, SIGNAL(toggled(bool)),
|
||||
this, SLOT(setValue(bool)));
|
||||
}
|
||||
|
||||
ConfParamFNW::ConfParamFNW(QWidget *parent, ConfLink& cflink,
|
||||
const QString& lbltxt,
|
||||
const QString& tltptxt)
|
||||
: ConfParamW(parent, cflink)
|
||||
{
|
||||
if (!createCommon(lbltxt, tltptxt))
|
||||
return;
|
||||
|
||||
|
||||
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() ) );
|
||||
m_hl->addWidget(m_le);
|
||||
|
||||
QPushButton *pb = new QPushButton(this);
|
||||
pb->setText(tr("Browse"));
|
||||
pb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
|
||||
QSizePolicy::Fixed,
|
||||
0, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
pb->sizePolicy().hasHeightForWidth() ) );
|
||||
m_hl->addWidget(pb);
|
||||
|
||||
|
||||
string s;
|
||||
m_cflink.get(s);
|
||||
m_le->setText(QString::fromUtf8(s.c_str()));
|
||||
|
||||
QObject::connect(pb, SIGNAL(clicked()), this, SLOT(showBrowserDialog()));
|
||||
QObject::connect(m_le, SIGNAL(textChanged(const QString&)),
|
||||
this, SLOT(setValue(const QString&)));
|
||||
}
|
||||
|
||||
void ConfParamFNW::showBrowserDialog()
|
||||
{
|
||||
QString s = QFileDialog::getOpenFileName("",
|
||||
"",
|
||||
this,
|
||||
"open file dialog",
|
||||
"Choose a file");
|
||||
if (!s.isEmpty())
|
||||
m_le->setText(s);
|
||||
}
|
||||
|
||||
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->setSpacing(6);
|
||||
|
||||
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() ) );
|
||||
tl->setText(lbltxt);
|
||||
QToolTip::add(tl, tltptxt);
|
||||
/* qt4 tl->setProperty("toolTip", tltptxt);*/
|
||||
vl1->addWidget(tl);
|
||||
|
||||
QPushButton *pbA = new QPushButton(this);
|
||||
pbA->setText(tr("Add"));
|
||||
pbA->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
|
||||
QSizePolicy::Fixed,
|
||||
0, // Horizontal stretch
|
||||
0, // Vertical stretch
|
||||
pbA->sizePolicy().hasHeightForWidth() ) );
|
||||
hl1->addWidget(pbA);
|
||||
QPushButton *pbD = new QPushButton(this);
|
||||
pbD->setText(tr("Delete"));
|
||||
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);
|
||||
|
||||
string s;
|
||||
m_cflink.get(s);
|
||||
list<string> ls;
|
||||
stringToStrings(s, ls);
|
||||
QStringList qls;
|
||||
for (list<string>::const_iterator it = ls.begin(); it != ls.end(); it++) {
|
||||
qls.push_back(QString::fromUtf8(it->c_str()));
|
||||
}
|
||||
m_lb->insertStringList(qls);
|
||||
|
||||
m_lb->setSelectionMode(QListBox::Extended);
|
||||
|
||||
m_lb->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Preferred,
|
||||
1, // Horizontal stretch
|
||||
1, // Vertical stretch
|
||||
m_lb->sizePolicy().hasHeightForWidth() ) );
|
||||
m_hl->addWidget(m_lb);
|
||||
|
||||
this->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
||||
QSizePolicy::Preferred,
|
||||
1, // Horizontal stretch
|
||||
1, // Vertical stretch
|
||||
this->sizePolicy().hasHeightForWidth() ) );
|
||||
|
||||
|
||||
QObject::connect(pbA, SIGNAL(clicked()), this, SLOT(showInputDialog()));
|
||||
QObject::connect(pbD, SIGNAL(clicked()), this, SLOT(deleteSelected()));
|
||||
}
|
||||
|
||||
void ConfParamSLW::showInputDialog()
|
||||
{
|
||||
bool ok;
|
||||
QString s = QInputDialog::getText("", // Caption
|
||||
"", // Label
|
||||
QLineEdit::Normal, // Mode
|
||||
QString::null, // text
|
||||
&ok,
|
||||
this);
|
||||
if (ok && !s.isEmpty()) {
|
||||
if (m_lb->findItem(s, Qt::ExactMatch) == 0) {
|
||||
m_lb->insertItem(s);
|
||||
m_lb->sort();
|
||||
listToConf();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConfParamSLW::listToConf()
|
||||
{
|
||||
LOGDEB(("ConfParamSLW::listToConf()\n"));
|
||||
list<string> ls;
|
||||
for (unsigned int i = 0; i < m_lb->count(); i++) {
|
||||
ls.push_back((const char *)m_lb->text(i));
|
||||
}
|
||||
string s;
|
||||
stringsToString(ls, s);
|
||||
m_cflink.set(s);
|
||||
}
|
||||
|
||||
void ConfParamSLW::deleteSelected()
|
||||
{
|
||||
bool didone;
|
||||
do {
|
||||
didone = false;
|
||||
for (unsigned int i = 0; i < m_lb->count(); i++) {
|
||||
if (m_lb->isSelected(i)) {
|
||||
LOGDEB(("%d is selected\n", i));
|
||||
m_lb->removeItem(i);
|
||||
didone = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (didone);
|
||||
listToConf();
|
||||
}
|
||||
|
||||
// "Add entry" dialog for a file name list
|
||||
void ConfParamFNLW::showInputDialog()
|
||||
{
|
||||
QString s = QFileDialog::getOpenFileName("",
|
||||
"",
|
||||
this,
|
||||
"open file dialog",
|
||||
"Choose a file");
|
||||
if (!s.isEmpty()) {
|
||||
if (m_lb->findItem(s, Qt::ExactMatch) == 0) {
|
||||
m_lb->insertItem(s);
|
||||
m_lb->sort();
|
||||
listToConf();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// "Add entry" dialog for a constrained string list
|
||||
void ConfParamCSLW::showInputDialog()
|
||||
{
|
||||
bool ok;
|
||||
QString s = QInputDialog::getItem("", // Caption
|
||||
"", // Label
|
||||
m_sl, // List
|
||||
0, // current
|
||||
false, // editable,
|
||||
&ok,
|
||||
this);
|
||||
if (ok && !s.isEmpty()) {
|
||||
if (m_lb->findItem(s, Qt::ExactMatch) == 0) {
|
||||
m_lb->insertItem(s);
|
||||
m_lb->sort();
|
||||
listToConf();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
138
src/qtgui/confgui/confgui.h
Normal file
138
src/qtgui/confgui/confgui.h
Normal file
@ -0,0 +1,138 @@
|
||||
#ifndef _confgui_h_included_
|
||||
#define _confgui_h_included_
|
||||
/* @(#$Id: confgui.h,v 1.1 2007-09-26 12:16:48 dockes Exp $ (C) 2007 J.F.Dockes */
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <qstring.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
class QHBoxLayout;
|
||||
class QLineEdit;
|
||||
class QListBox;
|
||||
|
||||
namespace confgui {
|
||||
|
||||
// A class to isolate the gui widget from the config storage mechanism
|
||||
class ConfLink {
|
||||
public:
|
||||
virtual bool set(const string& val) = 0;
|
||||
virtual bool get(string& val) = 0;
|
||||
};
|
||||
|
||||
// A widget to let the user change a configuration parameter
|
||||
class ConfParamW : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfParamW(QWidget *parent, ConfLink &cflink)
|
||||
: QWidget(parent), m_cflink(cflink)
|
||||
{
|
||||
}
|
||||
protected:
|
||||
ConfLink& m_cflink;
|
||||
QHBoxLayout *m_hl;
|
||||
virtual bool createCommon(const QString& lbltxt,
|
||||
const QString& tltptxt);
|
||||
|
||||
protected slots:
|
||||
void setValue(const QString& newvalue);
|
||||
void setValue(int newvalue);
|
||||
void setValue(bool newvalue);
|
||||
};
|
||||
|
||||
|
||||
// Widgets for setting the different types of configuration parameters:
|
||||
class ConfParamIntW : public ConfParamW {
|
||||
public:
|
||||
ConfParamIntW(QWidget *parent, ConfLink& cflink,
|
||||
const QString& lbltxt,
|
||||
const QString& tltptxt,
|
||||
int minvalue = INT_MIN,
|
||||
int maxvalue = INT_MAX);
|
||||
};
|
||||
|
||||
// Arbitrary string
|
||||
class ConfParamStrW : public ConfParamW {
|
||||
public:
|
||||
ConfParamStrW(QWidget *parent, ConfLink& cflink,
|
||||
const QString& lbltxt,
|
||||
const QString& tltptxt);
|
||||
};
|
||||
|
||||
// Constrained string: choose from list
|
||||
class ConfParamCStrW : public ConfParamW {
|
||||
public:
|
||||
ConfParamCStrW(QWidget *parent, ConfLink& cflink,
|
||||
const QString& lbltxt,
|
||||
const QString& tltptxt, const QStringList& sl);
|
||||
};
|
||||
|
||||
class ConfParamBoolW : public ConfParamW {
|
||||
public:
|
||||
ConfParamBoolW(QWidget *parent, ConfLink& cflink,
|
||||
const QString& lbltxt,
|
||||
const QString& tltptxt);
|
||||
};
|
||||
|
||||
class ConfParamFNW : public ConfParamW {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfParamFNW(QWidget *parent, ConfLink& cflink,
|
||||
const QString& lbltxt,
|
||||
const QString& tltptxt);
|
||||
protected slots:
|
||||
void showBrowserDialog();
|
||||
private:
|
||||
QLineEdit *m_le;
|
||||
};
|
||||
|
||||
// String list
|
||||
class ConfParamSLW : public ConfParamW {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfParamSLW(QWidget *parent, ConfLink& cflink,
|
||||
const QString& lbltxt,
|
||||
const QString& tltptxt);
|
||||
protected slots:
|
||||
virtual void showInputDialog();
|
||||
void deleteSelected();
|
||||
protected:
|
||||
QListBox *m_lb;
|
||||
void listToConf();
|
||||
};
|
||||
|
||||
// File/Dir name list
|
||||
class ConfParamFNLW : public ConfParamSLW {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfParamFNLW(QWidget *parent, ConfLink& cflink,
|
||||
const QString& lbltxt,
|
||||
const QString& tltptxt)
|
||||
: ConfParamSLW(parent, cflink, lbltxt, tltptxt)
|
||||
{
|
||||
}
|
||||
protected slots:
|
||||
virtual void showInputDialog();
|
||||
};
|
||||
|
||||
// Constrained string list (chose from predefined)
|
||||
class ConfParamCSLW : public ConfParamSLW {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfParamCSLW(QWidget *parent, ConfLink& cflink,
|
||||
const QString& lbltxt,
|
||||
const QString& tltptxt,
|
||||
const QStringList& sl)
|
||||
: ConfParamSLW(parent, cflink, lbltxt, tltptxt), m_sl(sl)
|
||||
{
|
||||
}
|
||||
protected slots:
|
||||
virtual void showInputDialog();
|
||||
const QStringList &m_sl;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* _confgui_h_included_ */
|
||||
183
src/qtgui/confgui/main.cpp
Normal file
183
src/qtgui/confgui/main.cpp
Normal file
@ -0,0 +1,183 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: main.cpp,v 1.1 2007-09-26 12:16:48 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "autoconfig.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
using std::string;
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qtranslator.h>
|
||||
|
||||
#include <qtextcodec.h>
|
||||
#include <qthread.h>
|
||||
#include <qtimer.h>
|
||||
#include <qlayout.h>
|
||||
|
||||
#include "pathut.h"
|
||||
#include "confgui.h"
|
||||
#include "debuglog.h"
|
||||
|
||||
using namespace confgui;
|
||||
|
||||
const string recoll_datadir = RECOLL_DATADIR;
|
||||
|
||||
static const char *thisprog;
|
||||
static int op_flags;
|
||||
#define OPT_MOINS 0x1
|
||||
#define OPT_h 0x4
|
||||
#define OPT_c 0x20
|
||||
static const char usage [] =
|
||||
"\n"
|
||||
"trconf\n"
|
||||
" -h : Print help and exit\n"
|
||||
;
|
||||
//" -c <configdir> : specify config directory, overriding $RECOLL_CONFDIR\n"
|
||||
//;
|
||||
static void
|
||||
Usage(void)
|
||||
{
|
||||
FILE *fp = (op_flags & OPT_h) ? stdout : stderr;
|
||||
fprintf(fp, "%s: Usage: %s", thisprog, usage);
|
||||
exit((op_flags & OPT_h)==0);
|
||||
}
|
||||
|
||||
class ConfLinkNull : public ConfLink {
|
||||
public:
|
||||
virtual bool set(const string& val)
|
||||
{
|
||||
fprintf(stderr, "Setting value to [%s]\n", val.c_str());
|
||||
return true;
|
||||
}
|
||||
virtual bool get(string& val) {val = ""; return true;}
|
||||
};
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
// fprintf(stderr, "Application created\n");
|
||||
string a_config;
|
||||
thisprog = argv[0];
|
||||
argc--; argv++;
|
||||
|
||||
while (argc > 0 && **argv == '-') {
|
||||
(*argv)++;
|
||||
if (!(**argv))
|
||||
Usage();
|
||||
while (**argv)
|
||||
switch (*(*argv)++) {
|
||||
case 'h': op_flags |= OPT_h; Usage();break;
|
||||
}
|
||||
// b1:
|
||||
argc--; argv++;
|
||||
}
|
||||
|
||||
DebugLog::getdbl()->setloglevel(DEBDEB1);
|
||||
DebugLog::setfilename("stderr");
|
||||
|
||||
// Translation file for Qt
|
||||
QTranslator qt( 0 );
|
||||
qt.load( QString( "qt_" ) + QTextCodec::locale(), "." );
|
||||
app.installTranslator( &qt );
|
||||
|
||||
// Translations for Recoll
|
||||
string translatdir = path_cat(recoll_datadir, "translations");
|
||||
QTranslator translator( 0 );
|
||||
// QTextCodec::locale() returns $LANG
|
||||
translator.load( QString("recoll_") + QTextCodec::locale(),
|
||||
translatdir.c_str() );
|
||||
app.installTranslator( &translator );
|
||||
// fprintf(stderr, "Translations installed\n");
|
||||
|
||||
|
||||
|
||||
QWidget w;
|
||||
ConfLinkNull lnk;
|
||||
|
||||
QVBoxLayout *vboxLayout = new QVBoxLayout(&w);
|
||||
vboxLayout->setSpacing(6);
|
||||
vboxLayout->setMargin(11);
|
||||
|
||||
ConfParamIntW *e1 = new ConfParamIntW(&w, lnk, "The text for the label",
|
||||
"The text for the tooltip");
|
||||
vboxLayout->addWidget(e1);
|
||||
|
||||
ConfParamStrW *e2 = new ConfParamStrW(&w, lnk,
|
||||
"The text for the string label",
|
||||
"The text for the string tooltip");
|
||||
vboxLayout->addWidget(e2);
|
||||
|
||||
QStringList valuelist;
|
||||
valuelist.push_back("aone");
|
||||
valuelist.push_back("btwo");
|
||||
valuelist.push_back("cthree");
|
||||
valuelist.push_back("dfour");
|
||||
|
||||
ConfParamCStrW *e21 = new ConfParamCStrW(&w, lnk,
|
||||
"The text for the string label",
|
||||
"The text for the string tooltip",
|
||||
valuelist);
|
||||
vboxLayout->addWidget(e21);
|
||||
|
||||
|
||||
ConfParamBoolW *e3 = new ConfParamBoolW(&w, lnk,
|
||||
"The text for the Bool label",
|
||||
"The text for the Bool tooltip");
|
||||
vboxLayout->addWidget(e3);
|
||||
|
||||
ConfParamFNW *e4 = new ConfParamFNW(&w, lnk,
|
||||
"The text for the File Name label",
|
||||
"The text for the File Name tooltip");
|
||||
vboxLayout->addWidget(e4);
|
||||
|
||||
ConfParamSLW *e5 = new ConfParamSLW(&w, lnk,
|
||||
"The text for the String List label",
|
||||
"The text for the String List tooltip");
|
||||
vboxLayout->addWidget(e5);
|
||||
|
||||
ConfParamFNLW *e6 = new ConfParamFNLW(&w, lnk,
|
||||
"The text for the File List label",
|
||||
"The text for the File List tooltip");
|
||||
vboxLayout->addWidget(e6);
|
||||
|
||||
ConfParamCSLW *e7 = new ConfParamCSLW(&w, lnk,
|
||||
"The text for the File List label",
|
||||
"The text for the File List tooltip",
|
||||
valuelist);
|
||||
vboxLayout->addWidget(e7);
|
||||
|
||||
QSize size(0, 0);
|
||||
size = size.expandedTo(w.minimumSizeHint());
|
||||
w.resize(size);
|
||||
//w.setSizeGripEnabled(true);
|
||||
w.show();
|
||||
|
||||
// Connect exit handlers etc.. Beware, apparently this must come
|
||||
// after mainWindow->show() , else the QMessageBox above never
|
||||
// returns.
|
||||
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
|
||||
// fprintf(stderr, "Go\n");
|
||||
// Let's go
|
||||
return app.exec();
|
||||
}
|
||||
30
src/qtgui/confgui/trconf.pro
Normal file
30
src/qtgui/confgui/trconf.pro
Normal file
@ -0,0 +1,30 @@
|
||||
TEMPLATE = app
|
||||
LANGUAGE = C++
|
||||
|
||||
CONFIG += qt warn_on thread release debug
|
||||
|
||||
HEADERS += confgui.h
|
||||
|
||||
SOURCES += main.cpp confgui.cpp
|
||||
|
||||
#FORMS =
|
||||
|
||||
unix {
|
||||
UI_DIR = .ui
|
||||
MOC_DIR = .moc
|
||||
OBJECTS_DIR = .obj
|
||||
|
||||
DEFINES += RECOLL_DATADIR=\"/usr/local/share/recoll\"
|
||||
LIBS += ../../lib/librcl.a -lz
|
||||
|
||||
INCLUDEPATH += ../../common ../../utils
|
||||
#../index ../internfile ../query ../unac \
|
||||
# ../aspell ../rcldb
|
||||
POST_TARGETDEPS = ../../lib/librcl.a
|
||||
}
|
||||
|
||||
UNAME = $$system(uname -s)
|
||||
contains( UNAME, [lL]inux ) {
|
||||
LIBS -= -liconv
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user