Class sh::filesystem::DetailColumn

class sh::filesystem::DetailColumn : public std::enable_shared_from_this<DetailColumn>

Abstract base class for a detail column (on filesystem nodes).

Those can e.g. be seen in the file list view, but can also be queried internally by other places in code.

It encapsulates the retrieval logic and metadata for one piece of additional information a sh::filesystem::FilesystemNode can have (e.g. the filesize). Retrieving the values is designed to be asynchronous. Each instance represents one column, while the actual logic is implemented in subclasses. For a new detail column, subclass this class and implement at least determineValue.

Subclassed by sh::detailcolumns::DetailColumnCustomAttributes, sh::detailcolumns::DetailColumnDirectSymlinkTarget, sh::detailcolumns::DetailColumnExtendedAttributes, sh::detailcolumns::DetailColumnFilesize, sh::detailcolumns::DetailColumnMimetype, sh::detailcolumns::DetailColumnMtime, sh::detailcolumns::DetailColumnResolvedSymlink, sh::filesystemhandlers::SharcFilesystemHandler::ArchivedSizeDetailColumn, sh::scripting::api::ApiDetailColumn

Public Functions

QString name()

The internal unique name.

QString displayName()

The display name.

bool isValueAvailable(std::shared_ptr<FilesystemNode> node)

Checks if a value for this detail is available for one given node.

QVariant value(std::shared_ptr<FilesystemNode> node, bool ignoreAged = false)

Returns the value for this detail for one given node.

Parameters
  • ignoreAged: If no value should be returned which is older than the last request (not useful for nearly all cases).

QString displayValue(std::shared_ptr<FilesystemNode> node, const sh::filesystem::FilesystemModelFileviewProxy *viewmodel)

Returns the stringified value for this details for one given node considering the configuration of a view.

bool isVisible()

If this detail shall be a visible column in the view.

QVariant requestValue(std::shared_ptr<FilesystemNode> node, sh::filesystem::Operation *op = 0, bool withNodeValues = false, bool withOperationsCache = true)

Requests to determine the value for this detail for one given node. Blocks until the value is available. Get it with the value method afterwards.

bool sort_doTypediff()

If sorting should separate files and directories.

int sort_order(std::shared_ptr<FilesystemNode> n1, std::shared_ptr<FilesystemNode> n2)

The sorting order.

uint displayIndex()

Controls which place this column should get in the user interface.

QVariant computeValue(std::shared_ptr<FilesystemNode> node, sh::filesystem::Operation *op)

Returns a freshly determined value for this column and the given node. It neither asks nor populates any caches or storages.

int defaultWidth()
bool isRightAligned()
~DetailColumn()
void applyValueByEurl(std::shared_ptr<const sh::filesystem::Eurl> eurl, sh::filesystem::Operation *op, QVariant value)

Applies the detail value to a given eurl (without using any caches).

Used for transferring some details when a file transfer occurs.

Optionally implement the one of the applyValueBy… methods and register the instance with sh::filesystem::FilesystemOperation::addTransferrableDetailColumn. For performance reasons, you should decide to implement applyValueByEurl.

void applyValueByNode(std::shared_ptr<FilesystemNode> node, sh::filesystem::Operation *op, QVariant value)

Applies the detail value to a given node (without using any caches).

Used for transferring some details when a file transfer occurs.

Optionally implement the one of the applyValueBy… methods and register the instance with sh::filesystem::FilesystemOperation::addTransferrableDetailColumn. For performance reasons, you should decide to implement applyValueByEurl.

Public Static Functions

QVariant VALUE_UNAVAILABLE()

A special value expressing that the value is not yet available.

void registerKnownDetailColumn(QString name, std::shared_ptr<DetailColumn> column)
std::shared_ptr<DetailColumn> findKnownDetailColumn(QString name)

Public Static Attributes

const uint DISPLAYINDEX_CORE = 10000
const uint DISPLAYINDEX_INTERESTING = 20000
const uint DISPLAYINDEX_EXOTIC = 30000

Private Members

QString _displayName
QString _name
uint _displayIndex
bool _sort_doTypediff
int _defaultWidth
bool _isRightAligned

Private Static Attributes

QMap<QString, std::shared_ptr<DetailColumn>> _knownDetailColumns
QMutex _knownDetailColumnsMutex

Friends

friend class sh::filesystem::FilesystemNode