diff --git a/src/qtgui/advsearch_w.h b/src/qtgui/advsearch_w.h index 8051fcc7..01912348 100644 --- a/src/qtgui/advsearch_w.h +++ b/src/qtgui/advsearch_w.h @@ -16,6 +16,7 @@ */ #ifndef _ADVSEARCH_W_H_INCLUDED_ #define _ADVSEARCH_W_H_INCLUDED_ +#include "autoconfig.h" #include diff --git a/src/qtgui/advshist.h b/src/qtgui/advshist.h index 8234bec5..8c48fbf5 100644 --- a/src/qtgui/advshist.h +++ b/src/qtgui/advshist.h @@ -16,6 +16,7 @@ */ #ifndef _ADVSHIST_H_INCLUDED_ #define _ADVSHIST_H_INCLUDED_ +#include "autoconfig.h" #include diff --git a/src/qtgui/confgui/confgui.h b/src/qtgui/confgui/confgui.h index 199d1a07..18c081e5 100644 --- a/src/qtgui/confgui/confgui.h +++ b/src/qtgui/confgui/confgui.h @@ -16,6 +16,8 @@ */ #ifndef _confgui_h_included_ #define _confgui_h_included_ +#include "autoconfig.h" + /** * This file defines a number of simple classes (virtual base: ConfParamW) * which let the user input configuration parameters. @@ -36,7 +38,6 @@ * 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). */ -#include "autoconfig.h" #include #include diff --git a/src/qtgui/rclmain_w.cpp b/src/qtgui/rclmain_w.cpp index d2237a33..45a93a1a 100644 --- a/src/qtgui/rclmain_w.cpp +++ b/src/qtgui/rclmain_w.cpp @@ -67,6 +67,20 @@ #include "rclhelp.h" #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; QString g_stringAllStem, g_stringNoStem; @@ -288,13 +302,15 @@ void RclMain::init() sc = new QShortcut(seql, this); connect(sc, SIGNAL (activated()), sSearch, SLOT (takeFocus())); - connect(&m_watcher, SIGNAL(fileChanged(QString)), - this, SLOT(idxStatus())); -#ifdef _WIN32 - connect(sSearch, SIGNAL(startSearch(std::shared_ptr, bool)), - this, SLOT(startSearch(std::shared_ptr, bool))); + connect(&m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(idxStatus())); + +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) + connect(sSearch, + XSIGNAL(startSearch(STD_SHARED_PTR, bool)), + this, XSLOT(startSearch(STD_SHARED_PTR, bool))); #else - connect(sSearch, SIGNAL(startSearch(STD_SHARED_PTR, bool)), + connect(sSearch, + SIGNAL(startSearch(STD_SHARED_PTR, bool)), this, SLOT(startSearch(STD_SHARED_PTR, bool))); #endif connect(sSearch, SIGNAL(clearSearch()), @@ -357,9 +373,9 @@ void RclMain::init() restable->setRclMain(this, true); connect(actionSaveResultsAsCSV, SIGNAL(triggered()), restable, SLOT(saveAsCSV())); -#ifdef _WIN32 - connect(this, SIGNAL(docSourceChanged(std::shared_ptr)), - restable, SLOT(setDocSource(std::shared_ptr))); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) + connect(this, XSIGNAL(docSourceChanged(STD_SHARED_PTR)), + restable, XSLOT(setDocSource(STD_SHARED_PTR))); #else connect(this, SIGNAL(docSourceChanged(STD_SHARED_PTR)), restable, SLOT(setDocSource(STD_SHARED_PTR))); @@ -393,9 +409,9 @@ void RclMain::init() this, SLOT(showSnippets(Rcl::Doc))); reslist->setRclMain(this, true); -#ifdef _WIN32 - connect(this, SIGNAL(docSourceChanged(std::shared_ptr)), - reslist, SLOT(setDocSource(std::shared_ptr))); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) + connect(this, XSIGNAL(docSourceChanged(STD_SHARED_PTR)), + reslist, XSLOT(setDocSource(STD_SHARED_PTR))); #else connect(this, SIGNAL(docSourceChanged(STD_SHARED_PTR)), reslist, SLOT(setDocSource(STD_SHARED_PTR))); diff --git a/src/qtgui/rclmain_w.h b/src/qtgui/rclmain_w.h index fc080b30..8e68224a 100644 --- a/src/qtgui/rclmain_w.h +++ b/src/qtgui/rclmain_w.h @@ -16,6 +16,7 @@ */ #ifndef RCLMAIN_W_H #define RCLMAIN_W_H +#include "autoconfig.h" #include #include diff --git a/src/qtgui/reslist.h b/src/qtgui/reslist.h index 77bac2c2..f15b7921 100644 --- a/src/qtgui/reslist.h +++ b/src/qtgui/reslist.h @@ -17,15 +17,11 @@ #ifndef _RESLIST_H_INCLUDED_ #define _RESLIST_H_INCLUDED_ +#include "autoconfig.h" #include #include -#ifndef NO_NAMESPACES -using std::list; -using std::pair; -#endif - #ifdef RESLIST_TEXTBROWSER #include #define RESLIST_PARENTCLASS QTextBrowser @@ -133,7 +129,7 @@ class ResList : public RESLIST_PARENTCLASS // docnum. Built while we insert text into the qtextedit std::map m_pageParaToReldocnums; virtual int docnumfromparnum(int); - virtual pair parnumfromdocnum(int); + virtual std::pair parnumfromdocnum(int); #else // Webview makes it more difficult to append text incrementally, // so we store the page and display it when done. diff --git a/src/qtgui/respopup.h b/src/qtgui/respopup.h index 65050df4..87936a08 100644 --- a/src/qtgui/respopup.h +++ b/src/qtgui/respopup.h @@ -16,6 +16,7 @@ */ #ifndef _RESPOPUP_H_INCLUDED_ #define _RESPOPUP_H_INCLUDED_ +#include "autoconfig.h" namespace ResultPopup { enum Options {showExpand = 0x1, showSubs = 0x2, isMain = 0x3, diff --git a/src/qtgui/ssearch_w.h b/src/qtgui/ssearch_w.h index e990a661..ba90ce73 100644 --- a/src/qtgui/ssearch_w.h +++ b/src/qtgui/ssearch_w.h @@ -16,6 +16,7 @@ */ #ifndef _SSEARCH_W_H_INCLUDED_ #define _SSEARCH_W_H_INCLUDED_ +#include "autoconfig.h" #include diff --git a/src/qtgui/xmltosd.h b/src/qtgui/xmltosd.h index 5040bb1b..43bacf06 100644 --- a/src/qtgui/xmltosd.h +++ b/src/qtgui/xmltosd.h @@ -14,6 +14,9 @@ * Free Software Foundation, Inc., * 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. * @@ -75,3 +78,4 @@ struct SSearchDef { int mode; }; bool xmlToSSearch(const string& xml, SSearchDef&); +#endif /* XMLTOSD_H_INCLUDED */