Commit graph

68 commits

Author SHA1 Message Date
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
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
Lubomir I. Ivanov
bdd89f0e7a Coordinate some mark_divelist_changed() calls
1) Make a call mark_divelist_changed(TRUE) when the user adds new
cylinder or weight entries.

2) Call mark_divelist_changed(FALSE) in
MainWindow::on_actionClose_triggered() so that each time after
a file is closed or a new one is created it does not ask immediately
the user for a save confirmation for the blank file/divelist.

3) Call mark_divelist_changed(TRUE) once a dive's geo location
has changed in GlobeGPS::changeDiveGeoPosition().

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27 20:57:11 +08:00
Lubomir I. Ivanov
8678e2d57c Better positioning of the plus sign icons in the Equip. tab
There are a couple of problems with said icons:
- When the Equip. tab is first seen, no relative event is monitored
so that the correct position is updated and the icons are positioned.

To solve that we connect the signal MainTab::currentChanged(int)
and call MainTab::equipmentPlusUpdate().

- When the info-profile QSplitter resizes with a snap towards/from
the edges of the main window, no resize handler is called such as
MainTab::resizeEvent().

A solution is to monitor the resize of the info-profile splitter
with MainWindow::on_infoProfileSplitter_splitterMoved() and again
call MainTab::equipmentPlusUpdate()

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27 20:57:10 +08:00
Tomaz Canabrava
c917b29701 Save / Restore the sizes of the columns in Cylinders / Weigth widgets
This patch saves / restores the sizes of the columns in the cylinders
and weigth table widgets, so everything is now properly behaved. There
's still other things to do - but I'm tired. i's sunday and there's a
protest against the brazilian government to go.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16 14:36:23 -03:00
Tomaz Canabrava
20849f014e Make the columns have a sane default width for 'type'
Make the columns on Cylinders edit and Wheight Edit to
have sane values for 'type', this is needed because the
old behavior was to set it fixed size, and the default fixed
size was silly. this calculates a good predefined value
taking the font size in consideration.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16 13:28:59 -03:00
Tomaz Canabrava
f9b4c6b889 Better handling of default sizes on the Cylinder and Weight widgets
Better handling of default sizes on the Cylinder and weight widgets,
the weigth widget didn't had a CSS applied so it looked odd compared
to the cylinder one, also the default behavior for the combobox delegate
didn't worked very well with the css applied, being too small.
this patch fixes that.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16 12:33:27 -03:00
Dirk Hohndel
a960cd2d45 Show & edit trip location and notes when exactly one trip is selected
While we still show the selected_dive in the profile and use it for Dive
Info and Equipment, in the Dive Notes tab we now show the trip location
and trip notes (and none of the other fields), if the user directly
selects a whole trip by clicking on the trip header.

This clever reuse of the widget now allows trip location and notes to be
edited in place.

As a side note: the Gtk version has long allowed the user to edit the
trip location and trip notes, but nowhere did it ever SHOW the trip
notes... so this is more than just feature parity...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-14 09:20:20 -07:00
Henrik Brautaset Aronsen
0031b64df7 Disable Document Mode for MainTab on MacOSX
Commit c4f06dc536 introduced Document
Mode on the MainTab QTabWidget. This doesn't look good on MacOSX.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-07 21:42:13 -07:00
Dirk Hohndel
9dab886117 Reload globe after dive location was modified
This way a change to the location name is immediately reflected in the
map display.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-05 11:39:40 +09:00
Tomaz Canabrava
48dda4192f Added a new widget 'MinMaxAvgWidget'
Added a new widget, MinMaxAvgWidget, a simple widget
that displays values in 'min, max, avg' fashion.
it has a setMaximum, setAverage and setMinimum
methods, that is userful for setting the minimum,
maximum and average of stuff. Ah, it also shows
the minimum, maximum and average of things.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-04 18:51:27 -03:00
Dirk Hohndel
e88a9aa83e Once again try to fix the selection
Things got broken. Again. We no longer kept track of the selected dives in
our structures which broke statistics.

This attempts to fix that, but appears to still have a bug when selecting
trips. Sometimes this results in 0 dives being selected according to our
data structures, while Qt happily shows all dives of the trip as seected.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-02 20:31:04 +09:00
Dirk Hohndel
9a65798daf Use a slightly shorter date string for Info tab
This way the spacing of the elements looks nicer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-31 17:59:01 +10:00
Tomaz Canabrava
bd6dfa1ebd Align Labels on center.
There was already a code for that on the maintab.cpp, but
since I moved all labels to groupboxes, the code stopped
working, and I tougth it'd better to kill the code since
it's faster and safer to use the interface builder for that.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-30 11:30:23 -03:00
Dirk Hohndel
81e27b6db9 Try to make the equipment tab more compact
My attempts to actually set the width of the columns with the
SizeHintRole all failed - so I gave up on that and am forcing things to
work by making the texts in the header somewhat longer and then resizing
to that. Definitely not what I wanted to do - but that plus reducing the
font size gives us a much more reasonable / compact look.

I really hope that someone else can explain to me how to get the
SizeHintRole to affect the width (and not just the height - that part
worked just fine) of a the cells in a column. Then we can replace this
hack by a much better solution (that won't fail if the translated strings
look different).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25 20:07:36 -07:00
Henrik Brautaset Aronsen
6fa670e612 Improve wording on buttons when editing a dive
Use the more familiar Save/Undo instead of OK/reset

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-24 06:15:28 -07:00
Dirk Hohndel
01a3bd2cc6 Add weightsystem delegate to enable editing of weightsystem
This is very much analogous to the way cylinders are implemented.
That means that just like with cylinders, if the user enters a new type
and hits 'tab' before hitting 'enter', Subsurface will crash.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-23 21:36:33 -07:00
Dirk Hohndel
8d359f8e57 Remove obsolete slots
The .ui components were removed in commit 0c7a575f7b3b ("Rework on the
Equipment tab to make it look more Modern.") but the "automagic" slots
were still here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-23 18:35:04 -07:00
Dirk Hohndel
115e5e5fbc The never ending, futile fight for whitespace consistency
I just need to write a tool that does this...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22 21:31:45 -07:00
Dirk Hohndel
33135e37a5 Start editing Dive Notes when clicking on Rating or Visibility
Those widgets respond to MouseButtonPress and not FocusIn.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22 20:00:26 -07:00
Tomaz Canabrava
134e20bdc2 Removed the unused add cylinder and add weigthsystem dialogs.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 14:52:38 -03:00
Tomaz Canabrava
fc4243eef0 Added a Delegate for editing Cylinders
Now when you edit 'Type', a drop-down list will appear
and will enable you to choose from it's contents.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 14:11:49 -03:00
Tomaz Canabrava
0b30c821ae Added a 'trash' icon on the Cylinders and Weigthsystem models
So, the Cylinders and Weigthsystems got a new Trash icon,
and the interface already intercepts the clicks ( on all
columns ) and send this to the 'remove' method on boch
models. On the model I'm just filtering the indexes that
are not 'DELETE' and creating a stub method to be filled
later.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 11:00:20 -03:00
Tomaz Canabrava
94ba79c0fe Only enable the add buttons when there's a dive loaded
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 09:42:35 -03:00
Tomaz Canabrava
28deb3e65d Re Enable the option to add cylinders / weigthsystems.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 09:40:26 -03:00
Tomaz Canabrava
df57b657fd Rework on the Equipment tab to make it look more Modern.
Note that this is a WIP and it does break functionality
- ie, not possible to add Equipments, but this will be
fixed in the next commit. Removed add / edit / remove
buttons, only a single '+' icon appears on the widget
now. the edit / delete will be done in place.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 09:17:18 -03:00
Tomaz Canabrava
e7b84233af Fixed memory leak
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-21 10:07:41 -03:00
Tomaz Canabrava
be31a53b0d Added support for visualization the Weigthssystems on the Equipment Tab.
This patch adds support showing and  for editing weigthsystems in the equipment tab,

so, now the two things that are missing are 'edit' and 'delete', wich are quite easy to do.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-21 09:59:41 -03:00
Tomaz Canabrava
126bc8cfa3 Added the code to show the cylinders from a dive.
i
Added the code to show the cylinders from a dive,
this code also already permits additions from the
interface, so the user can click 'add' and insert
what he wants there.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-21 09:33:55 -03:00
Dirk Hohndel
0d370ba108 Integrate visibility Star widget into editing flow
This also removes some incorrect code from the clear() function for the
DiveInfo tab. Putting the readOnly() calls for the DiveNotes tab there was
wrong.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-20 06:25:16 -07:00
Dirk Hohndel
11a6b18690 Display the statistics
This would be correct if the current selection code wasn't broken. Right
now we only add to our internal notion of what is selected - we never
deselect anything.

Once that is fixed, thestatistics should be correctly displayed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 22:48:31 -07:00
Dirk Hohndel
e818f0352b Try to add a StarWidget for visibility
It's not editable. And of course it continues to look like utter crap -
even more so now since this is left aligned and everything else is
centered.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 21:44:21 -07:00
Dirk Hohndel
adc7654816 When no dive is displayed, the DiveNotes field should not be editable
This also fixes a potential crash if no dives were loaded and the user
started editing the fields and clicked OK.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 17:38:20 -07:00
Dirk Hohndel
920a2069b0 Figure out if the user changed anything when editing
And mark the divelist changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 14:13:04 -07:00
Dirk Hohndel
9ffa37ab6f Rename buttons for dive edit
The old names made sense in the initial model (where you'd click on the
edit button to start an edit). The new names seem much more natural given
what we do now.

Also a tiny code cleanup removing a redundant if statement.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 12:59:36 -07:00
Dirk Hohndel
a4f243dfac Make direct edit the style of choice
Plus minor coding style fixes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 09:00:57 -07:00
Dirk Hohndel
9b1a3e09d1 Fix edit behavior
Commit 7b00668b400b ("Improve the Dirk edit mode.") had what looks like an
"autocomplete" typo. This also stops us from changing the text on the
button that in this edit mode is always just the "OK" button.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 08:42:58 -07:00
Dirk Hohndel
ae05498d94 Merge branch 'chooseEditMode' of https://github.com/tcanabrava/subsurface 2013-05-19 08:09:48 -07:00
Dirk Hohndel
1298aa87e5 Continue populating the DiveInfo tab
Pulled one more helper from statistics-gtk.c (but didn't modify the code
there to use it as that code is no longer being compiled).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 08:08:29 -07:00
Tomaz Canabrava
55b998d528 Improve the Dirk edit mode.
The dirk edit mode will be triggered as soon as the user
clicks on the field that he wants to edit. then he can
edit all fields, till he press ok / reset.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-19 11:45:01 -03:00
Tomaz Canabrava
206a148e07 Made possible to choose the edit style on compile time
This is just a for choosing the default edit style in the
future.  I prefer the new edit style as the user is sure
what the hell is going on ( ie - if he chooses to edit,
he is editing, there's a message warning him that he is
editing and everything else is blocked till he finishes
editing. ) and the GTK version is 'edit whenever I feel like',
wich I think is more unsafe but dirk asked me to put an option
and let the others choose.
e

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-19 11:19:57 -03:00
Dirk Hohndel
ba30d070c9 While editing the left button is renamed to "OK" to accept the changes
This seemed more logical than keeping it as "edit" and basically having to
hit "edit" a second time in order to save a change.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-18 21:33:04 -07:00
Tomaz Canabrava
046eacabe5 Make impossible to change dives while editing one.
This is to prevent loss of data, so if the user is editing something,
either cancel the edition or save it, to continue moving around on
the Dive List.  - Only the dive list is affected, user can still
play with the globe and the profile.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-18 21:30:54 -07:00
Tomaz Canabrava
c5e7a025e4 Added option to edit the selected dive.
Added option to edit the selected dive.
Now the user can click on 'Edit', and a nice box will
appear stating that the dive is in edit mode, and the user
can edit all of the 'Notes' tab fields, including the
rating. When the edition is finished, the user needs to
click on 'edit' again to mark as accepted, or in
reset to reset the fields to it's original state

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-18 17:06:48 -07:00
Henrik Brautaset Aronsen
f9598f062c Clean up some typos
Cosmetic commit to clean up some of the annoying typos in qt-ui

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-14 05:24:28 -04:00
Tomaz Canabrava
a6d9f27445 Change setText(QString()) to clear()
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-13 21:32:03 -05:00
Tomaz Canabrava
61373eaccf Fix segfault on mouseOver at the Profile with an invalid dive selected ( trip )
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-13 15:28:17 -03:00
Amit Chaudhuri
97a044d41f Tweaks to maintab
Align statistics tab labels as per infotab.

Amend helper function to show degree symbol for temp measurements.

Change order of member initialisation list to match order of decl
(ProfileGraphicsView::ProfileGraphicsView)

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-10 16:01:17 -07:00
Amit Chaudhuri
7f9fbd2295 Horizontally align labels on info widget page.
Left aligning text values looked wrong.

Use Qobject cast to filter labels from any other qobjects around and
set alignment. Doing this via Qt Designer would be tedious.

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-09 12:10:34 -07:00
Amit Chaudhuri
b5d5b05140 Fix crash on right click dive trip
A null pointer dereference occured after right click on a dive trip
because updateDiveInfo was called with dive == -1 causing get_dive(int)
to return null.

Wrap to avoid crash and clear dive info widget text labels.

[Dirk Hohndel: this is different from the fix I had committed earlier;
               I decided to combine the ideas, clean this one up a bit
	       more and this is the result]

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-08 12:10:51 -07:00