I want to know how to manipulate directories until I get video files.
Firstly the main Directory is "F:/TestingVideos/"
Inside the test video there are files e.g:1. Cash Office ,2.Rosville Gate ,3. My Videos
Each of this videos holds other folders for example Cash Office has a Directory of "F:/TestingVideos/Cash Office/"
inside we have folders that have dates for example we have the following "F:/TestingVideos/Cash Office/20141201/"
Inside the Date Folder I have videos that I want to play.
So far I have implemented a method:
void Dialog::on_loadedButton_clicked(){
QString videoname = "F:/TestingVideos/";`
ui->DirectoryLineEdit->setText(videoName);
QDir dir(videoName);
QFileInfoList files = dir.entryInfoList();
QStringList MonTypeFolder = dir.entryList(QDir::NoDotAndDotDot | QDir::AllDirs, QDir::DirsFirst);
ui->MonitoringcomboBox->addItems( MonTypeFolder);
ui->MonitoringcomboBox->show();
foreach(QFileInfo file, files){
if(file.isDir()){
//qDebug() << "DIR: " << file.fileName();
// qDebug() << "Directory path file:" << file.absoluteFilePath();
QString filePathString = file.absoluteFilePath();
QFileInfo info = QFileInfo(filePathString);
qDebug() << "Folders" << " are writable: " << info.isWritable() << "are readable: " << info.isReadable();
}
if(file.isFile()){
qDebug() << "FILE: " << file.fileName();
}
}
my output is true for my QFileInfo info;
for writeable and readable, also I do did a qDebug()<< info.absoluteFilePath()
I got the following results:
"F:/TestingVideos"
"F:/"
"F:/TestingVideos/Cash Office"
"F:/TestingVideos/Rosville"
"F:/TestingVideos/My Videos"
I want a way to manipulate the baseNames i.e. Cash Office, Rosville etc... Folders such that I can display their folders e.g. 20141201 in another combobox, since currently ui.monitoringcomboBox->show() can display the base names. I want to be able to manipulate the folders basically To a level where I where I can play a video using QUrl for example.
If i understood correctly you want something like this:
My code is a bit rough but you can use it as starting point:
-MainWindow.h:
-MainWindow.cpp:
I hope this will help you.