mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 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);
 | 
			
		||||
	if (!dive)
 | 
			
		||||
		return QVariant();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,7 +47,6 @@ public:
 | 
			
		|||
	QString displayTags() const;
 | 
			
		||||
	int countPhotos(dive *dive) const;
 | 
			
		||||
	int weight() const;
 | 
			
		||||
	QString icon_names[4];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct TripItem : public TreeItem {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue