mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-10-31 15:47:10 -04: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
52 lines
1.5 KiB
C++
52 lines
1.5 KiB
C++
#ifndef DIRECTORY_NODE_HPP__
|
|
#define DIRECTORY_NODE_HPP__
|
|
|
|
#include <QTreeWidgetItem>
|
|
#include <QString>
|
|
|
|
//
|
|
// Tree widget item representing a file system directory.
|
|
//
|
|
// It renders the directory name in the first column and progress
|
|
// information in the 2nd column. The progress information consists of
|
|
// two 64 bit integer values, the 1st in the DisplayRole is the number
|
|
// of bytes received and the 2nd in the UserRole the total bytes
|
|
// expected. The progress information is not automatically
|
|
// maintained, see the Directory class for an example of how to
|
|
// dynamically maintain the DirectoryNode progress values. The 1st
|
|
// column also renders a tristate check box that controls the first
|
|
// column check boxes of child items.
|
|
//
|
|
class DirectoryNode final
|
|
: public QTreeWidgetItem
|
|
{
|
|
public:
|
|
explicit DirectoryNode (QTreeWidgetItem * parent, QString const& name)
|
|
: QTreeWidgetItem {parent, Type}
|
|
{
|
|
setFlags (flags () | Qt::ItemIsUserCheckable | Qt::ItemIsTristate);
|
|
setText (0, name);
|
|
setCheckState (0, Qt::Unchecked);
|
|
|
|
// initialize as empty, the owning QTreeWidget must maintain these
|
|
// progress values
|
|
setData (1, Qt::DisplayRole, 0ll); // progress in bytes
|
|
setData (1, Qt::UserRole, 0ll); // expected bytes
|
|
}
|
|
|
|
bool operator == (QString const& name) const
|
|
{
|
|
return name == text (0);
|
|
}
|
|
|
|
static int const Type {UserType};
|
|
};
|
|
|
|
inline
|
|
bool operator == (QString const& lhs, DirectoryNode const& rhs)
|
|
{
|
|
return rhs == lhs;
|
|
}
|
|
|
|
#endif
|