| 
									
										
										
										
											2015-08-03 01:04:20 +02:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Copyright (C) 2015 Edouard Griffiths, F4EXB                                   //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is free software; you can redistribute it and/or modify          //
 | 
					
						
							|  |  |  | // it under the terms of the GNU General Public License as published by          //
 | 
					
						
							|  |  |  | // the Free Software Foundation as version 3 of the License, or                  //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is distributed in the hope that it will be useful,               //
 | 
					
						
							|  |  |  | // but WITHOUT ANY WARRANTY; without even the implied warranty of                //
 | 
					
						
							|  |  |  | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                  //
 | 
					
						
							|  |  |  | // GNU General Public License V3 for more details.                               //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // You should have received a copy of the GNU General Public License             //
 | 
					
						
							|  |  |  | // along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QtPlugin>
 | 
					
						
							|  |  |  | #include <QAction>
 | 
					
						
							|  |  |  | #include "plugin/pluginapi.h"
 | 
					
						
							|  |  |  | #include "util/simpleserializer.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "filesourcegui.h"
 | 
					
						
							|  |  |  | #include "filesourceplugin.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const PluginDescriptor FileSourcePlugin::m_pluginDescriptor = { | 
					
						
							|  |  |  | 	QString("File source input"), | 
					
						
							| 
									
										
										
										
											2015-09-02 01:16:40 +02:00
										 |  |  | 	QString("---"), | 
					
						
							| 
									
										
										
										
											2015-08-03 01:04:20 +02:00
										 |  |  | 	QString("(c) Edouard Griffiths, F4EXB"), | 
					
						
							| 
									
										
										
										
											2015-09-02 01:16:40 +02:00
										 |  |  | 	QString("https://github.com/f4exb/sdrangel"), | 
					
						
							| 
									
										
										
										
											2015-08-03 01:04:20 +02:00
										 |  |  | 	true, | 
					
						
							| 
									
										
										
										
											2015-09-02 01:16:40 +02:00
										 |  |  | 	QString("https://github.com/f4exb/sdrangel") | 
					
						
							| 
									
										
										
										
											2015-08-03 01:04:20 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-30 18:06:50 +02:00
										 |  |  | const QString FileSourcePlugin::m_deviceTypeID = FILESOURCE_DEVICE_TYPE_ID; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-03 01:04:20 +02:00
										 |  |  | FileSourcePlugin::FileSourcePlugin(QObject* parent) : | 
					
						
							|  |  |  | 	QObject(parent) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const PluginDescriptor& FileSourcePlugin::getPluginDescriptor() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return m_pluginDescriptor; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void FileSourcePlugin::initPlugin(PluginAPI* pluginAPI) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_pluginAPI = pluginAPI; | 
					
						
							| 
									
										
										
										
											2015-09-30 18:06:50 +02:00
										 |  |  | 	m_pluginAPI->registerSampleSource(m_deviceTypeID, this); | 
					
						
							| 
									
										
										
										
											2015-08-03 01:04:20 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PluginInterface::SampleSourceDevices FileSourcePlugin::enumSampleSources() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	SampleSourceDevices result; | 
					
						
							|  |  |  | 	int count = 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	for(int i = 0; i < count; i++) | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2015-10-01 05:44:33 +02:00
										 |  |  | 		QString displayedName(QString("FileSource[%1]").arg(i)); | 
					
						
							| 
									
										
										
										
											2015-09-30 06:57:40 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		result.append(SampleSourceDevice(displayedName, | 
					
						
							| 
									
										
										
										
											2015-09-30 18:06:50 +02:00
										 |  |  | 				m_deviceTypeID, | 
					
						
							| 
									
										
										
										
											2015-09-30 06:57:40 +02:00
										 |  |  | 				QString::null, | 
					
						
							|  |  |  | 				i)); | 
					
						
							| 
									
										
										
										
											2015-08-03 01:04:20 +02:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return result; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-30 08:55:58 +02:00
										 |  |  | PluginGUI* FileSourcePlugin::createSampleSourcePluginGUI(const QString& sourceId) | 
					
						
							| 
									
										
										
										
											2015-08-03 01:04:20 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2015-09-30 18:06:50 +02:00
										 |  |  | 	if(sourceId == m_deviceTypeID) | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2015-08-03 01:04:20 +02:00
										 |  |  | 		FileSourceGui* gui = new FileSourceGui(m_pluginAPI); | 
					
						
							|  |  |  | 		m_pluginAPI->setInputGUI(gui); | 
					
						
							|  |  |  | 		return gui; | 
					
						
							| 
									
										
										
										
											2015-09-30 18:06:50 +02:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2015-08-03 01:04:20 +02:00
										 |  |  | 		return NULL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } |