PDA

View Full Version : Remote QDirModel ?



jwintz
9th March 2007, 15:35
Hello,

The QDirModel class provides a data model for the local filesystem.

I wonder if there is a convenient way to create a QDirModel on a non local directory but from a directory on a server.

Has anyone already done such a thing ?

Thanks. Ju.

stevey
12th March 2007, 05:22
You'd need to have a service / daemon running on the server creating the model, then passing it back upon request to the client via some transport mechanism.

An issue you might face in implementing such a thing is synchronisation and efficiency.
The updates in the QTreeView is handled with signals / slots.
You could have the complete model stored on the server and have a the data() method sending the information on demand via some proxy class which handles the connection, but I doubt that you'd get decent refreshes when constantly polling the server over an http connection, partly due to the time to send the data, but also because each request has too many handshakes to acknowledge before the data is actually sent (maybe UDP would work).

Another option could be to simply send the entire model over to the client, then implement a QFileSystemWatcher which would send a new model to the client whenever a change is detected.
Typically the File System watcher just monitors a single folder, but you could make a controller class for it to monitor the dirmodel's base folder and sub folders for changes.

Which option you choose would depend on the circumstances. The latter option would mean that the server would be busy monitoring and might slow the machine down, but the first option would clag up the network.

Maybe there are other options.
I hope this helps :)



Steve York