UI Client FTP
-
Hi!
I am trying to develope a classic client FTP. I want to have to QTreeView to show both file systems (local and remotes). I have resolved the local part with QFileSystem, but I don't know how to do the remote part. I want to have something like, for example, MobaXTerm or Putty, that have the directory tree in the remote part and you can select directly the files you want.
How can I do this?
Thank you very much guys!
-
Yes, I think so. But I was wondering if there was a better option because, when the remote has a lot of files, this system takes a long time to load and the interface is blocked. Thank you very much for you answer.
-
In the process of exploring the directories and mounting the items in the tree, it takes a long time and that time is blocked. Possibly I amdoing something wrong.
@ivanicy
Well, it will take a while to send and receive the remote ftp queries, look at the remote's file system and collect the information.You should probably do the remote file system calls in its own thread.
QFileSystemModel
does exactly that for the local filesystem, and that will only be faster but it does it in a thread nonetheless for just this speed reason. Don't forget if you use a thread that must not attempt to access the UI (QTreeView
) directly. You may have to be careful about accessing theQStandardItemModel
or other model from the thread if it's also being used in the main thread, though it should be OK where it emits signals for the tree view as these will be safe cross-thread.Alternatively you may be able to just do remote calls from the main thread if you do them "a bit at a time". A lot of FTP-type explorers only examine/expand top-level directories initially, only when the user e.g. clicks in the tree view to expand further nodes does it go find their contents, This may well be preferable to gathering the complete tree at the outset.