Add a sample download dialog and upload sub-system

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
This commit is contained in:
Bill Somerville
2015-12-24 11:41:05 +00:00
parent 0775acf236
commit 0efe9231bb
26 changed files with 1391 additions and 43 deletions
+26 -24
View File
@@ -22,9 +22,9 @@ namespace
// char const * const wsprNetUrl = "http://127.0.0.1/post?";
};
WSPRNet::WSPRNet(QObject *parent)
WSPRNet::WSPRNet(QNetworkAccessManager * manager, QObject *parent)
: QObject{parent}
, networkManager {new QNetworkAccessManager {this}}
, networkManager {manager}
, uploadTimer {new QTimer {this}}
, m_urlQueueSize {0}
{
@@ -74,33 +74,35 @@ void WSPRNet::upload(QString const& call, QString const& grid, QString const& rf
void WSPRNet::networkReply(QNetworkReply *reply)
{
if (QNetworkReply::NoError != reply->error ()) {
Q_EMIT uploadStatus (QString {"Error: %1"}.arg (reply->error ()));
// not clearing queue or halting queuing as it may be a transient
// one off request error
}
else {
QString serverResponse = reply->readAll();
if( m_uploadType == 2) {
if (!serverResponse.contains(QRegExp("spot\\(s\\) added"))) {
emit uploadStatus("Upload Failed");
urlQueue.clear();
// check if request was ours
if (m_outstandingRequests.removeOne (reply)) {
if (QNetworkReply::NoError != reply->error ()) {
Q_EMIT uploadStatus (QString {"Error: %1"}.arg (reply->error ()));
// not clearing queue or halting queuing as it may be a transient
// one off request error
}
else {
QString serverResponse = reply->readAll();
if( m_uploadType == 2) {
if (!serverResponse.contains(QRegExp("spot\\(s\\) added"))) {
emit uploadStatus("Upload Failed");
urlQueue.clear();
uploadTimer->stop();
}
}
if (urlQueue.isEmpty()) {
emit uploadStatus("done");
QFile::remove(m_file);
uploadTimer->stop();
}
}
if (urlQueue.isEmpty()) {
emit uploadStatus("done");
QFile::remove(m_file);
uploadTimer->stop();
}
qDebug () << QString {"WSPRnet.org %1 outstanding requests"}.arg (m_outstandingRequests.size ());
// delete request object instance on return to the event loop otherwise it is leaked
reply->deleteLater ();
}
m_outstandingRequests.removeOne (reply);
qDebug () << QString {"WSPRnet.org %1 outstanding requests"}.arg (m_outstandingRequests.size ());
// delete request object instance on return to the event loop otherwise it is leaked
reply->deleteLater ();
}
bool WSPRNet::decodeLine(QString const& line, QHash<QString,QString> &query)