Commit c5e40d85 authored by Jean-Francois Dockes's avatar Jean-Francois Dockes
Browse files

replaced all q3 widgets except textbrowsers

parent e03b17fd
......@@ -58,30 +58,18 @@ src/lib/alldeps
src/lib/librcl.a
src/mk/localdefs
src/mk/sysconf
src/qt4gui/.moc/*
src/qt4gui/.ui/*
src/qt4gui/Makefile
src/qt4gui/advsearch.ui
src/qt4gui/images
src/qt4gui/preview.ui
src/qt4gui/qrc_recoll.cpp
src/qt4gui/recoll
src/qt4gui/recoll.app
src/qt4gui/recoll.pro
src/qt4gui/sort.ui
src/qt4gui/ssearchb.ui
src/qt4gui/uiprefs.ui
src/qt4gui/viewaction.ui
src/qtgui/.moc/*
src/qtgui/.obj/*
src/qtgui/.ui/*
src/qtgui/Makefile
src/qtgui/i18n/*.qm
src/qtgui/qrc_recoll.cpp
src/qtgui/recoll
src/qtgui/recoll.pro
src/query/alldeps
src/query/recollq
src/query/xadump
src/recollinstall
src/sampleconf/recoll.conf
src/sampleconf/rclmon.sh
src/sampleconf/recoll.conf
website/usermanual/*
......@@ -740,8 +740,8 @@ bool RclConfig::getFieldConfParam(const string &name, const string &sk,
string RclConfig::getMimeViewerDef(const string &mtype, const string& apptag)
{
LOGDEB(("RclConfig::getMimeViewerDef: mtype %s apptag %s\n",
mtype.c_str(), apptag.c_str()));
LOGDEB2(("RclConfig::getMimeViewerDef: mtype [%s] apptag [%s]\n",
mtype.c_str(), apptag.c_str()));
string hs;
if (mimeview == 0)
return hs;
......
......@@ -64,12 +64,7 @@ PrefsPack prefs;
void rwSettings(bool writing)
{
LOGDEB1(("rwSettings: write %d\n", int(writing)));
#if QT_VERSION >= 0x040000
QSettings settings("Recoll.org", "recoll");
#else
QSettings settings;
settings.setPath("Recoll.org", "Recoll", QSettings::User);
#endif
SETTING_RW(prefs.mainwidth, "/Recoll/geometry/width", Num, 0);
SETTING_RW(prefs.mainheight, "/Recoll/geometry/height", Num, 0);
SETTING_RW(prefs.pvwidth, "/Recoll/geometry/pvwidth", Num, 0);
......
......@@ -22,11 +22,6 @@ static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.57 2008-10-13 07:57:12 dockes E
#include <qevent.h>
#include <qwidget.h>
#if (QT_VERSION < 0x040000)
#define Q34EVOVERRIDE QEvent::AccelOverride
#else
#define Q34EVOVERRIDE QEvent::ShortcutOverride
#endif
#include "recoll.h"
#include "rclhelp.h"
......@@ -48,7 +43,8 @@ HelpClient::HelpClient(QObject *parent, const char *name)
bool HelpClient::eventFilter(QObject *obj, QEvent *event)
{
static time_t last_start;
if (event->type() == QEvent::KeyPress || event->type() == Q34EVOVERRIDE) {
if (event->type() == QEvent::KeyPress ||
event->type() == QEvent::ShortcutOverride) {
// LOGDEB(("HelpClient::eventFilter: %d\n", (int)event->type()));
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_F1 || ke->key() == Qt::Key_Help) {
......@@ -78,4 +74,3 @@ bool HelpClient::eventFilter(QObject *obj, QEvent *event)
}
return false;
}
......@@ -108,7 +108,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>31</height>
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="fileMenu">
......
......@@ -34,20 +34,7 @@ using std::pair;
#include <qapplication.h>
#include <qmessagebox.h>
#include <qfiledialog.h>
#if (QT_VERSION < 0x040000)
#include <qcstring.h>
#include <qpopupmenu.h>
#include <qradiobutton.h>
#include <qbuttongroup.h>
#include <qaccel.h>
#undef RCLQT4
#define RCLQT3 1
#else
#undef RCLQT3
#define RCLQT4 1
#include <qshortcut.h>
#endif
#include <qtabwidget.h>
#include <qtimer.h>
......@@ -92,18 +79,6 @@ using namespace confgui;
extern "C" int XFlush(void *);
QString g_stringAllStem, g_stringNoStem;
// Taken from qt designer. Don't know why it's needed.
#if RCLQT3
static QIconSet createIconSet(const QString &name)
{
QIconSet ic(QPixmap::fromMimeSource(name));
QString iname = "d_" + name;
ic.setPixmap(QPixmap::fromMimeSource(iname),
QIconSet::Small, QIconSet::Disabled );
return ic;
}
#endif
void RclMain::init()
{
// This is just to get the common catg strings into the message file
......@@ -175,14 +150,8 @@ void RclMain::init()
// A shortcut to get the focus back to the search entry.
QKeySequence seq("Ctrl+Shift+s");
#if RCLQT4
QShortcut *sc = new QShortcut(seq, this);
connect(sc, SIGNAL (activated()), this, SLOT (focusToSearch()));
#else
QAccel *sc = new QAccel(this);
sc->insertItem(seq);
connect(sc, SIGNAL (activated(int)), this, SLOT (focusToSearch()));
#endif
// Toolbar+combobox version of the category selector
......@@ -191,26 +160,20 @@ void RclMain::init()
QToolBar *catgToolBar = new QToolBar(this);
catgCMB = new QComboBox(FALSE, catgToolBar, "catCMB");
catgCMB->insertItem(tr("All"));
#if RCLQT4
catgToolBar->setObjectName(QString::fromUtf8("catgToolBar"));
catgCMB->setToolTip(tr("Document category filter"));
catgToolBar->addWidget(catgCMB);
this->addToolBar(Qt::TopToolBarArea, catgToolBar);
#endif
}
// Document categories buttons
#if RCLQT3
catgBGRP->setColumnLayout(1, Qt::Vertical);
connect(catgBGRP, SIGNAL(clicked(int)), this, SLOT(catgFilter(int)));
#else
QHBoxLayout *bgrphbox = new QHBoxLayout(catgBGRP);
QButtonGroup *bgrp = new QButtonGroup(catgBGRP);
bgrphbox->addWidget(allRDB);
int bgrpid = 0;
bgrp->addButton(allRDB, bgrpid++);
connect(bgrp, SIGNAL(buttonClicked(int)), this, SLOT(catgFilter(int)));
#endif
allRDB->setChecked(true);
list<string> cats;
rclconfig->getMimeCategories(cats);
......@@ -225,27 +188,17 @@ void RclMain::init()
but->setText(tr(catgnm));
if (prefs.catgToolBar && catgCMB)
catgCMB->insertItem(tr(catgnm));
#if RCLQT4
bgrphbox->addWidget(but);
bgrp->addButton(but, bgrpid++);
#endif
}
#if RCLQT3
catgBGRP->setButton(0);
#else
catgBGRP->setLayout(bgrphbox);
#endif
if (prefs.catgToolBar)
catgBGRP->hide();
// Connections
connect(sSearch, SIGNAL(startSearch(RefCntr<Rcl::SearchData>)),
this, SLOT(startSearch(RefCntr<Rcl::SearchData>)));
#if RCLQT4
sSearch->queryText->installEventFilter(this);
#else
sSearch->queryText->lineEdit()->installEventFilter(this);
#endif
connect(preferencesMenu, SIGNAL(activated(int)),
this, SLOT(setStemLang(int)));
......@@ -310,15 +263,6 @@ void RclMain::init()
// speeded up during indexing
periodictimer->start(1000);
#if RCLQT3
nextPageAction->setIconSet(createIconSet("nextpage.png"));
prevPageAction->setIconSet(createIconSet("prevpage.png"));
firstPageAction->setIconSet(createIconSet("firstpage.png"));
toolsSpellAction->setIconSet(QPixmap::fromMimeSource("spell.png"));
toolsDoc_HistoryAction->setIconSet(QPixmap::fromMimeSource("history.png"));
toolsAdvanced_SearchAction->setIconSet(QPixmap::fromMimeSource("asearch.png"));
toolsSort_parametersAction->setIconSet(QPixmap::fromMimeSource("sortparms.png"));
#else
toolsSpellAction->setIcon(QIcon(":/images/spell.png"));
nextPageAction->setIcon(QIcon(":/images/nextpage.png"));
prevPageAction->setIcon(QIcon(":/images/prevpage.png"));
......@@ -326,8 +270,6 @@ void RclMain::init()
toolsDoc_HistoryAction->setIcon(QIcon(":/images/history.png"));
toolsAdvanced_SearchAction->setIcon(QIcon(":/images/asearch.png"));
toolsSort_parametersAction->setIcon(QIcon(":/images/sortparms.png"));
#endif
// If requested by prefs, restore sort state. The easiest way is to let
// a SortForm do it for us.
......@@ -350,11 +292,7 @@ void RclMain::initDbOpen()
if (!maybeOpenDb(reason)) {
nodb = true;
switch (QMessageBox::
#if (QT_VERSION >= 0x030200)
question
#else
information
#endif
(this, "Recoll",
qApp->translate("Main", "Could not open database in ") +
QString::fromLocal8Bit(rclconfig->getDbDir().c_str()) +
......@@ -391,11 +329,7 @@ void RclMain::initDbOpen()
void RclMain::focusToSearch()
{
LOGDEB(("Giving focus to sSearch\n"));
sSearch->queryText->setFocus(
#if RCLQT4
Qt::ShortcutFocusReason
#endif
);
sSearch->queryText->setFocus(Qt::ShortcutFocusReason);
}
void RclMain::setStemLang(int id)
......
......@@ -32,43 +32,25 @@
#include "pathut.h"
class ExecCmd;
class Preview;
#if QT_VERSION < 0x040000
#include "rclmain.h"
#else
#include "ui_rclmain.h"
#endif
//MOC_SKIP_BEGIN
#if QT_VERSION < 0x040000
class DummyRclMainBase : public RclMainBase
{
public: DummyRclMainBase(QWidget* parent = 0) : RclMainBase(parent) {}
};
#define RCLMAINPARENT QWidget
#else
class DummyRclMainBase : public QMainWindow, public Ui::RclMainBase
{
public: DummyRclMainBase(QWidget *parent) :QMainWindow(parent){setupUi(this);}
#define RCLMAINPARENT QMainWindow
};
#endif
//MOC_SKIP_END
class Preview;
namespace confgui {
class ConfIndexW;
class ConfIndexW;
}
using confgui::ConfIndexW;
class RclMain : public DummyRclMainBase
class RclMain : public QMainWindow, public Ui::RclMainBase
{
Q_OBJECT
public:
RclMain(RCLMAINPARENT * parent = 0)
: DummyRclMainBase(parent)
RclMain(QWidget * parent = 0)
: QMainWindow(parent)
{
setupUi(this);
init();
}
~RclMain() {}
......
......@@ -36,13 +36,8 @@ void SortForm::init()
slabs += tr("Date");
slabs += tr("Mime type");
#if QT_VERSION < 0x040000
fldCMB1->insertStringList(slabs);
fldCMB2->insertStringList(slabs);
#else
fldCMB1->addItems(slabs);
fldCMB2->addItems(slabs);
#endif
// Initialize values from prefs:
mcntSB->setValue(prefs.sortDepth);
......
......@@ -21,41 +21,23 @@
#include <qvariant.h>
#include <qdialog.h>
#include "sortseq.h"
#if (QT_VERSION < 0x040000)
#include "sort.h"
#else
#include "ui_sort.h"
#endif
class QDialog;
//MOC_SKIP_BEGIN
#if QT_VERSION < 0x040000
class DummySortFormBase : public SortFormBase
{
public: DummySortFormBase(QWidget* parent = 0) : SortFormBase(parent) {}
};
#else
class DummySortFormBase : public QDialog, public Ui::SortFormBase
{
public: DummySortFormBase(QWidget* parent):QDialog(parent){setupUi(this);}
};
#endif
//MOC_SKIP_END
class SortForm : public DummySortFormBase
class SortForm : public QDialog, public Ui::SortFormBase
{
Q_OBJECT
public:
SortForm(QDialog* parent = 0)
: DummySortFormBase(parent)
SortForm(QWidget* parent = 0)
: QDialog(parent)
{
setupUi(this);
init();
}
~SortForm() {}
public slots:
virtual void apply();
virtual void setData();
......
......@@ -31,12 +31,8 @@ static char rcsid[] = "@(#$Id: spell_w.cpp,v 1.11 2007-02-19 16:28:05 dockes Exp
#include <qlayout.h>
#include <qtooltip.h>
#include <qcombobox.h>
#if (QT_VERSION < 0x040000)
#include <qlistview.h>
#else
#include <QTableWidget>
#include <QHeaderView>
#endif
#include "debuglog.h"
#include "recoll.h"
......@@ -92,59 +88,25 @@ void SpellW::init()
connect(dismissPB, SIGNAL(clicked()), this, SLOT(close()));
connect(expTypeCMB, SIGNAL(activated(int)), this, SLOT(modeSet(int)));
#if (QT_VERSION < 0x040000)
connect(suggsLV,
SIGNAL(doubleClicked(QListViewItem *, const QPoint &, int)),
this, SLOT(textDoubleClicked()));
// No initial sorting: user can choose to establish one
suggsLV->setSorting(100, false);
#else
QStringList labels(tr("Term"));
labels.push_back(tr("Doc. / Tot."));
suggsLV->setHorizontalHeaderLabels(labels);
suggsLV->setShowGrid(0);
suggsLV->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
suggsLV->verticalHeader()->setDefaultSectionSize(20);
connect(suggsLV,
SIGNAL(cellDoubleClicked(int, int)),
this, SLOT(textDoubleClicked(int, int)));
#endif
suggsLV->setColumnWidth(0, 200);
suggsLV->setColumnWidth(1, 150);
}
#if (QT_VERSION < 0x040000)
// Subclass qlistviewitem for numeric sorting on column 1
class MyListViewItem : public QListViewItem
{
public:
MyListViewItem(QListView *listView, const QString& s1, const QString& s2)
: QListViewItem(listView, s1, s2)
{ }
int compare(QListViewItem * i, int col, bool) const {
if (col == 0)
return i->text(0).compare(text(0));
if (col == 1)
return i->text(1).toInt() - text(1).toInt();
// ??
return 0;
}
};
#else
#endif
/* Expand term according to current mode */
void SpellW::doExpand()
{
// Can't clear qt4 table widget: resets column headers too
#if (QT_VERSION < 0x040000)
suggsLV->clear();
#else
suggsLV->setRowCount(0);
#endif
if (baseWordLE->text().isEmpty())
return;
......@@ -209,43 +171,25 @@ void SpellW::doExpand()
if (res.entries.empty()) {
#if (QT_VERSION < 0x040000)
new MyListViewItem(suggsLV, tr("No expansion found"), "");
#else
suggsLV->setItem(0, 0, new QTableWidgetItem(tr("No expansion found")));
#endif
} else {
#if (QT_VERSION < 0x040000)
for (list<Rcl::TermMatchEntry>::reverse_iterator it =
res.entries.rbegin();
it != res.entries.rend(); it++) {
#else
int row = 0;
for (list<Rcl::TermMatchEntry>::iterator it = res.entries.begin();
it != res.entries.end(); it++) {
#endif
LOGDEB(("SpellW::expand: %6d [%s]\n", it->wcf, it->term.c_str()));
char num[30];
if (it->wcf)
sprintf(num, "%d / %d", it->docs, it->wcf);
else
num[0] = 0;
#if (QT_VERSION < 0x040000)
new MyListViewItem(suggsLV,
QString::fromUtf8(it->term.c_str()),
QString::fromAscii(num));
#else
if (suggsLV->rowCount() <= row)
suggsLV->setRowCount(row+1);
suggsLV->setItem(row, 0,
new QTableWidgetItem(QString::fromUtf8(it->term.c_str())));
suggsLV->setItem(row++, 1,
new QTableWidgetItem(QString::fromAscii(num)));
#endif
}
#if (QT_VERSION >= 0x040000)
suggsLV->setRowCount(row+1);
#endif
}
}
......@@ -253,40 +197,18 @@ void SpellW::wordChanged(const QString &text)
{
if (text.isEmpty()) {
expandPB->setEnabled(false);
#if (QT_VERSION < 0x040000)
suggsLV->clear();
#else
suggsLV->setRowCount(0);
#endif
} else {
expandPB->setEnabled(true);
}
}
#if (QT_VERSION < 0x040000)
void SpellW::textDoubleClicked(int, int){}
void SpellW::textDoubleClicked()
#else
void SpellW::textDoubleClicked() {}
void SpellW::textDoubleClicked(int row, int)
#endif
{
#if (QT_VERSION < 0x040000)
QListViewItemIterator it(suggsLV);
while (it.current()) {
QListViewItem *item = it.current();
if (!item->isSelected()) {
++it;
continue;
}
emit(wordSelect((const char *)item->text(0)));
++it;
}
#else
QTableWidgetItem *item = suggsLV->item(row, 0);
if (item)
emit(wordSelect(item->text()));
#endif
}
void SpellW::modeSet(int mode)
......
......@@ -21,30 +21,16 @@
#include <qvariant.h>
#include <qwidget.h>
//MOC_SKIP_BEGIN
#if QT_VERSION < 0x040000
#include "spell.h"
class DummySpellBase : public SpellBase
{
public: DummySpellBase(QWidget* parent = 0) : SpellBase(parent) {}
};
#else
#include "ui_spell.h"
class DummySpellBase : public QWidget, public Ui::SpellBase
{
public: DummySpellBase(QWidget* parent):QWidget(parent){setupUi(this);}
};
#endif
//MOC_SKIP_END
class SpellW : public DummySpellBase
class SpellW : public QWidget, public Ui::SpellBase
{
Q_OBJECT
public:
SpellW(QWidget* parent = 0)
: DummySpellBase(parent)
: QWidget(parent)
{
setupUi(this);
init();
}
......
......@@ -56,11 +56,7 @@ void SSearch::init()
connect(searchPB, SIGNAL(clicked()), this, SLOT(startSimpleSearch()));
connect(searchTypCMB, SIGNAL(activated(int)), this, SLOT(searchTypeChanged(int)));
#if QT_VERSION >= 0x040000
queryText->installEventFilter(this);
#else
queryText->lineEdit()->installEventFilter(this);
#endif
m_escape = false;
}
......@@ -309,90 +305,6 @@ void SSearch::completion()
#undef SHOWEVENTS
#if defined(SHOWEVENTS)
#if QT_VERSION < 0x040000
static const char *eventTypeToStr(int tp)
{
switch (tp) {
case 0: return "None";
case 1: return "Timer";
case 2: return "MouseButtonPress";
case 3: return "MouseButtonRelease";
case 4: return "MouseButtonDblClick";
case 5: return "MouseMove";
case 6: return "KeyPress";
case 7: return "KeyRelease";
case 8: return "FocusIn";
case 9: return "FocusOut";
case 10: return "Enter";
case 11: return "Leave";
case 12: return "Paint";
case 13: return "Move";
case 14: return "Resize";
case 15: return "Create";
case 16: return "Destroy";
case 17: return "Show";
case 18: return "Hide";
case 19: return "Close";
case 20: return "Quit";
case 21: return "Reparent";
case 22: return "ShowMinimized";
case 23: return "ShowNormal";
case 24: return "WindowActivate";
case 25: return "WindowDeactivate";
case 26: return "ShowToParent";
case 27: return "HideToParent";
case 28: return "ShowMaximized";
case 29: return "ShowFullScreen";
case 30: return "Accel";
case 31: return "Wheel";
case 32: return "AccelAvailable";
case 33: return "CaptionChange";
case 34: return "IconChange";
case 35: return "ParentFontChange";
case 36: return "ApplicationFontChange";
case 37: return "ParentPaletteChange";
case 38: return "ApplicationPaletteChange";
case 39: return "PaletteChange";
case 40: return "Clipboard";
case 42: return "Speech";
case 50: return "SockAct";
case 51: return "AccelOverride";
case 52: return "DeferredDelete";