You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.9 KiB

9 years ago
////////////////////////////////////////////////////////////////////////////////
/**
* \file project.h
* \version v1.0
* \author Ing. Dominik Malcik
*/
////////////////////////////////////////////////////////////////////////////////
#ifndef PROJECT_H
#define PROJECT_H
#include <QObject>
#include <QMainWindow>
#include <QTextStream>
#include <vector>
#include <QMessageBox>
#include <iostream>
// singleton
#include "./libs/staticsingleton.h"
class Project : public QObject
{
Q_OBJECT
public:
static const QString PROJVERSION;
static const QString PROJSUBDIR_IMAGES;
static const QString PROJSUBDIR_LAYERS;
static const QString XML_TRUE;
static const QString XML_FALSE;
static const QString PROJ_FILE_EXT;
void valueInit();
void setProjectName (QString name);
QString getProjectName (void);
void setProjectFileName (QString name);
QString getProjectFileName (void);
void setProjectRootDir (QString s);
QString getProjectRootDir (void);
void setProjectRootDir_old (QString s);
QString getProjectRootDir_old (void);
void setImagesDir (QString s);
QString getImagesDir (void);
void setLayersDir (QString s);
QString getLayersDir (void);
void setFileImported (bool i);
bool getFileImported (void);
void setImages (std::vector<QString> i);
std::vector<QString> getImages (void);
void addToImages (QString s);
QString getSelectedImage (unsigned int index);
void eraseSelectedImage(unsigned int index);
void emitDeleteImported();
void setLayers (std::vector<QString> i);
std::vector<QString> getLayers (void);
void addToLayers (QString s);
QString getSelectedLayer (unsigned int index);
void eraseSelectedLayer(unsigned int index);
void emitDeleteAnalysings();
int layersCount();
void prepareProject(QString rootDir, QString projectName,
QString projectFileName, bool fileImported,
std::vector<QString> images, std::vector<QString> layers);
bool saveToFile(bool removeSubDirs);
bool fileCopy(QString fileName, QString destDir, QString destFilename, QString * newFileName);
bool removeDir(QString dirName);
bool deleteAnalysing(int index);
bool deleteImported(int index);
signals:
void imagesValueChanged();
void layersValueChanged();
public slots:
private:
// constructor, destructor private = singleton
explicit Project(QObject *parent = 0);
~Project();
// friend allows singleton to be created by this object
friend class cStaticSingleton<Project>;
QString projectRootDir;
QString projectRootDir_old;
QString projectFileName;
QString projectName;
bool fileImported;
QString imagesDir;
QString layersDir;
std::vector<QString> images;
std::vector<QString> layers;
};
// singleton instance of the project
typedef cStaticSingleton<Project> cProject;
#endif // PROJECT_H