author | zecke <zecke> | 2002-10-13 15:31:12 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-13 15:31:12 (UTC) |
commit | 6a9726437a59cf3b18bf57d6e20fb2dfaaa2fc34 (patch) (unidiff) | |
tree | 14fa6710ef6d80fa213250a97f13253eb88a80cd /noncore/apps/opie-console/test | |
parent | 5db679753dac04095a2fa4b03297785ed4ba4030 (diff) | |
download | opie-6a9726437a59cf3b18bf57d6e20fb2dfaaa2fc34.zip opie-6a9726437a59cf3b18bf57d6e20fb2dfaaa2fc34.tar.gz opie-6a9726437a59cf3b18bf57d6e20fb2dfaaa2fc34.tar.bz2 |
Move some stuff in filetransfer around
make pid == 0 after a finished process.
Introduce the FileReceive class
it does not parse progress though
Diffstat (limited to 'noncore/apps/opie-console/test') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/test/console.pro | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/test/sender.ui | 22 | ||||
-rw-r--r-- | noncore/apps/opie-console/test/senderui.cpp | 7 | ||||
-rw-r--r-- | noncore/apps/opie-console/test/senderui.h | 1 |
4 files changed, 32 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/test/console.pro b/noncore/apps/opie-console/test/console.pro index af0e9f7..6de2cd0 100644 --- a/noncore/apps/opie-console/test/console.pro +++ b/noncore/apps/opie-console/test/console.pro | |||
@@ -1,15 +1,17 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | #CONFIG = qt warn_on release | 2 | #CONFIG = qt warn_on release |
3 | CONFIG = qt debug | 3 | CONFIG = qt debug |
4 | #DESTDIR = $(OPIEDIR)/bin | 4 | #DESTDIR = $(OPIEDIR)/bin |
5 | HEADERS = ../io_layer.h ../io_serial.h ../sz_transfer.h ../file_layer.h\ | 5 | HEADERS = ../io_layer.h ../io_serial.h ../sz_transfer.h ../file_layer.h\ |
6 | senderui.h ../profile.h ../filetransfer.h ../procctl.h | 6 | senderui.h ../profile.h ../filetransfer.h ../procctl.h \ |
7 | ../filereceive.h ../receive_layer.h | ||
7 | SOURCES = ../io_layer.cpp ../io_serial.cpp \ | 8 | SOURCES = ../io_layer.cpp ../io_serial.cpp \ |
8 | ../profile.cpp ../sz_transfer.cpp ../file_layer.cpp\ | 9 | ../profile.cpp ../sz_transfer.cpp ../file_layer.cpp\ |
9 | main.cpp senderui.cpp ../filetransfer.cpp ../procctl.cpp | 10 | main.cpp senderui.cpp ../filetransfer.cpp ../procctl.cpp \ |
11 | ../filereceive.cpp ../receive_layer.cpp | ||
10 | INTERFACES = sender.ui | 12 | INTERFACES = sender.ui |
11 | INCLUDEPATH += $(OPIEDIR)/include | 13 | INCLUDEPATH += $(OPIEDIR)/include |
12 | DEPENDPATH += $(OPIEDIR)/include | 14 | DEPENDPATH += $(OPIEDIR)/include |
13 | LIBS += -lqpe -lopie | 15 | LIBS += -lqpe -lopie |
14 | TARGET = test | 16 | TARGET = test |
15 | 17 | ||
diff --git a/noncore/apps/opie-console/test/sender.ui b/noncore/apps/opie-console/test/sender.ui index b946b81..74b9790 100644 --- a/noncore/apps/opie-console/test/sender.ui +++ b/noncore/apps/opie-console/test/sender.ui | |||
@@ -1,78 +1,96 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>Sender</class> | 2 | <class>Sender</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>Form1</cstring> | 7 | <cstring>Form1</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>596</width> | 14 | <width>592</width> |
15 | <height>480</height> | 15 | <height>480</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Form1</string> | 20 | <string>Form1</string> |
21 | </property> | 21 | </property> |
22 | <vbox> | 22 | <vbox> |
23 | <property stdset="1"> | 23 | <property stdset="1"> |
24 | <name>margin</name> | 24 | <name>margin</name> |
25 | <number>11</number> | 25 | <number>11</number> |
26 | </property> | 26 | </property> |
27 | <property stdset="1"> | 27 | <property stdset="1"> |
28 | <name>spacing</name> | 28 | <name>spacing</name> |
29 | <number>6</number> | 29 | <number>6</number> |
30 | </property> | 30 | </property> |
31 | <widget> | 31 | <widget> |
32 | <class>QMultiLineEdit</class> | 32 | <class>QMultiLineEdit</class> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>name</name> | 34 | <name>name</name> |
35 | <cstring>MultiLineEdit1</cstring> | 35 | <cstring>MultiLineEdit1</cstring> |
36 | </property> | 36 | </property> |
37 | </widget> | 37 | </widget> |
38 | <widget> | 38 | <widget> |
39 | <class>QPushButton</class> | 39 | <class>QPushButton</class> |
40 | <property stdset="1"> | 40 | <property stdset="1"> |
41 | <name>name</name> | 41 | <name>name</name> |
42 | <cstring>PushButton3</cstring> | ||
43 | </property> | ||
44 | <property stdset="1"> | ||
45 | <name>text</name> | ||
46 | <string>Receive File</string> | ||
47 | </property> | ||
48 | </widget> | ||
49 | <widget> | ||
50 | <class>QPushButton</class> | ||
51 | <property stdset="1"> | ||
52 | <name>name</name> | ||
42 | <cstring>PushButton1</cstring> | 53 | <cstring>PushButton1</cstring> |
43 | </property> | 54 | </property> |
44 | <property stdset="1"> | 55 | <property stdset="1"> |
45 | <name>text</name> | 56 | <name>text</name> |
46 | <string>&Send</string> | 57 | <string>&Send</string> |
47 | </property> | 58 | </property> |
48 | </widget> | 59 | </widget> |
49 | <widget> | 60 | <widget> |
50 | <class>QPushButton</class> | 61 | <class>QPushButton</class> |
51 | <property stdset="1"> | 62 | <property stdset="1"> |
52 | <name>name</name> | 63 | <name>name</name> |
53 | <cstring>PushButton2</cstring> | 64 | <cstring>PushButton2</cstring> |
54 | </property> | 65 | </property> |
55 | <property stdset="1"> | 66 | <property stdset="1"> |
56 | <name>text</name> | 67 | <name>text</name> |
57 | <string>Send &File</string> | 68 | <string>Send &File</string> |
58 | </property> | 69 | </property> |
59 | </widget> | 70 | </widget> |
60 | </vbox> | 71 | </vbox> |
61 | </widget> | 72 | </widget> |
62 | <connections> | 73 | <connections> |
63 | <connection> | 74 | <connection> |
64 | <sender>PushButton1</sender> | 75 | <sender>PushButton1</sender> |
65 | <signal>clicked()</signal> | 76 | <signal>clicked()</signal> |
66 | <receiver>Form1</receiver> | 77 | <receiver>Form1</receiver> |
67 | <slot>slotSend()</slot> | 78 | <slot>slotSend()</slot> |
68 | </connection> | 79 | </connection> |
69 | <slot access="public">slotSend()</slot> | ||
70 | <connection> | 80 | <connection> |
71 | <sender>PushButton2</sender> | 81 | <sender>PushButton2</sender> |
72 | <signal>clicked()</signal> | 82 | <signal>clicked()</signal> |
73 | <receiver>Form1</receiver> | 83 | <receiver>Form1</receiver> |
74 | <slot>slotSendFile()</slot> | 84 | <slot>slotSendFile()</slot> |
75 | </connection> | 85 | </connection> |
86 | <connection> | ||
87 | <sender>PushButton3</sender> | ||
88 | <signal>clicked()</signal> | ||
89 | <receiver>Form1</receiver> | ||
90 | <slot>slotRev()</slot> | ||
91 | </connection> | ||
92 | <slot access="public">slotRev()</slot> | ||
93 | <slot access="public">slotSend()</slot> | ||
76 | <slot access="public">slotSendFile()</slot> | 94 | <slot access="public">slotSendFile()</slot> |
77 | </connections> | 95 | </connections> |
78 | </UI> | 96 | </UI> |
diff --git a/noncore/apps/opie-console/test/senderui.cpp b/noncore/apps/opie-console/test/senderui.cpp index 8bc1676..2ce3f6d 100644 --- a/noncore/apps/opie-console/test/senderui.cpp +++ b/noncore/apps/opie-console/test/senderui.cpp | |||
@@ -1,35 +1,36 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | #include <fcntl.h> | 3 | #include <fcntl.h> |
4 | #include <sys/termios.h> | 4 | #include <sys/termios.h> |
5 | 5 | ||
6 | #include <qmultilineedit.h> | 6 | #include <qmultilineedit.h> |
7 | #include <qsocketnotifier.h> | 7 | #include <qsocketnotifier.h> |
8 | 8 | ||
9 | #include "../profile.h" | 9 | #include "../profile.h" |
10 | #include "../io_serial.h" | 10 | #include "../io_serial.h" |
11 | #include "../filetransfer.h" | 11 | #include "../filetransfer.h" |
12 | #include "../filereceive.h" | ||
12 | 13 | ||
13 | #include <opie/oprocess.h> | 14 | #include <opie/oprocess.h> |
14 | 15 | ||
15 | #include "senderui.h" | 16 | #include "senderui.h" |
16 | 17 | ||
17 | SenderUI::SenderUI() | 18 | SenderUI::SenderUI() |
18 | : Sender() { | 19 | : Sender() { |
19 | 20 | ||
20 | /* we do that manually */ | 21 | /* we do that manually */ |
21 | Profile prof; | 22 | Profile prof; |
22 | QString str = "/dev/ttyS0"; | 23 | QString str = "/dev/ttyS0"; |
23 | prof.writeEntry("Device",str ); | 24 | prof.writeEntry("Device",str ); |
24 | prof.writeEntry("Baud", 115200 ); | 25 | prof.writeEntry("Baud", 115200 ); |
25 | 26 | ||
26 | qWarning("prof " + prof.readEntry("Device") + " " + str); | 27 | qWarning("prof " + prof.readEntry("Device") + " " + str); |
27 | ser = new IOSerial(prof); | 28 | ser = new IOSerial(prof); |
28 | connect(ser, SIGNAL(received(const QByteArray& ) ), | 29 | connect(ser, SIGNAL(received(const QByteArray& ) ), |
29 | this, SLOT(got(const QByteArray&) ) ); | 30 | this, SLOT(got(const QByteArray&) ) ); |
30 | 31 | ||
31 | if ( ser->open() ) | 32 | if ( ser->open() ) |
32 | qWarning("opened!!!"); | 33 | qWarning("opened!!!"); |
33 | else | 34 | else |
34 | qWarning("could not open"); | 35 | qWarning("could not open"); |
35 | 36 | ||
@@ -45,24 +46,30 @@ void SenderUI::slotSendFile() { | |||
45 | 46 | ||
46 | connect (sz, SIGNAL(sent()), | 47 | connect (sz, SIGNAL(sent()), |
47 | this, SLOT(fileTransComplete())); | 48 | this, SLOT(fileTransComplete())); |
48 | } | 49 | } |
49 | 50 | ||
50 | void SenderUI::slotSend() { | 51 | void SenderUI::slotSend() { |
51 | QCString str = MultiLineEdit1->text().utf8(); | 52 | QCString str = MultiLineEdit1->text().utf8(); |
52 | qWarning("sending: %s", str.data() ); | 53 | qWarning("sending: %s", str.data() ); |
53 | ser->send( str ); | 54 | ser->send( str ); |
54 | } | 55 | } |
55 | void SenderUI::got(const QByteArray& ar) { | 56 | void SenderUI::got(const QByteArray& ar) { |
56 | for ( uint i = 0; i < ar.count(); i++ ) { | 57 | for ( uint i = 0; i < ar.count(); i++ ) { |
57 | printf("%c", ar[i] ); | 58 | printf("%c", ar[i] ); |
58 | } | 59 | } |
59 | //printf("\n"); | 60 | //printf("\n"); |
60 | } | 61 | } |
61 | 62 | ||
62 | void SenderUI::fileTransComplete() { | 63 | void SenderUI::fileTransComplete() { |
63 | 64 | ||
64 | qWarning("file transfer complete"); | 65 | qWarning("file transfer complete"); |
65 | } | 66 | } |
66 | void SenderUI::send() { | 67 | void SenderUI::send() { |
67 | 68 | ||
68 | } | 69 | } |
70 | void SenderUI::slotRev(){ | ||
71 | qWarning("Going to receive!"); | ||
72 | FileReceive *rev = new FileReceive( FileReceive::SZ, ser ); | ||
73 | rev->receive(); | ||
74 | |||
75 | } \ No newline at end of file | ||
diff --git a/noncore/apps/opie-console/test/senderui.h b/noncore/apps/opie-console/test/senderui.h index 5e613cd..c130dcf 100644 --- a/noncore/apps/opie-console/test/senderui.h +++ b/noncore/apps/opie-console/test/senderui.h | |||
@@ -1,33 +1,34 @@ | |||
1 | #ifndef SENDER_UI_H | 1 | #ifndef SENDER_UI_H |
2 | #define SENDER_UI_H | 2 | #define SENDER_UI_H |
3 | 3 | ||
4 | #include <qcstring.h> | 4 | #include <qcstring.h> |
5 | 5 | ||
6 | #include "sender.h" | 6 | #include "sender.h" |
7 | 7 | ||
8 | class IOSerial; | 8 | class IOSerial; |
9 | class FileTransfer; | 9 | class FileTransfer; |
10 | class QSocketNotifier; | 10 | class QSocketNotifier; |
11 | class OProcess; | 11 | class OProcess; |
12 | class SenderUI : public Sender { | 12 | class SenderUI : public Sender { |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | public: | 14 | public: |
15 | SenderUI(); | 15 | SenderUI(); |
16 | ~SenderUI(); | 16 | ~SenderUI(); |
17 | 17 | ||
18 | public slots: | 18 | public slots: |
19 | void send(); | 19 | void send(); |
20 | void slotSendFile(); | 20 | void slotSendFile(); |
21 | void slotSend(); | 21 | void slotSend(); |
22 | void slotRev(); | ||
22 | void got(const QByteArray& ); | 23 | void got(const QByteArray& ); |
23 | void fileTransComplete(); | 24 | void fileTransComplete(); |
24 | private: | 25 | private: |
25 | IOSerial* ser; | 26 | IOSerial* ser; |
26 | FileTransfer* sz; | 27 | FileTransfer* sz; |
27 | int m_fd; | 28 | int m_fd; |
28 | QSocketNotifier* m_sock; | 29 | QSocketNotifier* m_sock; |
29 | OProcess* m_proc; | 30 | OProcess* m_proc; |
30 | }; | 31 | }; |
31 | 32 | ||
32 | 33 | ||
33 | #endif | 34 | #endif |