Commit Graph

27 Commits

Author SHA1 Message Date
John Ralls
b041a76690 [c++options]Dirty and changed are different.
Report options need to be saved when they're different from the
defaults, book options need to be saved when their value changes
regardless of whether it's the default value. That's dirty. Implement
it.
2023-06-20 14:50:42 -07:00
Vincent Dawans
b514245c22 Bug 798952 - Unable to set day threshold or counters in properties
Make sure counter values are retrieved as int; allow counter back
to zero; fix voucher default value.
2023-06-19 19:23:04 -07:00
John Ralls
aae568eca6 Add comment explaining "option.template get_value<int>()". 2023-06-17 16:58:03 -07:00
John Ralls
4dc8a7ee0d Bug 798952 - Unable to set day threshold or counters in properties
Make counters explicitly integer type and adjust the kvp load and save functions
to recognize that and behave accordingly so that other range options like day
threshold aren't affected.
2023-06-17 16:49:52 -07:00
Christopher Lam
d214b2f05d Merge Vincent Dawans' branch 'bug798879' into stable #1617 2023-05-30 22:41:05 +08:00
Vincent Dawans
1c04e744d3 [trep-engine.scm] Rename "Totals" option to "Grand Total" 2023-05-29 20:01:11 -07:00
John Ralls
6111184c73 Ensure incorrectly coded counter KVP is read correctly.
Bug 798930 caused some counters to be saved as KVP double. If the
correct int64_t value isn't found when reading, or if a double is
encountered when loading the option dialog, get the double value
and cast it to int64_t.
2023-05-26 21:24:06 -04:00
John Ralls
7d5663899c Bug 798930 - invoices wont sequence to the next number
Because KVP can't magically cast between int64_t and double.
2023-05-26 20:41:13 -04:00
Vincent Dawans
761d7f29a5 Bug 765920 - Running balance not accurate when sorted different ways
- Renamed option to "Account Balance" to avoid confusion with running
  total.
- Added helper function to ensure running balance and balance forward
  are only shown when transaction are grouped by account and sorted as
  in register. In that case column heading remains "Running Balance"
  and balance forward is shown. Otherwwise column heading is renamed
  "Account Balance" and balance forward is not shown.
- Also added missing code for Common Currency conversion.
2023-04-21 09:13:16 -07:00
Richard Cohen
6ba5bb326a Fix dereference of expired temporaries.
Reported by clang 15.0.7, which will be in Ubuntu 23.04, -Wdangling-gsl
2023-03-31 11:27:33 -07:00
Richard Cohen
b5f3f99035 Fix incorrect use of remove_if()
- spotted by clang-tidy bugprone
- probably no visible effects because of uniqueness, and other checks

libgnucash/engine/gnc-optiondb.cpp:149:5: warning: this call will remove at most one item even when multiple items should be removed [bugprone-inaccurate-erase]
    m_options.erase(std::remove_if(m_options.begin(), m_options.end(),
    ^

libgnucash/engine/gnc-optiondb.cpp:358:5: warning: the value returned by this function should be used [bugprone-unused-return-value]
    std::remove_if(m_callbacks.begin(), m_callbacks.end(),
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libgnucash/engine/gnc-optiondb.cpp:358:5: note: cast the expression to void to silence this warning
2023-03-17 16:50:11 +00:00
John Ralls
a44b3664e2 [c++options] Implement GncOptionGncOwnerValue class.
GncOwners aren't QofInstances and have limited lifetimes so an option
must hold its own, wrapped in std::unique_ptr for memory management.
2023-03-14 16:11:39 -07:00
John Ralls
cdb674ebf1 [c++options]Really fix the gnc_option_db_lookup_string_value leak
By deleting the function and using GncOptionDbImpl::lookup_string_option
directly. It returns a string that we don't have to worry about
memory-managing.

Also create a new GncOptionDbImpl::set_string_option to replace
gnc_option_db_set_string_value.
2023-03-06 11:43:50 -08:00
John Ralls
92071e8844 [c++options] Fix leak. 2023-03-05 10:14:20 -08:00
Richard Cohen
87c52f53fa Update some references to hello-world.scm 2023-02-27 11:36:04 +00:00
John Ralls
6ab7b16d62 [c++options] Restore the ability to set plot sizes in pixels.
Enable and fix the previously untested GtkOptionGtkUIItem::PLOTSIZE.

This has the potentially unfortunate side effect that integer range
options are assumed to be plot sizes. That's correct for now, but
if some report comes along that needs an integer range option for
something else it will have to be differentiated.
2023-02-25 16:25:36 -08:00
Richard Cohen
9c6ad222a9 [-Wunused-function] - remove 2023-02-16 09:20:59 +00:00
Robert Fewell
45a07463fb Change max timeout to 20 seconds for default invoice report 2023-02-05 10:21:56 +00:00
Robert Fewell
07f3f536cc Allow to select saved report on print invoice button
This change was inspired by mildred's #PR1247 and uses the new
GncReportCombo to allow selection of 'Saved Invoice reports' when the
invoice print button is used or when printing multiple invoices.

This change presents a dialog with the default for the report combo set
to the properties setting. This dialog has a timeout which is
adjustable under properties and will stop if a key is pressed or combo
popped so that a different report template can be selected and used.
There is also an 'OK' button that stops the time out and prints and a
'Cancel' button which cancels the print.
2023-02-02 14:05:53 +00:00
Robert Fewell
019214f1c2 Bug753307 - Custom Report be selectable as default Report for Printing
This commit changes the preference in Business->'Report for Printing'
to be saved as a book property and allow the selection of any Invoice
Report to be used as the default.
2023-02-01 16:29:11 +00:00
John Ralls
dd2497416c Merge Richard Cohen's 'internal-extern-c' into master. 2023-01-23 11:27:05 -08:00
John Ralls
60c06debce [c++options] Don't crash when find_option returns nullopt. 2023-01-23 11:22:35 -08:00
Richard Cohen
1cec0cb3f3 Use internal extern "C" { ... } for C++
- removes warnings compiling swig engine
...
[ 10%] Generating swig-engine.cpp
.../libgnucash/engine/engine-helpers.h:31: Warning 313: Unrecognized extern type "C++".
.../libgnucash/engine/gnc-date.h:83: Warning 313: Unrecognized extern type "C++".
.../libgnucash/engine/qofquery.h:90: Warning 302: Identifier 'QofQuery' redefined (ignored),
.../libgnucash/engine/gnc-option.hpp:55: Warning 302: previous definition of 'QofQuery'.
.../libgnucash/engine/gnc-commodity.h:56: Warning 313: Unrecognized extern type "C++".
.../libgnucash/engine/gncBusiness.h:40: Warning 313: Unrecognized extern type "C++".
.../libgnucash/engine/gncEntry.h:37: Warning 313: Unrecognized extern type "C++".
2023-01-23 18:40:01 +00:00
Christopher Lam
259881f940 [gnc-optiondb] add some more renamed options
following ab13b01f8c Replace ... with … in all translatable strings.
2022-12-24 22:14:35 +08:00
John Ralls
ab13b01f8c Replace ... with … in all translatable strings.
Also a few other places like translator comments and report options.

Replaces https://github.com/Gnucash/gnucash/pull/1033.
2022-12-23 12:43:54 -08:00
John Ralls
23ca899a77 Fix build on Apple Silicon or maybe Apple-clang-14.0
The compiler complains that there's no matching
gnc_register_number_range_option for GncOptionDB*, which without this
commit is true because the explicit templates are for GncOptionDBPtr&.
Note that the original template definition is for GncOptionDB* and
that the header-defined inlines that take GncOptionDBPtr& call the
GncOptionDB* version.
2022-10-02 11:42:52 -07:00
John Ralls
4ae17d12c7 [options] Move options from app-utils to engine.
Options is required for book options that are stored as part of the data
 file and so belongs in engine.
2022-08-25 22:09:56 -07:00