summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-19 12:56:27 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-19 12:59:36 -0700
commit9ffa37ab6fa26e950060e11323d78d7a3ecedcf1 (patch)
tree7f6c4010cbfe768ed2541f54c21b40f1aafe5ccb /qt-ui/maintab.cpp
parenta4f243dfacffb599d89de869c35c153ec5596d50 (diff)
downloadsubsurface-9ffa37ab6fa26e950060e11323d78d7a3ecedcf1.tar.gz
Rename buttons for dive edit
The old names made sense in the initial model (where you'd click on the edit button to start an edit). The new names seem much more natural given what we do now. Also a tiny code cleanup removing a redundant if statement. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp37
1 files changed, 16 insertions, 21 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 2f29021e4..0ded30da3 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -34,8 +34,8 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui->suit->setReadOnly(false);
ui->notes->setReadOnly(false);
ui->rating->setReadOnly(false);
- ui->editNotes->hide();
- ui->resetNotes->hide();
+ ui->editAccept->hide();
+ ui->editReset->hide();
ui->location->installEventFilter(this);
ui->divemaster->installEventFilter(this);
@@ -62,13 +62,13 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
bool MainTab::eventFilter(QObject* object, QEvent* event)
{
if (event->type() == QEvent::FocusIn) {
- if (ui->editNotes->isVisible()) {
+ if (ui->editAccept->isVisible()) {
return false;
}
- ui->editNotes->setChecked(true);
- ui->editNotes->show();
- ui->resetNotes->show();
- on_editNotes_clicked(true);
+ ui->editAccept->setChecked(true);
+ ui->editAccept->show();
+ ui->editReset->show();
+ on_editAccept_clicked(true);
}
return false;
}
@@ -248,7 +248,7 @@ void MainTab::reload()
cylindersModel->update();
}
-void MainTab::on_editNotes_clicked(bool edit)
+void MainTab::on_editAccept_clicked(bool edit)
{
ui->location->setReadOnly(!edit);
ui->divemaster->setReadOnly(!edit);
@@ -260,7 +260,7 @@ void MainTab::on_editNotes_clicked(bool edit)
mainWindow()->dive_list()->setEnabled(!edit);
if (edit) {
- ui->diveNotesMessage->setText("This dive is being edited. click on finish / reset when ready.");
+ ui->diveNotesMessage->setText(tr("This dive is being edited. click on finish / reset when ready."));
ui->diveNotesMessage->animatedShow();
notesBackup.buddy = ui->buddy->text();
notesBackup.suit = ui->suit->text();
@@ -268,21 +268,16 @@ void MainTab::on_editNotes_clicked(bool edit)
notesBackup.divemaster = ui->divemaster->text();
notesBackup.location = ui->location->text();
notesBackup.rating = ui->rating->currentStars();
- ui->editNotes->setText(tr("OK"));
} else {
ui->diveNotesMessage->animatedHide();
- ui->editNotes->setText(tr("edit"));
- }
-
- if (!edit) {
- ui->editNotes->hide();
- ui->resetNotes->hide();
+ ui->editAccept->hide();
+ ui->editReset->hide();
}
}
-void MainTab::on_resetNotes_clicked()
+void MainTab::on_editReset_clicked()
{
- if (!ui->editNotes->isChecked())
+ if (!ui->editAccept->isChecked())
return;
ui->buddy->setText(notesBackup.buddy);
@@ -291,7 +286,7 @@ void MainTab::on_resetNotes_clicked()
ui->divemaster->setText(notesBackup.divemaster);
ui->location->setText(notesBackup.location);
ui->rating->setCurrentStars(notesBackup.rating);
- ui->editNotes->setChecked(false);
+ ui->editAccept->setChecked(false);
ui->diveNotesMessage->animatedHide();
ui->location->setReadOnly(true);
@@ -302,8 +297,8 @@ void MainTab::on_resetNotes_clicked()
ui->rating->setReadOnly(true);
mainWindow()->dive_list()->setEnabled(true);
- ui->editNotes->hide();
- ui->resetNotes->hide();
+ ui->editAccept->hide();
+ ui->editReset->hide();
}
#define EDIT_NOTES(what, text) \