The NetworkRetriever class encapsulates the GNU tool wget. More...
#include <NetworkRetriever.h>
Signals | |
void | wgetExited () |
Public Member Functions | |
void | abort () |
Kills wget if it is still running. More... | |
bool | isDownloading () const |
Returns true if wget is still downloading, otherwise returns false. More... | |
NetworkRetriever (QObject *parent=nullptr) | |
void | setEnableConvert (bool) |
If convert is true all non-relative links are converted to relative links. More... | |
void | setEnableHTMLExtension (bool) |
Saves all text/html documents with .html extionsion if html is true. More... | |
void | setEnableRecursive (bool, int=0) |
If recursive is true all referenced files are downloaded recursively. More... | |
void | setEnableTimestamp (bool) |
If ts is true the timestamping is enabled, otherwise timestamping is disabled. More... | |
void | setFetchImages (bool) |
If img is true wget tries to get all needed image files to display the HTML page. More... | |
void | setFollowRelative (bool) |
If folRel is true wget follows relative links only. More... | |
void | setNoParent (bool) |
Do not ever ascend to the parent directory when retrieving recursively. More... | |
void | setNumberOfTries (int) |
Sets the number of retries to tries. More... | |
void | setOutputDirectory (const QString &) |
Sets the output directory to dir where all downloaded are written into. More... | |
void | setOutputFile (const QString &) |
Sets output file to out where documents are written to. More... | |
void | setProxy (const QString &, const QString &=QString(), const QString &=QString()) |
If you are behind a proxy server then you have to specify your proxy url with proxy. More... | |
bool | startDownload (const QString &) |
wget starts to download startUrl and all referenced pages. More... | |
virtual | ~NetworkRetriever () |
Static Public Member Functions | |
static bool | testWget () |
This is a test if wget is in PATH environment or not. More... | |
The NetworkRetriever class encapsulates the GNU tool wget.
wget is a non-interactive network retriever to download e.g. the whole file structure from a server.
NetworkRetriever::NetworkRetriever | ( | QObject * | parent = nullptr | ) |
References draftgeoutils.intersections::connect(), Gui::NetworkRetrieverP::convert, Gui::NetworkRetrieverP::folRel, Gui::NetworkRetrieverP::html, Gui::NetworkRetrieverP::img, Gui::NetworkRetrieverP::level, Gui::NetworkRetrieverP::nop, Gui::NetworkRetrieverP::recurse, Gui::NetworkRetrieverP::timeStamp, and Gui::NetworkRetrieverP::tries.
|
virtual |
void NetworkRetriever::abort | ( | void | ) |
Kills wget if it is still running.
Referenced by Gui::StdCmdDownloadOnlineHelp::activated(), PathPythonGui.simple_edit_panel.SimpleEditPanel::clicked(), and femsolver.run.Machine::run().
bool NetworkRetriever::isDownloading | ( | ) | const |
Returns true if wget is still downloading, otherwise returns false.
Referenced by Gui::StdCmdDownloadOnlineHelp::activated().
void NetworkRetriever::setEnableConvert | ( | bool | convert | ) |
If convert is true all non-relative links are converted to relative links.
As default the convert property is true.
References Gui::NetworkRetrieverP::convert.
Referenced by Gui::StdCmdDownloadOnlineHelp::StdCmdDownloadOnlineHelp().
void NetworkRetriever::setEnableHTMLExtension | ( | bool | html | ) |
Saves all text/html documents with .html extionsion if html is true.
As default the html property is false.
References Gui::NetworkRetrieverP::html.
Referenced by Gui::StdCmdDownloadOnlineHelp::StdCmdDownloadOnlineHelp().
If recursive is true all referenced files are downloaded recursively.
As default recursion is disabled. level specifies the maximum recursion depth. If level is 0 the recursion depth is infinite. As default the level property is 1.
References Gui::NetworkRetrieverP::level, and Gui::NetworkRetrieverP::recurse.
Referenced by Gui::StdCmdDownloadOnlineHelp::StdCmdDownloadOnlineHelp().
void NetworkRetriever::setEnableTimestamp | ( | bool | ts | ) |
If ts is true the timestamping is enabled, otherwise timestamping is disabled.
If timestamping is enabled files are no more re-retrieved unless they are newer than the local files. As default the timestamping property is disabled.
References Gui::NetworkRetrieverP::timeStamp.
Referenced by Gui::StdCmdDownloadOnlineHelp::StdCmdDownloadOnlineHelp().
void NetworkRetriever::setFetchImages | ( | bool | img | ) |
If img is true wget tries to get all needed image files to display the HTML page.
As default this behaviour is disabled..
References Gui::NetworkRetrieverP::img.
Referenced by Gui::StdCmdDownloadOnlineHelp::StdCmdDownloadOnlineHelp().
void NetworkRetriever::setFollowRelative | ( | bool | folRel | ) |
If folRel is true wget follows relative links only.
As default the follows relative property is false.
References Gui::NetworkRetrieverP::folRel.
Referenced by Gui::StdCmdDownloadOnlineHelp::StdCmdDownloadOnlineHelp().
void NetworkRetriever::setNoParent | ( | bool | nop | ) |
Do not ever ascend to the parent directory when retrieving recursively.
References Gui::NetworkRetrieverP::nop.
Referenced by Gui::StdCmdDownloadOnlineHelp::StdCmdDownloadOnlineHelp().
void NetworkRetriever::setNumberOfTries | ( | int | tries | ) |
Sets the number of retries to tries.
If tries is 0 the number of tries is unlimited. The default value of the tries property is set to 3.
References Gui::NetworkRetrieverP::tries.
Referenced by Gui::StdCmdDownloadOnlineHelp::StdCmdDownloadOnlineHelp().
void NetworkRetriever::setOutputDirectory | ( | const QString & | dir | ) |
Sets the output directory to dir where all downloaded are written into.
References Gui::NetworkRetrieverP::dir.
Referenced by Gui::StdCmdDownloadOnlineHelp::activated().
void NetworkRetriever::setOutputFile | ( | const QString & | out | ) |
Sets output file to out where documents are written to.
References Gui::NetworkRetrieverP::outputFile.
void NetworkRetriever::setProxy | ( | const QString & | proxy, |
const QString & | user = QString() , |
||
const QString & | passwd = QString() |
||
) |
If you are behind a proxy server then you have to specify your proxy url with proxy.
Moreover, if the proxy requires user authentication then you can specify the username with user and the password with passwd.
References Gui::NetworkRetrieverP::passwd, Gui::NetworkRetrieverP::proxy, and Gui::NetworkRetrieverP::user.
Referenced by Gui::StdCmdDownloadOnlineHelp::activated().
bool NetworkRetriever::startDownload | ( | const QString & | startUrl | ) |
wget starts to download startUrl and all referenced pages.
References Base::Console(), Gui::NetworkRetrieverP::convert, Gui::NetworkRetrieverP::dir, Base::ConsoleSingleton::Error(), Gui::NetworkRetrieverP::folRel, Gui::NetworkRetrieverP::html, Gui::NetworkRetrieverP::img, Gui::NetworkRetrieverP::level, Gui::NetworkRetrieverP::nop, Gui::NetworkRetrieverP::outputFile, Gui::NetworkRetrieverP::passwd, Gui::NetworkRetrieverP::proxy, Gui::NetworkRetrieverP::recurse, Gui::NetworkRetrieverP::startUrl, testWget(), Gui::NetworkRetrieverP::timeStamp, Gui::NetworkRetrieverP::tries, and Gui::NetworkRetrieverP::user.
Referenced by Gui::StdCmdDownloadOnlineHelp::activated().
|
static |
This is a test if wget is in PATH environment or not.
If the test succeeds true is returned, false otherwise.
Referenced by startDownload().
|
signal |