summaryrefslogtreecommitdiffstats
path: root/plugins/channel/tcpsrc/tcpsrcplugin.cpp
blob: 81b654bda6160dd50f12b87adc2cfde5373590ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <QtPlugin>
#include <QAction>
#include "plugin/pluginapi.h"
#include "tcpsrcplugin.h"
#include "tcpsrcgui.h"

const PluginDescriptor TCPSrcPlugin::m_pluginDescriptor = {
	QString("TCP Channel Source"),
	QString("---"),
	QString("(c) maintech GmbH (written by Christian Daniel)"),
	QString("http://www.maintech.de"),
	true,
	QString("http://www.maintech.de")
};

TCPSrcPlugin::TCPSrcPlugin(QObject* parent) :
	QObject(parent)
{
}

const PluginDescriptor& TCPSrcPlugin::getPluginDescriptor() const
{
	return m_pluginDescriptor;
}

void TCPSrcPlugin::initPlugin(PluginAPI* pluginAPI)
{
	m_pluginAPI = pluginAPI;

	// register TCP Channel Source
	QAction* action = new QAction(tr("&TCP Source"), this);
	connect(action, SIGNAL(triggered()), this, SLOT(createInstanceTCPSrc()));
	m_pluginAPI->registerChannel("de.maintech.sdrangelove.channel.tcpsrc", this, action);
}

PluginGUI* TCPSrcPlugin::createChannel(const QString& channelName)
{
	if(channelName == "de.maintech.sdrangelove.channel.tcpsrc") {
		TCPSrcGUI* gui = TCPSrcGUI::create(m_pluginAPI);
		m_pluginAPI->registerChannelInstance("de.maintech.sdrangelove.channel.tcpsrc", gui);
		m_pluginAPI->addChannelRollup(gui);
		return gui;
	} else {
		return NULL;
	}
}

void TCPSrcPlugin::createInstanceTCPSrc()
{
	TCPSrcGUI* gui = TCPSrcGUI::create(m_pluginAPI);
	m_pluginAPI->registerChannelInstance("de.maintech.sdrangelove.channel.tcpsrc", gui);
	m_pluginAPI->addChannelRollup(gui);
	//m_pluginAPI->registerChannelInstance("de.maintech.sdrangelove.channel.tcpsrc", TCPSrcGUI::create(m_pluginAPI));
}