summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-17 15:27:49 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-17 15:27:49 -0700
commit2d68214eac604c104226e2638161c0e4fd14fc79 (patch)
treeda091aca941be9cde9397d71cd8f3547f9c651db
parentd0145621a1d6a76922cc271208e07ed5827a6590 (diff)
downloadsubsurface-2d68214eac604c104226e2638161c0e4fd14fc79.tar.gz
Planner: show new icon to indicate that last point can't be deleted
Having the trash can disappear is somewhat intuitive, but I'd argue this is even more so. Fixes #789 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--icons/trash-forbidden.pngbin0 -> 4105 bytes
-rw-r--r--qt-models/cleanertablemodel.h1
-rw-r--r--qt-models/diveplannermodel.cpp4
-rw-r--r--qt-models/models.cpp5
-rw-r--r--subsurface.qrc1
5 files changed, 11 insertions, 0 deletions
diff --git a/icons/trash-forbidden.png b/icons/trash-forbidden.png
new file mode 100644
index 000000000..83d46fd54
--- /dev/null
+++ b/icons/trash-forbidden.png
Binary files differ
diff --git a/qt-models/cleanertablemodel.h b/qt-models/cleanertablemodel.h
index c47cf87f4..974d822e6 100644
--- a/qt-models/cleanertablemodel.h
+++ b/qt-models/cleanertablemodel.h
@@ -7,6 +7,7 @@
/* Retrieve the trash icon pixmap, common to most table models */
const QPixmap &trashIcon();
+const QPixmap &trashForbiddenIcon();
/* When using a QAbstractTableModel, consider using this instead
* of the default implementation, as it's easyer to setup the columns
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp
index 005061feb..cb221a0ad 100644
--- a/qt-models/diveplannermodel.cpp
+++ b/qt-models/diveplannermodel.cpp
@@ -218,12 +218,16 @@ QVariant DivePlannerPointsModel::data(const QModelIndex &index, int role) const
case REMOVE:
if (rowCount() > 1)
return p.entered ? trashIcon() : QVariant();
+ else
+ return trashForbiddenIcon();
}
} else if (role == Qt::SizeHintRole) {
switch (index.column()) {
case REMOVE:
if (rowCount() > 1)
return p.entered ? trashIcon().size() : QVariant();
+ else
+ return trashForbiddenIcon().size();
}
} else if (role == Qt::FontRole) {
if (divepoints.at(index.row()).entered) {
diff --git a/qt-models/models.cpp b/qt-models/models.cpp
index fa046ff3f..6f6b501de 100644
--- a/qt-models/models.cpp
+++ b/qt-models/models.cpp
@@ -18,6 +18,11 @@ const QPixmap &trashIcon()
return trash;
}
+const QPixmap &trashForbiddenIcon()
+{
+ static QPixmap trash = QPixmap(":trashForbidden").scaledToHeight(defaultIconMetrics().sz_small);
+ return trash;
+}
Qt::ItemFlags GasSelectionModel::flags(const QModelIndex &index) const
{
diff --git a/subsurface.qrc b/subsurface.qrc
index 1eaa8cc70..2672866a3 100644
--- a/subsurface.qrc
+++ b/subsurface.qrc
@@ -5,6 +5,7 @@
<file alias="subsurface-mobile-icon">icons/subsurface-mobile-icon.png</file>
<file alias="plus">icons/plus.png</file>
<file alias="trash">icons/trash.png</file>
+ <file alias="trashForbidden">icons/trash-forbidden.png</file>
<file alias="units">icons/units.png</file>
<file alias="advanced">icons/advanced.png</file>
<file alias="network">icons/network.png</file>