Qt GUI: made the Qt4 main window native Qt4 (no more use of Q3MainWindow)

This commit is contained in:
Jean-Francois Dockes 2010-01-30 14:09:40 +01:00
parent 4802ec53ed
commit 7f8c086f4a
6 changed files with 367 additions and 27 deletions

View File

@ -62,7 +62,6 @@ src/qt4gui/advsearch.ui
src/qt4gui/images
src/qt4gui/preview.ui
src/qt4gui/qrc_recoll.cpp
src/qt4gui/rclmain.ui
src/qt4gui/recoll
src/qt4gui/recoll.pro
src/qt4gui/sort.ui

336
src/qt4gui/rclmain.ui Normal file
View File

@ -0,0 +1,336 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RclMainBase</class>
<widget class="QMainWindow" name="RclMainBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>Recoll</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>4</number>
</property>
<item>
<widget class="SSearch" name="sSearch" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="catgBGRP">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string/>
</property>
<property name="selectedId" stdset="0">
<number>0</number>
</property>
<widget class="QRadioButton" name="allRDB">
<property name="text">
<string>All</string>
</property>
</widget>
</widget>
</item>
<item>
<widget class="ResList" name="resList" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="Toolbar">
<property name="windowTitle">
<string>Search tools</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="toolsAdvanced_SearchAction"/>
<addaction name="toolsSort_parametersAction"/>
<addaction name="toolsDoc_HistoryAction"/>
<addaction name="toolsSpellAction"/>
</widget>
<widget class="QToolBar" name="Toolbar1">
<property name="windowTitle">
<string>Result list</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="firstPageAction"/>
<addaction name="prevPageAction"/>
<addaction name="nextPageAction"/>
</widget>
<widget class="QMenuBar" name="MenuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>31</height>
</rect>
</property>
<widget class="QMenu" name="fileMenu">
<property name="title">
<string>&amp;File</string>
</property>
<addaction name="fileToggleIndexingAction"/>
<addaction name="separator"/>
<addaction name="fileEraseDocHistoryAction"/>
<addaction name="showMissingHelpers_Action"/>
<addaction name="separator"/>
<addaction name="fileExitAction"/>
</widget>
<widget class="QMenu" name="toolsMenu">
<property name="title">
<string>&amp;Tools</string>
</property>
<addaction name="toolsDoc_HistoryAction"/>
<addaction name="toolsAdvanced_SearchAction"/>
<addaction name="toolsSort_parametersAction"/>
<addaction name="toolsSpellAction"/>
</widget>
<widget class="QMenu" name="preferencesMenu">
<property name="title">
<string>&amp;Preferences</string>
</property>
<addaction name="indexConfigAction"/>
<addaction name="separator"/>
<addaction name="queryPrefsAction"/>
<addaction name="extIdxAction"/>
<addaction name="separator"/>
</widget>
<widget class="QMenu" name="helpMenu">
<property name="title">
<string>&amp;Help</string>
</property>
<addaction name="userManualAction"/>
<addaction name="showMissingHelpers_Action"/>
<addaction name="separator"/>
<addaction name="helpAbout_RecollAction"/>
</widget>
<addaction name="fileMenu"/>
<addaction name="toolsMenu"/>
<addaction name="preferencesMenu"/>
<addaction name="separator"/>
<addaction name="helpMenu"/>
</widget>
<action name="fileExitAction">
<property name="text">
<string>E&amp;xit</string>
</property>
<property name="shortcut">
<string>Ctrl+Q</string>
</property>
<property name="name" stdset="0">
<cstring>fileExitAction</cstring>
</property>
</action>
<action name="fileToggleIndexingAction">
<property name="text">
<string>Update &amp;index</string>
</property>
<property name="name" stdset="0">
<cstring>fileToggleIndexingAction</cstring>
</property>
</action>
<action name="fileEraseDocHistoryAction">
<property name="text">
<string>&amp;Erase document history</string>
</property>
<property name="name" stdset="0">
<cstring>fileEraseDocHistoryAction</cstring>
</property>
</action>
<action name="showMissingHelpers_Action">
<property name="text">
<string>&amp;Show missing helpers</string>
</property>
<property name="name" stdset="0">
<cstring>showMissingHelpers_Action</cstring>
</property>
</action>
<action name="helpAbout_RecollAction">
<property name="text">
<string>&amp;About Recoll</string>
</property>
<property name="name" stdset="0">
<cstring>helpAbout_RecollAction</cstring>
</property>
</action>
<action name="userManualAction">
<property name="text">
<string>&amp;User manual</string>
</property>
<property name="name" stdset="0">
<cstring>userManualAction</cstring>
</property>
</action>
<action name="toolsDoc_HistoryAction">
<property name="text">
<string>Document &amp;History</string>
</property>
<property name="toolTip">
<string>Document History</string>
</property>
<property name="name" stdset="0">
<cstring>toolsDoc_HistoryAction</cstring>
</property>
</action>
<action name="toolsAdvanced_SearchAction">
<property name="text">
<string>&amp;Advanced Search</string>
</property>
<property name="toolTip">
<string>Advanced/complex Search</string>
</property>
<property name="name" stdset="0">
<cstring>toolsAdvanced_SearchAction</cstring>
</property>
</action>
<action name="toolsSort_parametersAction">
<property name="text">
<string>&amp;Sort parameters</string>
</property>
<property name="toolTip">
<string>Sort parameters</string>
</property>
<property name="name" stdset="0">
<cstring>toolsSort_parametersAction</cstring>
</property>
</action>
<action name="toolsSpellAction">
<property name="text">
<string>Term &amp;explorer</string>
</property>
<property name="toolTip">
<string>Term explorer tool</string>
</property>
<property name="name" stdset="0">
<cstring>toolsSpellAction</cstring>
</property>
</action>
<action name="nextPageAction">
<property name="enabled">
<bool>false</bool>
</property>
<property name="iconText">
<string>Next page</string>
</property>
<property name="toolTip">
<string>Next page of results</string>
</property>
<property name="name" stdset="0">
<cstring>nextPageAction</cstring>
</property>
</action>
<action name="firstPageAction">
<property name="enabled">
<bool>false</bool>
</property>
<property name="iconText">
<string>First page</string>
</property>
<property name="toolTip">
<string>Go to first page of results</string>
</property>
<property name="name" stdset="0">
<cstring>firstPageAction</cstring>
</property>
</action>
<action name="prevPageAction">
<property name="enabled">
<bool>false</bool>
</property>
<property name="iconText">
<string>Previous page</string>
</property>
<property name="toolTip">
<string>Previous page of results</string>
</property>
<property name="name" stdset="0">
<cstring>prevPageAction</cstring>
</property>
</action>
<action name="indexConfigAction">
<property name="text">
<string>&amp;Indexing configuration</string>
</property>
<property name="name" stdset="0">
<cstring>indexConfigAction</cstring>
</property>
</action>
<action name="queryPrefsAction">
<property name="text">
<string>&amp;Query configuration</string>
</property>
<property name="name" stdset="0">
<cstring>queryPrefsAction</cstring>
</property>
</action>
<action name="extIdxAction">
<property name="text">
<string>External index dialog</string>
</property>
<property name="iconText">
<string>External index dialog</string>
</property>
<property name="name" stdset="0">
<cstring>extIdxAction</cstring>
</property>
</action>
</widget>
<layoutdefault spacing="2" margin="2"/>
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>SSearch</class>
<extends>QWidget</extends>
<header>ssearch_w.h</header>
</customwidget>
<customwidget>
<class>ResList</class>
<extends>QWidget</extends>
<header>reslist.h</header>
</customwidget>
</customwidgets>
<includes>
<include location="local">ssearch_w.h</include>
<include location="local">reslist.h</include>
</includes>
<resources/>
<connections/>
</ui>

View File

@ -2,7 +2,7 @@
# by "configure"
# Convert the uic files from qt3 to qt4.
UIFILES = advsearch.ui preview.ui rclmain.ui sort.ui spell.ui \
UIFILES = advsearch.ui preview.ui sort.ui spell.ui \
ssearchb.ui uiprefs.ui viewaction.ui
all: always $(UIFILES)
@ -11,8 +11,6 @@ advsearch.ui : ../qtgui/advsearch.ui
uic3 -convert ../qtgui/advsearch.ui > advsearch.ui
preview.ui : ../qtgui/preview.ui
uic3 -convert ../qtgui/preview.ui > preview.ui
rclmain.ui : ../qtgui/rclmain.ui
uic3 -convert ../qtgui/rclmain.ui > rclmain.ui
sort.ui : ../qtgui/sort.ui
uic3 -convert ../qtgui/sort.ui > sort.ui
spell.ui : ../qtgui/spell.ui

View File

@ -10,9 +10,11 @@
#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
@ -26,7 +28,6 @@ class ConfNull;
class RclConfig;
class ConfParamW;
class ConfParamDNLW;
class QGroupBox;
namespace confgui {
@ -54,12 +55,6 @@ public:
ConfTopPanelW(QWidget *parent, ConfNull *config);
};
#if QT_VERSION < 0x040000
#include <qgroupbox.h>
#else
#include <Q3GroupBox>
#endif
/**
* A panel for the parameters that can be changed in subdirectories:
*/

View File

@ -33,18 +33,13 @@ 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 <qfiledialog.h>
#else
#include <q3filedialog.h>
#define QFileDialog Q3FileDialog
#include <q3toolbar.h>
#define QToolBar Q3ToolBar
#endif
#include <qtabwidget.h>
@ -175,15 +170,29 @@ void RclMain::init()
// Toolbar+combobox version of the category selector
QComboBox *catgCMB = 0;
if (prefs.catgToolBar) {
catgCMB = new QComboBox(FALSE, new QToolBar(this), "catCMB");
QToolBar *catgToolBar = new QToolBar(this);
catgCMB = new QComboBox(FALSE, catgToolBar, "catCMB");
catgCMB->insertItem(tr("All"));
#if (QT_VERSION >= 0x040000)
catgToolBar->setObjectName(QString::fromUtf8("catgToolBar"));
catgCMB->setToolTip(tr("Document category filter"));
catgToolBar->addWidget(catgCMB);
this->addToolBar(Qt::TopToolBarArea, catgToolBar);
#endif
}
// Document categories buttons
#if (QT_VERSION < 0x040000)
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
list<string> cats;
rclconfig->getMimeCategories(cats);
// Text for button 0 is not used. Next statement just avoids unused
@ -197,8 +206,17 @@ void RclMain::init()
but->setText(tr(catgnm));
if (prefs.catgToolBar && catgCMB)
catgCMB->insertItem(tr(catgnm));
#if (QT_VERSION >= 0x040000)
bgrphbox->addWidget(but);
bgrp->addButton(but, bgrpid++);
#endif
}
#if (QT_VERSION < 0x040000)
catgBGRP->setButton(0);
#else
catgBGRP->setLayout(bgrphbox);
#endif
if (prefs.catgToolBar)
catgBGRP->hide();
// Connections
@ -264,7 +282,6 @@ void RclMain::init()
connect(indexConfigAction, SIGNAL(activated()), this, SLOT(showIndexConfig()));
connect(queryPrefsAction, SIGNAL(activated()), this, SLOT(showUIPrefs()));
connect(extIdxAction, SIGNAL(activated()), this, SLOT(showExtIdxDialog()));
connect(catgBGRP, SIGNAL(clicked(int)), this, SLOT(catgFilter(int)));
if (prefs.catgToolBar && catgCMB)
connect(catgCMB, SIGNAL(activated(int)), this, SLOT(catgFilter(int)));
connect(periodictimer, SIGNAL(timeout()), this, SLOT(periodic100()));

View File

@ -34,13 +34,8 @@
#if QT_VERSION < 0x040000
#include "rclmain.h"
#else
#if QT_VERSION >= 0x040601
// 4.6.1 uic is broken
#include "ui_rclmain.h-4.5"
#else
#include "ui_rclmain.h"
#endif
#endif
//MOC_SKIP_BEGIN
#if QT_VERSION < 0x040000
@ -50,10 +45,10 @@ class DummyRclMainBase : public RclMainBase
};
#define RCLMAINPARENT QWidget
#else
class DummyRclMainBase : public Q3MainWindow, public Ui::RclMainBase
class DummyRclMainBase : public QMainWindow, public Ui::RclMainBase
{
public: DummyRclMainBase(QWidget *parent) :Q3MainWindow(parent){setupUi(this);}
#define RCLMAINPARENT Q3MainWindow
public: DummyRclMainBase(QWidget *parent) :QMainWindow(parent){setupUi(this);}
#define RCLMAINPARENT QMainWindow
};
#endif
//MOC_SKIP_END