aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-09-25 14:36:59 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-09-25 14:36:59 -0300
commit8ce5d91dfed3e147dce03d6bbfa117b48f9170da (patch)
treef7c9db59006a58b8de0e84602e9d98d52e9828d6
parent94c8f64316969d775209c398c0ee1e5b4981e2c9 (diff)
downloadsubsurface-8ce5d91dfed3e147dce03d6bbfa117b48f9170da.tar.gz
Code cleanup - create a method for cleaning the Palette.
Code cleanup, create a method for cleaning the palette, less code is better in this case. :) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
-rw-r--r--qt-ui/maintab.cpp19
-rw-r--r--qt-ui/maintab.h1
2 files changed, 9 insertions, 11 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index c48b89a6c..b0fd62041 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -448,6 +448,12 @@ void MainTab::acceptChanges()
}
editMode = NONE;
+ resetPallete();
+ mainWindow()->refreshDisplay();
+}
+
+void MainTab::resetPallete()
+{
QPalette p;
ui->buddy->setPalette(p);
ui->notes->setPalette(p);
@@ -458,9 +464,9 @@ void MainTab::acceptChanges()
ui->airtemp->setPalette(p);
ui->watertemp->setPalette(p);
ui->dateTimeEdit->setPalette(p);
- mainWindow()->refreshDisplay();
}
+
#define EDIT_TEXT2(what, text) \
textByteArray = text.toLocal8Bit(); \
free(what);\
@@ -537,16 +543,7 @@ void MainTab::rejectChanges()
ui->notesButtonBox->hide();
ui->equipmentButtonBox->hide();
notesBackup.clear();
- QPalette p;
- ui->buddy->setPalette(p);
- ui->notes->setPalette(p);
- ui->location->setPalette(p);
- ui->coordinates->setPalette(p);
- ui->divemaster->setPalette(p);
- ui->suit->setPalette(p);
- ui->airtemp->setPalette(p);
- ui->watertemp->setPalette(p);
- ui->dateTimeEdit->setPalette(p);
+ resetPallete();
if (editMode == ADD) {
// more clean up
updateDiveInfo(selected_dive);
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index af2ecc07c..5450c2d0e 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -94,6 +94,7 @@ private:
enum { NONE, DIVE, TRIP, ADD } editMode;
Completers completers;
void enableEdition();
+ void resetPallete();
};
#endif