summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-19 09:00:57 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-19 09:00:57 -0700
commita4f243dfacffb599d89de869c35c153ec5596d50 (patch)
tree4fa6c895d273de36e9ba771dbcb9e9622c36e7f7 /qt-ui
parent9b1a3e09d170275156d75e8daad65dde7ff4735d (diff)
downloadsubsurface-a4f243dfacffb599d89de869c35c153ec5596d50.tar.gz
Make direct edit the style of choice
Plus minor coding style fixes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/maintab.cpp28
-rw-r--r--qt-ui/maintab.h4
2 files changed, 8 insertions, 24 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index c5c8ebda0..2f29021e4 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -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,17 +43,16 @@ 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();
- Q_FOREACH( QObject* obj, infoTabWidgets ){
+ Q_FOREACH(QObject* obj, infoTabWidgets) {
QLabel* label = qobject_cast<QLabel *>(obj);
if (label)
label->setAlignment(Qt::AlignHCenter);
}
QList<QObject *> statisticsTabWidgets = ui->statisticsTab->children();
- Q_FOREACH( QObject* obj, statisticsTabWidgets ){
+ Q_FOREACH(QObject* obj, statisticsTabWidgets) {
QLabel* label = qobject_cast<QLabel *>(obj);
if (label)
label->setAlignment(Qt::AlignHCenter);
@@ -65,8 +61,8 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
bool MainTab::eventFilter(QObject* object, QEvent* event)
{
- if(event->type() == QEvent::FocusIn){
- if (ui->editNotes->isVisible()){
+ if (event->type() == QEvent::FocusIn) {
+ if (ui->editNotes->isVisible()) {
return false;
}
ui->editNotes->setChecked(true);
@@ -204,7 +200,7 @@ void MainTab::on_addCylinder_clicked()
dialog.setCylinder(newCylinder);
int result = dialog.exec();
- if (result == QDialog::Rejected){
+ if (result == QDialog::Rejected) {
return;
}
@@ -263,7 +259,7 @@ void MainTab::on_editNotes_clicked(bool edit)
mainWindow()->dive_list()->setEnabled(!edit);
- if (edit){
+ if (edit) {
ui->diveNotesMessage->setText("This dive is being edited. click on finish / reset when ready.");
ui->diveNotesMessage->animatedShow();
notesBackup.buddy = ui->buddy->text();
@@ -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){
+ 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) \
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index afd06b529..7acb27d11 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -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