compiles (doesnt work) on qt4

This commit is contained in:
dockes 2006-12-04 08:17:24 +00:00
parent f8a066a848
commit 3e1a740412
9 changed files with 127 additions and 58 deletions

View File

@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>0</width>
<height>0</height>
<width>515</width>
<height>475</height>
</rect>
</property>
<property name="caption">
@ -147,16 +147,25 @@
</widget>
</vbox>
</widget>
<widget class="QLayoutWidget">
<widget class="QFrame">
<property name="name">
<cstring>clauseVBox</cstring>
<cstring>clauseFRM</cstring>
</property>
<property name="frameShape">
<enum>StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>Plain</enum>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>2</number>
<number>0</number>
</property>
<widget class="Line">
<property name="name">
@ -218,12 +227,12 @@
<property name="name">
<cstring>saveFileTypesPB</cstring>
</property>
<property name="text">
<string>Save as default</string>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Save as default</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: advsearch_w.cpp,v 1.14 2006-12-04 06:19:10 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: advsearch_w.cpp,v 1.15 2006-12-04 08:17:24 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -26,10 +26,11 @@ static char rcsid[] = "@(#$Id: advsearch_w.cpp,v 1.14 2006-12-04 06:19:10 dockes
#include <qframe.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#if (QT_VERSION < 0x040000)
#include <qcombobox.h>
#include <qlistbox.h>
#else
#include <q3combobox.h>
#include <q3listbox.h>
#endif
@ -194,11 +195,11 @@ void AdvSearch::addClause()
void AdvSearch::addClause(int tp)
{
SearchClauseW *w = new SearchClauseW(this);
SearchClauseW *w = new SearchClauseW(clauseFRM);
m_clauseWins.push_back(w);
connect(w->wordsLE, SIGNAL(returnPressed()),
this, SLOT(searchPB_clicked()));
clauseVBox->addWidget(w);
((QVBoxLayout *)(clauseFRM->layout()))->addWidget(w);
w->show();
w->tpChange(tp);
if (m_clauseWins.size() > iclausescnt) {
@ -207,7 +208,7 @@ void AdvSearch::addClause(int tp)
delClausePB->setEnabled(false);
}
// Have to adjust the size else we lose the bottom buttons! Why?
QSize sz = AdvSearchBaseLayout->sizeHint();
QSize sz = layout()->sizeHint();
resize(QSize(sz.width()+HORADJ, sz.height()+VERTADJ));
}
@ -222,7 +223,7 @@ void AdvSearch::delClause()
} else {
delClausePB->setEnabled(false);
}
QSize sz = AdvSearchBaseLayout->sizeHint();
QSize sz = layout()->sizeHint();
resize(QSize(sz.width()+HORADJ, sz.height()+VERTADJ));
}
@ -310,15 +311,23 @@ void AdvSearch::searchPB_clicked()
}
if (!subtreeCMB->currentText().isEmpty()) {
QString current = subtreeCMB->currentText();
sdata->setTopdir((const char*)subtreeCMB->currentText().utf8());
// The listbox is set for no insertion, do it. Have to check
// for dups as the internal feature seems to only work for
// user-inserted strings
if (!subtreeCMB->listBox()->findItem(subtreeCMB->currentText(),
Qt::CaseSensitive|Qt::ExactMatch))
subtreeCMB->insertItem(subtreeCMB->currentText(), 0);
// And keep it sorted
subtreeCMB->listBox()->sort();
// Keep history list clean and sorted. Maybe there would be a
// simpler way to do this
list<QString> entries;
for (int i = 0; i < subtreeCMB->count(); i++) {
entries.push_back(subtreeCMB->text(i));
}
entries.push_back(subtreeCMB->currentText());
entries.sort();
unique(entries.begin(), entries.end());
subtreeCMB->clear();
for (list<QString>::iterator it = entries.begin();
it != entries.end(); it++) {
subtreeCMB->insertItem(*it);
}
subtreeCMB->setCurrentText(current);
prefs.asearchSubdirHist.clear();
for (int index = 0; index < subtreeCMB->count(); index++)
prefs.asearchSubdirHist.push_back(subtreeCMB->text(index));

View File

@ -1,6 +1,6 @@
#ifndef _ADVSEARCH_W_H_INCLUDED_
#define _ADVSEARCH_W_H_INCLUDED_
/* @(#$Id: advsearch_w.h,v 1.8 2006-12-04 06:19:10 dockes Exp $ (C) 2005 J.F.Dockes */
/* @(#$Id: advsearch_w.h,v 1.9 2006-12-04 08:17:24 dockes Exp $ (C) 2005 J.F.Dockes */
/*
* 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
@ -73,7 +73,9 @@ public slots:
virtual void addClause();
virtual void addClause(int);
virtual bool close();
#if (QT_VERSION < 0x040000)
virtual void polish();
#endif
signals:
void startSearch(RefCntr<Rcl::SearchData>);

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: preview_w.cpp,v 1.8 2006-11-30 13:38:44 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: preview_w.cpp,v 1.9 2006-12-04 08:17:24 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -27,12 +27,19 @@ using std::pair;
#endif /* NO_NAMESPACES */
#include <qmessagebox.h>
#include <qprogressdialog.h>
#include <qthread.h>
#include <qvariant.h>
#include <qpushbutton.h>
#include <qtabwidget.h>
#if (QT_VERSION < 0x040000)
#include <qtextedit.h>
#include <qprogressdialog.h>
#else
#include <q3textedit.h>
#include <q3progressdialog.h>
#include <q3stylesheet.h>
#endif
#include <qevent.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qcheckbox.h>
@ -110,33 +117,34 @@ bool Preview::eventFilter(QObject *target, QEvent *event)
LOGDEB1(("Preview::eventFilter: keyEvent\n"));
QKeyEvent *keyEvent = (QKeyEvent *)event;
if (keyEvent->key() == Key_Q && (keyEvent->state() & ControlButton)) {
if (keyEvent->key() == Qt::Key_Q &&
(keyEvent->state() & Qt::ControlButton)) {
recollNeedsExit = 1;
return true;
} else if (keyEvent->key() == Key_Escape) {
} else if (keyEvent->key() == Qt::Key_Escape) {
close();
return true;
} else if (keyEvent->key() == Qt::Key_Down &&
(keyEvent->state() & ShiftButton)) {
(keyEvent->state() & Qt::ShiftButton)) {
// LOGDEB(("Preview::eventFilter: got Shift-Up\n"));
TabData *d = tabDataForCurrent();
if (d)
emit(showNext(m_searchId, d->docnum));
return true;
} else if (keyEvent->key() == Qt::Key_Up &&
(keyEvent->state() & ShiftButton)) {
(keyEvent->state() & Qt::ShiftButton)) {
// LOGDEB(("Preview::eventFilter: got Shift-Down\n"));
TabData *d = tabDataForCurrent();
if (d)
emit(showPrev(m_searchId, d->docnum));
return true;
} else if (keyEvent->key() == Key_W &&
(keyEvent->state() & ControlButton)) {
} else if (keyEvent->key() == Qt::Key_W &&
(keyEvent->state() & Qt::ControlButton)) {
// LOGDEB(("Preview::eventFilter: got ^W\n"));
closeCurrentTab();
return true;
} else if (dynSearchActive) {
if (keyEvent->key() == Key_F3) {
if (keyEvent->key() == Qt::Key_F3) {
doSearch(searchTextLine->text(), true, false);
return true;
}
@ -146,9 +154,9 @@ bool Preview::eventFilter(QObject *target, QEvent *event)
QWidget *tw = pvTab->currentPage();
QWidget *e = 0;
if (tw)
e = (QTextEdit *)tw->child("pvEdit");
e = (QWidget *)tw->child("pvEdit");
LOGDEB1(("Widget: %p, edit %p, target %p\n", tw, e, target));
if (e && target == tw && keyEvent->key() == Key_Slash) {
if (e && target == tw && keyEvent->key() == Qt::Key_Slash) {
searchTextLine->setFocus();
dynSearchActive = true;
return true;
@ -175,6 +183,12 @@ void Preview::searchTextLine_textChanged(const QString & text)
}
}
#if (QT_VERSION >= 0x040000)
#define QTextEdit Q3TextEdit
#define QProgressDialog Q3ProgressDialog
#define QStyleSheetItem Q3StyleSheetItem
#endif
QTextEdit *Preview::getCurrentEditor()
{
QWidget *tw = pvTab->currentPage();
@ -537,8 +551,13 @@ bool Preview::loadFileInCurrentTab(string fn, size_t sz, const Rcl::Doc &idoc,
for (prog = 1;;prog++) {
waiter.start();
waiter.wait();
#if (QT_VERSION < 0x040000)
if (lthr.finished())
break;
#else
if (lthr.isFinished())
break;
#endif
progress.setProgress(prog , prog <= nsteps-1 ? nsteps : prog+1);
qApp->processEvents();
if (progress.wasCanceled()) {
@ -569,8 +588,13 @@ bool Preview::loadFileInCurrentTab(string fn, size_t sz, const Rcl::Doc &idoc,
for (;;prog++) {
waiter.start(); waiter.wait();
if (rthr.finished())
break;
#if (QT_VERSION < 0x040000)
if (rthr.finished())
break;
#else
if (rthr.isFinished())
break;
#endif
progress.setProgress(prog , prog <= nsteps-1 ? nsteps : prog+1);
qApp->processEvents();
if (progress.wasCanceled()) {
@ -609,7 +633,7 @@ bool Preview::loadFileInCurrentTab(string fn, size_t sz, const Rcl::Doc &idoc,
progress.setLabelText(tr("Loading preview text into editor"));
qApp->processEvents();
int l = 0;
for (unsigned int pos = 0; pos < richTxt.length(); pos += l, prog++) {
for (int pos = 0; pos < (int)richTxt.length(); pos += l, prog++) {
progress.setProgress(prog , prog <= nsteps-1 ? nsteps : prog+1);
qApp->processEvents();

View File

@ -1,6 +1,6 @@
#ifndef _PREVIEW_W_H_INCLUDED_
#define _PREVIEW_W_H_INCLUDED_
/* @(#$Id: preview_w.h,v 1.5 2006-12-04 06:19:11 dockes Exp $ (C) 2006 J.F.Dockes */
/* @(#$Id: preview_w.h,v 1.6 2006-12-04 08:17:24 dockes Exp $ (C) 2006 J.F.Dockes */
/*
* 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
@ -26,6 +26,7 @@
#include "preview.h"
#else
#include "ui_preview.h"
#define QTextEdit Q3TextEdit
#endif
#include "refcntr.h"
#include "searchdata.h"

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: sort_w.cpp,v 1.2 2006-09-21 09:37:28 dockes Exp $ (C) 2006 J.F.Dockes";
static char rcsid[] = "@(#$Id: sort_w.cpp,v 1.3 2006-12-04 08:17:24 dockes Exp $ (C) 2006 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -31,13 +31,18 @@ static char rcsid[] = "@(#$Id: sort_w.cpp,v 1.2 2006-09-21 09:37:28 dockes Exp $
void SortForm::init()
{
const char *labels[5];
labels[0] = "";
labels[1] = "Date";
labels[2] = "Mime type";
labels[3] = 0;
fldCMB1->insertStrList(labels, 3);
fldCMB2->insertStrList(labels, 3);
QStringList slabs;
slabs += QString();
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.sortWidth);

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: ssearch_w.cpp,v 1.12 2006-11-30 13:38:44 dockes Exp $ (C) 2006 J.F.Dockes";
static char rcsid[] = "@(#$Id: ssearch_w.cpp,v 1.13 2006-12-04 08:17:24 dockes Exp $ (C) 2006 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -26,6 +26,7 @@ static char rcsid[] = "@(#$Id: ssearch_w.cpp,v 1.12 2006-11-30 13:38:44 dockes E
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qmessagebox.h>
#include <qevent.h>
#include "debuglog.h"
#include "guiutils.h"
@ -210,11 +211,11 @@ bool SSearch::eventFilter(QObject *target, QEvent *event)
QKeyEvent *ke = (QKeyEvent *)event;
LOGDEB1(("SSearch::eventFilter: keyPress escape %d key %d\n",
m_escape, ke->key()));
if (ke->key() == Key_Escape) {
if (ke->key() == Qt::Key_Escape) {
LOGDEB(("Escape\n"));
m_escape = true;
return true;
} else if (m_escape && ke->key() == Key_Space) {
} else if (m_escape && ke->key() == Qt::Key_Space) {
LOGDEB(("Escape space\n"));
ke->accept();
completion();

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.11 2006-11-21 08:47:51 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.12 2006-12-04 08:17:24 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -24,7 +24,6 @@ static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.11 2006-11-21 08:47:51 dockes E
#include <list>
#include <qfontdialog.h>
#include <qfiledialog.h>
#include <qspinbox.h>
#include <qmessagebox.h>
#include <qvariant.h>
@ -36,7 +35,16 @@ static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.11 2006-11-21 08:47:51 dockes E
#include <qlineedit.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#if QT_VERSION < 0x040000
#include <qlistbox.h>
#include <qfiledialog.h>
#else
#include <q3listbox.h>
#include <q3filedialog.h>
#define QListBox Q3ListBox
#define QListBoxItem Q3ListBoxItem
#define QFileDialog Q3FileDialog
#endif
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
@ -241,7 +249,7 @@ void UIPrefsDialog::showBrowserDialog()
this,
"open file dialog",
"Choose a file");
if (s)
if (!s.isEmpty())
helpBrowserLE->setText(s);
}
@ -268,7 +276,12 @@ void UIPrefsDialog::addADbPB_clicked()
if (item && item->isSelected()) {
allDbsLB->setSelected(i, false);
if (!actDbsLB->findItem(item->text(),
Qt::CaseSensitive|Qt::ExactMatch)) {
#if QT_VERSION < 0x040000
Qt::CaseSensitive|Qt::ExactMatch
#else
Q3ListBox::CaseSensitive|Q3ListBox::ExactMatch
#endif
)) {
actDbsLB->insertItem(item->text());
}
}
@ -343,7 +356,12 @@ void UIPrefsDialog::addExtraDbPB_clicked()
return;
}
if (allDbsLB->findItem(extraDbLE->text(),
Qt::CaseSensitive|Qt::ExactMatch)) {
#if QT_VERSION < 0x040000
Qt::CaseSensitive|Qt::ExactMatch
#else
Q3ListBox::CaseSensitive|Q3ListBox::ExactMatch
#endif
)) {
QMessageBox::warning(0, "Recoll",
tr("The selected directory is already in the index list"));
return;
@ -361,6 +379,6 @@ void UIPrefsDialog::browseDbPB_clicked()
tr("Select xapian index directory (ie: /home/buddy/.recoll/xapiandb)"));
fdia.setShowHiddenFiles(savedh);
if (s)
if (!s.isEmpty())
extraDbLE->setText(s);
}

View File

@ -1,4 +1,4 @@
/* @(#$Id: uiprefs_w.h,v 1.3 2006-12-04 06:19:11 dockes Exp $ (C) 2006 J.F.Dockes */
/* @(#$Id: uiprefs_w.h,v 1.4 2006-12-04 08:17:24 dockes Exp $ (C) 2006 J.F.Dockes */
/*
* 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
@ -17,7 +17,7 @@
*/
#ifndef _UIPREFS_W_H_INCLUDED_
#define _UIPREFS_W_H_INCLUDED_
/* @(#$Id: uiprefs_w.h,v 1.3 2006-12-04 06:19:11 dockes Exp $ (C) 2005 J.F.Dockes */
/* @(#$Id: uiprefs_w.h,v 1.4 2006-12-04 08:17:24 dockes Exp $ (C) 2005 J.F.Dockes */
#include <qvariant.h>
#include <qdialog.h>
@ -37,7 +37,7 @@ class DummyUIPrefsDialogBase : public UIPrefsDialogBase
: UIPrefsDialogBase(parent) {}
};
#else
class DummyUIPrefsDialogBase : public QWidget, protected Ui::UIPrefsDialogBase
class DummyUIPrefsDialogBase : public QDialog, protected Ui::UIPrefsDialogBase
{
public: DummyUIPrefsDialogBase(QDialog *parent) {setupUi(parent);}
};