This patch implements GUI for importing CSV log files. One is able to
configure what columns contain time, depth and temperature fields.
Pre-configured log applications currently included are ADP log viewer
and XP5. (Both of these use actually tab as separator, so the field
separator currently hard-coded.)
[Dirk Hohndel: minor fixes]
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Going through pixmaps for the profile was not needed and was making our prints
look very pixelated.
In Qt4, QWidget child classes are printed as bitmaps. So appart from
changing the code to print the tables to use a QGraphicsView instead,
there is nothing we can do, so the rest of the printing is still done as bitmaps.
Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Apparently qmake can't tell that #include "version.h" and #include
"libdivecomputer/version.h" are not the same thing. Instead of spending
another bunch of hours on fixing the buildsystem I decided to just cleanup
the spots where we actually use the version file and rename it to
ssrf-version.h.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch restores the ability to move the info-overlay panel on the
profile. For some reason the eventFilter wasn't working (and actually,
looking at the code, it really shouldn't, because I didn't see where I set
it to work, maybe someone (me) broke it a long time ago) well, it seems
fixed now at least. :)
Tested on XFCE, Gnome and KDE, with three different window managers.
[Dirk Hohndel: removed debug output]
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add units to the SAC in the print-out, reduce max depth in metric to one
decimal place, and leave some more characters of the notes to be printed..
Signed-off-by: Robert C. Helling <helling@atdotde.de
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Don't do "obvious cleanups" at 4 in the morning when you can't sleep because
of emotionally draining issues outside of your control... and if you do,
at least compile test them.
This was introduced by me in commit 2f9f46cb0253 ("Random white space
cleanup").
Sorry.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This Patch fixes the tab behavior on the QComboBox
delegate. For a QComboBox, tab was being treated as
'cancel' action on edit, but since it will send a
editingFinished() signal, and the Qt::Key_Return
will also send a editingFinished() signal, I couldn't
use that method and had to do a little hack around it.
The code is mostly clean and works.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Function is redundant as we should only render the profile
with a custom color table.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Make the active font (fnt) use the 'size' member of the received
text_render_options_t. This allows changing the size of
certain text elements.
For the moment most text elements are set to 12px.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Because of varying font (screen) DPI we use pixel sized fonts
when printing. Apparently 8px does not look that good on Windows
default fonts, but kinda OK on Linux. We compensate by
increasing the font size and table rows to 9px.
Also decrease the padding between the table and profile to 5px.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There was a report that the depth and time texts were small
and require more contrast on the B/W print. Use BLACK1 for these.
Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Custom widget frame styles such as 'Sunken' and 'Raised' which seem to
varry between OS will be captured as well:
http://harmattan-dev.nokia.com/docs/library/html/qt4/qframe.html#Shape-enum
So instead we temporarily set the profile frame to QFrame::NoFrame and
then restore it to the previous value.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This enabled a file selection dialog for selecting default log file
under the preferences.
[Dirk Hohndel: added missing declaration to .h file]
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
entry->ndl is computed and therefore should not be used for showing
the DC's ceiling. That made the DC ceiling jump to 0m when the computed
celing was at 0.
Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
CylinderModels::setDive() and WeightModel::setDive() have
potential to pass the 'last' argument to beginInsertRows() as
a negative number which triggers an assert that 'last' cannot
be smaller than 'first'.
Patch attempts to fix that by only calling beginInsertRows()
when there is at least one row to insert.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The end pressure was appearing in the column headed "O2"
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The dive planner always showed the depth in our internal units, ie
millimeter, in the sidebar that showed the plan points.
That made little sense in metric mode, and none at all in imperial. The
_graph_ showed things in meter and feet.
So make the DivePlannerPointsModel always convert things to and from the
user units.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There are other models ( Tree Models and Model Items
) that are not affected by this commits, this is
already a good cleanup but it can be extended
to also fix those two other possibilities.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Second model converted to be less boilerplated,
there are right now 7 models that will need to
be ported. each model can remove around 30 to 40
LOC, so this is not such a bigger improvement,
but it's an 'keeping an eye on the future'.
Also fixed a bug where the returned value was dummy.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The Model View system in Qt is *very* verbose, this is the
beginning of a series of patches that will concentrate
the boilerplate somewhere and reduce the amount of lines
and will also try to make the code cleaner and easyer to
understand,
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
I just went thru all of subsurface code removing
some whitespaces issues and trying to make the
code prettyer, I also removed a few QString issues.d
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
There's a C++ way for it. And, for some reason, it wasn't defined on my
MinGW build:
qt-ui/profilegraphics.cpp:1006:57: error: 'MAX' was not declared in this sscope
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Patch enables the 'Profile on top' / 'Notes on top'
functionality in the print options dialog.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
After selecting a dive or a series of dives, the "Stats" tab shows the
minimum, average and maximum stats for the selected dives. The "Depth"
section does not display the correct value for the maximum depth.
Signed-off-by: Benjamin Fogel <nystire@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- remove the build flags and libraries from the Makefile / Configure.mk
- remove the glib types (gboolean, gchar, gint64, gint)
- comment out / hack around gettext
- replace the glib file helper functions
- replace g_ascii_strtod
- replace g_build_filename
- use environment variables instead of g_get_home_dir() & g_get_user_name()
- comment out GPS string parsing (uses glib utf8 macros)
This needs massive cleanup, but it's a snapshot of what I have right now, in
case people want to look at it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add a helper function to unify the calculation of the
weight display string, instead of having the same calculation
in two places in the code.
Signed-off-by: Benjamin Fogel <nystire@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch fixes some unsane values that was being retrieved
by the ui-files on first time opening. it creates a basic layout
of the application using the current desktop size.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Some columns are a nice addition, but not a must have,
and thus are hidden-by-default, uncluttering the user interface.
This was discussed with a few designers before writting the code,
and also discussed with dirk on irc.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
"Weight" was misspelled "weigth" in several places in the code
and comments.
Signed-off-by: Benjamin Fogel <nystire@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Subsurface stores weight values in grams. When displaying lbs,
the dive list was not rounding the converted weights up, but
rather truncating the value at the decimal place. The equipment
list was rounding the converted weights up. This gave two
different displayed values for the same weight value.
Signed-off-by: Benjamin Fogel <nystire@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Those preferences removed ( basically the ones about visibility of
the List View of the Table ) are now managed by the Qt Settings
system, and thus there's no need to have them there. wich gave us
a pretty good cleanup.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Some people (free divers) are loving ft/s or m/s units for vertical speeds.
Now they can choose between /min or /s in the configuration (only Qt UI).
Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For a new installation, subsurface will now start on fullscreen,
this fixes the bug where subsurface would start using the interface
file ( mainwindow.ui ) configured size, and that silly monster
always changes when editing something.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The first time the user loads subsurface, the default_filename
is not configured yet, but yet the software tries to load "",
sending an error message that this file doesn't exists.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Taiane Ramos <exhora.tat@gmail.com>
If we #include "qt-ui/ui_anything" from anywhere, the Makefile rules
will blow up.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When straight decoding the event, it failed to handle older
SAMPLE_EVENT_GASCHANGE(11), the ones without he-part correctly. This was
shown clearly when it printed the 21/35 in dives/test20.xml as air.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We don't use any of the Standard Library features or classes in
Subsurface, except for three uses of std::sort, for which I added the
necessary #include.
It's always a good idea to include directly the headers you want,
without relying on indirect inclusion
On my machine, the build time dropped from 16.96s to 13.38s or a 12%
improvement.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Still don't like the order dependency - but at least this seems to work
and correctly build after make confclean.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This means we don't have to new/delete them, which is a waste of
overhead.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This means we can also remove the forward declarations.
This is the first step in removing the memory allocation for the ui
sub-classes. Without the second step, this commit is just making the
compilation time increase for no good reason :-)
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
PrintLayout::printTable():
- hide the QTableView widget border using a stylesheet
- add a guard to fix the last column extending post the page width
due to rounding
- use 1 extra pixel instead of 2 when grabbing the page region
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds a couple of classes and some other modifications
in PrintLayout that handle the printing of tables under a profile.
models.h : ProfilePrintModel
The class uses a 'struct *dive' to output all required data
for a certain dive at specific rows and columns. It also handles
font formatting and text alignment.
modeldelagatates.h : ProfilePrintDelegate
The class is used only for drawing a custom grid for profile tables.
PrintLayout::createProfileTable()
The function is used to create and setup the profile table object
PrintLayout::printProfileDives()
The function now has correct padding of dive profiles on a page
and also the printing of actual tables below them.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Adding +30 (seconds) to the position works fine for long dives but
when zoomed in on short dives, 30 seconds are a lot.
This commit sets the offset to +10 px regardless of the scaling.
Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
The toolbar adds two buttons to the profile.
The user can now toggle the scaling (zoomed to dive/round up to 30 mins)
and adding /removing ruler to/from the profile using this toolbar.
Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
This patch adds a ruler QGraphicsItem which can be dragged
along the profile. The ruler displays minimum, maximum and
average for depth and speed (ascent/descent rate). Also, all used
gas will be displayed.
This also adds a new attribute to struct plot_data to store the
speed (not just as velocity_t).
Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
printlayout.cpp(h):
This patch cleans some test code and adds the function
printProfileDives() that accepts a number of dives
per rows and columns. It can technically fit any number
of dives on a page given the page size allows it. Both
landscape and portrait layouts are supported.
It now replaces the old methods:
printTwoDives()
printSixDives()
Space is reserved for data tables that will be placed
bellow profiles on a later stage.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The Gtk+ style on the Gnome shell is somewhat broken on Qt for
some reason. This hack pokes the system, checks if it's running
gnome-shell, and if the current style is gtk+ ( I couldn't just
check for gtk+ since it worked on XFCE and other Gtk based enviro
ments. so a double check is needed. ) then I changed the Pallete
of the affected widgets by hand.
not a pretty hack but worked.
[Dirk Hohndel: redid the patch to be simpler and more consistent]
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix the positioning of the `add` button when on Gtk style,
in my XFCE install (and thus, may differ a bit from the
Gnome3 one ) the Plus button to add cylinders and weigths
got really strange placements, this seems to fix this,
I also tested on Oxygen and nothing broke there.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch fixes the cylinders and weigth edition
by keypress. I don`t know when I broke this and linus found,
most probably when I added the code for showing the
cylinder size and working press while moving the mouse
around the list - sorry guys.
So, now this *seems* fixed, tested for a fairly good
amount of time and everything seemed ok.
I was unable to reproduce the behavior that linus got
on two value overlapped on each other, tougth.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch fixes the display of subsurface in smaller
screens by creating ScrollArea containers that are
now englobbing each of the Tab-pages and the Planner
Widget. Some of those widgets were pretty big by the
amount of things on it and it was too big for small
( 14" and 15" ) screens.
This seems to fix it, and looks good both on Gtk+ and
Oxygen styles.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This is much better looking in the Oxygen style, and
on the other styles it looks like crap - so let`s not
use that.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch eliminates 18px offset from the MainWindow main
layout, making the window feel less spacy. Good on the Gtk+
style, but seems to also make a good work on the Oxygen one.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Fix some stuff concerning the pretyness of subsurface while running
on Gnome and XFCE enviroments. This is the kind of stuff that I
really didn`t want to put on the code but sometimes it`s for the
best. this makes the MainTab much more bearable. There are still
things to fix, like the size and positioning of some of the icons.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch removes the magic indexes used to control the mainwindow
display of the profile and planner by an enum. a bit more verbose
but hard to miss.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Since the cylinders and weigths have other data attached
to it, like size and working pressure, one could mess the
other data and want it to revert to the cylinder / weigth
defaults, but for that the user had to choose another
item, then go back to the previous one, so the cache would
be clean.
This patch fixes that by reverting the values to the
it fixes linus bug n2, where he had invalid data
on the other fields and had to go back and forth for it
to be fixed.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
So, the ComboBox is a beast, and when used on a Delegate
it's very hard to get things right, wich is a pitty, because
I overly like qt. So:
1 - Combobox needs to show the popup when user press ↓ and ↑ keys
2 - Combobox needs to select when user press enter, not twice.
3 - Combobox neesds to select when user selects from the mouse, not
pressing enter after.
4 - Combobox needs to not mess with stuff when moving around.
Everything that I listed there works on a non-delegate combobox,
but for some reason, a delegate missed those, so I reimplemented
all. not nice, but now we have a code that will work, I hope.
*fingers crossed*
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This code hooks the plus button on both cylinders and
weigthsystem tables to trigger the enableEdition() and
thus the work done when you click on + will be saved /
discarted when the user cancels the plan or accepts it.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This bit of magic actually performs the save on the
dive list for the changed weigths and cylinders,
it will set the cylinders only if there's a change
on the cylinder model, and it will set the weight
only if there's a change in the weigth model.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The old code marked the dive list as changed on any
of the changes in the model, this was incorrect since
the user could just cancel the edition, wich means
that the divelist shouldn't be marked as changed at all.
when the user clicks on'accept', and the item is indeed
changed on the dive list, then we mark_divelist_changed
to TRUE
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added a 'changed' member on Cylinders and weigth models to mark when
one was changed or not. Only the changed data should be inserted on
the selected dives, so if the user changes the cylinders on a multi
edit, there's no need ( and it will actually break things if we did that )
set the weigths too.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch enables edition on the selected dives as soon
the user press delete or any other column on the Cylinder
/ weigthsystem.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch enables canceling the edition of cylinders and weigth
systems, as soon as the user press cancel, the old values are
re-populated on all selected entries.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This creates a placeholder for the equipment edition,
it will ease the 'revert' and 'apply' when editing
multi dives.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
One more corner case that we cover correctly.
Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of getting data from Qt just use our internal notion of the number
of selected dive to decide if more than one dive is selected (and
therefore if we need to show the 'merge dives' option in the context
menu).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is fairly straight forward. What I dislike is the check for the magic
number of "14 indeces". I'm sure there's a better way to tell if more than
one dive is selected...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
plot_data.o2 and plot_data.he was wrong for all dives, due to that
cylinderindex was set right first in populate_pressure_information, and
thus those two contained bogus information.
This makes the plot-text use cylinderindex-lookup as everything else.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Things need to be cleared out and disabled. But fixing this bug leaves
another issue - while the newly selected dive after a delete acts as if it
was selected, it doesn't show up as selected in the dive list.
Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This was not as hard as I assumed it would be. I may still change the
horizontal dimension to be the more logical seconds instead of minutes,
but for now this achieves the main goal.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I always disliked the fact that when you moved the handlers around you
could just 'run over' the neighbors. This also (as a somewhat intended
side effect) prevents vertical descents and ascents).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I'm sure there are more issues like this where we need to handle things
differently depending on whether we are planning a dive or adding a dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This solves the odd case when closing the data file that clicking in the
info widget caused the input fields to respond and the little warning icon
to show up.
Also some minor whitespace cleanup for readability.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This mostly happens with no XML file or when closing the current XML file.
Sadly the user still can click on the empty date field (even if nothing
else is active on the screen) and a date reappears.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Only look up the dive number of a previous dive if there is a previous
dive.
Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the close action is triggered while there is no current dive (empty
history), the info widget is enabled. To avoid this behavior, we only
enable the info widget during update if the dive index is valid.
Signed-off-by: Alexandre Dupas <alexandre.dupas@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add two more rows to the widget - this is getting quite busy.
There still is some weirdness where the focus isn't returned where it
should be and a few other details, but overall getting there.
Added helper functions to parse a temperature and to deal with the
timezone offset - with that latter one I also fixed the time offset bug in
the planner.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is much friendlier than just showing an empty profile. I picked a
nice and simple three level dive. 25 minutes at 18m, 15 minutes at 9m, and
a safety stop.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If this is the last dive and if the previous dive had a number, give this
dive the next number.
Of course there are a couple of issues with the current implementation. We
have no way of changing the date / time of the added dive, so we KNOW that
it will be the last one. But I put that check there so that once we add
the ability to change the date / time (and hopefully remember to then move
the dive to the correct spot in the dive_table), we only assign a number
if it is the last dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This was surprisingly easy - which of course has me worried that I'm
missing something that I should do when cancelling out of this dialog.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This gets things mostly right.
It creates a dive and uses the planner widget to create samples which are
copied into the dive. It fills in some reasonable defaults (DC model,
timestamp), but doesn't allow editing the timestamp (or the temperatures
and air pressure).
On accept the planner gets reset and the dive appears correctly in the
dive list.
Cancel still needs to be handled.
And I bet there are many subtle bugs lurking here and there. But it's a
start.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Reset coordinates properly when clicking undo.
When auto-completing location, only copy coordinates if they have not
been manually edited.
Set the background to red if the gps coordinates won't change, e.g.
there is a parse error, the change is too small or only whitespace
changes.
Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Make the planner update its display continuously upon moving points
including deco. This appears fast enough on typical PCs. If this ends up
being to slow on some systems we may have to make it configurable.
[Dirk Hohndel: cleaned up the two patches and turned into one commit]
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This looks like it might work, but since we keep recreating the dive, the
info entered in the info pane is actually lost. But it's a step in the
right direction.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In add dive mode simply bring the diver safely back to the surface
(currently with a fixed ascent rate of 30ft/min (or 9m/min)).
We should make that rate configurable (for the planner as well as the dive
add function). Also, the dive add function should offer to automatically
include a safety stop.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Right now this is just calling the same code and setting a flag whether we
are planning or adding a dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added the Message and the ok/cancel buttons on the Equipment
Tab, they don't control the Equipment edition yet, but already
does the same as the Notes one, Now I need to merge the other
part - the actuall Equipment Edition.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Adds a Warning icon on the changed tabs, this is important as
usability, for you could change something on the 'notes' tab,
change the tab and did't realized that something was changed
( by forgotting or something ), then clicking on the cancel
button. so now there's a friendly reminder that you actually
changed something.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Some cleanup was needed in the MainTab code for ages,
now the Edition / Cancel / Ok of the Notes tab is
way more intuitive on the code level.
This is needed to support multidive edition on the
Cylinders and Weigths too, since it's a bit more
complicated, I didn't want to start with a Spaguetti
Code.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Equipment tab was opened by default, it should be DiveNotes
as per the old GTK version. this fixes that.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This is really nice to have when looking at specific coutures of a dive
or events.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This fixes a crash in the current Qt subsurface code that can happen
after downloading dives from a dive computer, and the new dives merge
with old dives, causing the old dives to be re-allocated into the
merged one.
In that case, the list widgets don't get fully updated, and contain
stale pointers to old dives that no longer exists. Doing anything that
refreshes the display will hide this problem, and you do need to have
multiple dive computers on the same dive to trigger it in the first
place, so it's reasonably hard to hit, but very annoying when you do.
This patch just makes us reload all the dive UI tables, which may be
overkill. It also doesn't actually fix the fact that we seem to do
"process_dives()" within the context of the downloader thread, which
looks like a possible source of races. The "process_dives()" should
also be moved to the main thread, but needs the preferDownloaded()
information that is part of the download window, so it doesn't fit
here. Somebody else (Tomaz?) will hopefully fix that part.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Coordinates are copied when auto-completing location, they are also
displayed and editable in maintab.
Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Due to a bug in how the entry-list was handled, a point on the polygon
was introduced at 0,0 that made a weird pink triangle across the whole
profile. This was quite clearly seen in dives/test15.xml
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This almost fixes it, but the offset from UTC isn't calculated correctly
it seems. Committing and hoping that a Qt expert can help.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Plotted the Scale on the Ruler in the planner.
There's a tiny bit issue - mostly noticiable while resizing,
but it's not a killer.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The Planner should be 'almost' like the profile, with the possibility
to use the mouse and keyboard to input a new plan, so this is a bit
of 'getting there.' I don't like too much code duplication but since
the current Profile Graphics is a crude cut-and-paste from the old
Cairo backend, it's easyer to start from scratch and have it well
organized as Qt code.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Ok on the planner now correctly creates a dive,
a few remarks, tougth:
1 - the number of the added dive is always 0
( but I may be testing it wrong )
2 - the information pane is working only when
the mouse is clicked, this is a regression and
it will be fixed. ;)
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The dive plan was bein created on the Profile, this
While this worked out, it created a bit of spaggethi
code, so now the model will take control of *everything*
on the planner.
I tested it quite a bit and doesn't seems to have appeared
a regression, wich is good.
Now that a dive plan is bein created, I can just save it. :)
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Plug the cancel action on the dive planner ( before that, only by
hitting the 'ESC' button things worked, so now you can also click
on the Cancel box that's on the right of the planner profile window.
Also, the beginning of the 'ok' code is also at place.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Position the X and Y labels of the rulers, this way
it's a bit more clear the deepness and the length
of the trip. It's still not the best approach, but
I'm getting close.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
When updating the weight system model we have to remove the old ones and
then correctly count the new ones.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is correct C. But debuggers in C++ mode are broken and can't display
the global variables. While I hate having to do this change, I hate not
being able to debug my software because of broken tools even more.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The code to initialize the weight systems from the last datafile loaded
had not been brought over from the Gtk version.
We now correctly update the data structure when loading file (but not yet
when editing values).
Most likely the same needs to be done for the tanks as well.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
* Removes the InterfaceThread
which is basically an unecessary proxy between the MainThread and
the DownloadThread.
* Use a state machine to control the DownloadWidget UI logic.
Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
Clicking on the plus button now adds a new stop on the planner.
The depth is always 10m and the time is 10 minutes after the
last stop. can be changed by double clicking or dragging the
balls around the canvas.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signal that the model changed when editing plan specific information,
when you changes the ATM pressure or any other information, the
graphic of the plan will be generated again to mirror your actual dive.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Plug most of the dive planner controls that weren't
plugged yet - StartTime, ATMPressure, BottomSAC,
DecoStopSAC, LowGF and highGF are being used by
the calculations now.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Enabled the CC SetPoint settings on the table, changing
it will automatically reflect the canvas. Also fixed a bug
that prevented the 'Air' handling on the diveplanner
table to show the list of options using arrow up and down.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
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>
Fixed a incorrect signal-connection call that should'nt
be there anymore because the TableView now correctly
knows what to do with models.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Merged the shared code for the three table views into
one code, this way less code is needed if we need to
construct another tableview in the future.
I still need to clean some of the models too.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Fixed showing the profile and info window when opening
the program. For some reason ( easy testing of the planner )
the planner was being opened instead of the profile and
info window. now everything's back to normal.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
"weight" was spelled as "weigth" in a few places in the code, but
more importantly, it was misspelled in the preferences dialog.
A minor nit-pick, maybe, but it still drew the eye in the dialog
and looked weird.
Signed-off-by: Benjamin Fogel <benjaminfogel@yahoo.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The code now seems to be mostly working. There is unfortunately
a QAction shortcut conflict between the implementation and the
MainWindow. - I'm gonna fix that in the next commit.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The plus sign for time was in a very strange position,
this puts it back to where it belongs, plus a bit of
code cleanup since the planner was in heavily modifications,
this will be needed quite a bit. :)
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Now the planner deletes points by clicking on the
trash icon on the table. The dive planner is almost
finished. <3
next: add a point from the table.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Deletes the logic of divepoints to the model, this
makes automatic updates on the table on deletions.
( remember, to select dive points, ctrl+click on it.
) if you want to delete it, press 'delete', it will
be removed from the graphics part and also from the
table.
Next: delete point by clicking on the table trash-
icon.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The gas choice now works and correctly ( I hope ) calculates
the gas choosen to show on the planner. User can choose the
gas from the list on the visual planner, and also on the table.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added support for changing depth and time on the table.
It now works both ways, one can edit the planner via the
table for a fine tuning. :)
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is the start of the Editable Model work
for the planner, it creates a new delegate and shares
the code for the model that creates the gas types, so
we only need to change in one place to add new gases.
The table is already edition-enabled, but the outcome
is still undone, next commit - put all together.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The DownloadDialog behavior was broken in a way it allows the user
to make changes on the dialog while the download is happening.
Also, clicking on "Cancel" breaks/hangs the UI sometimes, as libdivingcomputer
doesn't always cancels the download right away. That's a bug that
still needs to be fixed.
Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
Made the tableviews share a bit of code, and code cleanup.
The tableviews for Cylinders, Weigth and Dive Planner Points
now shares the CSS and I also implemented the save / load
methods for the dive planner points, so the functionality
is mostly done on the vieualization side. - since we are
now using three tables maybe it's a better idea to create
one class SubSurfaceTable that knows how to handle saving
/ loading of the columns... TODO for the future. ;)
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added a 'remove' icon on the dive planner table,
this makes the ui more consistent between the other
tables that also manages addition and removal of data.
the delete method is still unimplemented.
next - css.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Fixed moving a dive point between dive points.
this fixes mostly everything that I have broked
by using a Qt Model instead of a linked list -
but a model is better to make everything updated
and only poke in one place. sharing code++. :)
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Made possible to add a divepoint between two others,
this also implemented the last patch in the correct way.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Fixed entering a dive stop before another dive stop,
the correct way is to fix the position of them but
this is easyer - I'll update the correct one in
a couple of patches.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The values of the dive points on the tableview were
too big, I'm now dividing time by 60 and depth by 1000
to get the correct results.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Fixed a bug where moving a handler would mess the planner
by calculating invalid values to the planner on the model
side.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Moved a lot of code that handled the positioning of the
DiveHandles on the interface to the model. there are a
few bugs left ( regressions ) that I will fix in the
next commits. With this commit an edition of the points
on the widget will trigger a repaint of the planner profile.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Moving the handler on the graphics updates the model on the planner
Unfortunately, the graphics will move back to it's original
position because of the legacy code used to calculate the
dive plan. Next: fix the legacy code used to calculate the dive plan.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Moved the creation of the data plan point to the model,
this way when the user creates a data point on the
graphical planner, or when the user creates the point
on the QWidget based view, both of them will be updated.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This implementation of the shared model already shares
some, but not all data between the two views, but it's
already a huge improvement. When the user clicks on the
visual planner, it will update the view on the qt-widget
based view. The editing of the view is still not allowed,
and removing nodes is not allowed too ( yet. )
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Started the model to handle the divepoints between the
Qt Widget interface and the QGraphicsView one. good thing
is that we share code. Bad is that a model is harder to
work, but doable. :)
With this finished ( in a couple of commits ) one can
insert a point on the Qt widget or on the graphics view
and it will be 'mirrored' to both interfaces.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Changed the Window Hint of the planner popup to 'Popup'
this removes ghost items from the task bar.
Hint By: Danilo Cesar
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Removed a bunch of non-used graphics buttons,
since the new widget now contains everything
needed for the creation / cancelation of the
dive plan.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added a new widget to control the DivePlanner, now we
have two widgets, a graphics one and a qt sidget based one.
the Technical divers will most likely use the QtWidget one
while the hobbists will most likely use the QGraphicsView
one. there's not a option to choose one, they both will
appear at the same time.
Next step: make the screens to work.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Before this commit this dialog had a weird behavior in which
when it was shown, the whole screen was still active. In case of a
alt+tab, this dialog is sent to behind the application window, but still
visible in the task bar.
This commit basically changes this behavior to a regular pop-up.
Signed-off-by: Danilo Cesar Lemes de Paula <danilo.cesar@collabora.co.uk>
Looks like the QTextBrowser can't render the manual correctly.
Also, QWebView provides a better way to find contents on a webpage,
which is an important feature for an user manual (to be implemented).
Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
This is a bit of code cleanup that I'm not sure that will
pass, since it's all macro-based, but I don't have a thing
against macros at all. Sometimes they helps us keep a better
and cleaner code base. I think I managed to remove around 120
lines of code, wich isn't much, but I replaced it by 14. and the
code is now easyer to maintain, so hooray.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Change the background color of edited parts of the dive
on the interface. Specially util if you are editing multi
dives in a single step, and went to eat something or did
anything else for five minutes, then come back and don't
quite remember what did you changed. now it's in a cute
yellowish background.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch enables multi dive editing on the selected
dives. It's a bit of big patch where I reworked how it
worked since it was written just for a single dive.
this means that this can introduce bugs - I'v tested it
quite a bit but a thing could slip thru my fingers. :)
How this is supposed to work:
Select a few dives that you want ( one or more ) then
click on the field that you wanna edit / multi edit, and
press 'accept'. *only* the edited field will be modified
thru all dives.
Next patch - I'll change the bg color of the edited fields.A
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch fixes a thing that I run into when trying to implement
the multi-edition system. Whenever a dive was selected, via mouse
or keyboard, it had two stages: first, it would select the previous
and the current ( and thus, render the profile of the current) and
then whould release the previous and select the current again ( and
thus, rerendering the profile again, plus a few other things. )
With the multi-edition system this caused a more severe bug, since
the edition of the dives is directly applied as soon as the text fields
changes, as soon as we selected any dive on the list, the 'before' dive
would be modified by the 'current'. This patch fixes this - but since it's
just a 'code removal' patch, this can led to bad things in the future,
I tested it quite a bit, but didn't found anything, no regression.
*fingers crossed.*
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Fixed a bug where the auto-completion would not work via command
line, I fixed it by reloading the information of dives when a
dive file is open via command line or via UI.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added completion for buddy, divemaster, location and suit.
The completions uses some models that I created in the last
commit - everytime that a divelog file is loaded, it creates
a list of completion items.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added classes to handle the completion of dive editions, the
classes are BuddyCompletionModel, DiveMasterCompletionModel,
SuitCompletionModel and LocationCompletionModel, thanks to
plain old C macros, code got really small. and I hope the
logic is better than the Gtk version. :)
Now next step is to integrate it to the Ui. shouldn't be hard.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patches fixes showing back the labels 'Dive master' and 'Buddy'
after a trip selection was done, then back to single dive selection.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch makes the auto editon behave in a better way,
now you can scroll the notes widget without marking it as
editable, and also adds a bit of code cleanup, and a better
logic for editing the other widgets.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This bug manifested itself as too long deco obligation when moving
waypoints to later and then back to earlier times as all intermedite
versions were created as dives in the divelist (and the saturation of
these "previous dives" was taken into account.
It is not entirely clear to me how the dive will be permanently added to
the divelist once ok is pressed: One could in createDecoStops allocate
struct dive from the heap rather than from the stack and return a pointer
to it and which is then added to the dive list upon pressing ok.
[Dirk Hohndel: add include file to make this compile]
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The current QTextDocument implementation is slow due to
HTML parsing. By using QTableView with QAbstractTableModel
we boost the performance of the table print drastically.
This patch completely replaces the old solution.
There is a hidden QTableView widget which is populated
with all data and rendered using a QPainter attached to
the printer device.
A couple of new classes are added in models.h/cpp
that handle the table print model and these are then used
in printlayout.h/cpp.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
QObject::tr() has source string as first argument and disambiguation as
second argument. Currently the events shows "Starts with space!" instead
of " begin" or " end" after the event name.
Signed-off-by: Michael Andreen <harv@ruin.nu>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since the tooltip text was used as key in the map, two events of the
same type, close to eachother, would cause one of them to not be
removed.
Since ToolTip::removeToolTip() isn't used, we don't need a QMap and can
use a QList instead, so all tooltips are properly cleared.
Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added the possibility to choose gases in the planner,
now the user should click on the name of the gas, a
popup window will appear, asking the user to choose
what gas he wants for that ascent / descent.
now we need to hook that up with the createDecoStops
method that calculates the decompression.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added the current gas used on the planner, now it's a matter
of choosing the new gas, that will be done in the next commit.e
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added a button and a method to reduce time on the dive
planner. The dive planner will not reduce below deco-time
and it will also not reduce below TIME_INITIAL_MAX.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added the code to reduce depth on the planner. Depth
cannot be lower than 40m and it also won't let the
user reduce if there's any point on the 'reduced' area.
the icon is ugly - we need an artist.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The Working Press didn't correctly updated when there was a 'bar'
or 'psi' in the string ( and that was defalt behaviour );
The o2 didn't correctly updated when there was a '%' on the string
(and that was default behaviour ),
The He didn't correctly updated when there was a '%' on the string,
and that was also default behavior.
Now all of them correctly updates.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This is a follow up commit to the previous one that
enabled cancel for cylinders, everything in the commit
log for the cylinders also applyes here.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Made the default 'Cancel' action correctly cancel
the cylinder edition. This is needed only because
we bypassed the default behavior on Qt that took
care of this, because we wanted to have more control
on how the view would update the items accordingly
with wich one of the cylinders were selected
on the edition pane - the pressure and size of the
cylinders needed to have it's data set, but the Qt
Model/View system *thinks* that cancel-edition is
simply 'do not commit the edition data, then.' wich
would not work with us, because we passed the strange
data already. So, I created a backup data that serves
us very well. When the user cancels, this backup data
is added back on the cylinder, making everything as
it was before.
[Dirk Hohndel: removed the inadvertendly added boost header]
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds the getColor() helper function to
ProfileGraphicsView and EventItem so that retrieving
a certain color can depend on a 'isGrayscale' flag.
This flag is private and only set by
ProfileGraphicsView::setPrintMode() at this point.
EventItem also now accepts 'grayscale' as a constructor
argument.
A couple of side modifications are:
- move setBackgroundBrush() to ProfileGraphicsView::plot()
- set the same pen color as brush color for the dot in the
'!' symbol inside EventItem::EventItem().
TODO: look for color issues when printing using the
custom grayscale table
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
We pass the value of 'color_selected' stored in the
print options to ProfileGraphicsView::setPrintMode().
This way the profile can be printed in grayscale
internally instead of converting a QPixmap to
grayscale.
There are a couple of questions here:
1) Are all the 'if/then' checks for all individual
colors faster than the direct QPixmap/QImage grayscale
coversation.
2) The direct grayscale conversation does not give
control of individual colors, but can it look actually
better?
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
(experimental)
Add the method PrintLayout::convertPixmapToGrayscale()
to convert a rendered profile pixmap to grayscale.
It will probably be faster to have
ProfileGraphicsView render in grayscale under certain
conditions (and use a specific color table) instead -
e.g.:
ProfileGraphicsView::setPrintMode(bool printMode,
bool useGrayScale);
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
PrintLayout::printSixDives() goes trough all dives
and prints their profiles on full portrait pages.
This method is based on resizing the ProfileGraphicsView
widget, plotting each dive and then 'grabbing' it using
QPixmap::grabWidget().
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
When printing the profile there are certain features which
we want different (or disabled). This includes font scale ignoring
and showing a toolip. To achieve that we check for a printMode flag
in ProfileGraphicsView which can be set using setPrintMode(bool).
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
There is a potential issue when placing a heading on a new
page. If the height of a data row is larger of that of
a heading, a new heading can end up at the bottom of a page
leaving that page with two headings.
To solve that we add line breaks (<br>) until the new
page is reached and add the heading there. Algorithm
assumes that the height of a heading is larger than
a line break. Also it is now obviously even slower.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
QTextDocument uses a separate painting device,
thus we need to pass our QPrinter instance which may
have a resolution different from the screen resolution.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Don't set the cylinders and weight types if they are
the same than before, this fixes a bad thing that happened
when playing with the values. it could blank out the values
carefully chosen by you.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This is a linus request, adds a Single-click edition
on the tableview to make it more consistent with the
rest of the interface where edition is permitted.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
So, I used the Qt Event Filter strategy to bypass the normal role
of user interaction, the Qt ComboBox needed 2 keypresses to close
and edit. so I grabbed the first one and send together a second one.
Há.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch fixes the combobox behavior on the inline edit
to what it was ( well, similar to ) the GTK version,
up and arrow keys will walk you to the list of choices,
and it will update the other data as soon as you walks over it
one drawback is that you cant ( for now, since I do have a
very big headache at the moment ) cancel, since the cancel
will just forgets the item and do not call 'setData' on the
model, but we already called it while walking on the list.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Adds spport for key_up and key_down in the combobox
delegates, now when you press key_up or down, it will
show the list of choices instead of going one-by-one
in the lineedit.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This modifications makes the About dialog spacing more
consitent with different font sizes. Tested on
Ubuntu 12.04 with the 'Universal Access->Text size'
settings.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It might be a good practice to declare certain class
'helper' functions as constant members. But I don't
think there are performance benefits to that other
than the readability ones.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
We use the DiveItem struct from models.h so to ease the
display of date, depth and duration. All columns present
in the GTK build are now displayed.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Add this helper so that we can easily wrap the required
memory release after calling get_dive_date_string()
(fixes a small memory leak).
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Patch does:
- set individual column width and name
(held in tableColumnNames, tableColumnWidths)
- reduce font size in the table
- more small tweaks in the style sheet
TODO: finish printing all dive data
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
We don't really need includes of display.h and dive.h in
printoptions.h and printlayout.h or forward declartions
of 'struct dive' and 'struct options' in there.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
also includes:
- experiment with colored background for headings
- experiment with 'left' alignment for headings
('th' tag CSS does not support 'text-align')
- whitespace fixes
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Currently only for the table print, but now we use the
actual dive table to iterate trough all dives (find only
selected if needed) and print their 'number' element
in table rows.
Also improves the new-page detection algorithm slightly.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
PrintLayout for now only handles the table print,
while the data output itself is work in progress.
For now there is a simple HTML/CSS table logic based
on QTextDocument. There is an iterative algorithm
which listens for a page increase and adds a heading
on top of the new page.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Use a QPrintPreviewDialog, while the print logic is WIP.
This way Qt will show the print output in a window instead
of exporting to a file and opending it manualy.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
The setup() method will be called each time to obtain the
current printer settings. Also it calculates required scalling
based on screen agains printer DPI.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
PrintLayout is a class that will handle the layouting part
of dive profiles, text, tables depending on the settings
of a QPrinter and the PrinterDialog and PrintOptions
instances.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
By connecting to slots we always modify values at a previously
set 'struct options' pointer.
Also have the setup of slots and pre-set values in a
separate setup(struct options *) function.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Tab order should begin from the topmost widget and then
descend towards the bottom end of the dialog.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
The PrintOptions widget has value labels next to the
horizontal sliders. Add slots to update these labels
when a slider moves.
Patch also makes a modification so that the PrintOptions
constructor requires a 'struct options' pointer. If
an options struct is not received we do not set predefined
values and do not connect signals to slots, where
options will be updated immediately.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>