diff options
| author | Christoph Berg <myon@debian.org> | 2026-10-09 14:12:35 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-10-09 14:12:35 +0200 |
| commit | ffc62c792c9a5196cb4ce7a353287dfe20db6524 (patch) | |
| tree | 1269efa852935b183daae4bb33a58d1b4d2ffb53 /SampleDownloader | |
| parent | 059831534c7e884f0a607ed86b582fd00d821731 (diff) | |
New upstream version 3.3.0~beta1+dfsgupstream/3.3.0_beta1+dfsg
Diffstat (limited to 'SampleDownloader')
| -rw-r--r-- | SampleDownloader/Directory.cpp | 6 | ||||
| -rw-r--r-- | SampleDownloader/Directory.hpp | 3 | ||||
| -rw-r--r-- | SampleDownloader/FileNode.cpp | 5 | ||||
| -rw-r--r-- | SampleDownloader/FileNode.hpp | 3 | ||||
| -rw-r--r-- | SampleDownloader/README | 5 | ||||
| -rw-r--r-- | SampleDownloader/RemoteFile.cpp | 15 | ||||
| -rw-r--r-- | SampleDownloader/RemoteFile.hpp | 7 |
7 files changed, 21 insertions, 23 deletions
diff --git a/SampleDownloader/Directory.cpp b/SampleDownloader/Directory.cpp index 45ebe6b5..2d73928e 100644 --- a/SampleDownloader/Directory.cpp +++ b/SampleDownloader/Directory.cpp @@ -37,7 +37,6 @@ Directory::Directory (Configuration const * configuration : QTreeWidget {parent} , configuration_ {configuration} , network_manager_ {network_manager} - , http_only_ {false} , root_dir_ {configuration_->save_directory ()} , contents_ {this , network_manager_ @@ -95,7 +94,7 @@ void Directory::error (QString const& title, QString const& message) MessageBox::warning_message (this, title, message); } -bool Directory::refresh (bool http_only) +bool Directory::refresh () { abort (); clear (); @@ -103,7 +102,6 @@ bool Directory::refresh (bool http_only) root_dir_ = configuration_->save_directory (); QDir contents_dir {root_dir_.absoluteFilePath (samples_dir_name)}; contents_.local_file_path (contents_dir.absoluteFilePath (contents_file_name)); - contents_.http_only (http_only_ = http_only); QUrl url {url_root_.resolved (QDir {root_dir_.relativeFilePath (samples_dir_name)}.filePath (contents_file_name))}; if (url.isValid ()) { @@ -179,7 +177,7 @@ void Directory::parse_entries (QJsonArray const& entries, QDir const& dir, QTree { auto node = new FileNode {parent, network_manager_ , QDir {root_dir_.filePath (dir.path ())}.absoluteFilePath (name) - , url, http_only_}; + , url}; FileNode::sync_blocker b {node}; node->setIcon (0, file_icon_); node->setCheckState (0, node->local () ? Qt::Checked : Qt::Unchecked); diff --git a/SampleDownloader/Directory.hpp b/SampleDownloader/Directory.hpp index 1ffae0d8..3e933c9f 100644 --- a/SampleDownloader/Directory.hpp +++ b/SampleDownloader/Directory.hpp @@ -33,7 +33,7 @@ public: QSize sizeHint () const override {return {400, 500};} bool url_root (QUrl); - bool refresh (bool http_only); + bool refresh (); void abort (); void update (QTreeWidgetItem * item); @@ -48,7 +48,6 @@ private: Configuration const * configuration_; QNetworkAccessManager * network_manager_; - bool http_only_; QDir root_dir_; QUrl url_root_; RemoteFile contents_; diff --git a/SampleDownloader/FileNode.cpp b/SampleDownloader/FileNode.cpp index e274dc5a..b9241a64 100644 --- a/SampleDownloader/FileNode.cpp +++ b/SampleDownloader/FileNode.cpp @@ -11,10 +11,9 @@ FileNode::FileNode (QTreeWidgetItem * parent , QNetworkAccessManager * network_manager , QString const& local_file_path - , QUrl const& url - , bool http_only) + , QUrl const& url) : QTreeWidgetItem {parent, Type} - , remote_file_ {this, network_manager, local_file_path, http_only} + , remote_file_ {this, network_manager, local_file_path} , block_sync_ {false} { sync_blocker b {this}; diff --git a/SampleDownloader/FileNode.hpp b/SampleDownloader/FileNode.hpp index 4ba9f9d2..6261a1f2 100644 --- a/SampleDownloader/FileNode.hpp +++ b/SampleDownloader/FileNode.hpp @@ -28,8 +28,7 @@ public: explicit FileNode (QTreeWidgetItem * parent , QNetworkAccessManager * network_manager , QString const& local_path - , QUrl const& url - , bool http_only); + , QUrl const& url); bool local () const {return remote_file_.local ();} bool sync (bool local); diff --git a/SampleDownloader/README b/SampleDownloader/README index d11bfc72..2f191992 100644 --- a/SampleDownloader/README +++ b/SampleDownloader/README @@ -1,5 +1,6 @@ A UI for downloading sample files from a web server. Works in concert with samples/CMakeLists.txt which generates the JSON -contents description file and has a build target upload-samples that -uploads the samples and content file to the project files server. +contents description file and has a build target stage-samples that +copies the samples and contents file into a feat-web-pages checkout +for publication on GitHub Pages. diff --git a/SampleDownloader/RemoteFile.cpp b/SampleDownloader/RemoteFile.cpp index 72d1ddbd..98ec74fa 100644 --- a/SampleDownloader/RemoteFile.cpp +++ b/SampleDownloader/RemoteFile.cpp @@ -10,12 +10,11 @@ #include "moc_RemoteFile.cpp" RemoteFile::RemoteFile (ListenerInterface * listener, QNetworkAccessManager * network_manager - , QString const& local_file_path, bool http_only, QObject * parent) + , QString const& local_file_path, QObject * parent) : QObject {parent} , listener_ {listener} , network_manager_ {network_manager} , local_file_ {local_file_path} - , http_only_ {http_only} , is_valid_ {false} , redirect_count_ {0} , file_ {local_file_path} @@ -128,9 +127,17 @@ void RemoteFile::download (QUrl url) } #endif - if (url.isValid () && (!QSslSocket::supportsSsl () || http_only_)) + if ("https" == url.scheme () && !network_manager_->supportedSchemes ().contains ("https")) { - url.setScheme ("http"); + if (listener_) + { + listener_->download_finished (false); + listener_->error (tr ("Network Error") + , tr ("SSL/TLS support not installed, cannot fetch:\n\"%1\"") + .arg (url.toDisplayString ())); + } + is_valid_ = false; + return; } QNetworkRequest request {url}; request.setRawHeader ("User-Agent", "WSJT Sample Downloader"); diff --git a/SampleDownloader/RemoteFile.hpp b/SampleDownloader/RemoteFile.hpp index 3e6cb851..273c6887 100644 --- a/SampleDownloader/RemoteFile.hpp +++ b/SampleDownloader/RemoteFile.hpp @@ -39,8 +39,7 @@ public: }; explicit RemoteFile (ListenerInterface * listener, QNetworkAccessManager * network_manager - , QString const& local_file_path, bool http_only = false - , QObject * parent = nullptr); + , QString const& local_file_path, QObject * parent = nullptr); // true if local file exists or will do very soon bool local () const; @@ -57,9 +56,6 @@ public: QString local_file_path () const {return local_file_.absoluteFilePath ();} QUrl url () const {return url_;} - // always use an http scheme for remote URLs - void http_only (bool flag = true) {http_only_ = flag;} - private: void download (QUrl url); void reply_finished (); @@ -73,7 +69,6 @@ private: ListenerInterface * listener_; QNetworkAccessManager * network_manager_; QFileInfo local_file_; - bool http_only_; QUrl url_; QPointer<QNetworkReply> reply_; bool is_valid_; |
