[Interest] download a file form http

Sivan Greenberg sivan at omniqueue.com
Sat Jul 7 10:32:42 CEST 2012


On Fri, Jul 6, 2012 at 5:44 PM, Till Oliver Knoll
<till.oliver.knoll at gmail.com> wrote:
> Sivan, it seems to me that you're stumbling over the most basic steps in
> developing a Qt application, all of which could've been resolved by reading
> the docs and spending a fine day or so with the tutorials.
>
So, as stated before, I somewhat believed that Qt can be used even
when when you just know parts of it and do not master all of its
mechanics and internals . I now realize that the MOC mandates this
understanding. QML and the Qt creator made me think I could actually
drop that file download snippet "as is" and use as I do in Perl, C,
Python- I now realize this is an unreal expectation.

> And it takes off course a decent education in programming, plus if you bring
> along experience in other frameworks you should be able to apply that
> knowledge to Qt in no time!

I have been programming since I was about 6 yo, going from Basic to
assembly to Pascal to C/GTK then even C++ for around 2 years, and
since 2004 I have been developing both professionally and as a hobby
in Python. I think I have decent education in programming (how would
that be defined anyways?) and I know my way quite thoroughly in the
realms of object oriented methodology and design and the processes
around it. Given that, I mistakenly thought I could apply this over 12
years of knowledge (including the creation of a soft float toolchain
and debian based OS for MIPSel from scratch) when implementing this
very simple file download. I was wrong and I apologize for the noise.

>
>
> I am just saying that because you made the impression to me that you're
> expecting a given toolkit to quickly make you a wizard - when you're not.
>
Do you imply that in order to achieve what should otherwise be a dead
simple task (again, I want to concentrate on the "business logic" and
not have to care of the  HTTP RFC) using Qt I must become a wizard
first? Then I'm really on the wrong mailing list...:/
>
> So you've asked how to download a file in a single line (or so I remember).
> I'll give you a few more:
>
>  QNetworkAccessManager *manager = new QNetworkAccessManager(this);
>
> connect(manager, SIGNAL(finished(QNetworkReply*)),
>          this, SLOT(replyFinished(QNetworkReply*)));
>
>  manager->get(QNetworkRequest(QUrl("http://qt.nokia.com")));
>
> And yes, that's taken straight from the Qt docs!
>
I am aware of those docs, in fact I used them here:

http://projects.developer.nokia.com/qactus/browser/Qactus/mainwindow.cpp

> Off courses it doesn't deal with error conditions, aborting/resuming/pausing
> a download, handle the received data (hint: QFile! Just in case...)...
>

Right, so attaching QFile to that did not come to mind. More over,
asking around more than several times some "expert qt wizards" did not
yield one coherent answer showing this could be assisted by an stdlib
function to handle. I'll see about connecting this with QFile, thanks
for the tip.


> So if you're unfamiliar with Qt signals/slots (and it seems very likely,
> given your questions about moc/qmake), there's a chapter about that as well.
> And while you're at it, read the chapter about qmake as well. The Qt Object
> Model won't hurt either.

I'll set to become a qmake expert before I attempt any further Qt
development, but I am quite familiar with signal and slots as the
previous code link would prove.

>
> After that, if you have conceptional questions or still stumble over a
> particular problem, you're welcome to ask.
>
I kind of feel myself welcome to ask anyways :) At least we have a
nice community to compensate of confusing docs and API incompleteness
;)

> But don't try to convince people that "rapid prototyping" was the way to go
> and every toolkit should start implementing
> "doWhatIMean(iHaveNoClueWhatsoever)" methods. Because for me that had a
> taste of "I don't want/am unable to learn"!

Take a look at what I've done over the years so far in open source
(debian / ubuntu / gnome included) . I assure you I have more clue
than most of the people you'd meet randomly in an conference. It is
really not about doing what I want when I do not have a clue but
having API completeness. Network stack is severely low leveled  and
limited in Qt and I have some Nokia experts vouching for that that I
won't disclose their names :) That being said, I will not expect Qt to
be my compiled Python anymore.



Thanks for your reply!

-Sivan



More information about the Interest mailing list