mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 20:28:42 -05:00
924e20efa8
Samples are downloaded from a web server, currently the SF download server. The samples are stored in the source controlled samples directory and the CMake script there builds a suitable directory tree for upload to the web server under samples/web containing the samples hierarchy and the generated JSON contents database file. The samples CMake script also defines an 'upload-samples' target that uses rsync to efficiently upload the samples and the accompanying contents JSON database file. Any directory structure under the samples directory may be created, to add a new sample file simply add the file to source control and amend the list of sample files (SAMPLE_FILES) in samples/CMakeLists.txt. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6308 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
60 lines
1.4 KiB
C++
60 lines
1.4 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 ();
|
|
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_;
|
|
QDir root_dir_;
|
|
QUrl url_root_;
|
|
RemoteFile contents_;
|
|
DirectoryDelegate item_delegate_;
|
|
QIcon dir_icon_;
|
|
QIcon file_icon_;
|
|
};
|
|
|
|
#endif
|