mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Cleanup: remove DiveItem::icon_names member array
Each DiveItem (which is a wrapper around diveId with some virtual functions), had a member icon_names, which is an array of four QStrings. These were not used anywhere and must be an obscure oversight and was probably planned as a static cons array?. In any case, remove it. There *was* a function-local analogous icon_names array in DiveItem::data() though. This array would initialize four QStrings from C-string literals on every invocation. Make this array static, local to the translation unit and use the QStringLiteral macro to construct the QString object at compile-time. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
be50ee2017
commit
7dd49acf4b
2 changed files with 6 additions and 2 deletions
|
@ -82,11 +82,16 @@ QVariant TripItem::data(int column, int role) const
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const QString icon_names[4] = {
|
||||||
|
QStringLiteral(":zero"),
|
||||||
|
QStringLiteral(":photo-in-icon"),
|
||||||
|
QStringLiteral(":photo-out-icon"),
|
||||||
|
QStringLiteral(":photo-in-out-icon")
|
||||||
|
};
|
||||||
|
|
||||||
QVariant DiveItem::data(int column, int role) const
|
QVariant DiveItem::data(int column, int role) const
|
||||||
{
|
{
|
||||||
QVariant retVal;
|
QVariant retVal;
|
||||||
QString icon_names[4] = {":zero",":photo-in-icon", ":photo-out-icon", ":photo-in-out-icon" };
|
|
||||||
struct dive *dive = get_dive_by_uniq_id(diveId);
|
struct dive *dive = get_dive_by_uniq_id(diveId);
|
||||||
if (!dive)
|
if (!dive)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
|
@ -47,7 +47,6 @@ public:
|
||||||
QString displayTags() const;
|
QString displayTags() const;
|
||||||
int countPhotos(dive *dive) const;
|
int countPhotos(dive *dive) const;
|
||||||
int weight() const;
|
int weight() const;
|
||||||
QString icon_names[4];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TripItem : public TreeItem {
|
struct TripItem : public TreeItem {
|
||||||
|
|
Loading…
Reference in a new issue