From 4ea2f227d3fb0d9591bb4f18555420ac47f3397d Mon Sep 17 00:00:00 2001 From: wimpie Date: Fri, 02 Apr 2004 18:30:55 +0000 Subject: first import of NS2 app --- (limited to 'noncore/settings/networksettings2/irda') diff --git a/noncore/settings/networksettings2/irda/config.in b/noncore/settings/networksettings2/irda/config.in new file mode 100644 index 0000000..997cf55 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/config.in @@ -0,0 +1,4 @@ + config NS2IRDA + boolean "opie-networksettings2plugin-irda (set up IRDA)" + default "n" if NS2 + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NS2 && NS2CORE diff --git a/noncore/settings/networksettings2/irda/irda.pro b/noncore/settings/networksettings2/irda/irda.pro new file mode 100644 index 0000000..a7573b8 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irda.pro @@ -0,0 +1,17 @@ +TEMPLATE = lib +CONFIG += qt warn_on release +DESTDIR = $(OPIEDIR)/plugins/networksettings2 +HEADERS = irda_NN.h \ + irda_NNI.h \ + irdaedit.h +SOURCES = irda_NN.cpp \ + irda_NNI.cpp \ + irdaedit.cpp +INCLUDEPATH += $(OPIEDIR)/include ../ ../networksettings2 +DEPENDPATH += $(OPIEDIR)/include ../ ../networksettings2 +LIBS += -lqpe +INTERFACES = irdaGUI.ui +TARGET = irda +VERSION = 1.0.0 + +include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/settings/networksettings2/irda/irdaGUI.ui b/noncore/settings/networksettings2/irda/irdaGUI.ui new file mode 100644 index 0000000..f8a7020 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irdaGUI.ui @@ -0,0 +1,131 @@ + +IRDAGUI + + QWidget + + name + IRDA_FRM + + + geometry + + 0 + 0 + 283 + 199 + + + + caption + IRDA + + + layoutMargin + + + layoutSpacing + + + + margin + 2 + + + spacing + 2 + + + QLayoutWidget + + name + Layout4 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + TextLabel4 + + + text + Name + + + + QLineEdit + + name + Name_LE + + + + + + QLabel + + name + TextLabel3 + + + text + Description + + + + QMultiLineEdit + + name + Description_LE + + + + QLayoutWidget + + name + Layout5 + + + + margin + 0 + + + spacing + 6 + + + QCheckBox + + name + Automatic_CB + + + text + Start automatically + + + + QCheckBox + + name + Confirm_CB + + + text + Confirm before start + + + + + + + diff --git a/noncore/settings/networksettings2/irda/irda_NN.cpp b/noncore/settings/networksettings2/irda/irda_NN.cpp new file mode 100644 index 0000000..3b9c938 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irda_NN.cpp @@ -0,0 +1,59 @@ +#include "irda_NN.h" +#include "irda_NNI.h" + +static const char * IRDANeeds[] = + { 0 + }; + +/** + * Constructor, find all of the possible interfaces + */ +IRDANetNode::IRDANetNode() : ANetNode() { +} + +/** + * Delete any interfaces that we own. + */ +IRDANetNode::~IRDANetNode(){ +} + +const QString IRDANetNode::nodeDescription(){ + return tr("\ +

Sets up a infra red serial link.

\ +" +); +} + +ANetNodeInstance * IRDANetNode::createInstance( void ) { + return new AIRDA( this ); +} + +const char ** IRDANetNode::needs( void ) { + return IRDANeeds; +} + +const char * IRDANetNode::provides( void ) { + return "line"; +} + +bool IRDANetNode::generateProperFilesFor( + ANetNodeInstance * ) { + return 1; +} + +bool IRDANetNode::hasDataFor( const QString & ) { + return 0; +} + +bool IRDANetNode::generateDataForCommonFile( + SystemFile & , + long , + ANetNodeInstance * ) { + return 1; +} + +extern "C" { +void create_plugin( QList & PNN ) { + PNN.append( new IRDANetNode() ); +} +} diff --git a/noncore/settings/networksettings2/irda/irda_NN.h b/noncore/settings/networksettings2/irda/irda_NN.h new file mode 100644 index 0000000..82811a4 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irda_NN.h @@ -0,0 +1,44 @@ +#ifndef IRDA_NETNODE_H +#define IRDA_NETNODE_H + +#include "netnode.h" + +class AIRDA; + +class IRDANetNode : public ANetNode { + + Q_OBJECT + +public: + + IRDANetNode(); + virtual ~IRDANetNode(); + + virtual const QString pixmapName() + { return "irda"; } + + virtual const QString nodeName() + { return tr("Infrared link"); } + + virtual const QString nodeDescription() ; + + virtual ANetNodeInstance * createInstance( void ); + + virtual const char ** needs( void ); + virtual const char * provides( void ); + + virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); + virtual bool hasDataFor( const QString & S ); + virtual bool generateDataForCommonFile( + SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); + +private: + +}; + +extern "C" +{ + void create_plugin( QList & PNN ); +}; + +#endif diff --git a/noncore/settings/networksettings2/irda/irda_NNI.cpp b/noncore/settings/networksettings2/irda/irda_NNI.cpp new file mode 100644 index 0000000..78d6ff9 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irda_NNI.cpp @@ -0,0 +1,30 @@ +#include "irdaedit.h" +#include "irda_NNI.h" +#include "irda_NN.h" + +AIRDA::AIRDA( IRDANetNode * PNN ) : ANetNodeInstance( PNN ) { + + GUI = 0; + RT = 0; +} + +void AIRDA::setSpecificAttribute( QString & , QString & ) { +} + +void AIRDA::saveSpecificAttribute( QTextStream & ) { +} + +QWidget * AIRDA::edit( QWidget * parent ) { + GUI = new IRDAEdit( parent ); + GUI->showData( Data ); + return GUI; +} + +QString AIRDA::acceptable( void ) { + return ( GUI ) ? GUI->acceptable( ) : QString(); +} + +void AIRDA::commit( void ) { + if( GUI && GUI->commit( Data ) ) + setModified( 1 ); +} diff --git a/noncore/settings/networksettings2/irda/irda_NNI.h b/noncore/settings/networksettings2/irda/irda_NNI.h new file mode 100644 index 0000000..c2d6875 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irda_NNI.h @@ -0,0 +1,43 @@ +#ifndef IRDA_H +#define IRDA_H + +#include +#include "irdadata.h" +#include "irdarun.h" + +class IRDANetNode; +class IRDAEdit; + +class AIRDA : public ANetNodeInstance { + +public : + + AIRDA( IRDANetNode * PNN ); + + QWidget * edit( QWidget * parent ); + QString acceptable( void ); + void commit( void ); + + RuntimeInfo * runtime( void ) + { if( RT == 0 ) + RT = new IRDARun( this, Data ); + return RT; + } + + virtual void * data( void ) + { return (void *)&Data; } + +protected : + + virtual void setSpecificAttribute( QString & Attr, QString & Value ); + virtual void saveSpecificAttribute( QTextStream & TS ); + +private : + + IRDAEdit * GUI; + IRDAData Data; + IRDARun * RT; + +}; + +#endif diff --git a/noncore/settings/networksettings2/irda/irdadata.h b/noncore/settings/networksettings2/irda/irdadata.h new file mode 100644 index 0000000..c3c683e --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irdadata.h @@ -0,0 +1,18 @@ +#ifndef IRDA_DATA_H +#define IRDA_DATA_H + +#include + +typedef struct IRDAData { + QString Device; + QString LockFile; + long Speed; + short Parity; + short DataBits; + short StopBits; + bool HardwareControl; + bool SoftwareControl; + +} IRDAData_t; + +#endif diff --git a/noncore/settings/networksettings2/irda/irdaedit.cpp b/noncore/settings/networksettings2/irda/irdaedit.cpp new file mode 100644 index 0000000..2dfdce5 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irdaedit.cpp @@ -0,0 +1,17 @@ +#include +#include "irdaedit.h" + +IRDAEdit::IRDAEdit( QWidget * Parent ) : IRDAGUI( Parent ){ + +} + +QString IRDAEdit::acceptable( void ) { + return QString(); +} + +bool IRDAEdit::commit( IRDAData & Data ) { + return 0; +} + +void IRDAEdit::showData( IRDAData & Data ) { +} diff --git a/noncore/settings/networksettings2/irda/irdaedit.h b/noncore/settings/networksettings2/irda/irdaedit.h new file mode 100644 index 0000000..5131126 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irdaedit.h @@ -0,0 +1,12 @@ +#include "irdadata.h" +#include "irdaGUI.h" + +class IRDAEdit : public IRDAGUI { + +public : + + IRDAEdit( QWidget * parent ); + QString acceptable( void ); + bool commit( IRDAData & Data ); + void showData( IRDAData & Data ); +}; diff --git a/noncore/settings/networksettings2/irda/irdarun.h b/noncore/settings/networksettings2/irda/irdarun.h new file mode 100644 index 0000000..adc9c24 --- a/dev/null +++ b/noncore/settings/networksettings2/irda/irdarun.h @@ -0,0 +1,22 @@ +#include +#include "irdadata.h" + +class IRDARun : public AsLine { + +public : + + IRDARun( ANetNodeInstance * NNI, + IRDAData & Data ) : AsLine( NNI ) + { } + +protected : + + void detectState( NodeCollection * ) + { } + + bool setState( NodeCollection * , Action_t ) + { return 0; } + + bool canSetState( State_t , Action_t ) + { return 0; } +}; -- cgit v0.9.0.2