Commit graph

2859 commits

Author SHA1 Message Date
Danilo Cesar Lemes de Paula
1e69731804 use QWebView to show the user manual
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>
2013-08-25 19:03:43 -03:00
Dirk Hohndel
2fb2918607 Compile fix
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-08-13 20:29:22 +02:00
Tomaz Canabrava
41ada82a04 Fixed a bug where the auto-completion would not work via commandline.
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>
2013-08-13 11:53:48 -03:00
Tomaz Canabrava
6da2d40d3c Added completion for buddy, divemaster, location and suit.
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>
2013-08-13 10:49:59 -03:00
Tomaz Canabrava
84f73a5fb1 Added classes to handle the Completion of Dive Editions.
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>
2013-08-13 10:30:22 -03:00
Tomaz Canabrava
663ab6e23e Fixes showing the labels of divemaster and buddy after a trip selection
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>
2013-08-13 08:58:52 -03:00
Tomaz Canabrava
3464bcf6ef Makes the 'auto' edition behave in a better way.
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>
2013-08-13 08:34:04 -03:00
Michael Andreen
16addbf373 Use maxx from graphics context for time calculation.
Fixes #128.

Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-08-08 20:00:15 +02:00
Anton Lundin
89cb73cb2f ifdef out includes when we build without gtk
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-08-07 22:22:50 +02:00
Dirk Hohndel
de8bfe9bc3 Crude hack to stop the build from failing without asciidoc
This could be made much more elegant. For now it serves its purpose.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-08-05 17:22:11 +02:00
Robert C. Helling
7293885178 Delte the temporary dive from the divelist after calculating deco.
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>
2013-08-05 16:59:29 +02:00
Benjamin
aa5365eb3f Clean up code to remove false messages about errors in Eclipse
Imported the subsurface project into Eclipse to try and pull apart
how it all works together. Added an include for profile.h and some
brackets around a condition, but didn't make any functional changes
(I hope). These 2 changes should be purely cosmetic.

Signed-off-by: Benjamin Fogel <benjaminfogel@yahoo.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-08-05 16:49:33 +02:00
Lubomir I. Ivanov
e5b18db802 Print: improve table printing by using QTableView
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>
2013-08-05 06:59:19 +02:00
Michael Andreen
1f976371bf Fix " begin" and " end" for events in plot.
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>
2013-08-05 06:56:34 +02:00
Michael Andreen
069f588d9d Support more than one event of the same type in Qt tooltip.
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>
2013-08-05 06:55:18 +02:00
Michael Andreen
396b2d1031 Fix crash in DiveComputerList::addDC() when importing from DM4.
DiveComputerList::getExact() created a temporary QList with the
DiveComputerNodes matching a specific model. A pointer to a node in the
list was returned, which becomes invalid when the list goes out of scope
and gets destroyed. Causing a crash when the model strings are compared
later.

Instead of using contains() and creating a temporary list, we can just
use an iterator, which should be both faster and safer.

The crash is easy to trigger with DM4 imports, but can probably be
triggered in other cases too.

Similar problem with DiveComputerList::get().

Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-08-05 06:54:46 +02:00
Tomaz Canabrava
67fec4da70 Added the possibility to choose gases in the planner.
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>
2013-07-21 13:54:21 -03:00
Tomaz Canabrava
83c73168b0 Added a missing #UNDEF
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-21 13:01:33 -03:00
Tomaz Canabrava
3e3d8b2210 Good code cleanup.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-21 12:56:21 -03:00
Tomaz Canabrava
9dde9b3d4c Added the current gas used on the planner
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>
2013-07-21 12:12:31 -03:00
Tomaz Canabrava
b36dfc7c4f Removed unused code.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-21 10:03:04 -03:00
Tomaz Canabrava
a6025c8efd Added button to reduce dive time on the planner.
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>
2013-07-21 09:44:52 -03:00
Tomaz Canabrava
29cb15950e Added ( finally ) the code to reduce depth on the planner
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>
2013-07-21 09:27:04 -03:00
Miika Turkia
d776bb9eb3 Fix compile on clean source
Fixes #163

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-07-19 10:24:59 -07:00
Tomaz Canabrava
8ad7216e70 Fixes incorrect editing policies.
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>
2013-07-18 12:01:48 -07:00
Tomaz Canabrava
3aa55462dc Added the code to revert Weigths when user cancels edition
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>
2013-07-18 12:01:48 -07:00
Tomaz Canabrava
7e029980b8 'Cancel' action Cancels editing Cylinders.
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>
2013-07-18 12:01:05 -07:00
Thiago Macieira
4f49a69d7d Ask Qt to use system proxies in Subsurface
This causes the Marble widget to use proxies automatically too.

On Mac, this gets the global proxy settings; on Windows, it gets the
IE settings; on Unix, it uses environment variables (set http_proxy
and all_proxy).

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-07-18 12:00:12 -07:00
Lubomir I. Ivanov
f470f559d1 Colors: a couple of grayscale color tweaks
change the B/W color (index 1) of some of the
colors - e.g. BACKGROUND, ALERT_FG.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-18 12:00:12 -07:00
Lubomir I. Ivanov
9de15dec60 Profile: support grayscale plotting
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>
2013-07-18 12:00:12 -07:00
Lubomir I. Ivanov
17c97b921f Print: pass grayscale flag to setPrintMode()
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>
2013-07-18 12:00:12 -07:00
Lubomir I. Ivanov
3076dc6d47 Profile: add the isGrayscale flag
setPrintMode() can now be used to set the
profile to be plotted in grayscale.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-18 12:00:12 -07:00
Lubomir I. Ivanov
fc84f8868d Print: add method to convert profile to grayscale
(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>
2013-07-18 12:00:12 -07:00
Lubomir I. Ivanov
b241b7c06a Print: add experimental code for printing profiles
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>
2013-07-18 12:00:12 -07:00
Lubomir I. Ivanov
8ea849d0c2 Profile: use a printMode flag in ProfileGraphicsView
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>
2013-07-18 12:00:12 -07:00
Lubomir I. Ivanov
b722bf6931 Print: improve new page detection in table print
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>
2013-07-18 12:00:12 -07:00
Lubomir I. Ivanov
2bfda14c0b Print: support any resolution for the table print
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>
2013-07-18 12:00:12 -07:00
Tomaz Canabrava
63c33e152e Don't set if equal, on edit cylinders and weigth types.
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>
2013-07-18 09:01:37 -03:00
Tomaz Canabrava
29b92e2fc5 Adds Single-Click editions on the TableView
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>
2013-07-17 12:13:04 -03:00
Tomaz Canabrava
bad91ef11c Added EnterKey to finish edition on Cyl/Weigths with the popup open
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>
2013-07-17 11:47:23 -03:00
Tomaz Canabrava
1a0a4b7e08 Fixes the Combobox behavior on the inline-edit
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>
2013-07-16 19:13:58 -03:00
Tomaz Canabrava
c5a0c4e0d7 Support for key_up and down in the combobox delegate.
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>
2013-07-16 15:31:44 -03:00
Tomaz Canabrava
ee25edc28e Clear multi-line string separator on the c++ code.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-16 12:49:31 -03:00
Tomaz Canabrava
fdfd261f14 Fixeda a typo that got the 'x' value where the requested one was actually y.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-16 12:48:37 -03:00
Lubomir I. Ivanov
a69e92d891 About: improve dialog layout
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>
2013-07-11 09:22:20 -03:00
Lubomir I. Ivanov
3aae3ff547 Print: mark some functions in PrintLayout as 'const'
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>
2013-07-11 12:55:48 +03:00
Lubomir I. Ivanov
a4982c93cd Print: complete columns for the table print
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>
2013-07-11 12:45:41 +03:00
Lubomir I. Ivanov
127cd21137 Models: add the DiveItem::displayDate() helper
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>
2013-07-11 12:41:50 +03:00
Lubomir I. Ivanov
adb7dc6fac Models: move the declaration of DiveItem to the header
This should allow external use of the type by
including models.h.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-11 12:40:08 +03:00
Lubomir I. Ivanov
eab31855f5 Print: show column titles for table print
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>
2013-07-11 00:52:39 +03:00