aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/projectexplorer/devicesupport/devicemanager.cpp
diff options
context:
space:
mode:
authorMarcus Tillmanns <marcus.tillmanns@qt.io>2022-10-05 15:42:14 +0200
committerMarcus Tillmanns <marcus.tillmanns@qt.io>2022-10-11 08:53:02 +0000
commitae58d373b02a4a1e3391aa7f6df17d103db1a060 (patch)
tree8c1d7502c723849dcea408990716fed5ffe16d8b /src/plugins/projectexplorer/devicesupport/devicemanager.cpp
parente5e90ad9310f6f662e4eae8dbf2c5b7f8a279168 (diff)
Add FSEngine FilePath Cache
To speed up file dialogs we introduce a 1 minute cache for the FilePathInfo. A new version of "IDevice::iterateDirectories" allows implementations to provide the FilePathInfo directly. DockerDevice implements fetching the filePathInfo during iterateDirectories which greatly improves the speed again. Change-Id: I24ac16adb2478cbf16a22012e72fcb8910dcdac5 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/devicesupport/devicemanager.cpp')
-rw-r--r--src/plugins/projectexplorer/devicesupport/devicemanager.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp
index febcc6436e..c5a7f4e810 100644
--- a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp
+++ b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp
@@ -521,10 +521,18 @@ DeviceManager::DeviceManager(bool isInstance) : d(std::make_unique<DeviceManager
};
deviceHooks.iterateDirectory = [](const FilePath &filePath,
- const std::function<bool(const FilePath &)> &callBack,
+ const FilePath::IterateDirCallback &callBack,
const FileFilter &filter) {
auto device = DeviceManager::deviceForPath(filePath);
- QTC_ASSERT(device, return);
+ QTC_ASSERT(device, return );
+ device->iterateDirectory(filePath, callBack, filter);
+ };
+
+ deviceHooks.iterateDirectoryWithInfo = [](const FilePath &filePath,
+ const FilePath::IterateDirWithInfoCallback &callBack,
+ const FileFilter &filter) {
+ auto device = DeviceManager::deviceForPath(filePath);
+ QTC_ASSERT(device, return );
device->iterateDirectory(filePath, callBack, filter);
};
@@ -552,6 +560,12 @@ DeviceManager::DeviceManager(bool isInstance) : d(std::make_unique<DeviceManager
return device->writeFileContents(filePath, data, offset);
};
+ deviceHooks.filePathInfo = [](const FilePath &filePath) -> FilePathInfo {
+ auto device = DeviceManager::deviceForPath(filePath);
+ QTC_ASSERT(device, return {});
+ return device->filePathInfo(filePath);
+ };
+
deviceHooks.lastModified = [](const FilePath &filePath) {
auto device = DeviceManager::deviceForPath(filePath);
QTC_ASSERT(device, return QDateTime());