[Delta] Iris questions (was: Re: trying to make a code like justins code (jabber example) but i have errors)
K. Nimer
stormway at gmail.com
Mon Mar 24 18:49:48 PDT 2008
thanks man really thanks
i will try it out and get back to you :)
your explanation is pretty amazing
On Mon, Mar 24, 2008 at 6:01 PM, Justin Karneges <justin-psi2 at affinix.com>
wrote:
> On Monday 24 March 2008 5:12 pm, K. Nimer wrote:
> > i am totally confused and blown off , why did it work now ?
> >
> > thanks man but what is this ,
> >
> > i am soo lost , qt is powerful
> >
> > u know when you say your an expert in c++ but a kid in QT , well i am
> sorry
> > thats definitly me :S i am really lost
> >
> > is it me , or its because i ddint know what a delayslot is i am not sure
>
> I wouldn't expect you to know about the Client delayedCloseFinished()
> signal,
> but what you should know is how the Qt event loop works. I'm guessing
> Iris
> is your first time using Qt. You are brave. :) Maybe it would be best to
> write some simple GUI app first. Did you do the Qt tutorials?
>
> > is it also easy to send files that simple?
>
> Sort of. The setup is not straightforward.
>
> First, if you want to support P2P connections, then you need to set up an
> S5BServer:
>
> // create a server object listening on port 8010
> S5BServer *s5bServer = new s5bServer;
> if(!s5bServer->start(8010))
> {
> error...
> }
>
> // tell client to use it
> client->s5bManager()->setServer(s5bServer);
>
> If you skip this step, then you can only use proxy transfers.
>
> Next, enable the file transfer feature:
>
> client->setFileTransferEnabled(true);
>
> Now you may use the filetransfer.h API. From here it should be easy to
> understand, but it does take some work to use since Iris does not actually
> read and write files. For example, it is up to you to feed it with file
> data
> to send.
>
> To send a file:
>
> // session variables
> FileTransfer *ft;
> int total;
> QByteArray fileData;
>
> // create file transfer object for sending
> ft = client->fileTransferManager()->createTransfer();
>
> // listen to some signals
> connect(ft, SIGNAL(connected()), SLOT(ft_connected()));
> connect(ft, SIGNAL(bytesWritten(int)), SLOT(ft_bytesWritten(int)));
>
> // initialize and send the file
> total = 0;
> fileData = "Hello World\n";
> ft->setProxy("proxy.jabber.org"); // optional, use a proxy
> ft->sendFile(jid, "hello.txt", fileData.size(), "a cool file for you");
>
> slots:
>
> // p2p stream established, now we may send file data
> void ft_connected()
> {
> ft->writeFileData(fileData);
> }
>
> // some number of bytes have been sent
> void ft_bytesWritten(int bytes)
> {
> total += bytes;
>
> // all data sent?
> if(total == fileData.size())
> {
> // done
> ft->deleteLater();
> }
> }
>
> You should probably listen for other signals too, like accepted() (this
> means
> the other person has accepted the file, but the p2p stream is not yet
> established) and error() (means the user rejected, or there was some
> network
> problem during transfer).
>
> -Justin
> _______________________________________________
> Delta mailing list
> Delta at lists.affinix.com
> http://lists.affinix.com/listinfo.cgi/delta-affinix.com
>
--
Regards;
Khalid Nimer
Education:
Concordia University
Bachelor of Computer Science (ECP)
Option: Software Systems
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.affinix.com/pipermail/delta-affinix.com/attachments/20080324/54ef8b8f/attachment.htm
More information about the Delta
mailing list