diff options
| author | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:12 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:12 +0100 |
| commit | 98c02f78b26811ba5d9962ba27ec24cacf82bb22 (patch) | |
| tree | daaf609cde31d8fb3b6c3457c43663d14f0dda80 /SampleDownloader/FileNode.hpp | |
| parent | 332d2ce88c2f0bc2908cacdc6707e2f9fa49f26d (diff) | |
| parent | 992d4b4b8d3f3a630a2cf00d593ee4ce4dfa7ce8 (diff) | |
Update upstream source from tag 'upstream/2.7.0_rc8+repack'
Update to upstream version '2.7.0~rc8+repack'
with Debian dir 6fce941c8282d35c8df23d3de779a42e27688bc1
Diffstat (limited to 'SampleDownloader/FileNode.hpp')
| -rwxr-xr-x | SampleDownloader/FileNode.hpp | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/SampleDownloader/FileNode.hpp b/SampleDownloader/FileNode.hpp index d57a34fb..4ba9f9d2 100755 --- a/SampleDownloader/FileNode.hpp +++ b/SampleDownloader/FileNode.hpp @@ -1,67 +1,67 @@ -#ifndef FILE_NODE_HPP__
-#define FILE_NODE_HPP__
-
-#include <QTreeWidgetItem>
-
-#include "RemoteFile.hpp"
-
-class QNetworkAccessManager;
-class QString;
-class QUrl;
-
-//
-// A holder for a RemoteFile object linked to a QTreeWidget row.
-//
-// It renders the file name in first column and holds download
-// progress data in the second column. The progress information is a
-// 64 bit integer number of bytes in the DisplayRole and a total bytes
-// expected in the UserRole. The first column also renders a check box
-// that downloads the file when checked and removes the downloaded
-// file when unchecked. The URL and local absolute file path are
-// stored in the UserData and UserData+1 roles of the first column.
-//
-class FileNode final
- : public QTreeWidgetItem
- , protected RemoteFile::ListenerInterface
-{
-public:
- explicit FileNode (QTreeWidgetItem * parent
- , QNetworkAccessManager * network_manager
- , QString const& local_path
- , QUrl const& url
- , bool http_only);
-
- bool local () const {return remote_file_.local ();}
- bool sync (bool local);
- void abort ();
-
- static int constexpr Type {UserType + 1};
-
- //
- // Clients may use this RAII class to block nested calls to sync
- // which may be troublesome, e.g. when UI updates cause recursion.
- //
- struct sync_blocker
- {
- sync_blocker (FileNode * node) : node_ {node} {node_->block_sync_ = true;}
- sync_blocker (sync_blocker const&) = delete;
- sync_blocker& operator = (sync_blocker const&) = delete;
- ~sync_blocker () {node_->block_sync_ = false;}
- private:
- FileNode * node_;
- };
-
-protected:
- void error (QString const& title, QString const& message) override;
- bool redirect_request (QUrl const&) override {return true;} // allow
- void download_progress (qint64 bytes_received, qint64 total_bytes) override;
- void download_finished (bool success) override;
-
-private:
- RemoteFile remote_file_; // active download
- bool block_sync_;
-
- friend struct sync_blocker;
-};
-
-#endif
+#ifndef FILE_NODE_HPP__ +#define FILE_NODE_HPP__ + +#include <QTreeWidgetItem> + +#include "RemoteFile.hpp" + +class QNetworkAccessManager; +class QString; +class QUrl; + +// +// A holder for a RemoteFile object linked to a QTreeWidget row. +// +// It renders the file name in first column and holds download +// progress data in the second column. The progress information is a +// 64 bit integer number of bytes in the DisplayRole and a total bytes +// expected in the UserRole. The first column also renders a check box +// that downloads the file when checked and removes the downloaded +// file when unchecked. The URL and local absolute file path are +// stored in the UserData and UserData+1 roles of the first column. +// +class FileNode final + : public QTreeWidgetItem + , protected RemoteFile::ListenerInterface +{ +public: + explicit FileNode (QTreeWidgetItem * parent + , QNetworkAccessManager * network_manager + , QString const& local_path + , QUrl const& url + , bool http_only); + + bool local () const {return remote_file_.local ();} + bool sync (bool local); + void abort (); + + static int constexpr Type {UserType + 1}; + + // + // Clients may use this RAII class to block nested calls to sync + // which may be troublesome, e.g. when UI updates cause recursion. + // + struct sync_blocker + { + sync_blocker (FileNode * node) : node_ {node} {node_->block_sync_ = true;} + sync_blocker (sync_blocker const&) = delete; + sync_blocker& operator = (sync_blocker const&) = delete; + ~sync_blocker () {node_->block_sync_ = false;} + private: + FileNode * node_; + }; + +protected: + void error (QString const& title, QString const& message) override; + bool redirect_request (QUrl const&) override {return true;} // allow + void download_progress (qint64 bytes_received, qint64 total_bytes) override; + void download_finished (bool success) override; + +private: + RemoteFile remote_file_; // active download + bool block_sync_; + + friend struct sync_blocker; +}; + +#endif |
