Fix a signal name consistency issue for qt5

This commit is contained in:
Jean-Francois Dockes 2015-11-23 11:08:33 +01:00
parent 40c07f28d2
commit 295f763189
9 changed files with 41 additions and 19 deletions

View file

@ -16,6 +16,7 @@
*/ */
#ifndef _ADVSEARCH_W_H_INCLUDED_ #ifndef _ADVSEARCH_W_H_INCLUDED_
#define _ADVSEARCH_W_H_INCLUDED_ #define _ADVSEARCH_W_H_INCLUDED_
#include "autoconfig.h"
#include <vector> #include <vector>

View file

@ -16,6 +16,7 @@
*/ */
#ifndef _ADVSHIST_H_INCLUDED_ #ifndef _ADVSHIST_H_INCLUDED_
#define _ADVSHIST_H_INCLUDED_ #define _ADVSHIST_H_INCLUDED_
#include "autoconfig.h"
#include <vector> #include <vector>

View file

@ -16,6 +16,8 @@
*/ */
#ifndef _confgui_h_included_ #ifndef _confgui_h_included_
#define _confgui_h_included_ #define _confgui_h_included_
#include "autoconfig.h"
/** /**
* This file defines a number of simple classes (virtual base: ConfParamW) * This file defines a number of simple classes (virtual base: ConfParamW)
* which let the user input configuration parameters. * which let the user input configuration parameters.
@ -36,7 +38,6 @@
* destroyed and recreated as a copy if Cancel is pressed (you have to * destroyed and recreated as a copy if Cancel is pressed (you have to
* delete/recreate the widgets in this case as the links are no longer valid). * delete/recreate the widgets in this case as the links are no longer valid).
*/ */
#include "autoconfig.h"
#include <string> #include <string>
#include <limits.h> #include <limits.h>

View file

@ -67,6 +67,20 @@
#include "rclhelp.h" #include "rclhelp.h"
#include "moc_rclmain_w.cpp" #include "moc_rclmain_w.cpp"
/* Qt5 moc expands macros when defining signals. The SIGNAL() macro is
a stringification, so it does not expand macros. We have signals
where one of the types is a #define (for the variations on
std::shared_ptr). In qt5, the connection does not work because the
signal string is different between the definition and the connect
call, because of the different macro expansion. We have to use
another level of macro in Qt5 to force macro expansion, but not in
Qt4, so we both define the XSIGNAL and XSLOT macros here, and have
ifdefs in the code. What a mess... */
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#define XSIGNAL(X) SIGNAL(X)
#define XSLOT(X) SLOT(X)
#endif
using std::pair; using std::pair;
QString g_stringAllStem, g_stringNoStem; QString g_stringAllStem, g_stringNoStem;
@ -288,13 +302,15 @@ void RclMain::init()
sc = new QShortcut(seql, this); sc = new QShortcut(seql, this);
connect(sc, SIGNAL (activated()), sSearch, SLOT (takeFocus())); connect(sc, SIGNAL (activated()), sSearch, SLOT (takeFocus()));
connect(&m_watcher, SIGNAL(fileChanged(QString)), connect(&m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(idxStatus()));
this, SLOT(idxStatus()));
#ifdef _WIN32 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
connect(sSearch, SIGNAL(startSearch(std::shared_ptr<Rcl::SearchData>, bool)), connect(sSearch,
this, SLOT(startSearch(std::shared_ptr<Rcl::SearchData>, bool))); XSIGNAL(startSearch(STD_SHARED_PTR<Rcl::SearchData>, bool)),
this, XSLOT(startSearch(STD_SHARED_PTR<Rcl::SearchData>, bool)));
#else #else
connect(sSearch, SIGNAL(startSearch(STD_SHARED_PTR<Rcl::SearchData>, bool)), connect(sSearch,
SIGNAL(startSearch(STD_SHARED_PTR<Rcl::SearchData>, bool)),
this, SLOT(startSearch(STD_SHARED_PTR<Rcl::SearchData>, bool))); this, SLOT(startSearch(STD_SHARED_PTR<Rcl::SearchData>, bool)));
#endif #endif
connect(sSearch, SIGNAL(clearSearch()), connect(sSearch, SIGNAL(clearSearch()),
@ -357,9 +373,9 @@ void RclMain::init()
restable->setRclMain(this, true); restable->setRclMain(this, true);
connect(actionSaveResultsAsCSV, SIGNAL(triggered()), connect(actionSaveResultsAsCSV, SIGNAL(triggered()),
restable, SLOT(saveAsCSV())); restable, SLOT(saveAsCSV()));
#ifdef _WIN32 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
connect(this, SIGNAL(docSourceChanged(std::shared_ptr<DocSequence>)), connect(this, XSIGNAL(docSourceChanged(STD_SHARED_PTR<DocSequence>)),
restable, SLOT(setDocSource(std::shared_ptr<DocSequence>))); restable, XSLOT(setDocSource(STD_SHARED_PTR<DocSequence>)));
#else #else
connect(this, SIGNAL(docSourceChanged(STD_SHARED_PTR<DocSequence>)), connect(this, SIGNAL(docSourceChanged(STD_SHARED_PTR<DocSequence>)),
restable, SLOT(setDocSource(STD_SHARED_PTR<DocSequence>))); restable, SLOT(setDocSource(STD_SHARED_PTR<DocSequence>)));
@ -393,9 +409,9 @@ void RclMain::init()
this, SLOT(showSnippets(Rcl::Doc))); this, SLOT(showSnippets(Rcl::Doc)));
reslist->setRclMain(this, true); reslist->setRclMain(this, true);
#ifdef _WIN32 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
connect(this, SIGNAL(docSourceChanged(std::shared_ptr<DocSequence>)), connect(this, XSIGNAL(docSourceChanged(STD_SHARED_PTR<DocSequence>)),
reslist, SLOT(setDocSource(std::shared_ptr<DocSequence>))); reslist, XSLOT(setDocSource(STD_SHARED_PTR<DocSequence>)));
#else #else
connect(this, SIGNAL(docSourceChanged(STD_SHARED_PTR<DocSequence>)), connect(this, SIGNAL(docSourceChanged(STD_SHARED_PTR<DocSequence>)),
reslist, SLOT(setDocSource(STD_SHARED_PTR<DocSequence>))); reslist, SLOT(setDocSource(STD_SHARED_PTR<DocSequence>)));

View file

@ -16,6 +16,7 @@
*/ */
#ifndef RCLMAIN_W_H #ifndef RCLMAIN_W_H
#define RCLMAIN_W_H #define RCLMAIN_W_H
#include "autoconfig.h"
#include <qvariant.h> #include <qvariant.h>
#include <qmainwindow.h> #include <qmainwindow.h>

View file

@ -17,15 +17,11 @@
#ifndef _RESLIST_H_INCLUDED_ #ifndef _RESLIST_H_INCLUDED_
#define _RESLIST_H_INCLUDED_ #define _RESLIST_H_INCLUDED_
#include "autoconfig.h"
#include <list> #include <list>
#include <utility> #include <utility>
#ifndef NO_NAMESPACES
using std::list;
using std::pair;
#endif
#ifdef RESLIST_TEXTBROWSER #ifdef RESLIST_TEXTBROWSER
#include <QTextBrowser> #include <QTextBrowser>
#define RESLIST_PARENTCLASS QTextBrowser #define RESLIST_PARENTCLASS QTextBrowser
@ -133,7 +129,7 @@ class ResList : public RESLIST_PARENTCLASS
// docnum. Built while we insert text into the qtextedit // docnum. Built while we insert text into the qtextedit
std::map<int,int> m_pageParaToReldocnums; std::map<int,int> m_pageParaToReldocnums;
virtual int docnumfromparnum(int); virtual int docnumfromparnum(int);
virtual pair<int,int> parnumfromdocnum(int); virtual std::pair<int,int> parnumfromdocnum(int);
#else #else
// Webview makes it more difficult to append text incrementally, // Webview makes it more difficult to append text incrementally,
// so we store the page and display it when done. // so we store the page and display it when done.

View file

@ -16,6 +16,7 @@
*/ */
#ifndef _RESPOPUP_H_INCLUDED_ #ifndef _RESPOPUP_H_INCLUDED_
#define _RESPOPUP_H_INCLUDED_ #define _RESPOPUP_H_INCLUDED_
#include "autoconfig.h"
namespace ResultPopup { namespace ResultPopup {
enum Options {showExpand = 0x1, showSubs = 0x2, isMain = 0x3, enum Options {showExpand = 0x1, showSubs = 0x2, isMain = 0x3,

View file

@ -16,6 +16,7 @@
*/ */
#ifndef _SSEARCH_W_H_INCLUDED_ #ifndef _SSEARCH_W_H_INCLUDED_
#define _SSEARCH_W_H_INCLUDED_ #define _SSEARCH_W_H_INCLUDED_
#include "autoconfig.h"
#include <string> #include <string>

View file

@ -14,6 +14,9 @@
* Free Software Foundation, Inc., * Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef XMLTOSD_H_INCLUDED
#define XMLTOSD_H_INCLUDED
#include "autoconfig.h"
/** Parsing XML from saved queries or advanced search history. /** Parsing XML from saved queries or advanced search history.
* *
@ -75,3 +78,4 @@ struct SSearchDef {
int mode; int mode;
}; };
bool xmlToSSearch(const string& xml, SSearchDef&); bool xmlToSSearch(const string& xml, SSearchDef&);
#endif /* XMLTOSD_H_INCLUDED */