summaryrefslogtreecommitdiff
authorhash <hash>2002-10-09 19:37:41 (UTC)
committer hash <hash>2002-10-09 19:37:41 (UTC)
commit0f5a65dda7268881906743487672543ba8d3519f (patch) (unidiff)
tree47ee29dde931539505a9dfc990d344ce8309ea5f
parent3689213cd06e8655b3f338ad170ad4e0fa040b80 (diff)
downloadopie-0f5a65dda7268881906743487672543ba8d3519f.zip
opie-0f5a65dda7268881906743487672543ba8d3519f.tar.gz
opie-0f5a65dda7268881906743487672543ba8d3519f.tar.bz2
added a file transfer button
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/test/console.pro6
-rw-r--r--noncore/apps/opie-console/test/sender.ui18
-rw-r--r--noncore/apps/opie-console/test/senderui.cpp17
-rw-r--r--noncore/apps/opie-console/test/senderui.h4
4 files changed, 41 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/test/console.pro b/noncore/apps/opie-console/test/console.pro
index 721b820..b10b651 100644
--- a/noncore/apps/opie-console/test/console.pro
+++ b/noncore/apps/opie-console/test/console.pro
@@ -1,15 +1,15 @@
1TEMPLATE = app 1TEMPLATE = 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
5HEADERS = ../io_layer.h ../io_serial.h \ 5HEADERS = ../io_layer.h ../io_serial.h ../sz_transfer.h ../file_layer.h\
6 senderui.h ../profile.h 6 senderui.h ../profile.h
7SOURCES = ../io_layer.cpp ../io_serial.cpp \ 7SOURCES = ../io_layer.cpp ../io_serial.cpp \
8 ../profile.cpp \ 8 ../profile.cpp ../sz_transfer.cpp ../file_layer.cpp\
9 main.cpp senderui.cpp 9 main.cpp senderui.cpp
10INTERFACES = sender.ui 10INTERFACES = sender.ui
11INCLUDEPATH += $(OPIEDIR)/include 11INCLUDEPATH += $(OPIEDIR)/include
12DEPENDPATH += $(OPIEDIR)/include 12DEPENDPATH += $(OPIEDIR)/include
13LIBS += -lqpe -lopie 13LIBS += -lqpe -lopie
14TARGET = test 14TARGET = test
15 15
diff --git a/noncore/apps/opie-console/test/sender.ui b/noncore/apps/opie-console/test/sender.ui
index 092f6e3..b946b81 100644
--- a/noncore/apps/opie-console/test/sender.ui
+++ b/noncore/apps/opie-console/test/sender.ui
@@ -1,60 +1,78 @@
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>596</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>PushButton1</cstring> 42 <cstring>PushButton1</cstring>
43 </property> 43 </property>
44 <property stdset="1"> 44 <property stdset="1">
45 <name>text</name> 45 <name>text</name>
46 <string>&amp;Send</string> 46 <string>&amp;Send</string>
47 </property> 47 </property>
48 </widget> 48 </widget>
49 <widget>
50 <class>QPushButton</class>
51 <property stdset="1">
52 <name>name</name>
53 <cstring>PushButton2</cstring>
54 </property>
55 <property stdset="1">
56 <name>text</name>
57 <string>Send &amp;File</string>
58 </property>
59 </widget>
49 </vbox> 60 </vbox>
50</widget> 61</widget>
51<connections> 62<connections>
52 <connection> 63 <connection>
53 <sender>PushButton1</sender> 64 <sender>PushButton1</sender>
54 <signal>clicked()</signal> 65 <signal>clicked()</signal>
55 <receiver>Form1</receiver> 66 <receiver>Form1</receiver>
56 <slot>slotSend()</slot> 67 <slot>slotSend()</slot>
57 </connection> 68 </connection>
58 <slot access="public">slotSend()</slot> 69 <slot access="public">slotSend()</slot>
70 <connection>
71 <sender>PushButton2</sender>
72 <signal>clicked()</signal>
73 <receiver>Form1</receiver>
74 <slot>slotSendFile()</slot>
75 </connection>
76 <slot access="public">slotSendFile()</slot>
59</connections> 77</connections>
60</UI> 78</UI>
diff --git a/noncore/apps/opie-console/test/senderui.cpp b/noncore/apps/opie-console/test/senderui.cpp
index fc93c04..24d3eb2 100644
--- a/noncore/apps/opie-console/test/senderui.cpp
+++ b/noncore/apps/opie-console/test/senderui.cpp
@@ -1,47 +1,62 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include <stdio.h> 2#include <stdio.h>
3 3
4#include <qmultilineedit.h> 4#include <qmultilineedit.h>
5 5
6#include "../profile.h" 6#include "../profile.h"
7#include "../io_serial.h" 7#include "../io_serial.h"
8#include "../sz_transfer.h"
8 9
9 10
10#include "senderui.h" 11#include "senderui.h"
11 12
12SenderUI::SenderUI() 13SenderUI::SenderUI()
13 : Sender() { 14 : Sender() {
14 15
15 /* we do that manually */ 16 /* we do that manually */
16 Profile prof; 17 Profile prof;
17 QString str = "/dev/ttyS0"; 18 QString str = "/dev/ttyS1";
18 prof.writeEntry("Device",str ); 19 prof.writeEntry("Device",str );
19 prof.writeEntry("Baud", 115200 ); 20 prof.writeEntry("Baud", 115200 );
20 21
21 qWarning("prof " + prof.readEntry("Device") + " " + str); 22 qWarning("prof " + prof.readEntry("Device") + " " + str);
22 ser = new IOSerial(prof); 23 ser = new IOSerial(prof);
23 connect(ser, SIGNAL(received(const QByteArray& ) ), 24 connect(ser, SIGNAL(received(const QByteArray& ) ),
24 this, SLOT(got(const QByteArray&) ) ); 25 this, SLOT(got(const QByteArray&) ) );
25 26
26 if ( ser->open() ) 27 if ( ser->open() )
27 qWarning("opened!!!"); 28 qWarning("opened!!!");
28 else 29 else
29 qWarning("could not open"); 30 qWarning("could not open");
30 31
31 32
32 33
33} 34}
34SenderUI::~SenderUI() { 35SenderUI::~SenderUI() {
35 36
36} 37}
38void SenderUI::slotSendFile() {
39
40 sz = new SzTransfer(SzTransfer::SZ, ser);
41 sz->sendFile("/home/jake/test");
42
43 connect (sz, SIGNAL(sent()),
44 this, SLOT(fileTransComplete()));
45}
46
37void SenderUI::slotSend() { 47void SenderUI::slotSend() {
38 QCString str = MultiLineEdit1->text().utf8(); 48 QCString str = MultiLineEdit1->text().utf8();
39 qWarning("sending: %s", str.data() ); 49 qWarning("sending: %s", str.data() );
40 ser->send( str ); 50 ser->send( str );
41} 51}
42void SenderUI::got(const QByteArray& ar) { 52void SenderUI::got(const QByteArray& ar) {
43 for ( uint i = 0; i < ar.count(); i++ ) { 53 for ( uint i = 0; i < ar.count(); i++ ) {
44 printf("%c", ar[i] ); 54 printf("%c", ar[i] );
45 } 55 }
46 //printf("\n"); 56 //printf("\n");
47} 57}
58
59void SenderUI::fileTransComplete() {
60
61 qWarning("file transfer compete");
62}
diff --git a/noncore/apps/opie-console/test/senderui.h b/noncore/apps/opie-console/test/senderui.h
index bc69f5d..f6230cc 100644
--- a/noncore/apps/opie-console/test/senderui.h
+++ b/noncore/apps/opie-console/test/senderui.h
@@ -1,23 +1,27 @@
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
8class IOSerial; 8class IOSerial;
9class SzTransfer;
9class SenderUI : public Sender { 10class SenderUI : public Sender {
10 Q_OBJECT 11 Q_OBJECT
11public: 12public:
12 SenderUI(); 13 SenderUI();
13 ~SenderUI(); 14 ~SenderUI();
14 15
15public slots: 16public slots:
17 void slotSendFile();
16 void slotSend(); 18 void slotSend();
17 void got(const QByteArray& ); 19 void got(const QByteArray& );
20 void fileTransComplete();
18private: 21private:
19 IOSerial* ser; 22 IOSerial* ser;
23 SzTransfer* sz;
20}; 24};
21 25
22 26
23#endif 27#endif