senderdialog.cpp

Go to the documentation of this file.
00001 #include <QtGui>
00002 
00003 #include "senderdialog.h"
00004 
00005 SenderDialog::SenderDialog(QWidget *parent)
00006      : QDialog(parent)
00007 {
00008     setupUi(this);
00009 
00010     sender = new Sender();
00011     
00012     connect(sender, SIGNAL( connectionOpen() ), SLOT(connectionOpen() ) );
00013     connect(sender, SIGNAL( connectionClose() ), SLOT(connectionClose() ) );
00014     connect(sender, SIGNAL( received(QString) ), SLOT( received(QString) ) );
00015     
00016     Url->setText("udp://localhost:1234");
00017     Url->setReadOnly(false);
00018     Message->setReadOnly(false);
00019 
00020 }
00021 
00022 void SenderDialog::on_ButtonConnect_clicked()
00023 {
00024     if ( sender->isConnected() )
00025     {
00026         sender->disconnect();
00027     }
00028     else
00029     {
00030         QUrl url(Url->text());
00031         sender->connectUrl(url);
00032     }
00033 }
00034 
00035 
00036 void SenderDialog::on_ButtonSend_clicked()
00037 {
00038     QString text = Message->text();
00039     if ( !text.isEmpty() && sender->isConnected() )
00040     {
00041         sender->sendText(text);
00042         Message->clear();
00043     }
00044 }
00045 
00046 void SenderDialog::connectionOpen()
00047 {
00048     ButtonConnect->setText("Disconnect");
00049     Url->setReadOnly(true);
00050 }
00051 
00052 void SenderDialog::connectionClose()
00053 {
00054     ButtonConnect->setText("Connect");
00055     Url->setReadOnly(false);
00056 
00057 }
00058 
00059 void SenderDialog::received(QString line)
00060 {
00061     qDebug( line.toAscii() );
00062 }
00063 

Generated on Sun Oct 28 22:51:29 2007 for BBoB by  doxygen 1.5.3