Introduce IDevice::bytesAvailable()

It's going to replace RemoteLinuxCheckForFreeDiskSpaceService.

Change-Id: If8c30a57b9013387c69412f12102bcd4d41a88b5
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-01-04 15:46:55 +01:00
parent 3c7d0c5c98
commit 35cde5ddae
10 changed files with 63 additions and 7 deletions

View File

@@ -40,6 +40,7 @@
#include <QFileInfo>
#include <QOperatingSystemVersion>
#include <QRegularExpression>
#include <QStorageInfo>
#include <QUrl>
#include <qplatformdefs.h>
@@ -1421,6 +1422,16 @@ qint64 FilePath::fileSize() const
return QFileInfo(m_data).size();
}
qint64 FilePath::bytesAvailable() const
{
if (needsDevice()) {
QTC_ASSERT(s_deviceHooks.bytesAvailable, return false);
return s_deviceHooks.bytesAvailable(*this);
}
return QStorageInfo(m_data).bytesAvailable();
}
QTextStream &operator<<(QTextStream &s, const FilePath &fn)
{
return s << fn.toString();