From 71bf7d01fdd1b044723daec5cfbba2cb17c061bf Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Fri, 1 Dec 2017 12:03:14 +0000 Subject: [PATCH] Rename gnc-csv-trans-settings.* to gnc-csv-import-settings.* Change the name of the import settings files as they do not just deal with transactions and all associated required changes. --- gnucash/import-export/csv-imp/CMakeLists.txt | 4 +-- gnucash/import-export/csv-imp/Makefile.am | 4 +-- .../csv-imp/assistant-csv-price-import.cpp | 16 ++++----- .../csv-imp/assistant-csv-trans-import.cpp | 16 ++++----- ...ttings.cpp => gnc-csv-import-settings.cpp} | 34 +++++++++---------- ...ttings.hpp => gnc-csv-import-settings.hpp} | 20 +++++------ .../csv-imp/gnc-price-import.cpp | 6 ++-- .../csv-imp/gnc-price-import.hpp | 6 ++-- .../import-export/csv-imp/gnc-tx-import.cpp | 6 ++-- .../import-export/csv-imp/gnc-tx-import.hpp | 6 ++-- 10 files changed, 59 insertions(+), 59 deletions(-) rename gnucash/import-export/csv-imp/{gnc-csv-trans-settings.cpp => gnc-csv-import-settings.cpp} (95%) rename gnucash/import-export/csv-imp/{gnc-csv-trans-settings.hpp => gnc-csv-import-settings.hpp} (90%) diff --git a/gnucash/import-export/csv-imp/CMakeLists.txt b/gnucash/import-export/csv-imp/CMakeLists.txt index 44a14cacec..65082be1c7 100644 --- a/gnucash/import-export/csv-imp/CMakeLists.txt +++ b/gnucash/import-export/csv-imp/CMakeLists.txt @@ -17,7 +17,7 @@ SET(csv_import_SOURCES gnc-csv-account-map.c gnc-csv-gnumeric-popup.c gnc-csv-tokenizer.cpp - gnc-csv-trans-settings.cpp + gnc-csv-import-settings.cpp gnc-dummy-tokenizer.cpp gnc-fw-tokenizer.cpp gnc-price-import.cpp @@ -45,7 +45,7 @@ SET(csv_import_noinst_HEADERS gnc-csv-account-map.h gnc-csv-gnumeric-popup.h gnc-csv-tokenizer.hpp - gnc-csv-trans-settings.hpp + gnc-csv-import-settings.hpp gnc-dummy-tokenizer.hpp gnc-fw-tokenizer.hpp gnc-price-import.hpp diff --git a/gnucash/import-export/csv-imp/Makefile.am b/gnucash/import-export/csv-imp/Makefile.am index 4b473de869..f1b501f7ea 100644 --- a/gnucash/import-export/csv-imp/Makefile.am +++ b/gnucash/import-export/csv-imp/Makefile.am @@ -19,7 +19,7 @@ libgncmod_csv_import_la_SOURCES = \ gnc-tokenizer.cpp \ gnc-tx-import.cpp \ gnc-trans-props.cpp \ - gnc-csv-trans-settings.cpp + gnc-csv-import-settings.cpp noinst_HEADERS = \ assistant-csv-account-import.h \ @@ -37,7 +37,7 @@ noinst_HEADERS = \ gnc-tokenizer.hpp \ gnc-tx-import.hpp \ gnc-trans-props.hpp \ - gnc-csv-trans-settings.hpp + gnc-csv-import-settings.hpp libgncmod_csv_import_la_LDFLAGS = -avoid-version diff --git a/gnucash/import-export/csv-imp/assistant-csv-price-import.cpp b/gnucash/import-export/csv-imp/assistant-csv-price-import.cpp index 21126ea5b4..0fa6273d4b 100644 --- a/gnucash/import-export/csv-imp/assistant-csv-price-import.cpp +++ b/gnucash/import-export/csv-imp/assistant-csv-price-import.cpp @@ -52,7 +52,7 @@ extern "C" #include "go-charmap-sel.h" } -#include "gnc-csv-trans-settings.hpp" +#include "gnc-csv-import-settings.hpp" #include "gnc-price-import.hpp" #include "gnc-fw-tokenizer.hpp" #include "gnc-csv-tokenizer.hpp" @@ -738,7 +738,7 @@ void CsvImpPriceAssist::preview_populate_settings_combo() gtk_list_store_clear (GTK_LIST_STORE(model)); // Append the default entry - auto presets = get_trans_presets (settings_type); + auto presets = get_import_presets (settings_type); for (auto preset : presets) { GtkTreeIter iter; @@ -766,11 +766,11 @@ void CsvImpPriceAssist::preview_handle_save_del_sensitivity (GtkComboBox* combo) /* Handle sensitivity of the delete and save button */ if (gtk_combo_box_get_active_iter (combo, &iter)) { - CsvTransSettings *preset; + CsvImportSettings *preset; GtkTreeModel *model = gtk_combo_box_get_model (combo); gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1); - if (preset && !trans_preset_is_reserved_name (preset->m_name)) + if (preset && !preset_is_reserved_name (preset->m_name)) { /* Current preset is not read_only, so buttons can be enabled */ can_delete = true; @@ -778,7 +778,7 @@ void CsvImpPriceAssist::preview_handle_save_del_sensitivity (GtkComboBox* combo) } } else if (entry_text && (strlen (entry_text) > 0) && - !trans_preset_is_reserved_name (std::string(entry_text))) + !preset_is_reserved_name (std::string(entry_text))) can_save = true; gtk_widget_set_sensitive (save_button, can_save); @@ -807,7 +807,7 @@ CsvImpPriceAssist::preview_settings_load () if (!gtk_combo_box_get_active_iter (settings_combo, &iter)) return; - CsvTransSettings *preset = nullptr; + CsvImportSettings *preset = nullptr; auto model = gtk_combo_box_get_model (settings_combo); gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1); @@ -834,7 +834,7 @@ CsvImpPriceAssist::preview_settings_delete () if (!gtk_combo_box_get_active_iter (settings_combo, &iter)) return; - CsvTransSettings *preset = nullptr; + CsvImportSettings *preset = nullptr; auto model = gtk_combo_box_get_model (settings_combo); gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1); @@ -868,7 +868,7 @@ CsvImpPriceAssist::preview_settings_save () while (valid) { // Walk through the list, reading each row - CsvTransSettings *preset; + CsvImportSettings *preset; gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1); if (preset && (preset->m_name == std::string(new_name))) diff --git a/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp b/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp index 07091f0bdc..41779c63cd 100644 --- a/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp +++ b/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp @@ -58,7 +58,7 @@ extern "C" #include "go-charmap-sel.h" } -#include "gnc-csv-trans-settings.hpp" +#include "gnc-csv-import-settings.hpp" #include "gnc-tx-import.hpp" #include "gnc-fw-tokenizer.hpp" #include "gnc-csv-tokenizer.hpp" @@ -679,7 +679,7 @@ void CsvImpTransAssist::preview_populate_settings_combo() // Append the default entry - auto presets = get_trans_presets (settings_type); + auto presets = get_import_presets (settings_type); for (auto preset : presets) { GtkTreeIter iter; @@ -707,11 +707,11 @@ void CsvImpTransAssist::preview_handle_save_del_sensitivity (GtkComboBox* combo) /* Handle sensitivity of the delete and save button */ if (gtk_combo_box_get_active_iter (combo, &iter)) { - CsvTransSettings *preset; + CsvImportSettings *preset; GtkTreeModel *model = gtk_combo_box_get_model (combo); gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1); - if (preset && !trans_preset_is_reserved_name (preset->m_name)) + if (preset && !preset_is_reserved_name (preset->m_name)) { /* Current preset is not read_only, so buttons can be enabled */ can_delete = true; @@ -719,7 +719,7 @@ void CsvImpTransAssist::preview_handle_save_del_sensitivity (GtkComboBox* combo) } } else if (entry_text && (strlen (entry_text) > 0) && - !trans_preset_is_reserved_name (std::string(entry_text))) + !preset_is_reserved_name (std::string(entry_text))) can_save = true; gtk_widget_set_sensitive (save_button, can_save); @@ -752,7 +752,7 @@ CsvImpTransAssist::preview_settings_load () if (!gtk_combo_box_get_active_iter (settings_combo, &iter)) return; - CsvTransSettings *preset = nullptr; + CsvImportSettings *preset = nullptr; auto model = gtk_combo_box_get_model (settings_combo); gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1); @@ -779,7 +779,7 @@ CsvImpTransAssist::preview_settings_delete () if (!gtk_combo_box_get_active_iter (settings_combo, &iter)) return; - CsvTransSettings *preset = nullptr; + CsvImportSettings *preset = nullptr; auto model = gtk_combo_box_get_model (settings_combo); gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1); @@ -812,7 +812,7 @@ CsvImpTransAssist::preview_settings_save () while (valid) { // Walk through the list, reading each row - CsvTransSettings *preset; + CsvImportSettings *preset; gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1); if (preset && (preset->m_name == std::string(new_name))) diff --git a/gnucash/import-export/csv-imp/gnc-csv-trans-settings.cpp b/gnucash/import-export/csv-imp/gnc-csv-import-settings.cpp similarity index 95% rename from gnucash/import-export/csv-imp/gnc-csv-trans-settings.cpp rename to gnucash/import-export/csv-imp/gnc-csv-import-settings.cpp index 3bbc9847ba..0096c5397e 100644 --- a/gnucash/import-export/csv-imp/gnc-csv-trans-settings.cpp +++ b/gnucash/import-export/csv-imp/gnc-csv-import-settings.cpp @@ -1,5 +1,5 @@ /*******************************************************************\ - * gnc-csv-trans-settings.c -- Save and Load CSV Import Settings * + * gnc-csv-import-settings.c -- Save and Load CSV Import Settings * * * * Copyright (C) 2014 Robert Fewell * * * @@ -20,13 +20,13 @@ * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * * Boston, MA 02110-1301, USA gnu@gnu.org * \********************************************************************/ -/** @file gnc-csv-trans-settings.c +/** @file gnc-csv-import-settings.c @brief CSV Import Settings @author Copyright (c) 2014 Robert Fewell @author Copyright (c) 2016 Geert Janssens */ -#include "gnc-csv-trans-settings.hpp" +#include "gnc-csv-import-settings.hpp" #include extern "C" @@ -70,18 +70,18 @@ G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_IMPORT; preset_vec presets; -static std::shared_ptr create_int_no_preset(const std::string& set_type) +static std::shared_ptr create_int_no_preset(const std::string& set_type) { - auto preset = std::make_shared(); + auto preset = std::make_shared(); preset->m_name = no_settings; preset->m_settings_type = set_type; return preset; } -static std::shared_ptr create_int_gnc_exp_preset(void) +static std::shared_ptr create_int_gnc_exp_preset(void) { - auto preset = std::make_shared(); + auto preset = std::make_shared(); preset->m_name = gnc_exp; preset->m_skip_start_lines = 1; preset->m_multi_split = true; @@ -119,7 +119,7 @@ static std::shared_ptr create_int_gnc_exp_preset(void) * find all settings entries in the state key file * based on settings type. **************************************************/ -const preset_vec& get_trans_presets (const std::string& set_type) +const preset_vec& get_import_presets (const std::string& set_type) { // Search all Groups in the state key file for ones starting with prefix @@ -157,7 +157,7 @@ const preset_vec& get_trans_presets (const std::string& set_type) /* Then add all the ones we found in the state file */ for (auto preset_name : preset_names) { - auto preset = std::make_shared(); + auto preset = std::make_shared(); preset->m_settings_type = set_type; preset->m_name = preset_name; preset->load(); @@ -166,7 +166,7 @@ const preset_vec& get_trans_presets (const std::string& set_type) return presets; } -bool trans_preset_is_reserved_name (const std::string& name) +bool preset_is_reserved_name (const std::string& name) { return ((name == no_settings) || (name == _(no_settings.c_str())) || @@ -205,9 +205,9 @@ handle_load_error (GError **key_error, const std::string& group) * load the settings from a state key file **************************************************/ bool -CsvTransSettings::load (void) +CsvImportSettings::load (void) { - if (trans_preset_is_reserved_name (m_name)) + if (preset_is_reserved_name (m_name)) return true; GError *key_error = nullptr; @@ -355,9 +355,9 @@ CsvTransSettings::load (void) * save settings to a key file **************************************************/ bool -CsvTransSettings::save (void) +CsvImportSettings::save (void) { - if (trans_preset_is_reserved_name (m_name)) + if (preset_is_reserved_name (m_name)) { PWARN ("Ignoring attempt to save to reserved name '%s'", m_name.c_str()); return true; @@ -471,9 +471,9 @@ CsvTransSettings::save (void) } void -CsvTransSettings::remove (void) +CsvImportSettings::remove (void) { - if (trans_preset_is_reserved_name (m_name)) + if (preset_is_reserved_name (m_name)) return; auto keyfile = gnc_state_get_current (); @@ -483,7 +483,7 @@ CsvTransSettings::remove (void) bool -CsvTransSettings::read_only (void) +CsvImportSettings::read_only (void) { return ((m_name == no_settings) || (m_name == _(no_settings.c_str())) || diff --git a/gnucash/import-export/csv-imp/gnc-csv-trans-settings.hpp b/gnucash/import-export/csv-imp/gnc-csv-import-settings.hpp similarity index 90% rename from gnucash/import-export/csv-imp/gnc-csv-trans-settings.hpp rename to gnucash/import-export/csv-imp/gnc-csv-import-settings.hpp index 7df293c546..e6ce4d4f22 100644 --- a/gnucash/import-export/csv-imp/gnc-csv-trans-settings.hpp +++ b/gnucash/import-export/csv-imp/gnc-csv-import-settings.hpp @@ -1,5 +1,5 @@ /*******************************************************************\ - * gnc-csv-trans-settings.h -- Save and Load CSV Import Settings * + * gnc-csv-import-settings.h -- Save and Load CSV Import Settings * * * * Copyright (C) 2014 Robert Fewell * * * @@ -20,13 +20,13 @@ * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * * Boston, MA 02110-1301, USA gnu@gnu.org * \********************************************************************/ -/** @file gnc-csv-trans-settings.h +/** @file gnc-csv-import-settings.h @brief CSV Import Settings @author Copyright (c) 2014 Robert Fewell @author Copyright (c) 2016 Geert Janssens */ -#ifndef GNC_CSV_TRANS_SETTINGS_H -#define GNC_CSV_TRANS_SETTINGS_H +#ifndef GNC_CSV_IMPORT_SETTINGS_H +#define GNC_CSV_IMPORT_SETTINGS_H extern "C" { #include @@ -49,9 +49,9 @@ enum SEP_BUTTON_TYPES {SEP_SPACE, SEP_TAB, SEP_COMMA, SEP_COLON, SEP_SEMICOLON, /** Enumeration for the settings combo's */ enum SETTINGS_COL {SET_GROUP, SET_NAME}; -struct CsvTransSettings +struct CsvImportSettings { - CsvTransSettings() : m_file_format (GncImpFileFormat::CSV), m_encoding {"UTF-8"}, + CsvImportSettings() : m_file_format (GncImpFileFormat::CSV), m_encoding {"UTF-8"}, m_multi_split (false), m_date_format {0}, m_currency_format {0}, m_skip_start_lines{0}, m_skip_end_lines{0}, m_skip_alt_lines (false), m_separators {","}, m_load_error {false}, m_base_account {nullptr}, @@ -107,8 +107,8 @@ gnc_commodity *m_to_currency; // Price To Currency std::vector m_column_types_price; // The Price Column types in order }; -using preset_vec = std::vector>; -/** Creates a vector of CsvTransSettings which combines +using preset_vec = std::vector>; +/** Creates a vector of CsvImportSettings which combines * - one or more internally defined presets * - all preset found in the state key file. * @@ -117,12 +117,12 @@ using preset_vec = std::vector>; * * @return a reference to the populated vector. */ -const preset_vec& get_trans_presets (const std::string& set_type); +const preset_vec& get_import_presets (const std::string& set_type); /** Check whether name can be used as a preset name. * The names of the internal presets are considered reserved. * A preset with such a name should not be saved or deleted. */ -bool trans_preset_is_reserved_name (const std::string& name); +bool preset_is_reserved_name (const std::string& name); #endif diff --git a/gnucash/import-export/csv-imp/gnc-price-import.cpp b/gnucash/import-export/csv-imp/gnc-price-import.cpp index 44a17b913e..838c9473cb 100644 --- a/gnucash/import-export/csv-imp/gnc-price-import.cpp +++ b/gnucash/import-export/csv-imp/gnc-price-import.cpp @@ -42,7 +42,7 @@ extern "C" { #include "gnc-price-props.hpp" #include "gnc-csv-tokenizer.hpp" #include "gnc-fw-tokenizer.hpp" -#include "gnc-csv-trans-settings.hpp" +#include "gnc-csv-import-settings.hpp" G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_IMPORT; @@ -281,7 +281,7 @@ void GncPriceImport::separators (std::string separators) } std::string GncPriceImport::separators () { return m_settings.m_separators; } -void GncPriceImport::settings (const CsvTransSettings& settings) +void GncPriceImport::settings (const CsvImportSettings& settings) { /* First apply file format as this may recreate the tokenizer */ file_format (settings.m_file_format); @@ -315,7 +315,7 @@ void GncPriceImport::settings (const CsvTransSettings& settings) bool GncPriceImport::save_settings () { - if (trans_preset_is_reserved_name (m_settings.m_name)) + if (preset_is_reserved_name (m_settings.m_name)) return true; /* separators are already copied to m_settings in the separators diff --git a/gnucash/import-export/csv-imp/gnc-price-import.hpp b/gnucash/import-export/csv-imp/gnc-price-import.hpp index be91941a86..9959aaaa51 100644 --- a/gnucash/import-export/csv-imp/gnc-price-import.hpp +++ b/gnucash/import-export/csv-imp/gnc-price-import.hpp @@ -42,7 +42,7 @@ extern "C" { #include "gnc-tokenizer.hpp" #include "gnc-price-props.hpp" -#include "gnc-csv-trans-settings.hpp" +#include "gnc-csv-import-settings.hpp" #include /* A set of currency formats that the user sees. */ @@ -110,7 +110,7 @@ public: void separators (std::string separators); std::string separators (); - void settings (const CsvTransSettings& settings); + void settings (const CsvImportSettings& settings); bool save_settings (); void settings_name (std::string name); @@ -157,7 +157,7 @@ private: void update_price_props (uint32_t row, uint32_t col, GncPricePropType prop_type); struct CsvTranSettings; - CsvTransSettings m_settings; + CsvImportSettings m_settings; bool m_skip_errors; bool m_over_write; }; diff --git a/gnucash/import-export/csv-imp/gnc-tx-import.cpp b/gnucash/import-export/csv-imp/gnc-tx-import.cpp index daa85b4d98..eddbd753ef 100644 --- a/gnucash/import-export/csv-imp/gnc-tx-import.cpp +++ b/gnucash/import-export/csv-imp/gnc-tx-import.cpp @@ -39,7 +39,7 @@ extern "C" { #include "gnc-trans-props.hpp" #include "gnc-csv-tokenizer.hpp" #include "gnc-fw-tokenizer.hpp" -#include "gnc-csv-trans-settings.hpp" +#include "gnc-csv-import-settings.hpp" G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_IMPORT; @@ -293,7 +293,7 @@ void GncTxImport::separators (std::string separators) } std::string GncTxImport::separators () { return m_settings.m_separators; } -void GncTxImport::settings (const CsvTransSettings& settings) +void GncTxImport::settings (const CsvImportSettings& settings) { /* First apply file format as this may recreate the tokenizer */ file_format (settings.m_file_format); @@ -329,7 +329,7 @@ void GncTxImport::settings (const CsvTransSettings& settings) bool GncTxImport::save_settings () { - if (trans_preset_is_reserved_name (m_settings.m_name)) + if (preset_is_reserved_name (m_settings.m_name)) return true; /* separators are already copied to m_settings in the separators diff --git a/gnucash/import-export/csv-imp/gnc-tx-import.hpp b/gnucash/import-export/csv-imp/gnc-tx-import.hpp index 0c14a7489d..87e4ea4cd1 100644 --- a/gnucash/import-export/csv-imp/gnc-tx-import.hpp +++ b/gnucash/import-export/csv-imp/gnc-tx-import.hpp @@ -43,7 +43,7 @@ extern "C" { #include "gnc-tokenizer.hpp" #include "gnc-trans-props.hpp" -#include "gnc-csv-trans-settings.hpp" +#include "gnc-csv-import-settings.hpp" #include @@ -136,7 +136,7 @@ public: void separators (std::string separators); std::string separators (); - void settings (const CsvTransSettings& settings); + void settings (const CsvImportSettings& settings); bool save_settings (); void settings_name (std::string name); @@ -190,7 +190,7 @@ private: void update_pre_split_props (uint32_t row, uint32_t col, GncTransPropType prop_type); struct CsvTranSettings; - CsvTransSettings m_settings; + CsvImportSettings m_settings; bool m_skip_errors; bool m_req_mapped_accts;