mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 22:23:24 +00:00
Different states for edit / add dive site
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>
This commit is contained in:
parent
4c978eab2e
commit
612b068e33
4 changed files with 30 additions and 4 deletions
|
@ -101,6 +101,19 @@ void LocationInformationWidget::acceptChanges()
|
|||
emit coordinatesChanged();
|
||||
}
|
||||
|
||||
void LocationInformationWidget::editDiveSite(uint32_t uuid)
|
||||
{
|
||||
current_mode = EDIT_DIVE_SITE;
|
||||
setCurrentDiveSiteByUuid(uuid);
|
||||
}
|
||||
|
||||
void LocationInformationWidget::createDiveSite()
|
||||
{
|
||||
uint32_t uid = LocationInformationModel::instance()->addDiveSite(tr("untitled"));
|
||||
current_mode = CREATE_DIVE_SITE;
|
||||
setCurrentDiveSiteByUuid(uid);
|
||||
}
|
||||
|
||||
void LocationInformationWidget::rejectChanges()
|
||||
{
|
||||
if (currentDs && dive_site_is_empty(currentDs)) {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
class LocationInformationWidget : public QGroupBox {
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum mode{CREATE_DIVE_SITE, EDIT_DIVE_SITE};
|
||||
LocationInformationWidget(QWidget *parent = 0);
|
||||
protected:
|
||||
void showEvent(QShowEvent *);
|
||||
|
@ -15,8 +16,9 @@ protected:
|
|||
public slots:
|
||||
void acceptChanges();
|
||||
void rejectChanges();
|
||||
void setCurrentDiveSiteByUuid(uint32_t uuid);
|
||||
void updateGpsCoordinates(void);
|
||||
void updateGpsCoordinates();
|
||||
void editDiveSite(uint32_t uuid);
|
||||
void createDiveSite();
|
||||
void markChangedWidget(QWidget *w);
|
||||
void enableEdition();
|
||||
void resetState();
|
||||
|
@ -25,7 +27,11 @@ public slots:
|
|||
void on_diveSiteDescription_textChanged(const QString& text);
|
||||
void on_diveSiteName_textChanged(const QString& text);
|
||||
void on_diveSiteNotes_textChanged();
|
||||
private slots:
|
||||
void setCurrentDiveSiteByUuid(uint32_t uuid);
|
||||
signals:
|
||||
void startEditDiveSite(uint32_t uuid);
|
||||
void endEditDiveSite();
|
||||
void informationManagementEnded();
|
||||
void coordinatesChanged();
|
||||
void startFilterDiveSite(uint32_t uuid);
|
||||
|
@ -35,6 +41,7 @@ private:
|
|||
Ui::LocationInformation ui;
|
||||
bool modified;
|
||||
QAction *closeAction, *acceptAction, *rejectAction;
|
||||
mode current_mode;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -215,8 +215,13 @@ void MainWindow::on_actionManage_dive_sites_triggered() {
|
|||
enableDiveSiteEdit(displayed_dive.dive_site_uuid);
|
||||
}
|
||||
|
||||
void MainWindow::enableDiveSiteEdit(uint32_t id) {
|
||||
locationInformationWidget()->setCurrentDiveSiteByUuid(id);
|
||||
void MainWindow::enableDiveSiteCreation() {
|
||||
locationInformationWidget()->createDiveSite();
|
||||
setApplicationState("EditDiveSite");
|
||||
}
|
||||
|
||||
void MainWindow::enableDiveSiteEdit(uint32_t id) {
|
||||
locationInformationWidget()->editDiveSite(id);
|
||||
setApplicationState("EditDiveSite");
|
||||
}
|
||||
|
||||
|
|
|
@ -185,6 +185,7 @@ slots:
|
|||
void planCanceled();
|
||||
void planCreated();
|
||||
void setEnabledToolbar(bool arg1);
|
||||
void enableDiveSiteCreation();
|
||||
|
||||
private:
|
||||
Ui::MainWindow ui;
|
||||
|
|
Loading…
Add table
Reference in a new issue