| 
									
										
										
										
											2015-05-28 15:00:58 -03:00
										 |  |  | #ifndef CLEANERTABLEMODEL_H
 | 
					
						
							|  |  |  | #define CLEANERTABLEMODEL_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QAbstractTableModel>
 | 
					
						
							|  |  |  | #include <QStringList>
 | 
					
						
							| 
									
										
										
										
											2015-05-28 17:17:09 -03:00
										 |  |  | #include <QPixmap>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Retrieve the trash icon pixmap, common to most table models */ | 
					
						
							|  |  |  | const QPixmap &trashIcon(); | 
					
						
							| 
									
										
										
										
											2015-05-28 15:00:58 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* When using a QAbstractTableModel, consider using this instead
 | 
					
						
							|  |  |  |  * of the default implementation, as it's easyer to setup the columns | 
					
						
							|  |  |  |  * and headers. | 
					
						
							|  |  |  |  * Most subsurface classes uses this one to save loads of lines | 
					
						
							|  |  |  |  * of code and share a consistent layout. */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class CleanerTableModel : public QAbstractTableModel { | 
					
						
							|  |  |  | 	Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	explicit CleanerTableModel(QObject *parent = 0); | 
					
						
							|  |  |  | 	virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; | 
					
						
							|  |  |  | 	virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  | 	void setHeaderDataStrings(const QStringList &headers); | 
					
						
							| 
									
										
										
										
											2015-05-28 16:23:49 -03:00
										 |  |  | signals: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* instead of using QMessageBox directly, wire a QWidget to this signal and display the result.
 | 
					
						
							|  |  |  | 	 * This is because the QModels will be used from the Mobile version and the desktop version. */ | 
					
						
							|  |  |  | 	void warningMessage(const QString& title, const QString& message); | 
					
						
							| 
									
										
										
										
											2015-05-28 15:00:58 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  | 	QStringList headers; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-28 16:23:49 -03:00
										 |  |  | /* Has the string value changed */ | 
					
						
							|  |  |  | #define CHANGED() \
 | 
					
						
							|  |  |  | 	(vString = value.toString()) != data(index, role).toString() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-28 15:00:58 -03:00
										 |  |  | #endif
 |