QProcess executes an external process. There is no need to run QProcess in a separate thread. QProcess doesn't block anyhow unless you call one of QProcess::wait*() methods.
QProcess executes an external process. There is no need to run QProcess in a separate thread. QProcess doesn't block anyhow unless you call one of QProcess::wait*() methods.
J-P Nurmi
Okkk, so this my requirements:
I need the process to be running in a specific directory...
If I'm running just QProcesses in that for loop, the object is going to be set to download a new file before its done with the last one unless waitForFinished() is used! Therefore, the gui will be unresponsive.
I can't just call a temporary like this QProcess().start() because I can't set its directory.
Blocking applications event loop causes nothing to get updated meanwhile. You should just launch the process and connect to its signals instead of using blocking wait-methods. You will get informed via signals when the process is finished etc. You can download next file in corresponding slot.
Btw, have you noticed QHttp::get()?![]()
J-P Nurmi
Ok well I'm going to re-implement it using QHttp::get() to see how things work out. Just a few initial questions:
Can I set where the files are downloading to? I want them to go to QDir::tempPath()
Is there someway to get multiple files? Or will I just have to use a for loop?
Wouldn't I have to have that for-loop not progress until the file finishes?
Sorry for all the questions... Its hard to experiment on my own and code it with all my schoolwork! IT SUCKS!![]()
Notice the second parameter of QHttp::get(). You can easily construct temporary files with QTemporaryFile.
Yes, you can schedule multiple files to be downloaded. QHttp::get() is asynchronous and returns a unique identifier for each request:
"It" as school work or "it" as information technology?The function does not block and returns immediately. The request is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by requestStarted() and requestFinished().I warmly suggest putting school work on higher priority than your own personal hacking still if the latter is much more fun. I have myself put way too much effort on the latter in the past..
![]()
J-P Nurmi
last2kn0 (6th October 2007)
Ok, wow that sounds great! (I love Qt) Thanks for the pointers!
Um, so I guess I could just have Qhttp::get go to a QFile within QDir::tempPath(). I think I can handle that.
Yeah... ECSE (Electrical, Computer and Systems Engineering)... so its a fairly heavy workload. I've got my priorities straight... Trying to absorb from everyone else's experience so I can concentrate on my school for now.![]()
I appreciate the help... I've seen it all the time, "Go search for yourself, google's your friend, Qt Assistant, etc..." Thats just not plausible all the time, especially if your crazy and you are trying to dual! ha! I tried a little searching on my own but didn't want to interfere with school. So again, thanks! I'll keep ya updated on the progress when i get a chance to write the code.
I get this when I try to download something with QHttp::get:
QSslSocket: cannot find ssleay32 library: QLibrary::load_sys: Cannot load ssleay
32 (The specified module could not be found.).
My current code is like this:
Qt Code:
for (unsigned int i = STARTFILE; i < MAXFILES; ++i){ ul->get(fileName,file); }To copy to clipboard, switch view to plain text mode
I understand that the QIODevice has to be valid for the duration so this could cause problems. How can I fix this?
Also, I commented out the for loop just to prevent any problems with that... and I still have a problem: The files I download are 0 bytes! Why is this?
Thank you
I would still like an answer to the "ssleay32" thing as well as why the files are 0 bytes but I think I'm going to trash that implementation.
I may create a class like stated here: http://www.qtcentre.org/forum/f-qt-p...ighlight=qhttp
That might be a better approach.
Bookmarks