summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--qt-ui/maintab.cpp37
-rw-r--r--qt-ui/maintab.h4
-rw-r--r--qt-ui/maintab.ui6
3 files changed, 21 insertions, 26 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) \
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index 7acb27d11..f48cdace5 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -46,8 +46,8 @@ public Q_SLOTS:
void on_editWeight_clicked();
void on_delWeight_clicked();
void updateDiveInfo(int dive);
- void on_editNotes_clicked(bool edit);
- void on_resetNotes_clicked();
+ void on_editAccept_clicked(bool edit);
+ void on_editReset_clicked();
void on_location_textChanged(const QString& text);
void on_divemaster_textChanged(const QString& text);
void on_buddy_textChanged(const QString& text);
diff --git a/qt-ui/maintab.ui b/qt-ui/maintab.ui
index 74a9b15ad..ea66b391d 100644
--- a/qt-ui/maintab.ui
+++ b/qt-ui/maintab.ui
@@ -102,16 +102,16 @@
<widget class="StarWidget" name="rating" native="true"/>
</item>
<item row="10" column="1">
- <widget class="QPushButton" name="resetNotes">
+ <widget class="QPushButton" name="editReset">
<property name="text">
<string>reset</string>
</property>
</widget>
</item>
<item row="10" column="0">
- <widget class="QPushButton" name="editNotes">
+ <widget class="QPushButton" name="editAccept">
<property name="text">
- <string>edit</string>
+ <string>OK</string>
</property>
<property name="checkable">
<bool>true</bool>