aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/locationinformation.cpp
AgeCommit message (Collapse)Author
2015-06-27Add missing return statementGravatar Dirk Hohndel
We act on the event but don't consume it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: fix adding a new dive and chaning notes / descriptionGravatar Tomaz Canabrava
I had to create an event filter to deal with the missing callbacks from QPlainTextEdit (it doesn't support editingFinished()). Also we need to manually create a dive site on a newly added dive if the user entered one. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: change the default sizes of the dialogGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: better member nameGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: try to fix a crashGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: fill and change the current dive siteGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: correctly position the edit site widgetGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: create a dive site edit dialog without bordersGravatar Tomaz Canabrava
Plan is to make it pretty later. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-07Change the name of the dive site on the globeGravatar Tomaz Canabrava
The name of the dive site on the globe wasn't being updated when we changed the name of it in the dive management dialog. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-07Reset the current dive site when we reject itGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-07Always fill the fields in LocationInformation edit widget.Gravatar Tomaz Canabrava
If the current_dive was the same as the dive send to the LocationInformation widget, we would do nothing, wich is wrong because we could have filled the information on an add_dive_site action and then cancelled it, so the info will stay there until we change it. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03Fix acceptChanges for add modeGravatar Tomaz Canabrava
We didn't save the uuid of the newly created dive site on the affected dive. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03Fix reject changes for add/editGravatar Tomaz Canabrava
Reject changes was correct only for Edit, but not for Add. When in add mode we need to retrieve the old dive site, and when in edit mode we should do nothing. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03Do not set the state of the application from here.Gravatar Tomaz Canabrava
The mainwindow should manage the mainwindow. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03Fire signals for edit and filteringGravatar Tomaz Canabrava
Edit will always fire, Filtering only if the dive site already exists. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03Only filter by divesite if the divesite existsGravatar Tomaz Canabrava
And not when we are adding a new dive site. Also, remove hide button call. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03Reset state: have a correct dive site being displayedGravatar Tomaz Canabrava
I'm not sure if this is the right approach, but it seems to work: when we reset the state of the widget, we try to get the current dive site from the current dive, and set it. This way it will work for the globe later. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03Current dive site has nothing to do with enableEditionGravatar Tomaz Canabrava
It will be set later. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03Fix the message buttons in dive_site_editGravatar Tomaz Canabrava
Some button management operations where unnecessary. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03Different states for edit / add dive siteGravatar Tomaz Canabrava
When we start the dive site edit dialog, either for add or for edit, we don't save the state, so the reject state didn't know what to do with the dive site. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01Simplify model handling and crashes fixesGravatar Tomaz Canabrava
So, there's only one crash left (that I put a big TODO: on the maintab.cpp about) and I'll fix it tomorrow as it's quite late here and I'm almost sleeping at the keyboard. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01Remove unused methodGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01Remove Combobox from LocationManagementGravatar Tomaz Canabrava
I tought about it a bit, and the combobox of the location management was a bit overkill - we already have another combobox to select the divesite and also the plus button to add one. If the user wanna edit the current divesite, he can go to menu and edit it. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01Correctly change the dive_site nameGravatar Tomaz Canabrava
Correctly change and update the dive_site, updating the name on the combobox or other attached views. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01Create a new DiveSite when user clicks on addGravatar Tomaz Canabrava
Also reorganized a bit of the code, and renamed a few misleading methods. [Dirk Hohndel: remove some C++11 code] Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31Organize the dive_sites alphabeticallyGravatar Tomaz Canabrava
run std::sort on the dive_site list inside of the model. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31Fix crash when cancelling divesite edit with empty divesiteGravatar Tomaz Canabrava
Only happens if you dont't have any divesites in your list, but either way, it could happen. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29Update DiveLocationModel when thread finishesGravatar Tomaz Canabrava
This patch updates the DiveLocationModel when the GeoLoockupInformationThread finishes, and also selects the correct index for the displayed dive. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29LocationInformationModel moved to qt-modelsGravatar Tomaz Canabrava
I forgot about this one, and we are going to use it in the mobile version too. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-27Fix crash when rejecting dive site changesGravatar Dirk Hohndel
Emitting the stopFilterDiveSite signal caused us to clean up the UI which reset currentDs to NULL if this was a new dive site... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-27Start editing new site regardless what the user does firstGravatar Dirk Hohndel
It doesn't matter if we first enter coordinates, name, description or notes. If there is no currentDs we need to handle that gracefully. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-27Dive site management: make sure currentDs is validGravatar Dirk Hohndel
When double clicking on the globe on a dive with no dive site we did almost the right thing - except that we didn't create a dive site. Not 100% sure this is the right place to do this, but it seems to work and prevents the crash. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-26Filter out the dives that are not at dive_site.Gravatar Tomaz Canabrava
Untested code to filter out dives that are not at the active dive_site. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-26Only repopulate model when needed.Gravatar Tomaz Canabrava
The old way we set the location and *then* updated the model, so the very first location that we tried to show was empty. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-26Show the correct dive_site on the manage comboboxGravatar Tomaz Canabrava
When triggering the dive_site management, we need to get the uuid that was send to us and set it as the current dive_site on the combobox, the dialog can fill all required info for us. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-26Do not create a new dive site when curr is invalidGravatar Tomaz Canabrava
We will however create a new dive site when the user clicks on the add button - creating it here would led to strange behavior. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-26Don't setLocationId when accept/reject changesGravatar Tomaz Canabrava
setLocationId will filter the dives, so ignore the visual changes when accepting / rejecting, it will only be triggered again when we are showing this dialog again. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-22Location management: reflect changes to a location's nameGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-22Location management: reflect changes to the coordinates on the mapGravatar Dirk Hohndel
This is a bit aggressive as it changes the globe with every single character that's entered, but it's better than what we had before. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-22Location management: actually parse the GPS coordinatesGravatar Dirk Hohndel
We still don't respond correctly to a user changing them (i.e., the map doesn't change), but at least once they change the dive to a different dive and back to this one things get done correctly. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17Fix easily reproduced crashGravatar Dirk Hohndel
Open dive file. Click Location-manage. Pick a site. Click close. Click Location-manage again. BOOM. This seems to make sense, but since not a lot of the code is hooked up yet, I'm not sure this is what we want in the end. But for now it prevents an easily reproduced crash. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17Update the dive location when showing the dialogGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17Implement the row count for location informationGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17Implement the data method for location informationGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17Start the model for location information.Gravatar Tomaz Canabrava
And implement the reset method. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17Move Locationinformation to its own file.Gravatar Tomaz Canabrava
The SimpleWidgets file was getting too big, and location information will also need a new model - a good way to do not mix everything is to put things in a new file. [Dirk Hohndel: added missing include of stdint.h] Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>