mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-17 19:36:15 +00:00
Dive site: Add button to display all dive sites
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>
This commit is contained in:
parent
4a61f155d3
commit
32720a7c18
5 changed files with 28 additions and 0 deletions
|
@ -579,6 +579,20 @@ void DiveLocationLineEdit::showPopup()
|
|||
setTemporaryDiveSiteName(text());
|
||||
}
|
||||
|
||||
void DiveLocationLineEdit::showAllSites()
|
||||
{
|
||||
if (!view->isVisible()) {
|
||||
// By setting the "temporary dive site name" to the empty string,
|
||||
// all dive sites are shown sorted by distance from the site of
|
||||
// the current dive.
|
||||
setTemporaryDiveSiteName(QString());
|
||||
|
||||
// By selecting the whole text, the user can immediately start
|
||||
// typing to activate the full-text filter.
|
||||
selectAll();
|
||||
}
|
||||
}
|
||||
|
||||
DiveLocationLineEdit::DiveSiteType DiveLocationLineEdit::currDiveSiteType() const
|
||||
{
|
||||
return currType;
|
||||
|
|
|
@ -93,6 +93,7 @@ public:
|
|||
struct dive_site *currDiveSite() const;
|
||||
void fixPopupPosition();
|
||||
void setCurrentDiveSite(struct dive *d);
|
||||
void showAllSites();
|
||||
|
||||
signals:
|
||||
void diveSiteSelected();
|
||||
|
|
|
@ -829,6 +829,11 @@ void MainTab::on_location_diveSiteSelected()
|
|||
Command::editDiveSite(newDs, false);
|
||||
}
|
||||
|
||||
void MainTab::on_locationPopupButton_clicked()
|
||||
{
|
||||
ui.location->showAllSites();
|
||||
}
|
||||
|
||||
void MainTab::on_diveTripLocation_editingFinished()
|
||||
{
|
||||
if (!currentTrip)
|
||||
|
|
|
@ -57,6 +57,7 @@ slots:
|
|||
void acceptChanges();
|
||||
void rejectChanges();
|
||||
void on_location_diveSiteSelected();
|
||||
void on_locationPopupButton_clicked();
|
||||
void on_divemaster_editingFinished();
|
||||
void on_buddy_editingFinished();
|
||||
void on_suit_editingFinished();
|
||||
|
|
|
@ -216,6 +216,13 @@
|
|||
<item>
|
||||
<widget class="DiveLocationLineEdit" name="location"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="locationPopupButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="editDiveSiteButton">
|
||||
<property name="toolTip">
|
||||
|
|
Loading…
Add table
Reference in a new issue