"Fossies" - the Fresh Open Source Software Archive

Member "recoll-1.26.3/qtgui/snippets_w.h" (24 Nov 2019, 2528 Bytes) of package /linux/privat/recoll-1.26.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "snippets_w.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 1.25.23_vs_1.26.0.

    1 /* Copyright (C) 2012 J.F.Dockes
    2  *   This program is free software; you can redistribute it and/or modify
    3  *   it under the terms of the GNU General Public License as published by
    4  *   the Free Software Foundation; either version 2 of the License, or
    5  *   (at your option) any later version.
    6  *
    7  *   This program is distributed in the hope that it will be useful,
    8  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    9  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   10  *   GNU General Public License for more details.
   11  *
   12  *   You should have received a copy of the GNU General Public License
   13  *   along with this program; if not, write to the
   14  *   Free Software Foundation, Inc.,
   15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
   16  */
   17 #ifndef _SNIPPETS_W_H_INCLUDED_
   18 #define _SNIPPETS_W_H_INCLUDED_
   19 
   20 #include "autoconfig.h"
   21 
   22 #include <memory>
   23 
   24 #include <QString>
   25 
   26 #include "rcldoc.h"
   27 #include "docseq.h"
   28 #include "rclmain_w.h"
   29 
   30 #include "ui_snippets.h"
   31 
   32 class SnippetsW : public QWidget, public Ui::Snippets
   33 {
   34     Q_OBJECT
   35 public:
   36     SnippetsW(Rcl::Doc doc, std::shared_ptr<DocSequence> source,
   37               QWidget* parent = 0) 
   38         : QWidget(parent) {
   39         setupUi((QDialog*)this);
   40         init();
   41         onSetDoc(doc, source);
   42     }
   43 
   44 public slots:
   45     virtual void onLinkClicked(const QUrl &);
   46     virtual void onSetDoc(Rcl::Doc doc, std::shared_ptr<DocSequence> source);
   47     virtual void createPopupMenu(const QPoint& pos);
   48 
   49 protected slots:
   50     virtual void slotEditFind();
   51     virtual void slotEditFindNext();
   52     virtual void slotEditFindPrevious();
   53     virtual void slotSearchTextChanged(const QString&);
   54     virtual void reloadByRelevance();
   55     virtual void reloadByPage();
   56     
   57 signals:
   58     void startNativeViewer(Rcl::Doc, int pagenum, QString term);
   59         
   60 private:
   61     void init();
   62     std::shared_ptr<DocSequence> m_source;
   63     Rcl::Doc m_doc;
   64     bool m_sortingByPage;
   65 };
   66 
   67 #ifdef USING_WEBENGINE
   68 #include <QWebEnginePage>
   69 // Subclass the page to hijack the link clicks
   70 class SnipWebPage: public QWebEnginePage {
   71     Q_OBJECT
   72 public:
   73     SnipWebPage(SnippetsW *parent) 
   74     : QWebEnginePage((QWidget *)parent), m_parent(parent) {}
   75 protected:
   76     virtual bool acceptNavigationRequest(const QUrl& url, 
   77                                          NavigationType, 
   78                                          bool) {
   79         m_parent->onLinkClicked(url);
   80         return false;
   81     }
   82 private:
   83     SnippetsW *m_parent;
   84 };
   85 #endif
   86 
   87 
   88 #endif /* _SNIPPETS_W_H_INCLUDED_ */