-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve filebrowser #1493
Improve filebrowser #1493
Conversation
src/filebrowser/auto-update-mgr.cpp
Outdated
qWarning() << "[AutoUpdateManager] failed to list repos:" << error.toString(); | ||
} | ||
|
||
void AutoUpdateManager::onListReposSuccess(const std::vector<ServerRepo>& repos, QString repo_id, QString path, QString sig, QString file_id, QString local_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
现在这个 API 是没有返回 head_commit 信息对吧?https://download.seafile.com/published/web-api/v2.1/libraries.md#user-content-Get%20Library%20Info 也没有其他 API 可以获取单个资料库的 head_commit 信息?我觉得应该在这个 API 中增加 head_commit 字段。客户端调用这个 API,如果有 head_commit 信息就保存一下,没有就不用保存。
列出所有资料库这个请求太消耗资源了,每上传一次就调用一次对服务器性能有影响。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的,目前只有 List Libraries API 返回了 head_commit_id 。
QString fpath = ::pathJoin(current_path_, file.name); | ||
QString cached_file = data_mgr_->getLocalCachedFile(repo_.id, fpath, file.id); | ||
if (!cached_file.isEmpty() && QFileInfo(cached_file).exists() && !file.is_locked) { | ||
if (!(QFile::permissions(cached_file) & QFileDevice::WriteOwner)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
根据 https://doc.qt.io/qt-6/qfiledevice.html#Permission-enum ,这个代码在 Windows NTFS 下可能不能工作。
另外,为什么在刷新窗口的时候,不对锁定的文件设置只读,而只对已解锁的文件设置可写呢?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
根据 https://doc.qt.io/qt-6/qfiledevice.html#Permission-enum ,这个代码在 Windows NTFS 下可能不能工作。
测试后发现是可以在 Windows NTFS 下工作的,文档中关于 NTFS 的注释有点模糊,从 https://doc.qt.io/qt-6/qfileinfo.html#isWritable 理解似乎支持部分功能。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
另外,为什么在刷新窗口的时候,不对锁定的文件设置只读,而只对已解锁的文件设置可写呢?
原本想的是,刷新窗口时需要设置只读的场景比较少见,如果设置只读可能会影响部分正常的写入(mac 上测试了打开一个已经更新了的只读文件,似乎也能正常写入)
src/filebrowser/file-table.cpp
Outdated
@@ -38,7 +38,7 @@ const int kLockIconSize = 16; | |||
const int kFileStatusIconSize = 16; | |||
const int kMarginBetweenFileNameAndStatusIcon = 5; | |||
|
|||
const int kRefreshProgressInterval = 1000; | |||
const int kRefreshProgressInterval = 5000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个改为5秒的原因是什么?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
本地测试时偶尔会遇到并发问题:一个文件被修改后,还没来得及上传,就在 updateFileCacheStatus() 里被标记为 NOT_SYNCED 状态,导致无法正常同步了。
ecb9266
to
2e97431
Compare
No description provided.