"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/c2bCiterView.cpp" between
cb2bib-1.9.9.tar.gz and cb2bib-2.0.0.tar.gz

About: cb2Bib is a multiplatform application for rapidly extracting unformatted, or unstandardized bibliographic references from email alerts, journal Web pages, and PDF files.

c2bCiterView.cpp  (cb2bib-1.9.9):c2bCiterView.cpp  (cb2bib-2.0.0)
/*************************************************************************** /***************************************************************************
* Copyright (C) 2004-2018 by Pere Constans * Copyright (C) 2004-2019 by Pere Constans
* constans@molspaces.com * constans@molspaces.com
* cb2Bib version 1.9.9. Licensed under the GNU GPL version 3. * cb2Bib version 2.0.0. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution. * See the LICENSE file that comes with this distribution.
***************************************************************************/ ***************************************************************************/
#include "c2bCiterView.h" #include "c2bCiterView.h"
#include "c2bCiterExcerptView.h" #include "c2bCiterExcerptView.h"
#include <bibSearcher.h> #include <bibSearcher.h>
#include <QApplication> #include <QApplication>
#include <QHeaderView> #include <QHeaderView>
skipping to change at line 45 skipping to change at line 45
void c2bCiterView::reloadModel(QAbstractItemModel* citations, const QStringList& bibtex_files, const c2bCiter::State& s) void c2bCiterView::reloadModel(QAbstractItemModel* citations, const QStringList& bibtex_files, const c2bCiter::State& s)
{ {
_filter_mode = false; _filter_mode = false;
_filter_string.clear(); _filter_string.clear();
if (!citations) if (!citations)
return; return;
if (_citationsP != citations) if (_citationsP != citations)
{ {
_citationsP = static_cast<c2bCiterModel*>(citations); _citationsP = static_cast<c2bCiterModel*>(citations);
QTableView::setModel(_citationsP); QTableView::setModel(_citationsP);
connect(_citationsP, SIGNAL(patternFilterChanged(const QString&)), this, SLOT(updatePatternFilter(const QString&))); connect(_citationsP, SIGNAL(patternFilterChanged(QString)), this, SLOT(u pdatePatternFilter(QString)));
} }
QModelIndex i(currentIndex()); QModelIndex i(currentIndex());
_citationsP->reloadCitations(bibtex_files, s, &i); _citationsP->reloadCitations(bibtex_files, s, &i);
updateViewport(); updateViewport();
updateCurrentIndex(i); updateCurrentIndex(i);
} }
c2bCiter::State c2bCiterView::currentState() const c2bCiter::State c2bCiterView::currentState() const
{ {
if (_citationsP) if (_citationsP)
skipping to change at line 165 skipping to change at line 165
_citationsP->setDocumentFilter(f, &i); _citationsP->setDocumentFilter(f, &i);
updateViewport(); updateViewport();
updateCurrentIndex(i); updateCurrentIndex(i);
} }
} }
} }
void c2bCiterView::toggleGlossaryView() void c2bCiterView::toggleGlossaryView()
{ {
QModelIndex i(currentIndex()); QModelIndex i(currentIndex());
if (_citationsP->currentFormat() == c2bCiter::K if (_citationsP->currentFormat() == c2bCiter::K &&
&& (_citationsP->currentFilter() == c2bCiter::None || _citationsP->curre (_citationsP->currentFilter() == c2bCiter::None || _citationsP->currentF
ntFilter() == c2bCiter::Pattern)) ilter() == c2bCiter::Pattern))
_citationsP->restoreLastNonKeywordState(&i); _citationsP->restoreLastNonKeywordState(&i);
else else
_citationsP->setGlossaryView(&i); _citationsP->setGlossaryView(&i);
updateViewport(); updateViewport();
updateCurrentIndex(i); updateCurrentIndex(i);
} }
void c2bCiterView::keywordDocumentSearch() void c2bCiterView::keywordDocumentSearch()
{ {
const c2bCiter::KeywordData kd(_citationsP->keywordData(currentIndex())); const c2bCiter::KeywordData kd(_citationsP->keywordData(currentIndex()));
skipping to change at line 238 skipping to change at line 238
setColumnWidth(0, vp_w); setColumnWidth(0, vp_w);
for (int i = 1; i < nc; ++i) for (int i = 1; i < nc; ++i)
setColumnWidth(i, 0); setColumnWidth(i, 0);
return; return;
} }
for (int i = 1; i < nc; ++i) for (int i = 1; i < nc; ++i)
required_w += w.at(i); required_w += w.at(i);
if (required_w > vp_w) if (required_w > vp_w)
{ {
int available_w(vp_w - w.at(0)); int available_w(vp_w - w.at(0));
int div[] = {0, 0, 0, 0}; int div[] = { 0, 0, 0, 0 };
while (available_w > 0) while (available_w > 0)
for (int i = 1; i < nc; ++i) for (int i = 1; i < nc; ++i)
if (div[i] < w.at(i)) if (div[i] < w.at(i))
{ {
div[i] += 1; div[i] += 1;
--available_w; --available_w;
} }
for (int i = 1; i < nc; ++i) for (int i = 1; i < nc; ++i)
w[i] = div[i]; w[i] = div[i];
} }
else else
w[nc-1] += vp_w - required_w; w[nc - 1] += vp_w - required_w;
for (int i = 0; i < nc; ++i) for (int i = 0; i < nc; ++i)
setColumnWidth(i, w.at(i)); setColumnWidth(i, w.at(i));
} }
void c2bCiterView::keyPressEvent(QKeyEvent* qevent) void c2bCiterView::keyPressEvent(QKeyEvent* qevent)
{ {
if (_filter_mode) if (_filter_mode)
{ {
switch (qevent->key()) switch (qevent->key())
{ {
skipping to change at line 294 skipping to change at line 294
} }
if (qevent->modifiers() & Qt::ShiftModifier) if (qevent->modifiers() & Qt::ShiftModifier)
{ {
if (!qevent->text().isEmpty()) if (!qevent->text().isEmpty())
QTableView::keyboardSearch(qevent->text()); QTableView::keyboardSearch(qevent->text());
qevent->accept(); qevent->accept();
return; return;
} }
switch (qevent->key()) switch (qevent->key())
{ {
// Formats // Formats
case Qt::Key_A: case Qt::Key_A:
updateFormat(c2bCiter::AJYT); updateFormat(c2bCiter::AJYT);
qevent->accept(); qevent->accept();
return; return;
case Qt::Key_I: case Qt::Key_I:
updateFormat(c2bCiter::IT); updateFormat(c2bCiter::IT);
qevent->accept(); qevent->accept();
return; return;
case Qt::Key_J: case Qt::Key_J:
updateFormat(c2bCiter::JYA); updateFormat(c2bCiter::JYA);
skipping to change at line 316 skipping to change at line 316
return; return;
case Qt::Key_T: case Qt::Key_T:
updateFormat(c2bCiter::T); updateFormat(c2bCiter::T);
qevent->accept(); qevent->accept();
return; return;
case Qt::Key_Y: case Qt::Key_Y:
updateFormat(c2bCiter::YAJT); updateFormat(c2bCiter::YAJT);
qevent->accept(); qevent->accept();
return; return;
// Filters // Filters
case Qt::Key_Delete: case Qt::Key_Delete:
_citationsP->clearSelection(); _citationsP->clearSelection();
qevent->accept(); qevent->accept();
return; return;
case Qt::Key_D: case Qt::Key_D:
clearCurrentFilter(); clearCurrentFilter();
qevent->accept(); qevent->accept();
return; return;
case Qt::Key_F: case Qt::Key_F:
_filter_mode = true; _filter_mode = true;
skipping to change at line 347 skipping to change at line 347
return; return;
case Qt::Key_R: case Qt::Key_R:
setRelatedFilter(); setRelatedFilter();
qevent->accept(); qevent->accept();
return; return;
case Qt::Key_S: case Qt::Key_S:
toggleSelectedFilter(); toggleSelectedFilter();
qevent->accept(); qevent->accept();
return; return;
// Actions // Actions
case Qt::Key_Left: case Qt::Key_Left:
emit showPreviousState(); showPreviousState();
qevent->accept(); qevent->accept();
return; return;
case Qt::Key_Right: case Qt::Key_Right:
emit showNextState(); showNextState();
qevent->accept(); qevent->accept();
return; return;
case Qt::Key_C: case Qt::Key_C:
emit citeReferences(); emit citeReferences();
qevent->accept(); qevent->accept();
return; return;
case Qt::Key_E: case Qt::Key_E:
emit editReference(); emit editReference();
qevent->accept(); qevent->accept();
return; return;
skipping to change at line 385 skipping to change at line 385
return; return;
case Qt::Key_W: case Qt::Key_W:
emit openAnnote(); emit openAnnote();
qevent->accept(); qevent->accept();
return; return;
case Qt::Key_Escape: case Qt::Key_Escape:
emit hideCiter(); emit hideCiter();
qevent->accept(); qevent->accept();
return; return;
// Navigation // Navigation
case Qt::Key_Tab: case Qt::Key_Tab:
{ {
QKeyEvent ke(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier); QKeyEvent ke(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier);
QTableView::keyPressEvent(&ke); QTableView::keyPressEvent(&ke);
qevent->accept(); qevent->accept();
return; return;
} }
case Qt::Key_Backspace: case Qt::Key_Backspace:
{ {
QKeyEvent ke(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier); QKeyEvent ke(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier);
skipping to change at line 442 skipping to change at line 442
qevent->ignore(); qevent->ignore();
} }
} }
void c2bCiterView::resizeEvent(QResizeEvent* qevent) void c2bCiterView::resizeEvent(QResizeEvent* qevent)
{ {
updateViewport(); updateViewport();
QTableView::resizeEvent(qevent); QTableView::resizeEvent(qevent);
} }
void c2bCiterView::keyboardSearch(const QString& /* search */) void c2bCiterView::keyboardSearch(const QString& /* search */) {}
{}
 End of changes. 13 change blocks. 
14 lines changed or deleted 14 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)