forked from nerososft/Nider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeneralproject.cpp
48 lines (38 loc) · 1.19 KB
/
generalproject.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "generalproject.h"
#include <QDir>
#include <QFileInfo>
#include <QFile>
#include <QDebug>
#include <QIcon>
GeneralProject::GeneralProject()
{
this->model = new QStandardItemModel();
}
void initProject();
void GeneralProject::loadFolder(QStandardItem* mm,QString forderPath){
QStandardItem* modeli = new QStandardItem(QIcon(""),forderPath);
QDir dir(forderPath);
foreach(QFileInfo mfi ,dir.entryInfoList())
{
if(mfi.isFile())
{
QStandardItem* item = new QStandardItem(QIcon(""),mfi.absoluteFilePath());
modeli->appendRow(item);
qDebug()<< "File :" << mfi.fileName();
}else
{
if(mfi.fileName()=="." || mfi.fileName() == "..")continue;
qDebug() << "Entry Dir" << mfi.absoluteFilePath();
loadFolder(modeli,mfi.absoluteFilePath());
}
}
mm->appendRow(modeli);
}
QStandardItemModel* GeneralProject::getCurrentForder(QString folder){
QStandardItem* item = new QStandardItem(QIcon(""),folder);
loadFolder(item,folder);
this->model->appendRow(item);
return this->model;
}
QStandardItemModel* GeneralProject::loadFile(QString filePath){
}