Commit graph

100 commits

Author SHA1 Message Date
Tomaz Canabrava
a5d2003e3a Only get the icon for add/geocode once
Each time we searched for an icon on the qt resource
we had to open, inflate, create, store, delete the icon.
now we search for it only once, use as cache and make
the world a better place.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-27 06:43:18 -04:00
Gaetan Bisson
24471cfd0d Initialize currUuid
Signed-off-by: Gaetan Bisson <bisson@archlinux.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-24 07:10:17 -07:00
Tomaz Canabrava
a9642d5751 Do not display popup with modifiers
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:49 -07:00
Tomaz Canabrava
d95856d3b2 Select an index if no index is selected
Defaults to first row.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:49 -07:00
Tomaz Canabrava
5b3d52acec Correctly fix the popup position
When the message to 'This dive site is being edited' was
being show while the popup to choose the dive site, the
line edit was being covered. now it correctly moves to
the correct place.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:49 -07:00
Tomaz Canabrava
d586970f31 Removed a ton of dead code
Unused dead code / hack for the old QCompleter

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:49 -07:00
Tomaz Canabrava
e4c0ee32cd Handle palette change for dive site selection
If you select a dive site with a different uuid than your
current dive.dive_site_uuid, you should get a different
pallete to state clearly that something changed.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:23 -07:00
Tomaz Canabrava
7d863b5c28 Fix keyboard inconsistencies
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:23 -07:00
Tomaz Canabrava
4b8eec6c58 Fix new/existing dive site choices
Only set the currType and currUuid if text changed.
This is needed because if you hit key_down it would
set NEW_DIVE_SITE because a keypress on the lineedit was
due.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:23 -07:00
Tomaz Canabrava
80b42bd28b Set the current dive site uid / text
Start to make this thing usefull: Upon selecting the current index
or writting something on the line edit, we need to set the dive site.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:23 -07:00
Tomaz Canabrava
4352412731 Correctly handle space and tab
Space and tab should select the item in the itemview and hide
it; enter and return also do that automatically.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:23 -07:00
Tomaz Canabrava
33a19328d8 Block focus out event
The line edit wasn't being properly updated regarding its
paint event. Turns out it was because it received a focus
out event and then stopped refreshing the paint.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:23 -07:00
Tomaz Canabrava
eb2c78e953 Random fixes and improvements
Whitespace fixes, constructor fixes, new slot (still unused)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:22 -07:00
Tomaz Canabrava
fdec250723 Whitespace fix
Sorry.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:22 -07:00
Tomaz Canabrava
dd21ab6b11 Fix correct size of the popup
Correct the popup visibility.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:22 -07:00
Tomaz Canabrava
317c3de91d Handle dive site activation
Connect the view activated signal to send us the index.
Removing debug output that I forgot inside it.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:22 -07:00
Tomaz Canabrava
534e07399a Made it possible to keypress again
Click outside of the popup closes it, also handles theme
enter / return keys.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:22 -07:00
Tomaz Canabrava
fdd28fddf2 Start to handle keypresses
Keypress management is one of the main functions of the completer, so we
must create an event filter and hook things up properly.
key esq / enter should close the popup (and not leave us with a popup open
and no way to close it - it breaks X)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:22 -07:00
Tomaz Canabrava
c4c7e7a7f4 Display the popup in the correct place
The popup should be shown beneath the QLineEdit. this code here
is shamelessy stolen from the QCompleter source code because I
really didn't want to rethink the correct way of doing this.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:22 -07:00
Tomaz Canabrava
012e8ccb46 Re-add the 'plus' button on the delegate
This was missing in the delegate - now it's prettier.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:22 -07:00
Tomaz Canabrava
8c9a4ecd4b Stabilize the location model/proxy model
Since I removed the old location edit from the UI, I also need to
remove a bit of code from the UI that was calling it.

fix a few crashes regarding the old location edit.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:19 -07:00
Tomaz Canabrava
be6e190bd2 Skeleton of the new LocationCombobox
This is the bare minimum skeleton of the new completer for the dive site
management. Nothing works, yet, nothing is hoocked up, yet.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:07:07 -07:00
Sander Kleijwegt
6427564d33 Hide current dive site from dive sites with same coordinates.
Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-12 08:28:13 -07:00
Dirk Hohndel
a1c023bee0 Event filters need to tell the caller if they took the event
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 19:24:36 -07:00
Dirk Hohndel
5670b5fedd Silly compile fix
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 19:24:23 -07:00
Tomaz Canabrava
2da439f34c Correctly refresh dive site list
And also show a warning to the user saying that that
action is non-cancelable.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 18:43:52 -07:00
Tomaz Canabrava
1ef20ee5d8 Merge the dive sites selected.
Wee. :)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 18:43:43 -07:00
Tomaz Canabrava
e36e4d1faa UI code to merge dive sites
Get the Qt data structures and convert to something
that we can use in our C - core.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 18:43:09 -07:00
Tomaz Canabrava
560426bf82 Offer the option to merge dive sites.
Almost finishing. :)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 18:42:56 -07:00
Tomaz Canabrava
b52b95f3ec Show the correct data on the Dive Site List
We where showing the UID, wich didn't made sense.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 18:42:32 -07:00
Tomaz Canabrava
a3d6098c8c Display dive sites with same gps as the current
So we can merge them later - currently we are showing
only the ID, ugly - fixing next.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 18:42:15 -07:00
Sander Kleijwegt
d22a135343 Fix edit & show of divesites for new and existing dives.
The UI detects when it should refresh the loction after the
user finished editting a divesite. Creating and editting
divesites is now working even when the current dive is not
saved yet.

Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-29 20:10:32 -07:00
Sander Kleijwegt
10d0604297 Fix crash when creating a dive site without any dives in logbook.
A divesite uuid is created using the timestamp of the currently
selected dive. When there is no current_dive, use the current
time to create a uuid.

Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-28 16:13:50 -07:00
Dirk Hohndel
a99839a4f1 Remove a couple of debug messages
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 18:15:24 -07:00
Tomaz Canabrava
fc6d819616 Create a new dive site and edit it automatically
If the user clicks on the first or second option of the drop
down list, subsurface will move him to the dive site edit panel
automatically, since it's a new dive site and there's no information
about it yet.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 18:00:15 -07:00
Tomaz Canabrava
03702edf87 Get taxonomy from edit dive site widget
Moved the get taxonomy button from the maintab to the edit dive site
widget.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 17:58:59 -07:00
Dirk Hohndel
faa1c28100 Another fix to build with NO_MARBLE
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-31 11:15:35 -07:00
Tomaz Canabrava
e8720c2918 Repopulate the labels on the globe after an edit
Strangely, it still doesn't show the flag where it should be
(but it shows just after a reselect, so it's mostly a cache
issue somewhere)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-31 10:31:19 -07:00
Tomaz Canabrava
fa6e1d5506 Paint the coords-widget yellow after clicking on the globe
When we clicked in the globe and changed programatically
the text on the coordinates edit widget, the background
was still white instead of the bright yellow that it should
have to show that it was modified.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-31 10:31:00 -07:00
Tomaz Canabrava
c13e5d069c Save the gps edit into the current dive_site
The accept method didn't save the gps edit even if we
put correct text on it.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-31 10:29:33 -07:00
Tomaz Canabrava
f8b64da136 Change the coordinates via globe.
Now when the user selects the dive site edit, the globe
will enter in edit mode too.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-31 10:29:17 -07:00
Tomaz Canabrava
2faff7ceae Add a button to pick the coordinates via globe on the dive site edit
It's a placeholder for now, but next commit will make it work.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-31 10:28:28 -07:00
Tomaz Canabrava
7834341562 Remove unused signal
And move things around, informationManagementEnded was a good name
but endEditDiveSite is better.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-31 10:27:01 -07:00
Tomaz Canabrava
d50e767fb5 We do not change the displayed_dive_site - don't reset it
It seemed correct when we changed the dive_site that we could be
editing, but we don't do that anymore. (I actually think this
should be self-contained, no global that a lot of widgets can
change)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-25 13:53:57 -07:00
Tomaz Canabrava
71a23c5295 Break long lines
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-25 13:53:45 -07:00
Tomaz Canabrava
7c770f0790 Show dive_site info on the labels
Correctly show the dive_site information on the labels.
still crashes on accept / reject.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-25 13:53:20 -07:00
Tomaz Canabrava
f4c31f110f Clean code from the dive site edit
This is an edit dialog, not a create dialog.
This makes Subsurface crash but it's a step in the right direction.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-25 13:52:53 -07:00
Dirk Hohndel
05109b2d6c Don't hide location completion when user types space
Odd that I never noticed this until several people pointed it out to me.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-18 13:39:19 -07:00
Tomaz Canabrava
76e61bd8d9 Make sure we don't pass the wrong info
We were returning false here which meant that we were
overriding the information with the wrong value later.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-17 10:27:52 -07:00
Dirk Hohndel
f98ace681a Dive site edit: add second "create" line without completion
We now have TWO special entries. One with just what the user has typed and
one with the first completion of that text. This way both Henrik and Linus
can get what they want. I'm not sure I love this, but it's easy to revert
if the consensus is that this is too confusing. But it's much easier to
discuss this if people can actually play with it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16 12:22:56 -07:00