Make direct edit the style of choice

Plus minor coding style fixes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-05-19 09:00:57 -07:00
parent 9b1a3e09d1
commit a4f243dfac
2 changed files with 8 additions and 24 deletions

View file

@ -28,9 +28,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui->diveNotesMessage->hide();
ui->diveNotesMessage->setCloseButtonVisible(false);
#if EDIT_STYLE
ui->rating->setReadOnly(true);
#else
ui->location->setReadOnly(false);
ui->divemaster->setReadOnly(false);
ui->buddy->setReadOnly(false);
@ -46,7 +43,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui->suit->installEventFilter(this);
ui->notes->installEventFilter(this);
ui->rating->installEventFilter(this);
#endif
/* example of where code is more concise than Qt designer */
QList<QObject *> infoTabWidgets = ui->infoTab->children();
@ -273,18 +269,15 @@ void MainTab::on_editNotes_clicked(bool edit)
notesBackup.location = ui->location->text();
notesBackup.rating = ui->rating->currentStars();
ui->editNotes->setText(tr("OK"));
}
else{
} else {
ui->diveNotesMessage->animatedHide();
ui->editNotes->setText(tr("edit"));
}
#if !EDIT_STYLE
if (!edit) {
ui->editNotes->hide();
ui->resetNotes->hide();
}
#endif
}
void MainTab::on_resetNotes_clicked()
@ -292,9 +285,6 @@ void MainTab::on_resetNotes_clicked()
if (!ui->editNotes->isChecked())
return;
#if EDIT_STYLE
ui->editNotes->setText(tr("edit"));
#endif
ui->buddy->setText(notesBackup.buddy);
ui->suit->setText(notesBackup.suit);
ui->notes->setText(notesBackup.notes);
@ -312,10 +302,8 @@ void MainTab::on_resetNotes_clicked()
ui->rating->setReadOnly(true);
mainWindow()->dive_list()->setEnabled(true);
#if !EDIT_STYLE
ui->editNotes->hide();
ui->resetNotes->hide();
#endif
}
#define EDIT_NOTES(what, text) \

View file

@ -26,10 +26,6 @@ struct NotesBackup{
QString divemaster;
};
#define DIRK_EDIT_STYLE 0
#define TEST_EDIT_STYLE 1
#define EDIT_STYLE DIRK_EDIT_STYLE
class MainTab : public QTabWidget
{
Q_OBJECT