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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
| #include "project.h"
#include <QFileDialog>
Project *Project::openProject(QString &path)
{
QDir dir;
if(!dir.exists(path+"//ivt_project.ivp"))
{
return NULL;
}
dir.cd(path);
return new Project(dir);
}
Project* Project::createProject(QString &path)
{
QDir dir;
if((!dir.exists(path))&&dir.mkpath(path))
{
dir.cd(path);
dir.mkdir("Actions");
dir.mkdir("Movies");
dir.mkdir("Data");
QFile descriptor("ivt_project.ivp");
descriptor.open( QIODevice::WriteOnly );
QFile actionfile(path+"/Actions/actionfile.act");
actionfile.open( QIODevice::WriteOnly );
QFile moviefile(path+"/Movies/moviefile.avi");
moviefile.open( QIODevice::WriteOnly );
QFile datafile (path+"/Data/datafile.txt");
datafile.open( QIODevice::WriteOnly );
return new Project(dir);
}
return NULL;
}
Project::Project(QDir &path)
{
_path = path;
}
void save()
{
//QString ProjectName = QFileDialog::getSaveFileName(/*this,*/"Save Project", "", "Project files(*.ivp);;All Files (*)");
//just save project all rest including in the project (createproject)
//save all actions file
//save all movies
//save all data
//save descriptor
/* QString filename="actionfile.act";
if (filename.isEmpty())
return;
else{
QFile file(filename);
if(!file.open(QIODevice::WriteOnly)){
return;
}
QDataStream out(&file);
out << file;
}
*/
} |
Partager