Since this is the only caller, onvert the get_file_name() function
to return an std::string.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This used to have multiple values, but is currently only checked for
true/false. Reflect that in the type.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The deco timestep is a parameter to the plan() function. There
seems no need to define this as a global macro. Probably some
code reshuffeling artifact.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
We had locale aware formatting functions that generated QStrings.
Create an alternative that creates std::string, since we want that
in the core.
This commit is unfortunate for two reasons:
- The function is called "casprintf()" for analogy with the QString
version. However, the non locale aware function is called
"format_string_std()" for analogy with "format_string()".
Ultimately these names should be unified. Probably, once there
are no membuffer users left.
- This does UTF-16->UTF-8->UTF-16 roundtrips. The core formatting
functions should render UTF-8 and only convert to UTF-16, in
the UI layer.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Since the removal of this special case for MacOS was confirmed to be
working in the case of building with bluetooth support in #4120, we should
probably remove it from the code used when building without bluetooth
support as well.
Signed-off-by: Michael Keller <mikeller@042.ch>
Add a script that finds the changeset ID in the subsurface repository
that a given CICD release was built from.
The option '-c' can be used to check out the changeset, if one is found.
Signed-off-by: Michael Keller <mikeller@042.ch>
If Bluetooth isn't enabled, don't clear non Bluetooth address. There was an earlier concern that USB mount point shouldn't be preserved because they may change. This behavior is different on a Mac where the USB serial mount points tend to be persistent. Michael tested this on Linux and suggested on saving the mount points for Linux and Windows.
Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
Removed blank lines - forgot that blank lines without a continuation \ would break the macro. Embarrassing to say the least. I need to figure out how to upload tested code into git.
Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
Removed the MacOs specific code and added comment explaining why ui.device.Text must be set before the ui.bluetoothMode change handler runs.
Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
Preserve bluetooth address if we have it (don't rescan) and for MacOS save the mount point if we have it. As best as I can tell, the mount points for USB devices do not change on MacOs regardless of the USB port being used.
Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
Per Michael's suggestion, use isBluetoothAddress as check before skipping Bluetooth scan.
Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
When switching from a non-bluetooth computer to a bluetooh computer an unnecessary bluetooth scan may be forced. This patch will avoid the scan if the bluetooth device address is known.
Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
As far as I can see there are no translation strings for the
cylinder names, so there is no point in translating them back.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The combo-boxes (cylinder type, weightsystem, etc.) were controlled
by global models. Keeping these models up-to-date was very combersome
and buggy.
Create a new model everytime a combobox is opened. Ultimately it
might even be better to create a copy of the strings and switch
to simple QStringListModel. Set data in the core directly and
don't do this via the models.
The result is much simpler and easier to handle.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When autosync to cloud was enabled, the old code would crash,
because it synced to cloud from a signal handler, which executed
the main loop when checking the cloud connection, which deleted
the object which was causing the original signal. Or something
like that. See discussion in #4119.
To avoid such problems, send a signal via a 'QueuedConnection'
from QMLManager to itself. The slot will be called once the
signal handler terminates and the main event loop retakes
control.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When changes need saving, the notification text was set quite
deep in the calltree in "saveChangesLocal()". I don't know why
this was put so deep in the call tree. In any case, it prevents
asynchronous saving of the data. Therefore, pull it up to
chnagesNeedSaving().
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
In January it would just show the year for every day. That's
silly. Show the year only for Jan 1st.
Moreover, it would never show the month, because day-of-month
is counted from 1 (whereas month-of-year is counted from 0).
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The signals of the undo-stack can only be connected after it
was initialized. One of those cases where I would have preferred
a crash over a warning message. The mobile version is extremely
noisy!
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This fixes a crash condition when opening the cloud from
desktop: The old code passed a NULL pointer that was then
assigned to an std::string, which is not supported.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Remove the options to expand entities and so continue when encountering invalid /
malformed XML, as both of these can be exploited by supplying
maliciously crafted XML.
Signed-off-by: Michael Keller <mikeller@042.ch>
Q_FOREACH and foreach are anachronisms.
Range based for may cause a performance regression: it can
lead to a copy of shared containers (one reason why Qt's
COW containers are broken). However, as long as there is no
user noticeable delay, there is no point in analyzing each case.
And also no point in slapping an 'asConst' on every container
that is looped over.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of accessing a global variable, pass the filename
from the MainWindow to the dialog. This is supposed to cut
down on the global variable mess.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
To avoid memory management woes. These shouldn't be global
variables, but let's fix that later.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of accessing a global variable, pass the filename
from the MainWindow to the dialog. This is supposed to cut
down on the global variable mess.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of accessing a global variable, pass the filename
from the MainWindow to the dialog. This is supposed to cut
down on the global variable mess.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>