"Fossies" - the Fresh Open Source Software Archive

Member "cb2bib-2.0.0/src/c2bCiterExcerptView.cpp" (10 Feb 2019, 2408 Bytes) of package /linux/privat/cb2bib-2.0.0.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 "c2bCiterExcerptView.cpp" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 1.9.9_vs_2.0.0.

    1 /***************************************************************************
    2  *   Copyright (C) 2004-2019 by Pere Constans
    3  *   constans@molspaces.com
    4  *   cb2Bib version 2.0.0. Licensed under the GNU GPL version 3.
    5  *   See the LICENSE file that comes with this distribution.
    6  ***************************************************************************/
    7 #include "c2bCiterExcerptView.h"
    8 
    9 #include "c2bSettings.h"
   10 #include "c2bTextBrowser.h"
   11 #include "c2bUtils.h"
   12 
   13 #include <QGridLayout>
   14 
   15 
   16 c2bCiterExcerptView::c2bCiterExcerptView(const QString& html, QWidget* parentw) : QDialog(parentw)
   17 {
   18     setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
   19     setWindowTitle(tr("Document Excerpt - cb2Bib"));
   20     QGridLayout* gl;
   21     gl = new QGridLayout(this);
   22     gl->setContentsMargins(0, 0, 0, 0);
   23     _browserP = new c2bTextBrowser(this);
   24     gl->addWidget(_browserP, 0, 0, 1, 1);
   25 
   26     c2bSettings* settings(c2bSettingsP);
   27     resize(settings->value("c2bCiterExcerptView/size", QSize(500, 500)).toSize());
   28     move(settings->value("c2bCiterExcerptView/position", pos()).toPoint());
   29 
   30     _browserP->setFont(QFont(QFont().family(),
   31                              settings->value("c2bCiterExcerptView/BrowserFontPointSize", QFont().pointSize()).toInt()));
   32     QString css(c2bUtils::fileToString(settings->fileName("cb2Bib/BrowserCssFile")));
   33     if (css.isEmpty())
   34         css = c2bUtils::fileToString(":/htm/htm/references.css");
   35     _browserP->document()->setDefaultStyleSheet(css);
   36 
   37     QAction* c(new QAction(this));
   38     c->setShortcut(QKeySequence(Qt::Key_Left));
   39     addAction(c);
   40     connect(c, SIGNAL(triggered()), this, SLOT(close()));
   41 
   42     QAction* vzi(new QAction(this));
   43     vzi->setShortcut(QKeySequence(QKeySequence::ZoomIn));
   44     addAction(vzi);
   45     connect(vzi, SIGNAL(triggered()), _browserP, SLOT(zoomIn()));
   46     QAction* vzo(new QAction(this));
   47     vzo->setShortcut(QKeySequence(QKeySequence::ZoomOut));
   48     addAction(vzo);
   49     connect(vzo, SIGNAL(triggered()), _browserP, SLOT(zoomOut()));
   50 
   51     _browserP->updateHtml(html);
   52 }
   53 
   54 c2bCiterExcerptView::~c2bCiterExcerptView()
   55 {
   56     c2bSettings* settings(c2bSettingsP);
   57     if (!isFullScreen())
   58     {
   59         settings->setValue("c2bCiterExcerptView/position", pos());
   60         settings->setValue("c2bCiterExcerptView/size", size());
   61     }
   62     settings->setValue("c2bCiterExcerptView/BrowserFontPointSize", _browserP->font().pointSize());
   63 }