mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-14 08:01:49 -05:00
440559f0c3
Thanks to Mike W9MDB for the concept of forcing to HTTP if OpenSSL is not installed or if the user requires it for other reasons. The sample downloader should now be usable with or without OpenSSL libraries being installed, so long as SourceForge continue to serve identical content from both HTTP and HTTPS schemes on their file servers and mirrors. For users with baulked OpenSSL installations, incorrect or incomplete CA certificate stores, either the improved capability to ignore SSL/TLS errors for the duration of a session at their discretion or, as a last resort a new option to force an HTTP URL scheme is provided. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7379 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
61 lines
1.5 KiB
C++
61 lines
1.5 KiB
C++
#ifndef SAMPLE_DOWNLOADER_DIRECTORY_HPP__
|
|
#define SAMPLE_DOWNLOADER_DIRECTORY_HPP__
|
|
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <QTreeWidget>
|
|
#include <QIcon>
|
|
#include <QSize>
|
|
#include <QDir>
|
|
#include <QUrl>
|
|
|
|
#include "DirectoryDelegate.hpp"
|
|
#include "RemoteFile.hpp"
|
|
|
|
class Configuration;
|
|
class QNetworkAccessManager;
|
|
class QTreeWidgetItem;
|
|
class QNetworkReply;
|
|
class QAuthenticator;
|
|
class QJsonArray;
|
|
|
|
class Directory final
|
|
: public QTreeWidget
|
|
, protected RemoteFile::ListenerInterface
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit Directory (Configuration const * configuration
|
|
, QNetworkAccessManager * network_manager
|
|
, QWidget * parent = nullptr);
|
|
|
|
QSize sizeHint () const override {return {400, 500};}
|
|
|
|
bool url_root (QUrl);
|
|
bool refresh (bool http_only);
|
|
void abort ();
|
|
void update (QTreeWidgetItem * item);
|
|
|
|
protected:
|
|
void error (QString const& title, QString const& message) override;
|
|
bool redirect_request (QUrl const&) override {return true;} // allow
|
|
void download_finished (bool success) override;
|
|
|
|
private:
|
|
Q_SLOT void authentication (QNetworkReply *, QAuthenticator *);
|
|
void parse_entries (QJsonArray const& entries, QDir const& dir, QTreeWidgetItem * parent);
|
|
|
|
Configuration const * configuration_;
|
|
QNetworkAccessManager * network_manager_;
|
|
bool http_only_;
|
|
QDir root_dir_;
|
|
QUrl url_root_;
|
|
RemoteFile contents_;
|
|
DirectoryDelegate item_delegate_;
|
|
QIcon dir_icon_;
|
|
QIcon file_icon_;
|
|
};
|
|
|
|
#endif
|