Currently the top righthand part of the notes tab is used for
showing and editing air teperature and water temperature. But
these fields were moved over to the Information tab and are not
required in the Notes tab any more. Rather use this space for the
depth and duration data for manually-entered dives. Currently
extra vertical space is created in the Notes tab for showing this
field, resulting in inefficient use of screen space and
inelegant layout. This code moves the Duration and Depth fields
into the top righthand of the Notes tab.
Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
1) Reorganise the existing widgets in the Information tab
2) Move divemode widget and visibility widget from Notes tab to
Information tab
3) Translate water density to a word indicating water type
4) Reorganise the Notes tab to compensate for the moving the
divemode and visibility widgets to the Information tab
5) Remove the problems in showing a QGroupBox in Qt Windows. I do
this by removing the CSS specifying border characteristics
Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Replaces some enums with names that do not clash with windows #defines.
Specifically:
ERROR -> ERRORED, PASCAL->PASCALS, IGNORE->IGNORED,FLOAT->FLOATVAL
Signed-off-by: Paul Buxton <paulbuxton.mail@googlemail.com>
On the main tab, the trip time was not shown when switching to
a trip. Implement showing of the trip date in a function, as the
undo-code will also have to update the trip date in certain
circumstances.
Fixes#2207
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Since the default view is batched by trips, signals were sent trip-wise.
This seemed like a good idea at first, but when more and more parts used
these signals, it became a burden. Therefore push the batching to the
part of the code where it is needed: the trip view.
The divesAdded and divesDeleted are not yet converted, because these
are combined with trip addition/deletion. This should also be detangled,
but not now.
Since the dive-lists were sorted in the processByTrip function, the
dive-list model now does its own sorting. This will have to be
audited.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
These functions were spread out over dive.c and divelist.c.
Move them into their own file to make all this a bit less monolithic.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
On the MainTab, warn if more than one dive was edited. To this purpose,
add a new KMessageWidget with an "OK" button that closes the message.
Code is mostly a copy of the already existing "Editing dive" message.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This is a pointless one-liner function. Let's remove it. The
message it shows will probably be moved to the profile in the
not-so-distant future anyway.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
On the main dive tab, add a button that opens the dive-site selection
widget showing all dive sites. This is done by setting the "temporary
dive site name" to the empty string. Thus no dive sites are filtered
and the "add new dive site" entries are not shown. Moreover, the
text is selected. The user can therefore immediately start typing to
activate the filter or enter the name of a new dive site.
The idea is that after downloading dives with GPS information the
user can select one of the close dive sites.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When changing the dive selection, we have to reload the map to show
the correctly highlighted flags. Do this directly by hooking into
the DiveListNotifier::divesChanged signal instead of indirectly
via the MainTab.
Moreover, on reload center on the highlighted dive sites.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This struct is used to store the completers during construction
of the object. But it is never accessed afterwards. Therefore,
remove it from the object and remove the structure definition
from the header file.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Most tabs in the dive-information widget have there own translation
units and ui-files. Only the equipment tab was married with the
main tab. Move it out to get more reasonably sized translation units
and some isolation.
Currently, this needs ugly hacks when entering / checking for edit
mode: Access to MainTab is via the MainWindow. And vice/versa, when
accessing the DiveEquipmentTab from the MainTab, the former is
hardcoded as the first item of an array.
These hacks will soon be removed though, when making equipment
editing undoable. The tabs will then be independent.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The only caller of said function used to check whether MainTab is
in edit mode. For this case there is already a function - use that
instead.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The editing of a dive field is only performed when focus
is removed from the field. On pressing CTRL-s, the changes
in the currently active field were therefore not saved.
Remove the focus from all fields to trigger an edit command
yand thus ensure that all changes are saved.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The whole edit logic moved from displayed_dive to current_dive
and it became more and more tedious to keep these in sync.
Therefore, simply always display current_dive. The only exceptions
are the equipment tab and the planner, as these are not yet
integrated in the undo system. Once this is done, displayed_dive
can be removed.
Moreover, remove the clear parameter from updateDiveInfo().
Instead simply clear of there is no current_dive set.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
If a dive site was edited, the location field should be updated.
Do this by hooking into the diveSiteChanged signal of DiveListNotifier.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of letting the user edit the fields before adding a dive,
simply add an empty dive. Thus, the ADD mode of the main tab can
be removed.
Constructing a new dive with default-depth and making sure that
the dive is displayed correctly is very subtle. This all needs
to be detangled in due course.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Since all fields on the maintab are now directly edited,
there is no point in marking fields as changed. Remove
unused functions MainTab::markChangedWidget() and
MainTab::resetPalette().
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This is copying the dive editing code. It uses an OO design with
virtual functions for getting and setting the values. It doesn't
use templates though, as both fields of strig type. This feels
a bit over-engineered, but it is 1) consistent with the dive edit
code and 2) the number / types of dive trip fields might increase.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
These functions are now performed by the edit commands and the
macros have no users. Remove them.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Moving the tagged-string edit functions into the undo-system made
the MainTab::saveTaggedStrings() and MainTab::diffTaggedStrings()
functions unnecessary. Remove them.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The dive list was not updated automatically when an edit command was
executed. There was already a signal to do that, viz. divesChanged().
But that signal worked by-trip and didn't have a dive-field specifier.
The edit-commands used the divesEdited() signal that isn't by-trip
but has a dive-field specifier.
Unify these two signals to be by-trip and with dive-field specifier.
This needs common code to generate the by-trip list that is moved to
a command_private.h header.
Since there might now be multiple signals (one per trip) actually
check in the main-tab whether the current trip is affected to
avoid multiple update of fields. This has the positive(?) effect
of not doing any update if the current dive isn't changed.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The acceptingEdit field was used to ignore edit-signals in
MainTab::acceptEdit(). But an equivalent mechanism already
exists: setting editMode to IGNORE. For consistency, replace
the former by the latter. acceptEdit() resets the editMode
in all cases anyway.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This was a bit different from the other editing commands:
1) Only the current dive is edited not all selected dives.
Therefore, create a function that turns the current dive
into a one-element list.
2) The profile has to be replot. Here, likewise, create a
function to do that.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The code follows the other edit-commands, but uses its own base
class, because it is distinctly different. Editing the tag field
does not simply mean setting the tag for all dives, but rather
adding and removing individual tags.
This class will be reused for editing of dive buddies and masters.
Modify the tag widget thus that it sends an editingFinished()
signal when it goes out of focus. The editingFinished() signal
was prevented by hooking into the return, enter and tab key-events.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This one is a bit more tricky. There are two modes: set dive site
and set newly created dive site. This is realized using an OO model
with derived classed. Quite convoluted - but it seems to work.
Moreover, editing a dive site is not simply setting a value,
but the list of dives in a dive site has to be kept up to date.
Finally, we have to inform the dive site list of the changed
number of dives. Therefore add a new signal diveSiteDivesChanged.
To send only one signal per dive site, hook into the undo() and
redo() functions and call the functions of the base class there.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This is different from the other editing commands, because
date and time editing may change the order of the dive list.
Therefore, this uses an already implemented dive list command.
The command is extended to send a divesEdited() signal.
This signal and the divesChanged() signal, which is used by
the dive list, will be unified in a later commit.
Update of the graphics is now not done via signals, a direct
call is performed in MainTab::divesEdited(). This simplifies
things.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Mostly trivial. Since now on editing the field is re-set, the
validation function becomes unnecessary.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This one was trivially modelled after notes editing. Only difference:
the textChanged() signal was replaced by the editingFinished()
signal so that we're not generating undo-commands on every key-press.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Add a new UndoCommand for dive mode editing. This one is a bit
special, as the mode is associated with a dive computer (DC),
not a dive. Thus the edit command has an additional parameter,
viz. the index of the DC.
This does not fit properly to the EditBase class, as this class
isn't aware of additional parameters and therefore this parameter
is not sent via signals. At the moment this doesn't matter. In
any case, the semantics of editing are weird and therefore let's
do the simple thing (derive from EditBase) and let's see what
the future brings.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
To keep the UI in a consistent state, update the notes field if
it is changed by an undo command. To that purpose, add a new
signal to diveListNotifier with a list of dives and a field-id
as payload.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Implement a first rudimentary dive-editing command. The main code
resides in a base class Command::Edit, which calls virtual functions
to read / set the fields and extract the field name.
Implement an example: editing of dive notes.
This dose not yet update the UI on undo / redo.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Replace UUIDs from LocationInformationModel and fix the fallout.
Notably, replace the UUID "column" by a DIVESITE "column".
Getting pointers through Qt's QVariant is horrible, we'll have
to think about a better solution.
RECENTLY_ADDED_DIVESITE now defines to a special pointer to
struct dive_site (defined as ~0).
This fixes an interesting logic bug:
The old code checked the uuid of the LocationInformationModel (currUuid)
for the value "1", which corresponded to RECENTLY_ADDED_DIVESITE.
If equal, currType would be set to NEW_DIVE_SITE. Later, _currType_
was compared against _RECENTLY_ADDED_DIVESITE_. This would only work
because NEW_DIVE_SITE and RECENTLY_ADDED_DIVESITE both were defined
as 1.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
While trying to understand more of the big change from PR 1528,
I found that the divelist was marked changed while it was not
changed at all. Reason is simple. The MODIFY_DIVES code assumes
its called only for truly changed data. But in case of saving
tagged strings, it was not.
This fixes this. And I do not believe this has any visual effects.
Further, the now broken indentation is fixed seperately.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Fetching the taxonomy from GPS coordinates was implemented in
a QThread. But the only access to the main function was a
direct call to run(). Thus, the thread was *never* started.
The function call was always asynchronous [it was using an
event loop though, so the UI doesn't hang]. Notably this
means that the signals connected to the thread would never
fire. And the spinner would never be activated.
Thus:
1) Turn the thread into a simple function.
2) Remove the spinner.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
On dive editing, for every changed field the code looped through
the whole dive-list and modified the selected dives. Instead,
get the list of selected dives once and use that.
Whereas this may look like a gratuitous optimization, it will
make things easier for subsequent commits. Notably, we can
pass the list of selected dives to an "UndoObject".
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Both callers have a dive * and transform that into an id,
the callee transforms it right back to the dive *. Simply pass
the dive directly. This will allow us to use the function for
dives that have not yet been added.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The dive site list was connected to centerOnDiveSite(). Apparently,
the currently selected dive site should have been shown in the map.
Yet, this never worked, because the actual dive site of the selected
dive had precedence in centerOnDiveSite().
It seems that centerOnDiveSite() had actually to purposes:
1) center on the passed in dive site
2) center on the dive sites of the selected dives
Therefore, split this function in two separate functions for
each of these use-cases. This allows us to remove some pre-processor
magic (mobile vs. desktop) and to remove a parameter from the
MainTab::diveSiteChanged() signal.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signals can be useful. In this case, a simple function call does
it. Thus, remove the signal. It can be readded later at an more
appropriate place.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Disable tabs for equipment, info, pictures and extra info if a
dive trip is selected.
Remember specific tab selection for dives and dive trip to recover
selection when browsing dive list.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
If the user implicitly adds a dive site by editing a dive, and
a location filter is active, check the new dive site in the
location filter.
This is done by informing the LocationFilterModel of the new
dive site name prior to repopulation. The LocationFilterModel
then adds a corresponding entry and marks it as checked.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Since commit 01d961086c, MainWindow::refreshDisplay()
is called in the refreshDiveInfo() signal of maintab after editing a
dive site. Since this was the only use of the refreshDiveInfo signal,
remove this signal and instead connect to MainWindow::refreshDisplay directly.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Maintab is one of our most complex classes, and it's
something I'm not actually proud of. But it currently
works and the idea of splitting it was in my head for
quite a while.
This is the third or fourth tentative of splitting it,
and this time I let the most complex part of it untouched,
the Notes and Equipment tab are way too complex to untangle
right now on my limited time.
A new class 'TabBase' should be used for any new tab that
we may create, and added on the MainTab (see the new lines
on the MainTab constructor).
Also, Extra Info, Information, Photos and Statistics where
ported to this new way helping reduce the number of
lines and functions on the MainTab quite a bit.
Overall this is a step in the right direction for the future.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>