Debian Codegraph @

src/Gui/NetworkRetriever.h

raw
1 /***************************************************************************
2 * Copyright (c) 2004 Werner Mayer <wmayer[at]users.sourceforge.net> *
3 * *
4 * This file is part of the FreeCAD CAx development system. *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Library General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2 of the License, or (at your option) any later version. *
10 * *
11 * This library is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU Library General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Library General Public *
17 * License along with this library; see the file COPYING.LIB. If not, *
18 * write to the Free Software Foundation, Inc., 59 Temple Place, *
19 * Suite 330, Boston, MA 02111-1307, USA *
20 * *
21 ***************************************************************************/
22
23
24 #ifndef GUI_NETWORKRETRIEVER_H
25 #define GUI_NETWORKRETRIEVER_H
26
27 #include <QProcess>
28
29 #include "Command.h"
30
31
32 namespace Gui
33 {
34
35 /**
36 * The NetworkRetriever class encapsulates the GNU tool \a wget.
37 * wget is a non-interactive network retriever to download e.g. the whole
38 * file structure from a server.
39 * \author Werner Mayer
40 */
41 class NetworkRetriever: public QObject
42 {
43 Q_OBJECT
44
45 public:
46 NetworkRetriever(QObject* parent = nullptr);
47 ~NetworkRetriever() override;
48
49 void setNumberOfTries(int);
50 void setOutputFile(const QString&);
51 void setEnableTimestamp(bool);
52 void setProxy(const QString&, const QString& = QString(), const QString& = QString());
53 void setEnableRecursive(bool, int = 0);
54 void setFollowRelative(bool);
55 void setEnableConvert(bool);
56 void setFetchImages(bool);
57 void setEnableHTMLExtension(bool);
58 void setNoParent(bool);
59
60 void setOutputDirectory(const QString&);
61 bool startDownload(const QString&);
62 bool isDownloading() const;
63 void abort();
64
65 static bool testWget();
66
67 Q_SIGNALS:
68 void wgetExited();
69
70 private Q_SLOTS:
71 void testFailure();
72 void wgetFinished(int, QProcess::ExitStatus);
73
74 private:
75 QProcess* wget;
76 struct NetworkRetrieverP* d;
77 };
78
79 // --------------------------------------------------------------------
80
81 class StdCmdDownloadOnlineHelp: public QObject, public Command
82 {
83 Q_OBJECT
84
85 public:
86 StdCmdDownloadOnlineHelp(QObject* parent = nullptr);
87 ~StdCmdDownloadOnlineHelp() override;
88 /** i18n stuff of the command. */
89 void languageChange() override;
90
91 protected:
92 void activated(int iMsg) override;
93
94 /** Creates the action object. */
95 Action* createAction() override;
96
97 private Q_SLOTS:
98 void wgetFinished();
99
100 private:
101 NetworkRetriever* wget;
102 };
103
104 } // namespace Gui
105
106 #endif // GUI_NETWORKRETRIEVER_H