13namespace swift::misc::network
21 : m_name(name), m_url(url), m_size(size)
82 return dt.
toString(
"yyyy-MM-dd HH:mm:ss");
88 return "Name: " + m_name +
" description: " + m_description +
" size: " +
QString::number(m_size) +
131 case IndexUrl: m_url.setPropertyByIndex(index.
copyFrontRemoved(), variant);
break;
140 file.
setName(json.value(
"name").toString());
142 file.
setUrl(json.value(
"url").toString());
143 const qint64 size = json.value(
"size").toInt();
145 const qint64 created = json.value(
"tsCreated").toInt();
146 const qint64 lastUpdated = json.value(
"tsLastUpdated").toInt();
147 file.m_created = created;
static QString humanReadableFileSize(qint64 size)
Human readable (GB, MB, ..) file size.
static bool isExecutableFile(const QString &fileName)
Executable file (decided by appendix).
static bool isSwiftInstaller(const QString &fileName)
swift installer
Non-owning reference to a CPropertyIndex with a subset of its features.
Q_REQUIRED_RESULT CPropertyIndexRef copyFrontRemoved() const
Copy with first element removed.
CastType frontCasted() const
First element casted to given type, usually the PropertIndex enum.
bool isMyself() const
Myself index, used with nesting.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
QString getFormattedUtcTimestampYmdhms() const
As yyyy MM dd HH mm ss.
static bool canHandleIndex(CPropertyIndexRef index)
Can given index be handled.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
void setMSecsSinceEpoch(qint64 mSecsSinceEpoch)
Timestamp as ms value.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
QString convertToQString(bool i18n=false) const
Cast as QString.
QString getFormattedCreatedYmdhms() const
Created timestamp.
QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const
Property by index.
bool matchesBaseName(const QString &baseName) const
Matching name?
const QString & getName() const
Name.
bool isSwiftInstaller() const
swift installer
void setDescription(const QString &description)
Description.
QString getBaseName() const
Name with directory stripped.
CUrl getSmartUrl() const
Automatically concatenates the name if missing.
void setSize(qint64 size)
Set size.
bool isExecutableFile() const
Executable file (decided by appendix).
void setName(const QString &name)
Name.
void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant)
Set property by index.
qint64 getSize() const
Get size.
QString getSizeHumanReadable() const
Human readable (GB, MB, ..) file size.
bool hasName() const
Has name?
CRemoteFile()=default
Constructor.
ColumnIndex
Properties by index.
bool hasUrl() const
Has an URL.
QString getBaseNameAndSize() const
Name + human readable size.
static CRemoteFile fromDatabaseJson(const QJsonObject &json)
Role from DB JSON.
const CUrl & getUrl() const
Get URL.
void setUrl(const CUrl &url)
Set URL.
Value object encapsulating information of a location, kind of simplified CValueObject compliant versi...
CUrl withAppendedPath(const QString &path) const
Append path.
SWIFT_MISC_EXPORT bool caseInsensitiveStringCompare(const QString &c1, const QString &c2)
Case insensitive string compare.
QDateTime fromMSecsSinceEpoch(qint64 msecs)
QString toString(QStringView format) const const
QString arg(Args &&... args) const const
bool isEmpty() const const
QString number(double n, char format, int precision)
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
QVariant fromValue(T &&value)
int toInt(bool *ok) const const
#define SWIFT_DEFINE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template definition of mixins for a CValueObject subclass.