Prepare for webengine integration. defines and indents, no real changes
This commit is contained in:
parent
bc24792a2c
commit
504705879b
@ -427,6 +427,22 @@ if test X$enableQT = Xyes ; then
|
||||
QMAKE_DISABLE_WEBKIT=""
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(webengine,
|
||||
AC_HELP_STRING([--enable-webengine],
|
||||
[Enable use of qt-webengine (only meaningful if qtgui is enabled), in
|
||||
place or qt-webkit.]),
|
||||
enableWebengine=$enableval, enableWebengine="no")
|
||||
|
||||
if test "$enableWebengine" = "yes" ; then
|
||||
QMAKE_ENABLE_WEBENGINE=""
|
||||
QMAKE_DISABLE_WEBENGINE="#"
|
||||
QMAKE_ENABLE_WEBKIT="#"
|
||||
QMAKE_DISABLE_WEBKIT=""
|
||||
else
|
||||
QMAKE_ENABLE_WEBENGINE="#"
|
||||
QMAKE_DISABLE_WEBENGINE=""
|
||||
fi
|
||||
|
||||
##### Using QZeitGeist lib ? Default no for now
|
||||
AC_ARG_WITH(qzeitgeist,
|
||||
AC_HELP_STRING([--with-qzeitgeist],
|
||||
@ -504,6 +520,8 @@ AC_SUBST(QTGUI)
|
||||
AC_SUBST(XAPIANCXXFLAGS)
|
||||
AC_SUBST(QMAKE_ENABLE_WEBKIT)
|
||||
AC_SUBST(QMAKE_DISABLE_WEBKIT)
|
||||
AC_SUBST(QMAKE_ENABLE_WEBENGINE)
|
||||
AC_SUBST(QMAKE_DISABLE_WEBENGINE)
|
||||
AC_SUBST(QMAKE_ENABLE_ZEITGEIST)
|
||||
AC_SUBST(QMAKE_DISABLE_ZEITGEIST)
|
||||
AC_SUBST(LIBQZEITGEIST)
|
||||
|
||||
@ -5,9 +5,11 @@ VPATH = @srcdir@
|
||||
DEFINES += BUILDING_RECOLL
|
||||
|
||||
@QMAKE_ENABLE_WEBKIT@ QT += webkit
|
||||
@QMAKE_DISABLE_WEBKIT@ QMAKE_CXXFLAGS += -DRESLIST_TEXTBROWSER -DSNIPPETS_TEXTBROWSER
|
||||
@QMAKE_DISABLE_WEBKIT@ DEFINES += RESLIST_TEXTBROWSER
|
||||
@QMAKE_DISABLE_WEBKIT@ DEFINES += SNIPPETS_TEXTBROWSER
|
||||
@QMAKE_ENABLE_WEBKIT@ DEFINES += USING_WEBKIT
|
||||
|
||||
@QMAKE_ENABLE_WEBENGINE@ QT += webengine
|
||||
@QMAKE_ENABLE_WEBENGINE@ DEFINES += USING_WEBENGINE
|
||||
|
||||
QMAKE_CXXFLAGS += -std=c++11
|
||||
|
||||
@QMAKE_ENABLE_ZEITGEIST@ QT += dbus
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -19,26 +19,24 @@
|
||||
#define _RESLIST_H_INCLUDED_
|
||||
#include "autoconfig.h"
|
||||
|
||||
#include <list>
|
||||
#include <utility>
|
||||
#include <map>
|
||||
|
||||
#ifdef RESLIST_TEXTBROWSER
|
||||
#include <QTextBrowser>
|
||||
#define RESLIST_PARENTCLASS QTextBrowser
|
||||
#if defined(USING_WEBENGINE)
|
||||
# include <QWebEngineView>
|
||||
# define RESLIST_PARENTCLASS QWebEngineView
|
||||
#elif defined(USING_WEBKIT)
|
||||
# include <QWebView>
|
||||
# define RESLIST_PARENTCLASS QWebView
|
||||
#else
|
||||
#include <QWebView>
|
||||
#define RESLIST_PARENTCLASS QWebView
|
||||
# include <QTextBrowser>
|
||||
# define RESLIST_PARENTCLASS QTextBrowser
|
||||
#endif
|
||||
|
||||
#include "docseq.h"
|
||||
#include "sortseq.h"
|
||||
#include "filtseq.h"
|
||||
#include <memory>
|
||||
#include "rcldoc.h"
|
||||
#include "reslistpager.h"
|
||||
|
||||
class RclMain;
|
||||
class QtGuiResListPager;
|
||||
namespace Rcl {
|
||||
class Doc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a list of document records. The data can be out of the history
|
||||
@ -49,7 +47,7 @@ class ResList : public RESLIST_PARENTCLASS
|
||||
Q_OBJECT;
|
||||
|
||||
friend class QtGuiResListPager;
|
||||
public:
|
||||
public:
|
||||
ResList(QWidget* parent = 0, const char* name = 0);
|
||||
virtual ~ResList();
|
||||
|
||||
@ -65,7 +63,7 @@ class ResList : public RESLIST_PARENTCLASS
|
||||
void setFont();
|
||||
void setRclMain(RclMain *m, bool ismain);
|
||||
|
||||
public slots:
|
||||
public slots:
|
||||
virtual void setDocSource(std::shared_ptr<DocSequence> nsource);
|
||||
virtual void resetList(); // Erase current list
|
||||
virtual void resPageUpOrBack(); // Page up pressed
|
||||
@ -91,8 +89,8 @@ class ResList : public RESLIST_PARENTCLASS
|
||||
virtual void highlighted(const QString& link);
|
||||
virtual void createPopupMenu(const QPoint& pos);
|
||||
virtual void showQueryDetails();
|
||||
|
||||
signals:
|
||||
|
||||
signals:
|
||||
void nextPageAvailable(bool);
|
||||
void prevPageAvailable(bool);
|
||||
void docPreviewClicked(int, Rcl::Doc, int);
|
||||
@ -107,36 +105,36 @@ class ResList : public RESLIST_PARENTCLASS
|
||||
void wordReplace(const QString&, const QString&);
|
||||
void hasResults(int);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *e);
|
||||
void mouseReleaseEvent(QMouseEvent *e);
|
||||
void mouseDoubleClickEvent(QMouseEvent*);
|
||||
|
||||
protected slots:
|
||||
protected slots:
|
||||
virtual void languageChange();
|
||||
virtual void linkWasClicked(const QUrl &);
|
||||
|
||||
private:
|
||||
QtGuiResListPager *m_pager;
|
||||
private:
|
||||
QtGuiResListPager *m_pager{0};
|
||||
std::shared_ptr<DocSequence> m_source;
|
||||
int m_popDoc; // Docnum for the popup menu.
|
||||
int m_curPvDoc;// Docnum for current preview
|
||||
int m_lstClckMod; // Last click modifier.
|
||||
int m_listId; // query Id for matching with preview windows
|
||||
int m_popDoc{-1}; // Docnum for the popup menu.
|
||||
int m_curPvDoc{-1};// Docnum for current preview
|
||||
int m_lstClckMod{0}; // Last click modifier.
|
||||
int m_listId{0}; // query Id for matching with preview windows
|
||||
|
||||
#ifdef RESLIST_TEXTBROWSER
|
||||
#if defined(USING_WEBKIT) || defined(USING_WEBENGINE)
|
||||
// Webview makes it more difficult to append text incrementally,
|
||||
// so we store the page and display it when done.
|
||||
QString m_text;
|
||||
#else
|
||||
// Translate from textedit paragraph number to relative
|
||||
// docnum. Built while we insert text into the qtextedit
|
||||
std::map<int,int> m_pageParaToReldocnums;
|
||||
virtual int docnumfromparnum(int);
|
||||
virtual std::pair<int,int> parnumfromdocnum(int);
|
||||
#else
|
||||
// Webview makes it more difficult to append text incrementally,
|
||||
// so we store the page and display it when done.
|
||||
QString m_text;
|
||||
#endif
|
||||
RclMain *m_rclmain;
|
||||
bool m_ismainres;
|
||||
RclMain *m_rclmain{0};
|
||||
bool m_ismainres{true};
|
||||
|
||||
virtual void displayPage(); // Display current page
|
||||
static int newListId();
|
||||
@ -144,7 +142,7 @@ class ResList : public RESLIST_PARENTCLASS
|
||||
bool scrollIsAtTop();
|
||||
bool scrollIsAtBottom();
|
||||
void setupArrows();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
#endif /* _RESLIST_H_INCLUDED_ */
|
||||
|
||||
@ -23,12 +23,12 @@
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
#ifdef SNIPPETS_TEXTBROWSER
|
||||
#include <QTextBrowser>
|
||||
#else
|
||||
#if defined(USING_WEBKIT)
|
||||
#include <QWebSettings>
|
||||
#include <QWebFrame>
|
||||
#include <QUrl>
|
||||
#else
|
||||
#include <QTextBrowser>
|
||||
#endif
|
||||
#include <QShortcut>
|
||||
|
||||
@ -42,10 +42,10 @@ using namespace std;
|
||||
|
||||
// Note: the internal search currently does not work with QTextBrowser. To be
|
||||
// fixed by looking at the preview code if someone asks for it...
|
||||
#ifdef SNIPPETS_TEXTBROWSER
|
||||
#define browser ((QTextBrowser*)browserw)
|
||||
#else
|
||||
#if defined(USING_WEBKIT)
|
||||
#define browser ((QWebView*)browserw)
|
||||
#else
|
||||
#define browser ((QTextBrowser*)browserw)
|
||||
#endif
|
||||
|
||||
class PlainToRichQtSnippets : public PlainToRich {
|
||||
@ -92,22 +92,7 @@ void SnippetsW::init()
|
||||
connect(nextPB, SIGNAL(clicked()), this, SLOT(slotEditFindNext()));
|
||||
connect(prevPB, SIGNAL(clicked()), this, SLOT(slotEditFindPrevious()));
|
||||
|
||||
#ifdef SNIPPETS_TEXTBROWSER
|
||||
browserw = new QTextBrowser(this);
|
||||
verticalLayout->insertWidget(0, browserw);
|
||||
connect(browser, SIGNAL(anchorClicked(const QUrl &)),
|
||||
this, SLOT(linkWasClicked(const QUrl &)));
|
||||
browser->setReadOnly(true);
|
||||
browser->setUndoRedoEnabled(false);
|
||||
browser->setOpenLinks(false);
|
||||
browser->setTabChangesFocus(true);
|
||||
if (prefs.reslistfontfamily.length()) {
|
||||
QFont nfont(prefs.reslistfontfamily, prefs.reslistfontsize);
|
||||
browser->setFont(nfont);
|
||||
} else {
|
||||
browser->setFont(QFont());
|
||||
}
|
||||
#else
|
||||
#if defined(USING_WEBKIT)
|
||||
browserw = new QWebView(this);
|
||||
verticalLayout->insertWidget(0, browserw);
|
||||
browser->setUrl(QUrl(QString::fromUtf8("about:blank")));
|
||||
@ -123,6 +108,21 @@ void SnippetsW::init()
|
||||
}
|
||||
if (!prefs.snipCssFile.isEmpty())
|
||||
ws->setUserStyleSheetUrl(QUrl::fromLocalFile(prefs.snipCssFile));
|
||||
#else
|
||||
browserw = new QTextBrowser(this);
|
||||
verticalLayout->insertWidget(0, browserw);
|
||||
connect(browser, SIGNAL(anchorClicked(const QUrl &)),
|
||||
this, SLOT(linkWasClicked(const QUrl &)));
|
||||
browser->setReadOnly(true);
|
||||
browser->setUndoRedoEnabled(false);
|
||||
browser->setOpenLinks(false);
|
||||
browser->setTabChangesFocus(true);
|
||||
if (prefs.reslistfontfamily.length()) {
|
||||
QFont nfont(prefs.reslistfontfamily, prefs.reslistfontsize);
|
||||
browser->setFont(nfont);
|
||||
} else {
|
||||
browser->setFont(QFont());
|
||||
}
|
||||
#endif
|
||||
|
||||
// Make title out of file name if none yet
|
||||
@ -193,10 +193,10 @@ void SnippetsW::init()
|
||||
"generator got lost in a maze...</p>"));
|
||||
}
|
||||
oss << "\n</body></html>";
|
||||
#ifdef SNIPPETS_TEXTBROWSER
|
||||
browser->insertHtml(QString::fromUtf8(oss.str().c_str()));
|
||||
#else
|
||||
#if defined(USING_WEBKIT)
|
||||
browser->setHtml(QString::fromUtf8(oss.str().c_str()));
|
||||
#else
|
||||
browser->insertHtml(QString::fromUtf8(oss.str().c_str()));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -212,10 +212,10 @@ void SnippetsW::slotEditFindNext()
|
||||
if (!searchFM->isVisible())
|
||||
slotEditFind();
|
||||
|
||||
#ifdef SNIPPETS_TEXTBROWSER
|
||||
browser->find(searchLE->text(), 0);
|
||||
#else
|
||||
#if defined(USING_WEBKIT)
|
||||
browser->findText(searchLE->text());
|
||||
#else
|
||||
browser->find(searchLE->text(), 0);
|
||||
#endif
|
||||
|
||||
}
|
||||
@ -224,18 +224,19 @@ void SnippetsW::slotEditFindPrevious()
|
||||
if (!searchFM->isVisible())
|
||||
slotEditFind();
|
||||
|
||||
#ifdef SNIPPETS_TEXTBROWSER
|
||||
browser->find(searchLE->text(), QTextDocument::FindBackward);
|
||||
#else
|
||||
#if defined(USING_WEBKIT)
|
||||
browser->findText(searchLE->text(), QWebPage::FindBackward);
|
||||
#else
|
||||
browser->find(searchLE->text(), QTextDocument::FindBackward);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SnippetsW::slotSearchTextChanged(const QString& txt)
|
||||
{
|
||||
#ifdef SNIPPETS_TEXTBROWSER
|
||||
browser->find(txt, 0);
|
||||
#else
|
||||
#if defined(USING_WEBKIT)
|
||||
browser->findText(txt);
|
||||
#else
|
||||
browser->find(txt, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user