134 lines
3.7 KiB
C++
134 lines
3.7 KiB
C++
#ifndef WIZARDPAGEMODEL_H
|
|
#define WIZARDPAGEMODEL_H
|
|
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <QQmlEngine>
|
|
|
|
class WizardPageModel : public QObject
|
|
{
|
|
Q_OBJECT
|
|
Q_PROPERTY(QStringList listSelectedFiles READ getListSelectedFiles WRITE setListSelectedFiles NOTIFY listSelectedFilesChanged)
|
|
Q_PROPERTY(QString projectName READ getProjectName WRITE setProjectname NOTIFY projectNameChanged)
|
|
Q_PROPERTY(QString projectPath READ getProjectPath WRITE setProjectPath NOTIFY projectPathChanged)
|
|
Q_PROPERTY(double percentCompete READ getPercentCompete WRITE setPercentCompete NOTIFY percentCompeteChanged)
|
|
Q_PROPERTY(QVariant listFilePath READ listFilePath WRITE setlistFilePath FINAL)
|
|
Q_PROPERTY(bool isTranslating READ getIsTranslating WRITE setIsTranslating NOTIFY isTranslatingChanged)
|
|
QML_ELEMENT
|
|
|
|
public:
|
|
explicit WizardPageModel(QObject *parent = nullptr);
|
|
|
|
void setListSelectedFiles(const QStringList& listFiles) {
|
|
listSelectedFiles = listFiles;
|
|
emit listSelectedFilesChanged();
|
|
}
|
|
|
|
QStringList getListSelectedFiles() const {
|
|
return listSelectedFiles;
|
|
}
|
|
|
|
QString getProjectName() const {
|
|
return projectName;
|
|
}
|
|
|
|
void setProjectname(const QString& newName) {
|
|
projectName = newName;
|
|
emit projectNameChanged();
|
|
}
|
|
|
|
QString getProjectPath() const {
|
|
return projectPath;
|
|
}
|
|
|
|
void setProjectPath(const QString& newPath) {
|
|
projectPath = newPath;
|
|
emit projectPathChanged();
|
|
}
|
|
|
|
double getPercentCompete() const {
|
|
return percentCompete;
|
|
}
|
|
|
|
void setPercentCompete(double newValue) {
|
|
percentCompete = newValue;
|
|
emit percentCompeteChanged();
|
|
}
|
|
|
|
enum Stages {
|
|
ChooseFiles,
|
|
SetupParams,
|
|
Translate,
|
|
Watch
|
|
};
|
|
|
|
QVariant listFilePath() const {return m_listFilePath; }
|
|
void setlistFilePath(const QVariant& listFilePath) {
|
|
m_listFilePath = listFilePath;
|
|
setListSelectedFiles(m_listFilePath.toStringList());
|
|
}
|
|
|
|
static QString getStageName(Stages stage) {
|
|
switch (stage){
|
|
case ChooseFiles: {
|
|
return "Выбор файлов";
|
|
}
|
|
case SetupParams: {
|
|
return "Установка параметров";
|
|
}
|
|
case Translate: {
|
|
return "Преобразование";
|
|
}
|
|
case Watch: {
|
|
return "Просмотр";
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
static QString getStageDescription(Stages stage) {
|
|
switch (stage){
|
|
case ChooseFiles:{
|
|
return "Выберите файлы для конвертации.";
|
|
}
|
|
case SetupParams:{
|
|
return "Установите параметры конфигурации проекта.";
|
|
}
|
|
}
|
|
|
|
return "";
|
|
}
|
|
|
|
void setStage(Stages newStage) {
|
|
currentStage = newStage;
|
|
emit stageChanged();
|
|
}
|
|
|
|
Stages getStage() const{
|
|
return currentStage;
|
|
}
|
|
|
|
bool getIsTranslating() const { return isTranslating; }
|
|
void setIsTranslating(bool newValue) {isTranslating = newValue; emit isTranslatingChanged(); }
|
|
|
|
signals:
|
|
void listSelectedFilesChanged();
|
|
void projectNameChanged();
|
|
void projectPathChanged();
|
|
void percentCompeteChanged();
|
|
void stageChanged();
|
|
void listFilePathChanged();
|
|
void isTranslatingChanged();
|
|
|
|
private:
|
|
bool isTranslating = false;
|
|
Stages currentStage = ChooseFiles;
|
|
QStringList listSelectedFiles;
|
|
QString projectName;
|
|
QString projectPath;
|
|
double percentCompete;
|
|
QVariant m_listFilePath;
|
|
};
|
|
|
|
#endif // WIZARDPAGEMODEL_H
|