aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
AgeCommit message (Collapse)Author
2013-09-09Use the same code for command line and gui for file handling.Gravatar Tomaz Canabrava
The Command line execution of Subsurface happened before the GUI was created, this leaded to various bugs by me(tm) over time. This patch seems to fix all of those, by reusing the same code for GUI interaction and CommandLine interaction. I had to rework how the main.c worked, it used to be C code calling C++ code, and this is non desirable, since C doesn't really understand C++. I Moved all of C-related code to 'subsurfacestartup.c/h' and created a tiny wrapper to call it, so all of the C code is still C code, and the new main.cpp calls the mainwindow->loadFiles and mainWindow->importFiles to get rid of the bugs that happened before. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-03Tie all the pieces together and make Preferences work as intendedGravatar Dirk Hohndel
Not Apply / Close without Saving / OK work as designed. And things get correctly stored and reset. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-30Add --help command line optionGravatar Henrik Brautaset Aronsen
Added a simple usage text on the command line. Also added a --verbose alias for completeness. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-30Stop building prefs.cGravatar Dirk Hohndel
The only tiny function in there that was still needed seems to fit nicely into main.c Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-29Add --version to command line optionsGravatar Henrik Brautaset Aronsen
Displays Subsurface and libdivecomputer versions. Suggested-by: Jef Driesen <jefdriesen@telenet.be> Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-29Connect preferences to the rest of the codeGravatar Dirk Hohndel
The biggest problem here was that bool has different sizes in C and C++ code. So using this in a structure shared between the two sides wasn't a smart idea. Instead I went with 'short', but that caused problems with Qt being to smart for its own good and not doing the right thing when dealing with 'boolean' settings and a short value. This may be something in the way I implemented things (as I doubt that something this fundamental would be broken) but the workaround implemented here (explicitly using 0 or 1 depending on the value of the boolean) seems to work. I also decided to get rid of the confusion of where gflow/gfhigh are floating point (0..1) and when they are integers (0..100). We now use integers anywhere outside of deco.c. I also applied some serious spelling corrections to the preferences dialog's ui file. Finally, this enables the code that selects which partial pressure graph to show. Still to do: font size, metric/imperial logic Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-21Replace GError handling with a kMessageWidget based approachGravatar Dirk Hohndel
Instead of passing pointers to GError around we pass just pointers to error message texts around and use kMessageWidget to show those. Problem is that right now the close button on that doesn't do a thing - so the error stays around indefinitely. Oops. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-21Remove Gtk crudGravatar Dirk Hohndel
The DEBUGFILE logic isn't needed anymore. Nor are helpers dealing with model / datastructure updates. Nor conditional compiles to use Gtk instead of Qt. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-21Initialize QSettings earlier & change the Organization to "Subsurface"Gravatar Dirk Hohndel
The first change allows the default_filename to be found again. The second change switches us to .config/Subsurface/Subsurface.conf which I find much more useful. QtCreator also fixed a few indentation issues for me. How helpful. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-17Merge branch 'Qt'Gravatar Dirk Hohndel
After the 3.1 release it is time to shift the focus on the Qt effort - and the best way to do this is to merge the changes in the Qt branch into master. Linus was extremely nice and did a merge for me. I decided to do my own merge instead (which by accident actually based on a different version of the Qt branch) and then used his merge to double check what I was doing. I resolved a few things differently but overall what we did was very much the same (and I say this with pride since Linus is a professional git merger) Here's his merge commit message: This is a rough and tumble merge of the Qt branch into 'master', trying to sort out the conflicts as best as I could. There were two major kinds of conflicts: - the Makefile changes, in particular the split of the single Makefile into Rules.mk and Configure.mk, along with the obvious Qt build changes themselves. Those changes conflicted with some of the updates done in mainline wrt "release" targets and some helper macros ($(NAME) etc). Resolved by largely taking the Qt branch versions, and then editing in the most obvious parts of the Makefile updates from mainline. NOTE! The script/get_version shell script was made to just fail silently on not finding a git repository, which avoided having to take some particularly ugly Makefile changes. - Various random updates in mainline to support things like dive tags. The conflicts were mainly to the gtk GUI parts, which obviously looked different afterwards. I fixed things up to look like the newer code, but since the gtk files themselves are actually dead in the Qt branch, this is largely irrelevant. NOTE! This does *NOT* introduce the equivalent Qt functionality. The fields are there in the code now, but there's no Qt UI for the whole dive tag stuff etc. This seems to compile for me (although I have to force "QMAKE=qmake-qt4" on f19), and results in a Linux binary that seems to work, but it is otherwise largely untested. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-11Require libzip, xslt and osm-gps-map in all buildsGravatar Henrik Brautaset Aronsen
Conditional inclusion of libzip, xslt and osm-gps-map just makes testing more cumbersome, since testers might lack Subsurface features without knowing. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-03Remove the majority of the Gtk related codeGravatar Dirk Hohndel
- rip all Gtk code from qt-gui.cpp - don't compile Gtk specific files - don't link against Gtk libraries - don't compile modules we don't use at all (yet) - use #if USE_GTK_UI on the remaining files to disable Gtk related parts - disable the non-functional Cochran support while I'm at it Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-24Split report_dives into UI and logic and move to divelist filesGravatar Dirk Hohndel
Functionality is unchanged, except we now have a nice process_dives function that deals with all the logic and that gets called from report_dives from the Gtk code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-18Delay Qt ui constructionGravatar Amit Chaudhuri
The Qt ui will need to read the dive_table to populate widgets with dives. Gtk functionality in init_ui is required to parse the dives. Split init_ui to allow parsing to proceed and complete before Qt ui mainwindow constructor is called. Play with qDebug()'s printf style (Thiago!) Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-07Move set_filename() calls outside of parse_file()Gravatar Alberto Mardegan
Remove the boolean parameter from parse_file; the code is more readable by having an explicit call to set_filename() where necessary, rather than a boolean parameter. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
2013-04-02Move set_filename() calls outside of parse_file()Gravatar Alberto Mardegan
Remove the boolean parameter from parse_file; the code is more readable by having an explicit call to set_filename() where necessary, rather than a boolean parameter. Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
2013-03-01Make the map provider choice a preferenceGravatar Dirk Hohndel
Not all of the providers seem to work for me (Yahoo Satellite doesn't appear to give me any data), but for now I'll leave most of them in. We can later decide to offer only some of them. It might be more fun to be able to pick the provider directly from the map widget. But for now I kept this in the preferences which seemed to be a good place for it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-18Clear statistics and equipment when no dive is selectedGravatar Dirk Hohndel
This all seems very strange forward. The reason for the check whether the stats_w widget has been populated is that at the very beginning, when the UI is still being assembled, a first call to switch_page() happens as the notebook pages are assembled. At that point the stats_w widget is still empty which tells us that we aren't ready to display anything. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09Fixed some memory leaks in windows.c and main.cGravatar Lubomir I. Ivanov
windows.c:subsurface_gettext_domainpath(): - memory at pointer returned from g_win32_getlocale() should be released main.c:setup_system_prefs() - it seems all calls to <os_file>:system_default_filename() return a pre-allocated buffer, therefore we don't need to call strdup() on the result itself. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-09Finish removing accesses to first divecomputer instead of diveGravatar Dirk Hohndel
This adds watertemp and airtemp to the dive, populates them in fixup and uses them elsewhere in the code. WARNING: as a sideeffect we now edit the airtemp in the dive, but we never display this in the DIve Info notebook (as that always displays the data from the specific selected divecomputer). This is likely to cause confusion. It's consistent behavior, but... odd. This brings back the desire to have a view of "best data available" for a dive, in addition to the "per divecomputer" view. This would also allow us to consolidate the different pressure graphs we may be getting from different divecomputers (consider the case where you dive with multiple air integrated computers that are connected to different tanks - now we could have one profile with all the correct tank pressure plots overlayed - and the best available (or edited) data in the corresponding Dive Info notebook. This commit also fixes a few remaining accesses to the first divecomputer that fell through the cracks earlier and does a couple of other related cleanups. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-31Better algorithm to merge gps locations & locations names from webserviceGravatar Dirk Hohndel
This no longer abuses the dive merging code (which would leave stray "dives" behind if a gps fix couldn't be merged with any of the dives) and instead parses the gps fixes into a second table and then walks that table and tries to find matching dives. The code tries to be reasonably smart about this. If we have auto-generated GPS fixes at regular intervals, we look for a fix that is during a dive (that's likely when the boat where the phone is staying dry is more or less above the diver having fun). And if we have named entries (so the user typed in a location name) we try to match them in order to the dives that happened "that day" (where "that day" is about 6h before and after the timestamp of the gps fix). This commit also renames dive_has_location() to dive_has_gps_location() as the difference between if(!dive->location) and if(dives_has_location) is a bit too subtle... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-30Massive cleanupGravatar Dirk Hohndel
Mostly coding style and whitespace changes plus making lots of functions static that have no need to be extern. This also helped find a bit of code that is actually no longer used. This should have absolutely no functional impact - all changes should be purely cosmetic. But it removes a bunch of lines of code and makes the rest easier to read. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-24Don't set a default filename when called with multiple filenamesGravatar Dirk Hohndel
The behavior is just too illogical - it's too easy to unintentionally overwrite a file this way. The default filename is set if we have exactly one filename on the command line or if we we open the default file. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-24Don't mark divelist changed for automated merges after allGravatar Linus Torvalds
The intention was good, and this was added in commit 4982389ca762 ("Fix setting of the dive_table.preexisting logic"), but it turns out to not be that great idea after all. So the thinking is that merging two dives clearly changes the dive list, and it really does. At the same time, because it's an automated merge, if you re-read the old XML file, you'll get it done again, so saving the changes doesn't really *matter*. And it turns out to be somewhat annoying with test dives: we have - dives/test23.xml: <dive number='23' tripflag='INTRIP' date='2011-12-02' time='6:00:00' duration='30:00 min'> - dives/test25.xml: <dive number='26' date='2011-12-02' time='6:00:00' duration='30:00 min'> that merge automatically if you run subsurface on all the test dives together. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-24Merge branch 'webservice-import'Gravatar Dirk Hohndel
Update maxdepth / duration that have moved into the divecomputer structure. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-23Fix setting of the dive_table.preexisting logicGravatar Linus Torvalds
The 'preexisting' value is used for downloading dives: we want to add new dives but, but then compare those new dives against the preexisting ones before we start sorting things and possibly merging them. However, the value was only updated sporadically, resulting in it having stale information in it. Which would cause problems particularly if you deleted dives, so that the preexisting value would point past the actual existing values! So just update it unconditionally in dive_list_update_dives(), which anything that changes the dive list is supposed to call in order to display the changes anyway. Also, just for safety, when removing a dive, put NULL in the last dive table location. Nobody should ever access past the end anyway (this is enforced by 'get_dive()') but there are places that access the dive list table directly, and the libdivecomputer download was one of those. No reason to leave stale dive pointers possibly around for uses like that. Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-23Move more dive computer filled data to the divecomputer structureGravatar Linus Torvalds
This moves the fields 'duration', 'surfacetime', 'maxdepth', 'meandepth', 'airtemp', 'watertemp', 'salinity' and 'surface_pressure' to the per-divecomputer data structure. They are filled in by the dive computer, and normally not edited. NOTE! All actual *use* of this data was then changed from dive->field to dive->dc.field programmatically with a shell-script and sed, and the result then edited for details. So while the XML save and restore code has been updated, all the displaying etc will currently always just show the first dive computer entry. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-23Import and merge GPS data from the webserviceGravatar Dirk Hohndel
Dive locations marked (and named) via the companion app are downloaded from the webservice, parsed and merged with the existing dives. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-13Add support for MOD, EAD, AND and EADD in the mouse over displayGravatar Dirk Hohndel
- MOD: Maximum Operation Depth based on a configurable limit - EAD: Equivalent Air Depth considering N2 and (!) O2 narcotic - END: Equivalent Nitrogen (Narcotic) Depth considering just N2 narcotic (ignoring O2) - EADD: Equivalent Air Density Depth Please note that some people and even diving organisations have opposite definitions for EAD and END. Considering A stands for Air, lets choose the above. And considering N for Nitrogen it also fits in this scheme. This patch moves N2_IN_AIR from deco.c to dive.h as this is already used in several places and might be useful for future use also. It also respecifies N2_IN_AIR to a more correct value of 78,084%, the former one also included all other gases than oxygen appearing in air. If someone needs to use the former value it would be more correct to use 1-O2_IN_AIR instead. Signed-off-by: Jan Schubert / Jan.Schubert@GMX.li Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-11Add default filename and divelist font to prefs structureGravatar Linus Torvalds
.. and add the usual logic to not save the default values. This also simplifies the initial system-specific setup of both of these: since we have defaults for all the preferences that get set up at startup, we can just initialize those defaults to the system-specific fonts then and there. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-10Make the default preferences explicitGravatar Linus Torvalds
This makes it explicit what the default preferences are, so that we can more easily avoid unnecessarily saving default settings. It also makes imperial metrics the default for the US (Burma and Liberia always get forgotten!) Right now we tend to be somewhat confused about defaults. We do have them, but then even if something has a default value, we tend to write it out to the config file. Which is not just unnecessary, but makes it really hard to see after-the-fact whether the user actually wanted that *specific* value, or whether they just wanted the default behavior. So this prepares for having explicit configuration for when we want something different than the defaults. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-10Split up preference data structure definition into 'pref.h'Gravatar Linus Torvalds
.. and rename the badly named 'output_units/input_units' variables. We used to have this confusing thing where we had two different units (input vs output) that *look* like they are mirror images, but in fact "output_units" was the user units, and "input_units" are the XML parsing units. So this renames them to be clearer. "output_units" is now just "units" (it's the units a user would ever see), and "input_units" is now "xml_parsing_units" and set by the XML file parsers to reflect the units of the parsed file. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-22Imrpove the nickname handlingGravatar Dirk Hohndel
We now store the model information together with the deviceid and nickname in order to be able to check if we have a record for any dive computer with the same model (as that now triggers our nickname dialog). This changes the format of the config entries for nicknames - the best solution might be to just delete those and start again. What is still missing is the code to store the nicknames in the XML file. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-21Remove nickname from divecomputer data structureGravatar Dirk Hohndel
Having it there with the model information seemed to make sense but on second thought it's the wrong spot to keep that information, especially since we were storing it in the XML file in every single dive. This change removes the nickname member from the divecomputer and makes the rest of the code reasonably self consistent. It does not add much of the new code for the new design to handle nicknames. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-13Add the ability to set a nickname for a dive computerGravatar Dirk Hohndel
We maintain a list of dive computers that we know about (by deviceid) and their nicknames in our config. If the user downloads dive from a dive computer that we haven't seen before, we give them the option to set a nickname for that dive computer. That nickname is displayed in the profile (and stored in the XML file, assuming it is not the same as the model). This implementation attempts to make sure that it correctly deals with utf8 nicknames. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-05When starting with an empty data file and downloading dives, number themGravatar Dirk Hohndel
We have been very careful not to mess with the numbering that a user may intend - but one obvious case where we should automatically number the dives appears to be the first time download from a dive computer. Right now all dives show up with number '0' and that's just really ugly and a bad experience for a first time user. With this change if a user starts with an empty data file and downloads dives from a computer for the first time, Subsurface will give them numbers starting with '1'. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11Add special download modes to force updates from the divecomputerGravatar Dirk Hohndel
This will hopefully not be something we need often, but if we improve support for a divecomputer (either in libdivecomputer or in our native Uemis code or even in the way we handle (and potentially discard) events), then it is extremely useful to be able to say "re-download things from the divecomputer and for things that were not edited in Subsurface, don't try to merge the data (which gives BAD results if for example you fixed a bug in the depth calculation in libdivecomputer) but instead simply take the samples, the events and some of the other unedited data straight from the download". This commit implements just that - a "force download" checkbox in the download dialog that makes us reimport all dives from the dive computer, even the ones we already have, and an "always prefer downloaded dive" checkbox that then tells Subsurface not to merge but simply to take the data from the downloaded dive - without overwriting the things we have already edited in Subsurface (like location, buddy, equipment, etc). This, as a precaution, refuses to merge dives that don't have identical start times. So if you have edited the date / time of a dive or if you have previously merged your dive with a different dive computer (and therefore modified samples and events) you are out of luck. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11Support merging of two adjacent divesGravatar Linus Torvalds
This introduces the notion of merging two disjoint dives: you can select two dives from the dive list, and if the selection is exactly two dives, and they are adjacent (and share the same dive trip), we support the notion of merging the dives into one dive. The most common reason for this is an extended surface event, which made the dive computer decide that the dive was ended, but maybe you were just waiting for a buddy or a student at the surface, and you want to stitch together two dives into one. There are still details to be sorted out: my Suunto dive computers don't actually do surface samples at the beginning or end of the dive, so when you stitch two dives together, the profile ends up being this odd "a couple of feet under water between the two parts of the dive" thing. But that's an independent thing from the actual merging logic, and I'll work on that separately. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11Prepare to merge non-overlapping divesGravatar Linus Torvalds
This just re-organizes the dive merging code so that we expose a new "merge_dives(a, b, offset)" function that merges two dives together into one with the samples (and events) of 'b' at the specified offset after 'a'. We'll want to use this if a dive computer has decided that the dive ended (due to a pause at the surface), but we really want to just turn the two computer dives into one long one with an extended surface swim. No functional changes, but some independent cleanups due to the trip simplifications. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-09Fix dive trip merging logicGravatar Linus Torvalds
We used to have very spotty logic for picking the dive trip when merging two dives. It turns out that that spotty logic almost never really matters, because in practice you'll never hit the situation of merging two dives with different dive trips, but it *can* happen. In particular, it happens when you use multiple dive computers, and end up loading the dives from one computer on top of the dives of your other computer. If the clocks of the dive computers was set sufficiently close to each other, the dive merging logic will kick in and you may now have slightly different times for the dives that get merged, and the trip merging logic got *really* confused. The trip management also depends on the trip dates being updated correctly when the dives associated with a trip are updated (whether added or removed), and the trip merging code did none of that. This fixes it all up. Hopefully correctly. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-25Allow debug output to go either to log file or to stderrGravatar Dirk Hohndel
This makes it easier to debug things in a debugger, but the infrastructure to send out debug builds where an end user can send in a useful logfile is still in place. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-18Don't enable equipment notebook buttons if there is no diveGravatar Dirk Hohndel
The buttons didn't actually do anything when clicked, but this still was inconsistent behavior. Reported-by: Pierre-Yves Chibon <pingou@pingoured.fr> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-18Find translation files on Linux after Subsurface was installedGravatar Dirk Hohndel
So far we only looked in the a local subdirectory, but once Subsurface has been installed, we don't need to change the search path for translation files anymore. Fixes #2 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-15Set locale under WindowsGravatar Dirk Hohndel
This is mostly a quick hack to be able to test localization under Windows. It seems to work fine under Windows 7 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-15Forgot to localize names of months and weekdaysGravatar Dirk Hohndel
We marked the strings for translation, but then didn't actually call the translation function on them. Our dates are still not truely localized as we have hand written code for the date / time handling that constructs the dates according to US fashion as [Weekday], [Month] [Day of Month], [Year] [hh:mm] Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-15Support for gettext in MacOSX application bundleGravatar Henrik Brautaset Aronsen
The MacOSX applications bundle needs to be told where to bind the text domain from. Also copy the gettext .mo files in the install-macosx target. [Dirk Hohndel: minor change in main(): move the path declaration to the beginning of the function] Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11Conversion to gettext to allow localizationGravatar Dirk Hohndel
This is just the first step - convert the string literals, try to catch all the places where this isn't possible and the program needs to convert string constants at runtime (those are the N_ macros). Add a very rough first German localization so I can at least test what I have done. Seriously, I have never used a localized OS, so I am certain that I have many of the 'standard' translations wrong. Someone please take over :-) Major issues with this: - right now it hardcodes the search path for the message catalog to be ./locale - that's of course bogus, but it works well while doing initial testing. Once the tooling support is there we just should use the OS default. - even though de_DE defaults to ISO-8859-15 (or ISO-8859-1 - the internets can't seem to agree) I went with UTF-8 as that is what Gtk appears to want to use internally. ISO-8859-15 encoded .mo files create funny looking artefacts instead of Umlaute. - no support at all in the Makefile - I was hoping someone with more experience in how to best set this up would contribute a good set of Makefile rules - likely this will help fix the first issue in that it will also install the .mo file(s) in the correct place(s) For now simply run msgfmt -c -o subsurface.mo deutsch.po to create the subsurface.mo file and then move it to ./locale/de_DE.UTF-8/LC_MESSAGES/subsurface.mo If you make changes to the sources and need to add new strings to be translated, this is what seems to work (again, should be tooled through the Makefile): xgettext -o subsurface-new.pot -s -k_ -kN_ --add-comments="++GETTEXT" *.c msgmerge -s -U po/deutsch.po subsurface-new.pot If you do this PLEASE do one commit that just has the new msgid as changes in line numbers create a TON of diff-noise. Do changes to translations in a SEPARATE commit. - no testing at all on Windows or Mac It builds on Windows :-) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-09A file that we import should never become the default file we save toGravatar Dirk Hohndel
Only files that are opened should be considered r/w. Files that are imported should be treated as if they were r/o. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-04Provide a method to use unicode command line arguments on WindowsGravatar Lubomir I. Ivanov
For unicode command line characters Windows uses UTF-16, while Glib and GTK use UTF-8. To solve that we retrieve the command line via __wgetmainargs() and use g_utf16_to_utf8() to convert each argument. The used method should support wildcards passed as arguments (e.g. *.xml). Two new, OS abstracted functions appear in linux.c (NOP), macos.c (NOP), windows.c: subsurface_command_line_init(...) subsurface_command_line_exit(...) which are being called in main() Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-29Fix a number of obvious memory leaksGravatar Dirk Hohndel
Just the result of cppcheck and valgrind... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>