I have used QTCPSocket and it works fine and easy.
For your directory structure, I would write a recursive function that would walk the directory tree, recording the full path for each file/directory found, adding the references to a QList.
void recursiveFileFind
(QString srcdir
) {
for ( int i = 0 ; i< dirs.length(); i++ )
{
if(dirs[i] == "." || dirs[i] == "..")
continue;
recursiveFileFind(dirs[i]);
// do something with the directories?
}
for ( int fi=0; fi < files.length(); fi++ ) // first level of files
{
// make an entry object and add it to a QList
}
}
void recursiveFileFind(QString srcdir)
{
QDir dir(srcdir);
QStringList dirs = dir.entryList(QDir::AllDirs);
QStringList files = dir.entryList(QDir::Files);
for ( int i = 0 ; i< dirs.length(); i++ )
{
if(dirs[i] == "." || dirs[i] == "..")
continue;
recursiveFileFind(dirs[i]);
// do something with the directories?
}
for ( int fi=0; fi < files.length(); fi++ ) // first level of files
{
// make an entry object and add it to a QList
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks