"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/c2bConsole.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.

c2bConsole.cpp  (cb2bib-1.9.9):c2bConsole.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 "c2bConsole.h" #include "c2bConsole.h"
#include "c2bNetworkQuery.h"
#include "c2bSettings.h" #include "c2bSettings.h"
#include "c2bTests.h" #include "c2bTests.h"
#include "c2bNetworkQuery.h"
#include <bibExtractor.h> #include <bibExtractor.h>
#include <bibParser.h> #include <bibParser.h>
#include <collectionIndex.h> #include <collectionIndex.h>
#include <metadataParser.h> #include <metadataParser.h>
#include <texToHtml.h> #include <texToHtml.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QTimer> #include <QTimer>
c2bConsole::c2bConsole(QObject* parento) : QObject(parento) c2bConsole::c2bConsole(QObject* parento) : QObject(parento) {}
{}
c2bConsole::~c2bConsole() c2bConsole::~c2bConsole() {}
{}
void c2bConsole::load() void c2bConsole::load()
{ {
// Send _process to application cue // Send _process to application cue
QTimer::singleShot(0, this, SLOT(_process())); QTimer::singleShot(0, this, SLOT(_process()));
} }
void c2bConsole::_process() void c2bConsole::_process()
{ {
int code(0); int code(0);
skipping to change at line 52 skipping to change at line 50
code = cl_txt2bib(); code = cl_txt2bib();
else if (c2bSettingsP->cl_index) else if (c2bSettingsP->cl_index)
code = cl_index(); code = cl_index();
else if (c2bSettingsP->cl_cb2bib_tests) else if (c2bSettingsP->cl_cb2bib_tests)
code = cl_cb2bib_tests(); code = cl_cb2bib_tests();
QCoreApplication::exit(code); QCoreApplication::exit(code);
} }
int c2bConsole::cl_html_annote() int c2bConsole::cl_html_annote()
{ {
if (QFileInfo(c2bSettingsP->cl_annote_filename).exists()) if (QFileInfo::exists(c2bSettingsP->cl_annote_filename))
{ {
const QString tex(c2bUtils::fileToString(c2bSettingsP->cl_annote_filenam e)); const QString tex(c2bUtils::fileToString(c2bSettingsP->cl_annote_filenam e));
const QString htmlf(c2bSettingsP->cl_annote_filename + ".html"); const QString htmlf(c2bSettingsP->cl_annote_filename + ".html");
texToHtml t2h; texToHtml t2h;
t2h.toHtml(tex, htmlf); t2h.toHtml(tex, htmlf);
return 0; return 0;
} }
else else
{ {
c2bUtils::warn(QObject::tr("Error: Could not open %1 file for reading"). arg(c2bSettingsP->cl_annote_filename)); c2bUtils::warn(QObject::tr("Error: Could not open %1 file for reading"). arg(c2bSettingsP->cl_annote_filename));
return 1; return 1;
} }
} }
int c2bConsole::cl_doc2bib() int c2bConsole::cl_doc2bib()
{ {
bibParser bp; bibParser bp;
metadataParser mp(&bp); metadataParser mp(&bp);
c2bNetworkQuery nq(&bp); // needs c2bUtils::fromHtmlString c2bNetworkQuery nq(&bp); // needs c2bUtils::fromHtmlString
bibExtractor be(&bp, &mp, &nq); bibExtractor be(&bp, &mp, &nq);
const int c(be.extract(c2bSettingsP->cl_extract_input_filenames, c2bSettings const int c(be.extract(c2bSettingsP->cl_extract_input_filenames, c2bSettings
P->cl_extract_output_filename, bibExtractor::Document)); P->cl_extract_output_filename,
bibExtractor::Document));
return c; return c;
} }
int c2bConsole::cl_txt2bib() int c2bConsole::cl_txt2bib()
{ {
bibParser bp; bibParser bp;
metadataParser mp(&bp); metadataParser mp(&bp);
c2bNetworkQuery nq(&bp); c2bNetworkQuery nq(&bp);
bibExtractor be(&bp, &mp, &nq); bibExtractor be(&bp, &mp, &nq);
const int c(be.extract(c2bSettingsP->cl_extract_input_filenames, c2bSettings const int c(be.extract(c2bSettingsP->cl_extract_input_filenames, c2bSettings
P->cl_extract_output_filename, bibExtractor::PlainText)); P->cl_extract_output_filename,
bibExtractor::PlainText));
return c; return c;
} }
int c2bConsole::cl_index() int c2bConsole::cl_index()
{ {
bibParser bp; bibParser bp;
collectionIndex ci(&bp); collectionIndex ci(&bp);
const int c(ci.index(c2bSettingsP->cl_index_dirname)); const int c(ci.index(c2bSettingsP->cl_index_dirname));
return c; return c;
} }
 End of changes. 9 change blocks. 
12 lines changed or deleted 12 lines changed or added

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