summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/cable
authorwimpie <wimpie>2004-04-02 18:30:55 (UTC)
committer wimpie <wimpie>2004-04-02 18:30:55 (UTC)
commit4ea2f227d3fb0d9591bb4f18555420ac47f3397d (patch) (side-by-side diff)
tree4fdd216cf7af4a747e2ca71e35d15f3d9e646333 /noncore/settings/networksettings2/cable
parent5334b639c9f97793bcae4f50f7b47c7a2ada4e2f (diff)
downloadopie-4ea2f227d3fb0d9591bb4f18555420ac47f3397d.zip
opie-4ea2f227d3fb0d9591bb4f18555420ac47f3397d.tar.gz
opie-4ea2f227d3fb0d9591bb4f18555420ac47f3397d.tar.bz2
first import of NS2 app
Diffstat (limited to 'noncore/settings/networksettings2/cable') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/cable/cable.pro18
-rw-r--r--noncore/settings/networksettings2/cable/cableGUI.ui545
-rw-r--r--noncore/settings/networksettings2/cable/cable_NN.cpp59
-rw-r--r--noncore/settings/networksettings2/cable/cable_NN.h44
-rw-r--r--noncore/settings/networksettings2/cable/cable_NNI.cpp66
-rw-r--r--noncore/settings/networksettings2/cable/cable_NNI.h43
-rw-r--r--noncore/settings/networksettings2/cable/cabledata.h18
-rw-r--r--noncore/settings/networksettings2/cable/cableedit.cpp68
-rw-r--r--noncore/settings/networksettings2/cable/cableedit.h12
-rw-r--r--noncore/settings/networksettings2/cable/cablerun.cpp26
-rw-r--r--noncore/settings/networksettings2/cable/cablerun.h21
-rw-r--r--noncore/settings/networksettings2/cable/config.in4
12 files changed, 924 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/cable/cable.pro b/noncore/settings/networksettings2/cable/cable.pro
new file mode 100644
index 0000000..d902360
--- a/dev/null
+++ b/noncore/settings/networksettings2/cable/cable.pro
@@ -0,0 +1,18 @@
+TEMPLATE = lib
+CONFIG += qt warn_on release
+DESTDIR = $(OPIEDIR)/plugins/networksettings2
+HEADERS = cable_NN.h \
+ cable_NNI.h \
+ cableedit.h
+SOURCES = cable_NN.cpp \
+ cable_NNI.cpp \
+ cableedit.cpp \
+ cablerun.cpp
+INCLUDEPATH += $(OPIEDIR)/include ../ ../networksettings2
+DEPENDPATH += $(OPIEDIR)/include ../ ../networksettings2
+LIBS += -lqpe
+INTERFACES = cableGUI.ui
+TARGET = cable
+VERSION = 1.0.0
+
+include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/cable/cableGUI.ui b/noncore/settings/networksettings2/cable/cableGUI.ui
new file mode 100644
index 0000000..2431861
--- a/dev/null
+++ b/noncore/settings/networksettings2/cable/cableGUI.ui
@@ -0,0 +1,545 @@
+<!DOCTYPE UI><UI>
+<class>CableGUI</class>
+<widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Cable_FRM</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>235</width>
+ <height>194</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Cable</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>2</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>2</number>
+ </property>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout3</cstring>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="1" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Lock file</string>
+ </property>
+ </widget>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Device</string>
+ </property>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>LockFile_LE</cstring>
+ </property>
+ </widget>
+ <widget row="0" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>DeviceFile_LE</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Serial settings</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>2</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>2</number>
+ </property>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout13</cstring>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>2</number>
+ </property>
+ <widget row="0" column="1" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>2400</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>9600</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>19200</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>38400</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>57600</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>115200</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>230400</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>460800</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>500000</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>921600</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>1000000</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>1152000</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>1500000</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>2000000</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>2500000</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>3000000</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>3500000</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>4000000</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Speed_CB</cstring>
+ </property>
+ <property stdset="1">
+ <name>currentItem</name>
+ <number>5</number>
+ </property>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Parity</string>
+ </property>
+ </widget>
+ <widget row="0" column="2" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2_2_3</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Data bits</string>
+ </property>
+ </widget>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Speed</string>
+ </property>
+ </widget>
+ <widget row="1" column="2" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2_2_3_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Stop bits</string>
+ </property>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>No</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Even</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Odd</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Mark</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Space</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Parity_CB</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>currentItem</name>
+ <number>0</number>
+ </property>
+ </widget>
+ <widget row="0" column="3" >
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>DataBits_SB</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>maxValue</name>
+ <number>8</number>
+ </property>
+ <property stdset="1">
+ <name>minValue</name>
+ <number>5</number>
+ </property>
+ <property stdset="1">
+ <name>value</name>
+ <number>8</number>
+ </property>
+ </widget>
+ <widget row="1" column="3" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>1</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>2</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>StopBits_CB</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout17</cstring>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>2</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Flow control :</string>
+ </property>
+ <property stdset="1">
+ <name>alignment</name>
+ <set>AlignTop|AlignLeft</set>
+ </property>
+ <property>
+ <name>vAlign</name>
+ </property>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout16</cstring>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>2</number>
+ </property>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>HardwareFC_CB</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Hardware</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>SoftwareFC_CB</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Software</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer6</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+</UI>
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp
new file mode 100644
index 0000000..756903e
--- a/dev/null
+++ b/noncore/settings/networksettings2/cable/cable_NN.cpp
@@ -0,0 +1,59 @@
+#include "cable_NN.h"
+#include "cable_NNI.h"
+
+static const char * CableNeeds[] =
+ { 0
+ };
+
+/**
+ * Constructor, find all of the possible interfaces
+ */
+CableNetNode::CableNetNode() : ANetNode() {
+}
+
+/**
+ * Delete any interfaces that we own.
+ */
+CableNetNode::~CableNetNode(){
+}
+
+const QString CableNetNode::nodeDescription(){
+ return tr("\
+<p>Sets up a wired serial or parallel.</p>\
+"
+);
+}
+
+ANetNodeInstance * CableNetNode::createInstance( void ) {
+ return new ACable( this );
+}
+
+const char ** CableNetNode::needs( void ) {
+ return CableNeeds;
+}
+
+const char * CableNetNode::provides( void ) {
+ return "line";
+}
+
+bool CableNetNode::generateProperFilesFor(
+ ANetNodeInstance * ) {
+ return 1;
+}
+
+bool CableNetNode::hasDataFor( const QString & ) {
+ return 0;
+}
+
+bool CableNetNode::generateDataForCommonFile(
+ SystemFile & ,
+ long ,
+ ANetNodeInstance * ) {
+ return 1;
+}
+
+extern "C" {
+void create_plugin( QList<ANetNode> & PNN ) {
+ PNN.append( new CableNetNode() );
+}
+}
diff --git a/noncore/settings/networksettings2/cable/cable_NN.h b/noncore/settings/networksettings2/cable/cable_NN.h
new file mode 100644
index 0000000..401317b
--- a/dev/null
+++ b/noncore/settings/networksettings2/cable/cable_NN.h
@@ -0,0 +1,44 @@
+#ifndef CABLE_NETNODE_H
+#define CABLE_NETNODE_H
+
+#include "netnode.h"
+
+class ACable;
+
+class CableNetNode : public ANetNode {
+
+ Q_OBJECT
+
+public:
+
+ CableNetNode();
+ virtual ~CableNetNode();
+
+ virtual const QString pixmapName()
+ { return "cable"; }
+
+ virtual const QString nodeName()
+ { return tr("Cable Connection"); }
+
+ 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<ANetNode> & PNN );
+};
+
+#endif
diff --git a/noncore/settings/networksettings2/cable/cable_NNI.cpp b/noncore/settings/networksettings2/cable/cable_NNI.cpp
new file mode 100644
index 0000000..d26afd1
--- a/dev/null
+++ b/noncore/settings/networksettings2/cable/cable_NNI.cpp
@@ -0,0 +1,66 @@
+#include "cableedit.h"
+#include "cable_NNI.h"
+#include "cable_NN.h"
+
+ACable::ACable( CableNetNode * PNN ) : ANetNodeInstance( PNN ) {
+ // default values
+ Data.Device = "/dev/ttyS0";
+ Data.LockFile = "/var/Lock";
+ Data.Speed = 115200;
+ Data.DataBits = 8;
+ Data.Parity = 0;
+ Data.StopBits = 1;
+ Data.HardwareControl = 0;
+ Data.SoftwareControl = 0;
+ GUI = 0;
+ RT = 0;
+}
+
+void ACable::setSpecificAttribute( QString & A, QString & V) {
+ if( A == "device" ) {
+ Data.Device = V;
+ } else if ( A == "lockfile" ) {
+ Data.LockFile = V;
+ } else if ( A == "speed" ) {
+ Data.Speed = V.toLong();
+ } else if ( A == "parity" ) {
+ Data.Parity = V.toShort();
+ } else if ( A == "databits" ) {
+ Data.DataBits = V.toShort();
+ } else if ( A == "stopbits" ) {
+ Data.StopBits = V.toShort();
+ } else if ( A == "hardwarecontrol" ) {
+ Data.HardwareControl = ( V == "yes" );
+ } else if ( A == "softwarecontrol" ) {
+ Data.SoftwareControl = ( V == "yes" );
+ }
+}
+
+void ACable::saveSpecificAttribute( QTextStream & TS ) {
+ TS << "device=" << quote( Data.Device ) << endl;
+ TS << "lockfile=" << quote( Data.LockFile ) << endl;
+ TS << "speed=" << Data.Speed << endl;
+ TS << "parity=" << Data.Parity << endl;
+ TS << "databits=" << Data.DataBits << endl;
+ TS << "stopbits=" << Data.StopBits << endl;
+ TS << "hardwarecontrol=" <<
+ ((Data.HardwareControl) ? "yes" : "no") << endl;
+ TS << "softwarecontrol=" <<
+ ((Data.SoftwareControl) ? "yes" : "no") << endl;
+}
+
+QWidget * ACable::edit( QWidget * parent ) {
+ GUI = new CableEdit( parent );
+ GUI->showData( Data );
+ return GUI;
+}
+
+QString ACable::acceptable( void ) {
+ return ( GUI ) ? GUI->acceptable( ) : QString();
+}
+
+void ACable::commit( void ) {
+ if( GUI && GUI->commit( Data ) ) {
+ setModified( 1 );
+ }
+}
diff --git a/noncore/settings/networksettings2/cable/cable_NNI.h b/noncore/settings/networksettings2/cable/cable_NNI.h
new file mode 100644
index 0000000..0654a5d
--- a/dev/null
+++ b/noncore/settings/networksettings2/cable/cable_NNI.h
@@ -0,0 +1,43 @@
+#ifndef CABLE_H
+#define CABLE_H
+
+#include <netnode.h>
+#include "cabledata.h"
+#include "cablerun.h"
+
+class CableNetNode;
+class CableEdit;
+
+class ACable : public ANetNodeInstance {
+
+public :
+
+ ACable( CableNetNode * PNN );
+
+ QWidget * edit( QWidget * parent );
+ QString acceptable( void );
+ void commit( void );
+
+ RuntimeInfo * runtime( void )
+ { if( RT == 0 )
+ RT = new CableRun( 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 :
+
+ CableEdit * GUI;
+ CableData_t Data;
+ CableRun * RT;
+
+};
+
+#endif
diff --git a/noncore/settings/networksettings2/cable/cabledata.h b/noncore/settings/networksettings2/cable/cabledata.h
new file mode 100644
index 0000000..c449d96
--- a/dev/null
+++ b/noncore/settings/networksettings2/cable/cabledata.h
@@ -0,0 +1,18 @@
+#ifndef CABLE_DATA_H
+#define CABLE_DATA_H
+
+#include <qstring.h>
+
+typedef struct CableData {
+ QString Device;
+ QString LockFile;
+ long Speed;
+ short Parity;
+ short DataBits;
+ short StopBits;
+ bool HardwareControl;
+ bool SoftwareControl;
+
+} CableData_t;
+
+#endif
diff --git a/noncore/settings/networksettings2/cable/cableedit.cpp b/noncore/settings/networksettings2/cable/cableedit.cpp
new file mode 100644
index 0000000..6e1a13b
--- a/dev/null
+++ b/noncore/settings/networksettings2/cable/cableedit.cpp
@@ -0,0 +1,68 @@
+#include <GUIUtils.h>
+#include <stdio.h>
+#include <qlineedit.h>
+#include <qcombobox.h>
+#include <qspinbox.h>
+#include <qcheckbox.h>
+#include "cabledata.h"
+#include "cableedit.h"
+
+static long SpeedTable[] = {
+ 2400, 9600, 19200, 38400, 57600, 115200,
+ 230400, 460800, 500000, 921600, 1000000,
+ 1152000, 1500000, 2000000, 2500000, 3000000,
+ 3500000, 4000000, -1
+};
+
+CableEdit::CableEdit( QWidget * Parent ) : CableGUI( Parent ) {
+}
+
+void CableEdit::showData( CableData_t & D ) {
+ DeviceFile_LE->setText( D.Device );
+ LockFile_LE->setText( D.LockFile );
+ for( long * Run = SpeedTable; *Run != -1; *Run ++ ) {
+ if( *Run == D.Speed ) {
+ Speed_CB->setCurrentItem(
+ ((long)(Run)-(long)(SpeedTable))/sizeof(long) );
+ break;
+ }
+ }
+ Parity_CB->setCurrentItem( D.Parity );
+ DataBits_SB->setValue( D.DataBits );
+ StopBits_CB->setCurrentItem( D.StopBits );
+ HardwareFC_CB->setChecked( D.HardwareControl );
+ SoftwareFC_CB->setChecked( D.SoftwareControl );
+}
+
+QString CableEdit::acceptable( void ) {
+ if( DeviceFile_LE->text().isEmpty() )
+ return tr("Device filename needed");
+ return QString();
+}
+
+bool CableEdit::commit( CableData_t & D ) {
+ bool SM = 0;
+
+ TXTM( D.Device, DeviceFile_LE, SM );
+ TXTM( D.LockFile, LockFile_LE, SM );
+
+ for( long * Run = SpeedTable; *Run != -1; *Run ++ ) {
+ if( *Run == D.Speed ) {
+ if( D.Speed != Speed_CB->currentText().toLong() ) {
+ SM = 1;
+ D.Speed = Speed_CB->currentText().toLong();
+ }
+ break;
+ }
+ }
+
+ CIM(D.Parity, Parity_CB, SM );
+
+ SBM(D.DataBits, DataBits_SB, SM );
+ CIM(D.StopBits, StopBits_CB, SM );
+
+ CBM( D.HardwareControl, HardwareFC_CB, SM );
+ CBM( D.SoftwareControl, SoftwareFC_CB, SM );
+
+ return SM;
+}
diff --git a/noncore/settings/networksettings2/cable/cableedit.h b/noncore/settings/networksettings2/cable/cableedit.h
new file mode 100644
index 0000000..ffacc61
--- a/dev/null
+++ b/noncore/settings/networksettings2/cable/cableedit.h
@@ -0,0 +1,12 @@
+#include "cabledata.h"
+#include "cableGUI.h"
+
+class CableEdit : public CableGUI {
+
+public :
+
+ CableEdit( QWidget * parent );
+ QString acceptable( void );
+ bool commit( CableData_t & D );
+ void showData( CableData_t & D );
+};
diff --git a/noncore/settings/networksettings2/cable/cablerun.cpp b/noncore/settings/networksettings2/cable/cablerun.cpp
new file mode 100644
index 0000000..edb4b01
--- a/dev/null
+++ b/noncore/settings/networksettings2/cable/cablerun.cpp
@@ -0,0 +1,26 @@
+#include <fcntl.h>
+#include <unistd.h>
+#include "cablerun.h"
+
+void CableRun::detectState( NodeCollection * NC ) {
+
+ int fd = open( D->Device.latin1(), O_RDWR );
+
+ if( fd < 0 ) {
+ NC->setCurrentState( Unavailable );
+ }
+ close( fd );
+ NC->setCurrentState( Available );
+}
+
+bool CableRun::setState( NodeCollection * NC, Action_t A ) {
+ if( A == Activate ) {
+ detectState(NC);
+ return (NC->currentState() == Available);
+ }
+ return 1;
+}
+
+bool CableRun::canSetState( State_t , Action_t ) {
+ return 1;
+}
diff --git a/noncore/settings/networksettings2/cable/cablerun.h b/noncore/settings/networksettings2/cable/cablerun.h
new file mode 100644
index 0000000..36ee640
--- a/dev/null
+++ b/noncore/settings/networksettings2/cable/cablerun.h
@@ -0,0 +1,21 @@
+#include <asline.h>
+#include "cabledata.h"
+
+class CableRun : public AsLine {
+
+public :
+
+ CableRun( ANetNodeInstance * NNI,
+ CableData & Data ) : AsLine( NNI )
+ { D = &Data; }
+
+protected :
+
+ void detectState( NodeCollection * NC );
+ bool setState( NodeCollection * NC, Action_t A );
+ bool canSetState( State_t Curr, Action_t A );
+
+private :
+
+ CableData_t * D;
+};
diff --git a/noncore/settings/networksettings2/cable/config.in b/noncore/settings/networksettings2/cable/config.in
new file mode 100644
index 0000000..4453107
--- a/dev/null
+++ b/noncore/settings/networksettings2/cable/config.in
@@ -0,0 +1,4 @@
+ config NS2CABLE
+ boolean "opie-networksettings2plugin-cable (set up Cable)"
+ default "n" if NS2
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && NS2 && NS2CORE