Commit Graph

22807 Commits

Author SHA1 Message Date
John Ralls
2a42078e9a Prevent libstdc++ copysign declaration error on Win32. 2020-05-30 15:18:18 -07:00
John Ralls
8654cb86c8 Don't try to build gnucash-windows-locale.c on non-Windows OSes. 2020-05-30 14:48:20 -07:00
John Ralls
14ed322297 Extract set_win32_thread_locale() to a new C file gnucash-windows-locale.c
g++ can't find the Microsoft Locale symbols, gcc can.
2020-05-30 14:21:07 -07:00
John Ralls
e810ee1c09 gi18n.h, binreloc.h, and gnc-engine.h have C linkage. 2020-05-30 14:18:34 -07:00
Christopher Lam
b0effbc36f cli-reports: if run-report matches multiple, offer choices
If --run-report="Reportname" matches multiple reports, offer a
disambiguation. Will show guid and display the options selected in the
saved report. Example:

"Multicolumn View" matches multiple reports. Select guid instead:

* guid: 2f17ecb535f24a3a9f314bc5855569e5
General / Number of columns: 2.0
General / Report name: A saved-report based on multicolumn-view
General / Stylesheet: Easy

* guid: d8ba4a2e89e8479ca9f6eccdeb164588
2020-05-30 23:16:04 +08:00
Geert Janssens
ad826e0f44 A few translation tweaks in gnucash and gnucash-cli
Contrary to glib's option parsing, boost's doesn't do further translations
internally, so pass it pre-translated messages.
2020-05-30 10:19:48 +02:00
Geert Janssens
18adb5723c C++ tweaks
- use auto where possible
- replace goto with function to call
2020-05-30 09:33:57 +02:00
Geert Janssens
780c4b4e2b Small tweaks that got left out by mistake
Among others this will fix the missing saved reports in
gnucash-cli --run-report
2020-05-30 09:22:42 +02:00
Geert Janssens
d57a1cfaec Move saved report loading to report initialization code 2020-05-30 09:06:59 +02:00
Christopher Lam
30450e4d87 Check all known report templates instead of just custom reports.
Allows users to run any report from the command-line.
2020-05-29 17:13:59 -07:00
John Ralls
3884e24eb9 Convert args passed to run reports to const std::string&. 2020-05-29 17:11:38 -07:00
John Ralls
1e9b5a5707 gnucash-cli: Actually run the report. 2020-05-29 16:03:25 -07:00
John Ralls
c23ca6fb12 Make run-report member variable names consistent. 2020-05-29 16:00:52 -07:00
Christopher Lam
caac850104 instead of saved-reports only, dump in-menu? reports alphabetically
@derekatkins request
2020-05-29 15:31:04 -07:00
Christopher Lam
b34913feda [cli-reports] run reports from cli 2020-05-29 15:30:42 -07:00
Geert Janssens
1ea284d868 Use common input file parameter for gnucash-cli --add-price-quotes
As gnucash and most gnucash-cli commands will work on an input file
it makes sense to use the common positional input-file parameter everywhere.

It's still optional for a normal gnucash run though. It will fall back to
to last-used file as before.

A --add-price-quotes run on the other hand will bail out with an error
message. As this command is typically run unattended in a cron script
it's safer to explicitly request a file to work on.
2020-05-29 18:34:23 +02:00
Geert Janssens
4af7ea0f0a Fix log initialization
- Log related options weren't parsed properly yet
- Rewrite gnc_log_init to use c++ features
2020-05-29 17:43:37 +02:00
Geert Janssens
fa66168d59 Rework gnucash startup code to be a Gnucash class member function
This allows to remove a couple of helper functions
2020-05-29 17:43:37 +02:00
Geert Janssens
b56b87685b Factor out common quotes retrieval code into a new file gnucash-commands.cpp
This file will contain implementations of all
commands that can be run via gnucash-cli.
2020-05-29 17:43:37 +02:00
Geert Janssens
09b270c693 Return from main instead of exiting
Right now it doesn't make a difference as the end of main
is currently never reached. However with some additional
tweaks it can be, and that would allow the application
destructor to be called for a nicer cleanup on exit.
2020-05-29 17:43:37 +02:00
Geert Janssens
5cf0c05ca4 Catch unrecognized command line options
Print help message if that happens.
The alternative would be to pass allow_unregistered() to the options description
while parsing. That however would only make sense if we had other code to parse
the options. We don't.
2020-05-29 17:43:37 +02:00
Geert Janssens
160034165c Make options that don't take arguments bool_switch type
This means they will always exist in the value store after parsing and
are set to true or false. This eliminates the need to test for their
existence first.
2020-05-29 17:43:37 +02:00
Geert Janssens
88ed957d2a Pass argc and argv by value instead of by reference
Contrary to gtk_init, boost::program_options won't remove parsed options from
the argument list so there's no need to provide the option to update
the list.
2020-05-29 17:43:37 +02:00
Geert Janssens
a435b4c4f6 Port command line option handling to boost::program_options
This allows for better separation of options in common, gnucash and gnucash-cli options.
2020-05-29 17:43:37 +02:00
Geert Janssens
317f32de0b Only offer gtk options for gnucash, not for gnucash-cli
* As the gtk command line options are only relevant for
  gnucash and not gnucash-cli, remove the bit that adds
  them from Gnucash::CoreApp.
* As the gtk command line options are parsed out by gtk_init_check
  it's sufficient to run that before parsing our own command line
  options to have gtk handle them for us.
* That just leaves us with the loss of a help message for the
  gtk command line options. To handle that we derive a class
  Gnucash::Gnucash from Gnucash::CoreApp which will generate an
  option context for the gtk options purely to extract the help message.
  This will then be used if the users pass option --help-gtk.

This is a bit clumsy to do with GOptionContext as it requires to store
a few gnucash only parameters in Gnucash::CoreApp. The plan is to
improve this in a future commit.
Note however we will still be stuck with the dummy option context generation
for the gtk option help message. There's just no other way to extract this
message otherwise.
2020-05-29 17:43:37 +02:00
John Ralls
f6788412ce MacOS Build Fixes 2020-05-29 17:43:37 +02:00
Geert Janssens
2b8f91a191 Rename Gnucash::Base to Gnucash::CoreApp
That name better reflects what the class represents
2020-05-29 17:37:57 +02:00
Geert Janssens
91473b1218 Reformat Objective C code to work around a KDevelop bug.
KDevelop erroneously interprets [[ as the beginning of a C++17 attribute which
messes up all subsequent formatting. Changing this to '[ [' (with a space in between)
resolves the issue.
2020-05-29 17:37:57 +02:00
Geert Janssens
785f6702a1 Switch to using boost::locale::format and iostream for printing messages 2020-05-29 17:37:57 +02:00
Geert Janssens
969d00a59f Further cleanup in gnucash and gnucash-cli
- Remove unneeded includes, required a few fixes in other header files
- Silence unused parameter warnings using c++17 attribute [[maybe_unused]]
- Remove some duplicate, unused functions from gnucash and gnucash-cli
  They were a left over from a previous commit
2020-05-29 17:37:57 +02:00
Geert Janssens
c58cfdb87d Extract common setup bits from gnucash and gnucash-cli into a separate class Gnucash::Base
This is just a first start, more refactoring will follow in later commits.
The idea is to have an application class that provides the basic framework
gnucash and gnucash-cli will become specializations of this class adding their
specific functionality. I'm splitting this over several commits to be able to
keep track of all the many changes.
2020-05-29 17:37:57 +02:00
Geert Janssens
3cd0de8ce4 Introduce new executable 'gnucash-cli'
This tool is intended to expose certain gnucash functions to a command line interface.
The first one is --add-price-quotes. This option currently also exists in gnucash.
It will be marked deprecated there. Future extensions to this can be things like
report generation, non-interactive imports,...
2020-05-29 17:37:57 +02:00
Geert Janssens
736979f932 Build gnucash main file as C++ 2020-05-29 17:37:57 +02:00
Geert Janssens
9bf2b026ac Rename main source file from gnucash-bin.c to gnucash.c
That reflects more closely what the eventual binary will be named.
2020-05-29 17:37:57 +02:00
Geert Janssens
45d52d612a Fix build depencency hiccup
report-menus needs gnc-gnome. It may also need gnc-gnome-utils
but that's already a dependency of gnc-gnome so it will be
built anyway.
2020-05-29 17:36:13 +02:00
Geert Janssens
a124e647db Add files omitted in previous commit 2020-05-29 17:35:04 +02:00
Frank H. Ellenberger
3a97fc6a81 Merge PR #727 2020-05-29 17:23:56 +02:00
Geert Janssens
5fc2b9519c Add mock sources and import-export test to dist 2020-05-29 17:20:53 +02:00
Frank H. Ellenberger
2a77c9fc9c L12N:de Ammend last commit about Python messages
keep format-flags
update po date
2020-05-29 16:47:00 +02:00
Christopher Lam
def9a1610c Use gnc:split->owner instead of gnc:owner-from-split 2020-05-29 21:32:23 +08:00
Christopher Lam
c434239b7d Upgrade split->owner to gnc:split->owner 2020-05-29 21:32:23 +08:00
Christopher Lam
8717c5c3cc Bugfix new reports 2020-05-29 21:11:58 +08:00
Christopher Lam
efb9abfb4d deprecate old reports 2020-05-29 18:18:38 +08:00
Christopher Lam
6caf7beee3 Merge branch 'master-guid-dance' #706
For release notes:

* new reports are now using different options and renderer
* options and layout are different

* Old reports still accessible via --extras
2020-05-29 18:13:57 +08:00
c-holtermann
bcb2b47151 updates for python gettext 2020-05-29 10:15:08 +02:00
c-holtermann
fdf51872c1 update with recent gnucash.pot 2020-05-29 10:14:10 +02:00
John Ralls
5091d7a670 Merge Christoph Holterman's python-gettext-localize into master. 2020-05-28 14:17:10 -07:00
John Ralls
20251999a4 python-gettext-localize: Additional POTFILES.in changes. 2020-05-28 14:16:38 -07:00
c-holtermann
b13f40aeaf remove translation test 2020-05-28 20:55:15 +02:00
c-holtermann
e1701fbdd6 locale is not needed anymore (debug) 2020-05-28 20:42:27 +02:00