Cleanup: remove field-coloring code in MainTab

Since all fields on the maintab are now directly edited,
there is no point in marking fields as changed. Remove
unused functions MainTab::markChangedWidget() and
MainTab::resetPalette().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-02-24 21:31:34 +01:00 committed by Dirk Hohndel
parent d7d408a99e
commit c4ad477d07
2 changed files with 0 additions and 35 deletions

View file

@ -773,7 +773,6 @@ void MainTab::acceptChanges()
emit addDiveFinished();
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::NOTHING);
MainWindow::instance()->diveList->setFocus();
resetPallete();
displayed_dive.divetrip = nullptr; // Should not be necessary, just in case!
return;
} else {
@ -871,7 +870,6 @@ void MainTab::acceptChanges()
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::NOTHING);
}
int scrolledBy = MainWindow::instance()->diveList->verticalScrollBar()->sliderPosition();
resetPallete();
if (lastMode == MANUALLY_ADDED_DIVE) {
MainWindow::instance()->diveList->reload();
int newDiveNr = get_divenr(get_dive_by_uniq_id(addedId));
@ -897,25 +895,6 @@ void MainTab::acceptChanges()
editMode = NONE;
}
void MainTab::resetPallete()
{
QPalette p;
ui.buddy->setPalette(p);
ui.notes->setPalette(p);
ui.location->setPalette(p);
ui.divemaster->setPalette(p);
ui.suit->setPalette(p);
ui.airtemp->setPalette(p);
ui.DiveType->setPalette(p);
ui.watertemp->setPalette(p);
ui.dateEdit->setPalette(p);
ui.timeEdit->setPalette(p);
ui.tagWidget->setPalette(p);
ui.diveTripLocation->setPalette(p);
ui.duration->setPalette(p);
ui.depth->setPalette(p);
}
void MainTab::rejectChanges()
{
EditMode lastMode = editMode;
@ -935,7 +914,6 @@ void MainTab::rejectChanges()
tabBar()->setTabIcon(0, QIcon()); // Notes
tabBar()->setTabIcon(1, QIcon()); // Equipment
hideMessage();
resetPallete();
// no harm done to call cancelPlan even if we were not in ADD or PLAN mode...
DivePlannerPointsModel::instance()->cancelPlan();
if(lastMode == ADD)
@ -965,17 +943,6 @@ void MainTab::rejectChanges()
ui.editDiveSiteButton->setEnabled(!ui.location->text().isEmpty());
}
void MainTab::markChangedWidget(QWidget *w)
{
QPalette p;
qreal h, s, l, a;
enableEdition();
qApp->palette().color(QPalette::Text).getHslF(&h, &s, &l, &a);
p.setBrush(QPalette::Base, (l <= 0.3) ? QColor(Qt::yellow).lighter() : (l <= 0.6) ? QColor(Qt::yellow).light() : /* else */ QColor(Qt::yellow).darker(300));
w->setPalette(p);
modified = true;
}
static QStringList stringToList(const QString &s)
{
QStringList res = s.split(",", QString::SkipEmptyParts);

View file

@ -114,9 +114,7 @@ private:
bool lastSelectedDive;
int lastTabSelectedDive;
int lastTabSelectedDiveTrip;
void resetPallete();
void copyTagsToDisplayedDive();
void markChangedWidget(QWidget *w);
dive_trip_t *currentTrip;
QList<TabBase*> extraWidgets;
};