"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/c2b/settings.cpp" between
cb2bib-2.0.0.tar.gz and cb2bib-2.0.1.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.

settings.cpp  (cb2bib-2.0.0):settings.cpp  (cb2bib-2.0.1)
/*************************************************************************** /***************************************************************************
* Copyright (C) 2004-2019 by Pere Constans * Copyright (C) 2004-2021 by Pere Constans
* constans@molspaces.com * constans@molspaces.com
* cb2Bib version 2.0.0. Licensed under the GNU GPL version 3. * cb2Bib version 2.0.1. 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 "settings.h" #include "settings.h"
#include "cb2bib_utilities.h" #include "cb2bib_utilities.h"
#include <QCoreApplication> #include <QCoreApplication>
#include <QDir> #include <QDir>
/** /**
skipping to change at line 82 skipping to change at line 82
{ {
_c2bApp = QCoreApplication::instance(); _c2bApp = QCoreApplication::instance();
Q_ASSERT_X(_c2bApp, "settings", "application was not instantiated"); Q_ASSERT_X(_c2bApp, "settings", "application was not instantiated");
Q_ASSERT_X(!_c2b_global_settings, "settings", "settings already instantiated "); Q_ASSERT_X(!_c2b_global_settings, "settings", "settings already instantiated ");
settings::_c2b_global_settings = this; settings::_c2b_global_settings = this;
_application_pid = QString::number(_c2bApp->applicationPid()); _application_pid = QString::number(_c2bApp->applicationPid());
_is_loaded = true; _is_loaded = true;
cl_bibedit = false; cl_bibedit = false;
cl_cb2bib_import_mode = false; cl_cb2bib_import_mode = false;
cl_cb2bib_information = false;
cl_cb2bib_tests = false; cl_cb2bib_tests = false;
cl_citer = false; cl_citer = false;
cl_configure = false; cl_configure = false;
cl_doc2bib = false; cl_doc2bib = false;
cl_html_annote = false; cl_html_annote = false;
cl_import = false; cl_import = false;
cl_index = false; cl_index = false;
cl_sloppy = false; cl_sloppy = false;
cl_txt2bib = false; cl_txt2bib = false;
cl_user_configured = false; cl_user_configured = false;
skipping to change at line 185 skipping to change at line 186
defaults["cb2Bib/PostprocessBibTeXArg"] = C2B_POSTPROCESS_BIBTEX_ARG; defaults["cb2Bib/PostprocessBibTeXArg"] = C2B_POSTPROCESS_BIBTEX_ARG;
defaults["cb2Bib/PostprocessBibTeXExt"] = C2B_POSTPROCESS_BIBTEX_EXT; defaults["cb2Bib/PostprocessBibTeXExt"] = C2B_POSTPROCESS_BIBTEX_EXT;
// Misc // Misc
defaults["c2bAnnote/IncludeCSS"] = true; defaults["c2bAnnote/IncludeCSS"] = true;
defaults["c2bAnnote/UseRelativeLinks"] = false; defaults["c2bAnnote/UseRelativeLinks"] = false;
defaults["cb2Bib/AddMetadata"] = true; defaults["cb2Bib/AddMetadata"] = true;
defaults["cb2Bib/AutomaticPdfDownload"] = false; defaults["cb2Bib/AutomaticPdfDownload"] = false;
defaults["cb2Bib/AutomaticQuery"] = false; defaults["cb2Bib/AutomaticQuery"] = false;
defaults["cb2Bib/CheckRepeatedOnSave"] = false; defaults["cb2Bib/CheckRepeatedOnSave"] = false;
defaults["cb2Bib/CiteCommandPattern"] = C2B_CITE_COMMAND_PATTERN;
defaults["cb2Bib/CiteIdPattern"] = C2B_CITE_ID_PATTERN; defaults["cb2Bib/CiteIdPattern"] = C2B_CITE_ID_PATTERN;
defaults["cb2Bib/ConvertReferenceToLaTeX"] = true; defaults["cb2Bib/ConvertReferenceToLaTeX"] = true;
defaults["cb2Bib/CopyMovePdf"] = "copy"; defaults["cb2Bib/CopyMovePdf"] = "copy";
defaults["cb2Bib/DoHeuristicGuess"] = true; defaults["cb2Bib/DoHeuristicGuess"] = true;
defaults["cb2Bib/DocumentIdPattern"] = C2B_DOCUMENT_ID_PATTERN; defaults["cb2Bib/DocumentIdPattern"] = C2B_DOCUMENT_ID_PATTERN;
defaults["cb2Bib/FindReplaceInput"] = true; defaults["cb2Bib/FindReplaceInput"] = true;
defaults["cb2Bib/FindReplaceInputList"] = C2B_FIND_REPLACE_LIST.split("^e"); defaults["cb2Bib/FindReplaceInputList"] = QString(C2B_FIND_REPLACE_LIST).spl it("^e");
defaults["cb2Bib/InsertMetadata"] = false; defaults["cb2Bib/InsertMetadata"] = false;
defaults["cb2Bib/KeepTmpNQFiles"] = false; defaults["cb2Bib/KeepTmpNQFiles"] = false;
defaults["cb2Bib/MovePdf"] = false; defaults["cb2Bib/MovePdf"] = false;
defaults["cb2Bib/PageNumberSeparator"] = " - "; defaults["cb2Bib/PageNumberSeparator"] = " - ";
defaults["cb2Bib/PostprocessMonth"] = false; defaults["cb2Bib/PostprocessMonth"] = false;
defaults["cb2Bib/PreAppendMetadata"] = "prepend"; defaults["cb2Bib/PreAppendMetadata"] = "prepend";
defaults["cb2Bib/PreparserAutomatic"] = false; defaults["cb2Bib/PreparserAutomatic"] = false;
defaults["cb2Bib/PreparserShowLog"] = true; defaults["cb2Bib/PreparserShowLog"] = true;
defaults["cb2Bib/RelativePdfDirectory"] = false; defaults["cb2Bib/RelativePdfDirectory"] = false;
defaults["cb2Bib/SetJournalsToFullname"] = false; defaults["cb2Bib/SetJournalsToFullname"] = false;
skipping to change at line 302 skipping to change at line 304
\endhtmlonly \endhtmlonly
- <b>Note:</b> On Windows use <tt>c2bconsole</tt> instead of <tt>cb2bib</tt>. - <b>Note:</b> On Windows use <tt>c2bconsole</tt> instead of <tt>cb2bib</tt>.
See \ref relnotes130. See \ref relnotes130.
- <b>Note:</b> If using reference extraction command, see \ref - <b>Note:</b> If using reference extraction command, see \ref
faq_automatic_extraction. faq_automatic_extraction.
*/ */
bool settings::isConsoleMode(int& argc, char** argv) bool settings::isConsoleMode(const int argc, char** argv)
{ {
for (int i = 0; i < argc; ++i) for (int i = 0; i < argc; ++i)
if (strcmp(argv[i], "--html-annote") == 0 || strcmp(argv[i], "--doc2bib" ) == 0 || if (strcmp(argv[i], "--html-annote") == 0 || strcmp(argv[i], "--doc2bib" ) == 0 ||
strcmp(argv[i], "--txt2bib") == 0 || strcmp(argv[i], "--index") == 0 strcmp(argv[i], "--txt2bib") == 0 || strcmp(argv[i], "--index") == 0
|| strcmp(argv[i], "--test") == 0) || strcmp(argv[i], "--c2binfo") == 0 ||
strcmp(argv[i], "--test") == 0)
return true; return true;
return false; return false;
} }
bool settings::isSingleApplicationMode(int& argc, char** argv) bool settings::isSingleApplicationMode(const int argc, char** argv)
{ {
for (int i = 0; i < argc; ++i) for (int i = 0; i < argc; ++i)
if (strcmp(argv[i], "--citer") == 0) if (strcmp(argv[i], "--citer") == 0)
return true; return true;
return false; return false;
} }
bool settings::isConfiguredMode() bool settings::isConfiguredMode()
{ {
const QCoreApplication* capp = QCoreApplication::instance(); const QCoreApplication* capp = QCoreApplication::instance();
skipping to change at line 418 skipping to change at line 421
else if (arguments.at(i) == "--html-annote") else if (arguments.at(i) == "--html-annote")
checkCommand(&cl_html_annote, &actions); checkCommand(&cl_html_annote, &actions);
else if (arguments.at(i) == "--view-annote") else if (arguments.at(i) == "--view-annote")
checkCommand(&cl_view_annote, &actions); checkCommand(&cl_view_annote, &actions);
else if (arguments.at(i) == "--doc2bib") else if (arguments.at(i) == "--doc2bib")
checkCommand(&cl_doc2bib, &actions); checkCommand(&cl_doc2bib, &actions);
else if (arguments.at(i) == "--txt2bib") else if (arguments.at(i) == "--txt2bib")
checkCommand(&cl_txt2bib, &actions); checkCommand(&cl_txt2bib, &actions);
else if (arguments.at(i) == "--index") else if (arguments.at(i) == "--index")
checkCommand(&cl_index, &actions); checkCommand(&cl_index, &actions);
else if (arguments.at(i) == "--c2binfo")
cl_cb2bib_information = true;
else if (arguments.at(i).startsWith("--test")) else if (arguments.at(i).startsWith("--test"))
cl_cb2bib_tests = true; cl_cb2bib_tests = true;
else else
_is_loaded = false; _is_loaded = false;
} }
if (actions > 1) if (actions > 1)
_is_loaded = false; _is_loaded = false;
if (cl_user_configured && cl_configure) if (cl_user_configured && cl_configure)
_is_loaded = false; _is_loaded = false;
if (cl_sloppy && !(cl_doc2bib || cl_txt2bib)) if (cl_sloppy && !(cl_doc2bib || cl_txt2bib))
_is_loaded = false; _is_loaded = false;
if (cl_index && if (cl_index &&
(cl_bibedit || cl_citer || cl_import || cl_html_annote || cl_view_annote || cl_doc2bib || cl_txt2bib)) (cl_bibedit || cl_citer || cl_import || cl_html_annote || cl_view_annote || cl_doc2bib || cl_txt2bib))
_is_loaded = false; _is_loaded = false;
if (!_is_loaded) if (!_is_loaded)
{ {
printUsage(); printUsage();
return; return;
} }
cl_console_mode = cl_html_annote || cl_cb2bib_tests || cl_doc2bib || cl_txt2 cl_console_mode =
bib || cl_index; cl_html_annote || cl_cb2bib_information || cl_cb2bib_tests || cl_doc2bib
|| cl_txt2bib || cl_index;
cl_cb2bib_mode = !(cl_console_mode || cl_configure || cl_view_annote); cl_cb2bib_mode = !(cl_console_mode || cl_configure || cl_view_annote);
// Check for cl_user_configured // Check for cl_user_configured
if (cl_configure) if (cl_configure)
for (int i = 1; i < arguments.count() - 1; ++i) for (int i = 1; i < arguments.count() - 1; ++i)
if (arguments.at(i) == "--configure") if (arguments.at(i) == "--configure")
{ {
if (!arguments.at(i + 1).startsWith('-')) if (!arguments.at(i + 1).startsWith('-'))
cl_user_configured = true; cl_user_configured = true;
break; break;
 End of changes. 10 change blocks. 
9 lines changed or deleted 15 lines changed or added

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