| 
									
										
										
										
											2013-07-31 11:29:42 +00:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Reads an ADIF log file into memory | 
					
						
							|  |  |  |  * Searches log for call, band and mode | 
					
						
							|  |  |  |  * VK3ACF July 2013 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef __ADIF_H
 | 
					
						
							|  |  |  | #define __ADIF_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-07 23:03:18 +00:00
										 |  |  | #if defined (QT5)
 | 
					
						
							|  |  |  | #include <QList>
 | 
					
						
							|  |  |  | #include <QString>
 | 
					
						
							| 
									
										
										
										
											2013-08-08 23:51:53 +00:00
										 |  |  | #include <QMultiHash>
 | 
					
						
							| 
									
										
										
										
											2013-08-07 23:03:18 +00:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2013-07-31 11:29:42 +00:00
										 |  |  | #include <QtGui>
 | 
					
						
							| 
									
										
										
										
											2013-08-07 23:03:18 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2013-07-31 11:29:42 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-09 20:45:53 +00:00
										 |  |  | class QDateTime; | 
					
						
							| 
									
										
										
										
											2013-07-31 11:29:42 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | class ADIF | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	public: | 
					
						
							| 
									
										
										
										
											2017-08-30 02:27:57 +00:00
										 |  |  | 	void init(QString const& filename); | 
					
						
							|  |  |  | 	void load(); | 
					
						
							|  |  |  | 	void add(QString const& call, QString const& band, QString const& mode, QString const& date); | 
					
						
							|  |  |  | 	bool match(QString const& call, QString const& band, QString const& mode) const; | 
					
						
							|  |  |  | 	QList<QString> getCallList() const; | 
					
						
							|  |  |  | 	int getCount() const; | 
					
						
							| 
									
										
										
										
											2013-07-31 11:29:42 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2013-09-06 05:00:28 +00:00
										 |  |  |         // open ADIF file and append the QSO details. Return true on success
 | 
					
						
							| 
									
										
										
										
											2017-08-30 02:27:57 +00:00
										 |  |  | 	bool addQSOToFile(QString const& hisCall, QString const& hisGrid, QString const& mode, QString const& rptSent, QString const& rptRcvd, QDateTime const& dateTimeOn, QDateTime const& dateTimeOff, QString const& band, | 
					
						
							|  |  |  | 										QString const& comments, QString const& name, QString const& strDialFreq, QString const& m_myCall, QString const& m_myGrid, QString const& m_txPower); | 
					
						
							| 
									
										
										
										
											2013-09-06 05:00:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-31 11:29:42 +00:00
										 |  |  | 	private: | 
					
						
							|  |  |  | 		struct QSO | 
					
						
							|  |  |  | 		{ | 
					
						
							|  |  |  | 		  QString call,band,mode,date; | 
					
						
							|  |  |  | 		};		   | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-09 20:45:53 +00:00
										 |  |  | 		QMultiHash<QString, QSO> _data; | 
					
						
							| 
									
										
										
										
											2013-07-31 11:29:42 +00:00
										 |  |  | 		QString _filename; | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2017-09-16 20:27:05 +00:00
										 |  |  | 		QString extractField(QString const& line, QString const& fieldName) const; | 
					
						
							| 
									
										
										
										
											2013-07-31 11:29:42 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 |