From 506b1338750ba9f29b80e7909693f60781a54ccc Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Wed, 18 Sep 2013 22:38:38 -0300 Subject: Add a Warning icon on the changed tabs, for edition of dives. Adds a Warning icon on the changed tabs, this is important as usability, for you could change something on the 'notes' tab, change the tab and did't realized that something was changed ( by forgotting or something ), then clicking on the cancel button. so now there's a friendly reminder that you actually changed something. Signed-off-by: Tomaz Canabrava --- icons/warning.png | Bin 0 -> 24526 bytes qt-ui/maintab.cpp | 7 ++++++- qt-ui/mainwindow.h | 1 - subsurface.qrc | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 icons/warning.png diff --git a/icons/warning.png b/icons/warning.png new file mode 100644 index 000000000..cf53cddc3 Binary files /dev/null and b/icons/warning.png differ diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 5905285fa..3b879133b 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -132,10 +132,12 @@ void MainTab::enableEdition() bool MainTab::eventFilter(QObject* object, QEvent* event) { if (isEnabled() && event->type() == QEvent::FocusIn && (object == ui->rating || object == ui->visibility)){ + tabBar()->setTabIcon(currentIndex(), QIcon(":warning")); enableEdition(); } if (isEnabled() && event->type() == QEvent::MouseButtonPress ) { + tabBar()->setTabIcon(currentIndex(), QIcon(":warning")); enableEdition(); } return false; // don't "eat" the event. @@ -340,7 +342,8 @@ void MainTab::reload() void MainTab::acceptChanges() { mainWindow()->dive_list()->setEnabled(true); - + tabBar()->setTabIcon(0, QIcon()); // Notes + tabBar()->setTabIcon(1, QIcon()); // Equipment ui->diveNotesMessage->animatedHide(); ui->notesButtonBox->hide(); /* now figure out if things have changed */ @@ -388,6 +391,8 @@ void MainTab::acceptChanges() void MainTab::rejectChanges() { + tabBar()->setTabIcon(0, QIcon()); // Notes + tabBar()->setTabIcon(1, QIcon()); // Equipment mainWindow()->dive_list()->setEnabled(true); if (mainWindow() && mainWindow()->dive_list()->selectedTrips.count() == 1){ ui->notes->setText(notesBackup[NULL].notes ); diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h index 6cc99db96..b30f10a03 100644 --- a/qt-ui/mainwindow.h +++ b/qt-ui/mainwindow.h @@ -14,7 +14,6 @@ struct DiveList; class QSortFilterProxyModel; class DiveTripModel; - namespace Ui { class MainWindow; diff --git a/subsurface.qrc b/subsurface.qrc index cf7864b27..4e9e8ff84 100644 --- a/subsurface.qrc +++ b/subsurface.qrc @@ -10,6 +10,7 @@ icons/minimum.svg icons/maximum.svg icons/average.svg + icons/warning.png qt-ui/css/tableviews.css -- cgit v1.2.3-70-g09d2