mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-01 16:13:57 -04:00
0efe9231bb
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
89 lines
2.0 KiB
C++
89 lines
2.0 KiB
C++
#include "revision_utils.hpp"
|
|
|
|
#include <cstring>
|
|
|
|
#include <QCoreApplication>
|
|
#include <QRegularExpression>
|
|
|
|
#include "svnversion.h"
|
|
|
|
namespace
|
|
{
|
|
QString revision_extract_number (QString const& s)
|
|
{
|
|
QString revision;
|
|
|
|
// try and match a number
|
|
QRegularExpression re {R"(^[$:]\w+: (\d+[^$]*)\$$)"};
|
|
auto match = re.match (s);
|
|
if (match.hasMatch ())
|
|
{
|
|
revision = 'r' + match.captured (1);
|
|
}
|
|
return revision;
|
|
}
|
|
}
|
|
|
|
QString revision (QString const& svn_rev_string)
|
|
{
|
|
QString result;
|
|
auto revision_from_svn = revision_extract_number (svn_rev_string);
|
|
|
|
#if defined (CMAKE_BUILD)
|
|
QString svn_info {":Rev: " WSJTX_STRINGIZE (SVNVERSION) " $"};
|
|
|
|
auto revision_from_svn_info = revision_extract_number (svn_info);
|
|
if (!revision_from_svn_info.isEmpty ())
|
|
{
|
|
// we managed to get the revision number from svn info etc.
|
|
result = revision_from_svn_info;
|
|
}
|
|
else if (!revision_from_svn.isEmpty ())
|
|
{
|
|
// fall back to revision passed in if any
|
|
result = revision_from_svn;
|
|
}
|
|
else
|
|
{
|
|
// match anything
|
|
QRegularExpression re {R"(^[$:]\w+: ([^$]*)\$$)"};
|
|
auto match = re.match (svn_info);
|
|
if (match.hasMatch ())
|
|
{
|
|
result = match.captured (1);
|
|
}
|
|
}
|
|
#else
|
|
if (!revision_from_svn.isEmpty ())
|
|
{
|
|
// not CMake build so all we have is revision passed
|
|
result = revision_from_svn;
|
|
}
|
|
#endif
|
|
return result.trimmed ();
|
|
}
|
|
|
|
QString version (bool include_patch)
|
|
{
|
|
#if defined (CMAKE_BUILD)
|
|
QString v {WSJTX_STRINGIZE (WSJTX_VERSION_MAJOR) "." WSJTX_STRINGIZE (WSJTX_VERSION_MINOR)};
|
|
if (include_patch)
|
|
{
|
|
v += "." WSJTX_STRINGIZE (WSJTX_VERSION_PATCH)
|
|
# if defined (WSJTX_RC)
|
|
+ "-rc" WSJTX_STRINGIZE (WSJTX_RC)
|
|
# endif
|
|
;
|
|
}
|
|
#else
|
|
QString v {"Not for Release"};
|
|
#endif
|
|
return v;
|
|
}
|
|
|
|
QString program_title (QString const& revision)
|
|
{
|
|
QString id {QCoreApplication::applicationName () + " v" + QCoreApplication::applicationVersion ()};
|
|
return id + " " + revision + " by K1JT";
|
|
}
|