diff --git a/CMakeLists.txt.user b/CMakeLists.txt.user index 07ce784..6687187 100644 --- a/CMakeLists.txt.user +++ b/CMakeLists.txt.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/Quartz/CMakeLists.txt b/Quartz/CMakeLists.txt index 593667b..d233065 100644 --- a/Quartz/CMakeLists.txt +++ b/Quartz/CMakeLists.txt @@ -95,9 +95,14 @@ qt_add_qml_module(appQtQuckApp SOURCES listfilesfiltermodel.h listfilesfiltermodel.cpp SOURCES models/recentfileitem.h models/recentfileitem.cpp QML_FILES qml/SearchComponent.qml + QML_FILES qml/ComponentStage.qml SOURCES models/PasportModel.h SOURCES views/projectstatusfragment.h views/projectstatusfragment.cpp SOURCES helpers.h helpers.cpp + SOURCES wizardpageactivity.h wizardpageactivity.cpp + # SOURCES models/wizardpagemodel.h models/wizardpagemodel.cpp + SOURCES wizardpagemodel.h wizardpagemodel.cpp + SOURCES wizardpagepresentor.h wizardpagepresentor.cpp ) set_target_properties(appQtQuckApp PROPERTIES diff --git a/Quartz/FigmaStyles.h b/Quartz/FigmaStyles.h index f68a22e..61a3d3f 100644 --- a/Quartz/FigmaStyles.h +++ b/Quartz/FigmaStyles.h @@ -26,5 +26,10 @@ const QColor CORLOR_MENU_ITEM_SELECTED_EXIT(colorFromHex("#F9565E"));//qRgb(197, const QColor COLOR_FIELD_BORDER_CHANGED(colorFromHex("#17A831")); const QColor COLOR_FIELD_BORDER_SELECTED(colorFromHex("#0084FF")); + const QColor CORLOR_STAGE_ITEM_SELECTED(qRgb(222,222,222)); + const QColor CORLOR_STAGE_ITEM_BASE(qRgb(255,255,255)); + const QColor CORLOR_STAGE_ITEM_ELIPSE_NOT_AVALIBLE(colorFromHex("#ffd9d9d9")); + const QColor CORLOR_STAGE_ITEM_ELIPSE_AVALIBLE(colorFromHex("#ff8FD033")); + } #endif // FIGMASTYLES_H diff --git a/Quartz/figmaadapter.cpp b/Quartz/figmaadapter.cpp index 4f0070c..78a5f9e 100644 --- a/Quartz/figmaadapter.cpp +++ b/Quartz/figmaadapter.cpp @@ -27,6 +27,8 @@ #include "cycleupdater.h" #include "projectpageppesentor.h" #include "helpers.h" +#include "wizardpageactivity.h" +#include "wizardpagepresentor.h" void saveSettingClick(IPageActivity *activity) { @@ -214,11 +216,22 @@ void FigmaAdapter::showInfoPageLoaded() void FigmaAdapter::showNewProject() { - loadPage(FIGMA_SettingsPage,[this] {showSettingsLoaded();}); + loadPage(FIGMA_WizardPage,[this] {showNewProjectLoaded();}); } void FigmaAdapter::showNewProjectLoaded() { + QQuickItem* page; + page = QuickHelper::getQuickItem(rootObject, "WizardPage"); + + WizardPageActivity * wizardPageActivity = 0; + + if ((rootObject && page) == false) return; + + wizardPageActivity = new WizardPageActivity(page,page); + activity = wizardPageActivity; + + WizardPagePresentor *presentor = new WizardPagePresentor(wizardPageActivity,wizardPageActivity); } void FigmaAdapter::showProjects() diff --git a/Quartz/figmaadapter.h b/Quartz/figmaadapter.h index 0ac6bc8..1573c5c 100644 --- a/Quartz/figmaadapter.h +++ b/Quartz/figmaadapter.h @@ -68,8 +68,6 @@ private slots: void createProjectClicked(); void settingsClicked(); void fieldInfoClicked(); - - }; #endif // FIGMAADAPTER_H diff --git a/Quartz/models/wizardpagemodel.cpp b/Quartz/models/wizardpagemodel.cpp new file mode 100644 index 0000000..141619c --- /dev/null +++ b/Quartz/models/wizardpagemodel.cpp @@ -0,0 +1,7 @@ +#include "wizardpagemodel.h" + +WizardPageModel::WizardPageModel(QObject *parent) + : QObject{parent} +{ + +} diff --git a/Quartz/models/wizardpagemodel.h b/Quartz/models/wizardpagemodel.h new file mode 100644 index 0000000..87b62b0 --- /dev/null +++ b/Quartz/models/wizardpagemodel.h @@ -0,0 +1,85 @@ +#ifndef WIZARDPAGEMODEL_H +#define WIZARDPAGEMODEL_H + +#include +#include +#include + +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) + 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 + }; + + void setStage(Stages newStage) { + currentStage = newStage; + } + + Stages getStage() const{ + return currentStage; + } + + +signals: + void listSelectedFilesChanged(); + void projectNameChanged(); + void projectPathChanged(); + void percentCompeteChanged(); + +private: + Stages currentStage = ChooseFiles; + QStringList listSelectedFiles; + QString projectName; + QString projectPath; + double percentCompete; +}; + +#endif // WIZARDPAGEMODEL_H diff --git a/Quartz/pages/FigmaQmlInterface/qml/ProgressTranslateCancelButton38_figma.qml b/Quartz/pages/FigmaQmlInterface/qml/ProgressTranslateCancelButton38_figma.qml index 85d2662..02b58cc 100644 --- a/Quartz/pages/FigmaQmlInterface/qml/ProgressTranslateCancelButton38_figma.qml +++ b/Quartz/pages/FigmaQmlInterface/qml/ProgressTranslateCancelButton38_figma.qml @@ -17,8 +17,6 @@ Rectangle { height:31 color:"#ff8b6ef5" radius:30 - border.width: 1 - border.color: "#8B6EF5" clip: true Component.onCompleted: { } diff --git a/Quartz/pages/FigmaQmlInterface/qml/TestPage_ProjectsPage2_figma.qml b/Quartz/pages/FigmaQmlInterface/qml/TestPage_ProjectsPage2_figma.qml index c1495d4..27e7ac2 100644 --- a/Quartz/pages/FigmaQmlInterface/qml/TestPage_ProjectsPage2_figma.qml +++ b/Quartz/pages/FigmaQmlInterface/qml/TestPage_ProjectsPage2_figma.qml @@ -113,7 +113,9 @@ Rectangle { width:148 height:8 Rectangle { + // component (Instance) level: 1 AvailibleSizeProgressBarPassedBar id: figma_i701_311_613_435 + // # "AvailibleSizeProgressBarPassedBar" objectName:"AvailibleSizeProgressBarPassedBar" x:0 y:0 @@ -176,7 +178,7 @@ Rectangle { x:0 y:96 width:172 - height:326 + height:321 color:"#ffffffff" clip: true diff --git a/Quartz/pages/FigmaQmlInterface/qml/TestPage_SerchItem2_figma.qml b/Quartz/pages/FigmaQmlInterface/qml/TestPage_SerchItem2_figma.qml index fa13f7e..36f30fd 100644 --- a/Quartz/pages/FigmaQmlInterface/qml/TestPage_SerchItem2_figma.qml +++ b/Quartz/pages/FigmaQmlInterface/qml/TestPage_SerchItem2_figma.qml @@ -7,7 +7,7 @@ import QtQuick.Controls import QtQuick.Shapes import FigmaQmlInterface Rectangle { -// component (Instance) level: 0 SerchItem +// component (Instance) level: 0 SerchItem id: figma_696_233 // # "SerchItem" objectName:"SerchItem" @@ -17,8 +17,8 @@ Rectangle { height:20 color:"#ffffffff" radius:8 - clip: true -Shape { + clip: true +Shape { anchors.fill: parent ShapePath { strokeColor: Qt.rgba(0.0392157, 0.356863, 1, 1) @@ -80,9 +80,9 @@ PathLine { x: 0; y: 8 } PathLine { x: 0.5; y: 8 } PathCubic { control1X: 0.5; control1Y: 3.85786; control2X: 3.85786; control2Y: 0.5; x: 8; y: 0.5 } PathLine { x: 8; y: 0 } -}} +}} TextField { - // component (Instance) level: 0 SearchField + // component (Instance) level: 0 SearchField id: figma_696_234 // # "SearchField" objectName:"SearchField" @@ -102,7 +102,7 @@ background: Rectangle {color: "transparent"} font.family: "Tahoma" verticalAlignment: Text.AlignVCenter } Rectangle { - // component (Instance) level: 0 SearchButton + // component (Instance) level: 0 SearchButton id: figma_696_235 // # "SearchButton" objectName:"SearchButton" @@ -112,10 +112,10 @@ background: Rectangle {color: "transparent"} font.family: "Tahoma" height:20 color:"#ffffffff" radius:400 - clip: false - + clip: false + Item { - // component (Instance) level: 0 Search + // component (Instance) level: 0 Search id: figma_696_236 // # "Search" objectName:"Search" @@ -129,7 +129,6 @@ background: Rectangle {color: "transparent"} font.family: "Tahoma" source: source_figma_696_236 maskSource: maskSource_figma_696_236 } - Image { id: source_figma_696_236 layer.enabled: true @@ -137,9 +136,8 @@ background: Rectangle {color: "transparent"} font.family: "Tahoma" visible: false mipmap: true anchors.fill:parent - source: "images/" + source: "images/8c9d53cbdf8ebb4f44c3bbf62a2ced4162dc01e3.png" } - Shape { id: maskSource_figma_696_236 anchors.fill: parent @@ -152,27 +150,25 @@ background: Rectangle {color: "transparent"} font.family: "Tahoma" fillRule: ShapePath.WindingFill PathSvg { path: "M0 0L14.666 0L14.666 14.666L0 14.666L0 0Z" - } + } } } - Shape { anchors.fill: parent ShapePath { strokeColor: "transparent" strokeWidth:0.14666 fillColor:"#00000000" - // component (shapeFill) level: 0 + // component (shapeFill) level: 0 id: svgpath_figma_696_236 fillRule: ShapePath.WindingFill PathSvg { id: path_0_figma_696_236 path: "M0 0L14.666 0L14.666 14.666L0 14.666L0 0Z" - } + } } } - property alias path: path_0_figma_696_236.path - } + } } } diff --git a/Quartz/pages/FigmaQmlInterface/qml/TestPage_SettingsPage1_figma.qml b/Quartz/pages/FigmaQmlInterface/qml/TestPage_SettingsPage1_figma.qml index b804de9..47f551c 100644 --- a/Quartz/pages/FigmaQmlInterface/qml/TestPage_SettingsPage1_figma.qml +++ b/Quartz/pages/FigmaQmlInterface/qml/TestPage_SettingsPage1_figma.qml @@ -6,7 +6,6 @@ import QtQuick.Shapes import QtQuick.Controls import QtQuick.Shapes import FigmaQmlInterface - Rectangle { // component (Instance) level: 0 SettingsPage id: figma_701_334 @@ -50,7 +49,6 @@ Rectangle { verticalAlignment: Text.AlignTop } } - InputComponent42_figma { // component (Instance) level: 0 InputComponent id: figma_701_336 @@ -91,9 +89,70 @@ Rectangle { height:23 color: "transparent" radius:5 - property color borderColor: "black" - border.color: borderColor clip: false +Shape { + anchors.fill: parent +ShapePath { + strokeColor: Qt.rgba(0, 0, 0, 1) + strokeWidth: 1 + fillColor: "transparent" + PathMove { x: 5; y: 0 } +PathLine { x: 5; y: 0.5 } +PathLine { x: 550; y: 0.5 } +PathLine { x: 550; y: 0 } +PathLine { x: 550; y: -0.5 } +PathLine { x: 5; y: -0.5 } +PathLine { x: 5; y: 0 } +PathMove { x: 555; y: 5 } +PathLine { x: 554.5; y: 5 } +PathLine { x: 554.5; y: 18 } +PathLine { x: 555; y: 18 } +PathLine { x: 555.5; y: 18 } +PathLine { x: 555.5; y: 5 } +PathLine { x: 555; y: 5 } +PathMove { x: 550; y: 23 } +PathLine { x: 550; y: 22.5 } +PathLine { x: 5; y: 22.5 } +PathLine { x: 5; y: 23 } +PathLine { x: 5; y: 23.5 } +PathLine { x: 550; y: 23.5 } +PathLine { x: 550; y: 23 } +PathMove { x: 0; y: 18 } +PathLine { x: 0.5; y: 18 } +PathLine { x: 0.5; y: 5 } +PathLine { x: 0; y: 5 } +PathLine { x: -0.5; y: 5 } +PathLine { x: -0.5; y: 18 } +PathLine { x: 0; y: 18 } +PathMove { x: 5; y: 23 } +PathLine { x: 5; y: 22.5 } +PathCubic { control1X: 2.51472; control1Y: 22.5; control2X: 0.5; control2Y: 20.4853; x: 0.5; y: 18 } +PathLine { x: 0; y: 18 } +PathLine { x: -0.5; y: 18 } +PathCubic { control1X: -0.5; control1Y: 21.0376; control2X: 1.96243; control2Y: 23.5; x: 5; y: 23.5 } +PathLine { x: 5; y: 23 } +PathMove { x: 555; y: 18 } +PathLine { x: 554.5; y: 18 } +PathCubic { control1X: 554.5; control1Y: 20.4853; control2X: 552.485; control2Y: 22.5; x: 550; y: 22.5 } +PathLine { x: 550; y: 23 } +PathLine { x: 550; y: 23.5 } +PathCubic { control1X: 553.038; control1Y: 23.5; control2X: 555.5; control2Y: 21.0376; x: 555.5; y: 18 } +PathLine { x: 555; y: 18 } +PathMove { x: 550; y: 0 } +PathLine { x: 550; y: 0.5 } +PathCubic { control1X: 552.485; control1Y: 0.5; control2X: 554.5; control2Y: 2.51472; x: 554.5; y: 5 } +PathLine { x: 555; y: 5 } +PathLine { x: 555.5; y: 5 } +PathCubic { control1X: 555.5; control1Y: 1.96243; control2X: 553.038; control2Y: -0.5; x: 550; y: -0.5 } +PathLine { x: 550; y: 0 } +PathMove { x: 5; y: 0 } +PathLine { x: 5; y: -0.5 } +PathCubic { control1X: 1.96243; control1Y: -0.5; control2X: -0.5; control2Y: 1.96243; x: -0.5; y: 5 } +PathLine { x: 0; y: 5 } +PathLine { x: 0.5; y: 5 } +PathCubic { control1X: 0.5; control1Y: 2.51472; control2X: 2.51472; control2Y: 0.5; x: 5; y: 0.5 } +PathLine { x: 5; y: 0 } +}} TextField { // component (Instance) level: 1 RemoteAddressLabelField id: figma_i701_336_219_74 @@ -106,7 +165,7 @@ Rectangle { color:"#ff7d7e82" wrapMode: TextEdit.WordWrap text:"http://localhost:1234" - background: Rectangle {color: "transparent"} font.family: "Tahoma" +background: Rectangle {color: "transparent"} font.family: "Tahoma" font.italic: false font.letterSpacing: 0 font.pixelSize: 16 @@ -116,7 +175,6 @@ Rectangle { } } } - Rectangle { // component (Instance) level: 0 Frame 880 id: figma_767_75 @@ -170,9 +228,70 @@ Rectangle { color: "transparent" radius:5 clip: false - property color borderColor: "black" - border.color: borderColor - TextField { +Shape { + anchors.fill: parent +ShapePath { + strokeColor: Qt.rgba(0, 0, 0, 1) + strokeWidth: 1 + fillColor: "transparent" + PathMove { x: 5; y: 0 } +PathLine { x: 5; y: 0.5 } +PathLine { x: 550; y: 0.5 } +PathLine { x: 550; y: 0 } +PathLine { x: 550; y: -0.5 } +PathLine { x: 5; y: -0.5 } +PathLine { x: 5; y: 0 } +PathMove { x: 555; y: 5 } +PathLine { x: 554.5; y: 5 } +PathLine { x: 554.5; y: 18 } +PathLine { x: 555; y: 18 } +PathLine { x: 555.5; y: 18 } +PathLine { x: 555.5; y: 5 } +PathLine { x: 555; y: 5 } +PathMove { x: 550; y: 23 } +PathLine { x: 550; y: 22.5 } +PathLine { x: 5; y: 22.5 } +PathLine { x: 5; y: 23 } +PathLine { x: 5; y: 23.5 } +PathLine { x: 550; y: 23.5 } +PathLine { x: 550; y: 23 } +PathMove { x: 0; y: 18 } +PathLine { x: 0.5; y: 18 } +PathLine { x: 0.5; y: 5 } +PathLine { x: 0; y: 5 } +PathLine { x: -0.5; y: 5 } +PathLine { x: -0.5; y: 18 } +PathLine { x: 0; y: 18 } +PathMove { x: 5; y: 23 } +PathLine { x: 5; y: 22.5 } +PathCubic { control1X: 2.51472; control1Y: 22.5; control2X: 0.5; control2Y: 20.4853; x: 0.5; y: 18 } +PathLine { x: 0; y: 18 } +PathLine { x: -0.5; y: 18 } +PathCubic { control1X: -0.5; control1Y: 21.0376; control2X: 1.96243; control2Y: 23.5; x: 5; y: 23.5 } +PathLine { x: 5; y: 23 } +PathMove { x: 555; y: 18 } +PathLine { x: 554.5; y: 18 } +PathCubic { control1X: 554.5; control1Y: 20.4853; control2X: 552.485; control2Y: 22.5; x: 550; y: 22.5 } +PathLine { x: 550; y: 23 } +PathLine { x: 550; y: 23.5 } +PathCubic { control1X: 553.038; control1Y: 23.5; control2X: 555.5; control2Y: 21.0376; x: 555.5; y: 18 } +PathLine { x: 555; y: 18 } +PathMove { x: 550; y: 0 } +PathLine { x: 550; y: 0.5 } +PathCubic { control1X: 552.485; control1Y: 0.5; control2X: 554.5; control2Y: 2.51472; x: 554.5; y: 5 } +PathLine { x: 555; y: 5 } +PathLine { x: 555.5; y: 5 } +PathCubic { control1X: 555.5; control1Y: 1.96243; control2X: 553.038; control2Y: -0.5; x: 550; y: -0.5 } +PathLine { x: 550; y: 0 } +PathMove { x: 5; y: 0 } +PathLine { x: 5; y: -0.5 } +PathCubic { control1X: 1.96243; control1Y: -0.5; control2X: -0.5; control2Y: 1.96243; x: -0.5; y: 5 } +PathLine { x: 0; y: 5 } +PathLine { x: 0.5; y: 5 } +PathCubic { control1X: 0.5; control1Y: 2.51472; control2X: 2.51472; control2Y: 0.5; x: 5; y: 0.5 } +PathLine { x: 5; y: 0 } +}} + TextField { // component (Instance) level: 1 LocalServerPortField id: figma_i701_337_219_74 // # "LocalServerPortField" @@ -234,9 +353,70 @@ background: Rectangle {color: "transparent"} font.family: "Ta height:23 color: "transparent" radius:5 - clip: false - property color borderColor: "black" - border.color: borderColor + clip: false +Shape { + anchors.fill: parent +ShapePath { + strokeColor: Qt.rgba(0, 0, 0, 1) + strokeWidth: 1 + fillColor: "transparent" + PathMove { x: 5; y: 0 } +PathLine { x: 5; y: 0.5 } +PathLine { x: 550; y: 0.5 } +PathLine { x: 550; y: 0 } +PathLine { x: 550; y: -0.5 } +PathLine { x: 5; y: -0.5 } +PathLine { x: 5; y: 0 } +PathMove { x: 555; y: 5 } +PathLine { x: 554.5; y: 5 } +PathLine { x: 554.5; y: 18 } +PathLine { x: 555; y: 18 } +PathLine { x: 555.5; y: 18 } +PathLine { x: 555.5; y: 5 } +PathLine { x: 555; y: 5 } +PathMove { x: 550; y: 23 } +PathLine { x: 550; y: 22.5 } +PathLine { x: 5; y: 22.5 } +PathLine { x: 5; y: 23 } +PathLine { x: 5; y: 23.5 } +PathLine { x: 550; y: 23.5 } +PathLine { x: 550; y: 23 } +PathMove { x: 0; y: 18 } +PathLine { x: 0.5; y: 18 } +PathLine { x: 0.5; y: 5 } +PathLine { x: 0; y: 5 } +PathLine { x: -0.5; y: 5 } +PathLine { x: -0.5; y: 18 } +PathLine { x: 0; y: 18 } +PathMove { x: 5; y: 23 } +PathLine { x: 5; y: 22.5 } +PathCubic { control1X: 2.51472; control1Y: 22.5; control2X: 0.5; control2Y: 20.4853; x: 0.5; y: 18 } +PathLine { x: 0; y: 18 } +PathLine { x: -0.5; y: 18 } +PathCubic { control1X: -0.5; control1Y: 21.0376; control2X: 1.96243; control2Y: 23.5; x: 5; y: 23.5 } +PathLine { x: 5; y: 23 } +PathMove { x: 555; y: 18 } +PathLine { x: 554.5; y: 18 } +PathCubic { control1X: 554.5; control1Y: 20.4853; control2X: 552.485; control2Y: 22.5; x: 550; y: 22.5 } +PathLine { x: 550; y: 23 } +PathLine { x: 550; y: 23.5 } +PathCubic { control1X: 553.038; control1Y: 23.5; control2X: 555.5; control2Y: 21.0376; x: 555.5; y: 18 } +PathLine { x: 555; y: 18 } +PathMove { x: 550; y: 0 } +PathLine { x: 550; y: 0.5 } +PathCubic { control1X: 552.485; control1Y: 0.5; control2X: 554.5; control2Y: 2.51472; x: 554.5; y: 5 } +PathLine { x: 555; y: 5 } +PathLine { x: 555.5; y: 5 } +PathCubic { control1X: 555.5; control1Y: 1.96243; control2X: 553.038; control2Y: -0.5; x: 550; y: -0.5 } +PathLine { x: 550; y: 0 } +PathMove { x: 5; y: 0 } +PathLine { x: 5; y: -0.5 } +PathCubic { control1X: 1.96243; control1Y: -0.5; control2X: -0.5; control2Y: 1.96243; x: -0.5; y: 5 } +PathLine { x: 0; y: 5 } +PathLine { x: 0.5; y: 5 } +PathCubic { control1X: 0.5; control1Y: 2.51472; control2X: 2.51472; control2Y: 0.5; x: 5; y: 0.5 } +PathLine { x: 5; y: 0 } +}} TextField { // component (Instance) level: 1 RemoteServerLoginField id: figma_i701_338_219_74 @@ -299,9 +479,70 @@ background: Rectangle {color: "transparent"} font.family: "Ta height:23 color: "transparent" radius:5 - clip: false - property color borderColor: "black" - border.color: borderColor + clip: false +Shape { + anchors.fill: parent +ShapePath { + strokeColor: Qt.rgba(0, 0, 0, 1) + strokeWidth: 1 + fillColor: "transparent" + PathMove { x: 5; y: 0 } +PathLine { x: 5; y: 0.5 } +PathLine { x: 550; y: 0.5 } +PathLine { x: 550; y: 0 } +PathLine { x: 550; y: -0.5 } +PathLine { x: 5; y: -0.5 } +PathLine { x: 5; y: 0 } +PathMove { x: 555; y: 5 } +PathLine { x: 554.5; y: 5 } +PathLine { x: 554.5; y: 18 } +PathLine { x: 555; y: 18 } +PathLine { x: 555.5; y: 18 } +PathLine { x: 555.5; y: 5 } +PathLine { x: 555; y: 5 } +PathMove { x: 550; y: 23 } +PathLine { x: 550; y: 22.5 } +PathLine { x: 5; y: 22.5 } +PathLine { x: 5; y: 23 } +PathLine { x: 5; y: 23.5 } +PathLine { x: 550; y: 23.5 } +PathLine { x: 550; y: 23 } +PathMove { x: 0; y: 18 } +PathLine { x: 0.5; y: 18 } +PathLine { x: 0.5; y: 5 } +PathLine { x: 0; y: 5 } +PathLine { x: -0.5; y: 5 } +PathLine { x: -0.5; y: 18 } +PathLine { x: 0; y: 18 } +PathMove { x: 5; y: 23 } +PathLine { x: 5; y: 22.5 } +PathCubic { control1X: 2.51472; control1Y: 22.5; control2X: 0.5; control2Y: 20.4853; x: 0.5; y: 18 } +PathLine { x: 0; y: 18 } +PathLine { x: -0.5; y: 18 } +PathCubic { control1X: -0.5; control1Y: 21.0376; control2X: 1.96243; control2Y: 23.5; x: 5; y: 23.5 } +PathLine { x: 5; y: 23 } +PathMove { x: 555; y: 18 } +PathLine { x: 554.5; y: 18 } +PathCubic { control1X: 554.5; control1Y: 20.4853; control2X: 552.485; control2Y: 22.5; x: 550; y: 22.5 } +PathLine { x: 550; y: 23 } +PathLine { x: 550; y: 23.5 } +PathCubic { control1X: 553.038; control1Y: 23.5; control2X: 555.5; control2Y: 21.0376; x: 555.5; y: 18 } +PathLine { x: 555; y: 18 } +PathMove { x: 550; y: 0 } +PathLine { x: 550; y: 0.5 } +PathCubic { control1X: 552.485; control1Y: 0.5; control2X: 554.5; control2Y: 2.51472; x: 554.5; y: 5 } +PathLine { x: 555; y: 5 } +PathLine { x: 555.5; y: 5 } +PathCubic { control1X: 555.5; control1Y: 1.96243; control2X: 553.038; control2Y: -0.5; x: 550; y: -0.5 } +PathLine { x: 550; y: 0 } +PathMove { x: 5; y: 0 } +PathLine { x: 5; y: -0.5 } +PathCubic { control1X: 1.96243; control1Y: -0.5; control2X: -0.5; control2Y: 1.96243; x: -0.5; y: 5 } +PathLine { x: 0; y: 5 } +PathLine { x: 0.5; y: 5 } +PathCubic { control1X: 0.5; control1Y: 2.51472; control2X: 2.51472; control2Y: 0.5; x: 5; y: 0.5 } +PathLine { x: 5; y: 0 } +}} TextField { // component (Instance) level: 1 RemoteServerPasswordField id: figma_i701_339_219_74 @@ -432,7 +673,7 @@ background: Rectangle {color: "transparent"} font.family: "Ta // component (Instance) level: 1 StrokeElement id: figma_i701_343_219_155 // # "StrokeElement" - objectName: "StrokeElementProjectsPath" + objectName:"StrokeElement" x:0 y:17 width:555 @@ -440,9 +681,69 @@ background: Rectangle {color: "transparent"} font.family: "Ta color: "transparent" radius:5 clip: false - property color borderColor : "black" - border.width: 1 - border.color: borderColor +Shape { + anchors.fill: parent +ShapePath { + strokeColor: Qt.rgba(0, 0, 0, 1) + strokeWidth: 1 + fillColor: "transparent" + PathMove { x: 5; y: 0 } +PathLine { x: 5; y: 0.5 } +PathLine { x: 550; y: 0.5 } +PathLine { x: 550; y: 0 } +PathLine { x: 550; y: -0.5 } +PathLine { x: 5; y: -0.5 } +PathLine { x: 5; y: 0 } +PathMove { x: 555; y: 5 } +PathLine { x: 554.5; y: 5 } +PathLine { x: 554.5; y: 18 } +PathLine { x: 555; y: 18 } +PathLine { x: 555.5; y: 18 } +PathLine { x: 555.5; y: 5 } +PathLine { x: 555; y: 5 } +PathMove { x: 550; y: 23 } +PathLine { x: 550; y: 22.5 } +PathLine { x: 5; y: 22.5 } +PathLine { x: 5; y: 23 } +PathLine { x: 5; y: 23.5 } +PathLine { x: 550; y: 23.5 } +PathLine { x: 550; y: 23 } +PathMove { x: 0; y: 18 } +PathLine { x: 0.5; y: 18 } +PathLine { x: 0.5; y: 5 } +PathLine { x: 0; y: 5 } +PathLine { x: -0.5; y: 5 } +PathLine { x: -0.5; y: 18 } +PathLine { x: 0; y: 18 } +PathMove { x: 5; y: 23 } +PathLine { x: 5; y: 22.5 } +PathCubic { control1X: 2.51472; control1Y: 22.5; control2X: 0.5; control2Y: 20.4853; x: 0.5; y: 18 } +PathLine { x: 0; y: 18 } +PathLine { x: -0.5; y: 18 } +PathCubic { control1X: -0.5; control1Y: 21.0376; control2X: 1.96243; control2Y: 23.5; x: 5; y: 23.5 } +PathLine { x: 5; y: 23 } +PathMove { x: 555; y: 18 } +PathLine { x: 554.5; y: 18 } +PathCubic { control1X: 554.5; control1Y: 20.4853; control2X: 552.485; control2Y: 22.5; x: 550; y: 22.5 } +PathLine { x: 550; y: 23 } +PathLine { x: 550; y: 23.5 } +PathCubic { control1X: 553.038; control1Y: 23.5; control2X: 555.5; control2Y: 21.0376; x: 555.5; y: 18 } +PathLine { x: 555; y: 18 } +PathMove { x: 550; y: 0 } +PathLine { x: 550; y: 0.5 } +PathCubic { control1X: 552.485; control1Y: 0.5; control2X: 554.5; control2Y: 2.51472; x: 554.5; y: 5 } +PathLine { x: 555; y: 5 } +PathLine { x: 555.5; y: 5 } +PathCubic { control1X: 555.5; control1Y: 1.96243; control2X: 553.038; control2Y: -0.5; x: 550; y: -0.5 } +PathLine { x: 550; y: 0 } +PathMove { x: 5; y: 0 } +PathLine { x: 5; y: -0.5 } +PathCubic { control1X: 1.96243; control1Y: -0.5; control2X: -0.5; control2Y: 1.96243; x: -0.5; y: 5 } +PathLine { x: 0; y: 5 } +PathLine { x: 0.5; y: 5 } +PathCubic { control1X: 0.5; control1Y: 2.51472; control2X: 2.51472; control2Y: 0.5; x: 5; y: 0.5 } +PathLine { x: 5; y: 0 } +}} TextField { // component (Instance) level: 1 ProjectsPathLabelField id: figma_i701_343_219_74 @@ -535,9 +836,8 @@ background: Rectangle {color: "transparent"} font.family: "Ta } } } - ProgressTranslateCancelButton38_figma { - // component (Instance) level: 0 SaveButton + // component (Instance) level: 0 SaveButton id: figma_799_63 // # "SaveButton" objectName:"SaveButton" @@ -547,7 +847,7 @@ background: Rectangle {color: "transparent"} font.family: "Ta height:19 color:"#ff0a5bff" Text { - // component (Instance) level: 1 ShowLabel + // component (Instance) level: 1 ShowLabel id: figma_i799_63_652_314 // # "ShowLabel" objectName:"ShowLabel" diff --git a/Quartz/pages/FigmaQmlInterface/qml/TestPage_WizardPage1_figma.qml b/Quartz/pages/FigmaQmlInterface/qml/TestPage_WizardPage1_figma.qml index 3495fbf..bad1d4d 100644 --- a/Quartz/pages/FigmaQmlInterface/qml/TestPage_WizardPage1_figma.qml +++ b/Quartz/pages/FigmaQmlInterface/qml/TestPage_WizardPage1_figma.qml @@ -63,7 +63,7 @@ Rectangle { objectName:"Шаги" x:9 y: (figma_701_493.height - height) / 2 + 0.5 - width:35 + width:30 height:16 color:"#ff000000" wrapMode: TextEdit.WordWrap @@ -77,7 +77,7 @@ Rectangle { verticalAlignment: Text.AlignTop } } - Rectangle { + Column { // component (Instance) level: 0 ContentListStages id: figma_701_533 // # "ContentListStages" @@ -86,7 +86,7 @@ Rectangle { y:33 width:180 height:309 - color: "transparent" + // color: "transparent" clip: true } @@ -131,7 +131,7 @@ Rectangle { objectName:"LabelWizardStage" x:0 y:0 - width:103 + width:585 height:17 color:"#ff000000" wrapMode: TextEdit.WordWrap @@ -146,6 +146,7 @@ Rectangle { } } } + Text { // component (Instance) level: 0 LabelDesciptionWizardStage id: figma_701_503 diff --git a/Quartz/qml/ComponentStage.qml b/Quartz/qml/ComponentStage.qml new file mode 100644 index 0000000..60b4cc3 --- /dev/null +++ b/Quartz/qml/ComponentStage.qml @@ -0,0 +1,77 @@ +//Generated by FigmaQML 3.2.1 + +import QtQuick +import QtQuick.Effects +import QtQuick.Shapes +import QtQuick.Controls +import QtQuick.Shapes +import FigmaQmlInterface + +Rectangle { +// component (Instance) level: 0 ComponentStage + id: root + // # "ComponentStage" + objectName:"ComponentStage" + anchors.left: parent.left + anchors.right: parent.right + // x:0 + // y:0 + // width:144 + height:23 + color: "transparent" + clip: false + + property string stageName: "" + property color elipseColor: "#ffd9d9d9" + + Shape { + // component (Instance) level: 1 Ellipse 3 + id: figma_i703_616_670_555 + // # "Ellipse 3" + objectName:"Ellipse 3" + x: 0 + y: 6 + width: 10 + height: 10 + ShapePath { + id: svgpath_figma_i703_616_670_555 + strokeColor: "transparent" + strokeWidth:1 + fillColor: root.elipseColor + // component (shapeFill) level: 1 + fillRule: ShapePath.WindingFill + PathSvg { + id: path_0_figma_i703_616_670_555 + path: "M10 5C10 7.76142 7.76142 10 5 10C2.23858 10 0 7.76142 0 5C0 2.23858 2.23858 0 5 0C7.76142 0 10 2.23858 10 5Z" + } + } + property alias path: path_0_figma_i703_616_670_555.path + } + + Text { + // component (Instance) level: 1 Выбор файлов + id: figma_i703_616_670_553 + // # "Выбор файлов" + objectName:"stageName" + anchors.left : parent.left + anchors.right: parent.right + anchors.leftMargin: 14 + anchors.rightMargin:0 + anchors.top: parent.top + anchors.topMargin: 4 + // x:14 + // y:4 + // width:130 + height:15 + color:"#ff000000" + wrapMode: TextEdit.WordWrap + text: root.stageName + font.family: "Tahoma" + font.italic: false + font.letterSpacing: 0 + font.pixelSize: 12 + font.weight: Font.Normal + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignTop + } +} diff --git a/Quartz/qml/ScrollableTextList.qml b/Quartz/qml/ScrollableTextList.qml index 6b3d10a..8eb6802 100644 --- a/Quartz/qml/ScrollableTextList.qml +++ b/Quartz/qml/ScrollableTextList.qml @@ -24,7 +24,7 @@ Item { ] onAccepted: { - mainViewPresentor.listFilePath = fileDialog.currentFiles.map(url => url.toString()) + wizardPageModel.listFilePath = fileDialog.currentFiles.map(url => url.toString()) var fileNames = fileDialog.currentFiles.map(url => url.toString().split('/').pop()); createAndSetNewModel(fileNames); // Используем новую функцию для создания модели console.log("Выбрано файлов:", fileNames.length); diff --git a/Quartz/quickhelper.cpp b/Quartz/quickhelper.cpp index 5c12dc7..e213976 100644 --- a/Quartz/quickhelper.cpp +++ b/Quartz/quickhelper.cpp @@ -146,7 +146,8 @@ void QuickHelper::addComponent( const QList& listItems, const QString& textComponent, QObject** addedComponent, - ArrDifferentTypes** arrDiffTypesOut + ArrDifferentTypes** arrDiffTypesOut, + QList> *listComponentsToSet ) { qDebug() << "[C++] Starting to create function"; @@ -172,8 +173,18 @@ void QuickHelper::addComponent( arrDifferentTypes->setArrDifferentTypes(listItems); QQmlContext* context = new QQmlContext(engine->rootContext(), parentItem); + context->setContextObject(arrDifferentTypes); context->setContextProperty("quickUpdaterData", arrDifferentTypes); + if (listComponentsToSet&&listComponentsToSet->size()) { + auto it = listComponentsToSet->begin(); + auto itEnd = listComponentsToSet->end(); + + while (it != itEnd) { + context->setContextProperty(it->first, it->second); + ++it; + } + } QQmlComponent component(engine); component.setData(textComponent.toLocal8Bit(), QUrl()); @@ -200,6 +211,7 @@ void QuickHelper::addComponent( // 5. Контекст удалится автоматически при удалении updaterObject context->setParent(updaterObject); + context->setObjectName("customQMLContext"); if (addedComponent) { *addedComponent = updaterObject; @@ -459,14 +471,17 @@ QQuickItem * QuickHelper::addProgressBar(QQuickItem* parent, QQuickItem *progres QQuickItem *item = qobject_cast(addedComponent); return item; } -}; -QQuickItem * QuickHelper::addContentToItem(QQuickItem *parentItem, QString name) + return 0; +} + +QQuickItem * QuickHelper::addContentToItem(QQuickItem *parentItem, QString name, const QString& text, + QList> *listComponentsToSet) { - - if(name.endsWith(".qml")){ + if (name.endsWith(".qml")) { name = name.left(name.size()-4); } + QString componentName = name; QString textCompnent = R"( import FigmaQmlInterface @@ -477,13 +492,16 @@ import QtQuckApp textCompnent += componentName; textCompnent += R"( { - id: customComponent -} + id: root )"; + textCompnent+= text; + textCompnent+= R"( +} +)" ; QVariantList listItems; QObject *createdComponent = 0; QQuickItem *createdComponentItem = 0; - QuickHelper::addComponent(parentItem, listItems,textCompnent, &createdComponent); + QuickHelper::addComponent(parentItem, listItems,textCompnent, &createdComponent,0,listComponentsToSet); if (createdComponent) { createdComponentItem = qobject_cast(createdComponent); @@ -509,3 +527,15 @@ void QuickHelper::setBorderColor(QQuickItem *item, const QColor &color, int bord qWarning() << "Item does not have a 'border' property:" << item; } } + +QQmlContext * QuickHelper::getCustomContext(QQuickItem* object){ + if (object){ + auto childObject = object->findChild("customQMLContext"); + if(childObject){ + return qobject_cast(childObject); + } + } + return 0; +} + + diff --git a/Quartz/quickhelper.h b/Quartz/quickhelper.h index 768591f..814b2ea 100644 --- a/Quartz/quickhelper.h +++ b/Quartz/quickhelper.h @@ -19,7 +19,6 @@ public: static void clearChildren(QQuickItem *parentItem); static void moveTextFiledX(QQuickItem *parentItem); static QQuickItem * getQuickItem(QObject *rootObject, const QString &elementName); - // static void addMouseArea(QObject *rootObject, std::function onClickAction); static void doFunction(QObject *rootObject, const QList &listItems, const QString &textFunction, const QString &functionName); static void updateColor(QObject *rootObject, QColor disabledColor, QColor enabledColor); @@ -33,15 +32,18 @@ public: static void setPropetryEnumerator(QQuickItem* item, const QString& propertyName, const QString& propertyValue); static void textChangedSubscription(QObject *rootObject, CallbackWrapper *wrapper); - static void addComponent(QObject *rootObject, const QList &listItems, const QString &textComponent, QObject** addedComponent = 0, ArrDifferentTypes** arrDiffTypes=0); + static void addComponent(QObject *rootObject, const QList &listItems, const QString &textComponent, QObject** addedComponent = 0, ArrDifferentTypes** arrDiffTypes=0, QList> *listComponentsToSet = 0); static void addMouseAreaElements(QObject *rootObject, std::function onClickedAction, std::function onEnteredAction, std::function onExitedAction,QObject** addedComponent = 0); static QQmlContext *getContextFromQObject(QObject *qmlObject); static void freeItem(QQuickItem *&item); static QQuickItem *addProgressBar(QQuickItem *parent, QQuickItem *progressBar, QQuickItem *progressBarFilled); static void setFunctionHandlerArg1(QObject *rootObject, const QString ¶m, std::function handler); static void addMouseAreaWithCopy(QObject *rootObject, std::function onClickedAction, std::function onEnteredAction, std::function onExitedAction, QObject **addedComponent = 0,ArrDifferentTypes** arrDiffTypesOut = 0); - static QQuickItem *addContentToItem(QQuickItem *parentItem, QString name); + static QQuickItem *addContentToItem(QQuickItem *parentItem, QString name, const QString& text ="", QList> *listComponentsToSet = 0); static void setBorderColor(QQuickItem *item, const QColor &color, int borderWidth = -1); + static QQmlContext *getCustomContext(QQuickItem *object); +private: + }; #endif // QUICKHELPER_H diff --git a/Quartz/wizardpageactivity.cpp b/Quartz/wizardpageactivity.cpp new file mode 100644 index 0000000..3ae3593 --- /dev/null +++ b/Quartz/wizardpageactivity.cpp @@ -0,0 +1,291 @@ +#include "wizardpageactivity.h" +#include "QDebug" +#include "QQuickItem" +#include "quickhelper.h" +#include "wizardpagemodel.h" +#include "FigmaStyles.h" +#include "QQmlContext" + +QMap* gLIBS(WizardPageActivity*activity){ + return (QMap*)activity->getListItemsByStage(); +} + +class SelectFilesFragment : public QObject { +public: + SelectFilesFragment(QQuickItem * root, QObject* model) : QObject(root), root(root), model(model) { + init(); + } + QObject* model; +private: + const QString FILED_LIST_FILES_CONTENT = "ColumnLeft"; + const QString FILED_BUTTON_CONTENT = "ButtonChooseFiles"; + + bool isAllElementsFound(){ + bool retCode = true; + listFilesContent = QuickHelper::getQuickItem(root, FILED_LIST_FILES_CONTENT); + if (!listFilesContent) { + qWarning() << "Failed to get listFilesContent:" << FILED_LIST_FILES_CONTENT; + retCode = false; + } + + buttonChooseFiles = QuickHelper::getQuickItem(root, FILED_BUTTON_CONTENT); + if (!buttonChooseFiles) { + qWarning() << "Failed to get buttonChooseFiles:" << FILED_BUTTON_CONTENT; + retCode = false; + } + + return retCode; + + } + void init() { + if(!isAllElementsFound()) return; + + if (listFilesItem) { + listFilesItem->setParentItem(nullptr); + listFilesItem->setParent(nullptr); + listFilesItem->deleteLater(); + } + + listFilesItem = 0; + + QList> listAppendPropetries ;//{{ "wizardPageModel", model}}; + + listFilesItem = QuickHelper::addContentToItem(listFilesContent, "ScrollableTextList","", &listAppendPropetries); + + auto context = QuickHelper::getCustomContext(listFilesItem); + if (context) { + context->setContextProperty("wizardPageModel", model); + } + + QuickHelper::addMouseAreaElements(buttonChooseFiles, + [this] {handleChooseFiles();}, + [this] { + if (buttonChooseFiles->isEnabled()) { + buttonChooseFiles->setProperty("color", QML::CORLOR_BUTTON_FOCUSED); + } + },[this] { + if (buttonChooseFiles->isEnabled()) { + buttonChooseFiles->setProperty("color", QML::CORLOR_BUTTON_BASE); + } + }); + + } + + void handleNewFiles(){ + + } + void handleChooseFiles() + { + if (listFilesItem) { + QMetaObject::invokeMethod(listFilesItem, "openFileDialog"); + } + } + + + QQuickItem *buttonChooseFiles = 0; + QQuickItem * listFilesItem = 0; + QQuickItem * listFilesContent = 0; + + QQuickItem * root; + +}; + + +WizardPageActivity::WizardPageActivity(QQuickItem * item, QObject *parent) + : QObject{parent}, root(item) +{ + if (!item) { + qWarning() << "[C++] Root object is null"; + return; + } + + + listItemsByStage = new QMap(); + + init(); +} + +void WizardPageActivity::pageChanged() +{ +} + +void WizardPageActivity::isAllowChangePage(const std::function &continueChange, const std::function &blockChange) +{ + continueChange(); +} + +void WizardPageActivity::init() +{ + if(!isAllElementsFound()) return; + + loadListStages(); +} + +void WizardPageActivity::loadListStages() { + QQuickItem *item = 0; + + item = QuickHelper::addContentToItem(fieldContentListStages, "ComponentStage"); + auto mapItemsStage = gLIBS(this); + mapItemsStage->insert(WizardPageModel::Stages::ChooseFiles, item); + + item = QuickHelper::addContentToItem(fieldContentListStages, "ComponentStage"); + mapItemsStage->insert(WizardPageModel::Stages::SetupParams, item); + + item = QuickHelper::addContentToItem(fieldContentListStages, "ComponentStage"); + mapItemsStage->insert(WizardPageModel::Stages::Translate, item); + + item = QuickHelper::addContentToItem(fieldContentListStages, "ComponentStage"); + mapItemsStage->insert(WizardPageModel::Stages::Watch, item); + + auto stageIt = gLIBS(this)->begin(); + auto stageItEnd = gLIBS(this)->end(); + + + while (stageIt != stageItEnd) { + auto key = stageIt.key(); + auto value = stageIt.value(); + value->setProperty("stageName", WizardPageModel::getStageName(stageIt.key())); + QuickHelper::addMouseAreaElements(stageIt.value(), + [this,key]{stageClicked(key);}, + [this,value]{ + if (value->isEnabled()) { + value->setProperty("color", QML::CORLOR_STAGE_ITEM_SELECTED); + } + },[this,value]{ + if (value->isEnabled()) { + value->setProperty("color", QML::CORLOR_STAGE_ITEM_BASE); + } + }); + + value->setEnabled(false); + ++stageIt; + } +} + +void WizardPageActivity::stageClicked(WizardPageModel::Stages stage) +{ + qDebug() << WizardPageModel::getStageName(stage); +} + +void WizardPageActivity::updateListStages(WizardPageModel::Stages newStage) +{ + QList listAllowed; + + switch (newStage) { + case WizardPageModel::Stages::ChooseFiles: { + listAllowed = {WizardPageModel::Stages::ChooseFiles}; + + break; + } + + case WizardPageModel::Stages::SetupParams: { + listAllowed = {WizardPageModel::Stages::ChooseFiles, WizardPageModel::Stages::SetupParams}; + break; + } + + case WizardPageModel::Stages::Translate: { + listAllowed = {WizardPageModel::Stages::ChooseFiles, WizardPageModel::Stages::SetupParams, WizardPageModel::Stages::Translate}; + break; + } + + case WizardPageModel::Stages::Watch: { + listAllowed = {WizardPageModel::Stages::ChooseFiles, WizardPageModel::Stages::SetupParams, WizardPageModel::Stages::Translate}; + break; + } + } + + setListAllowed(listAllowed); +} + +void WizardPageActivity::setListAllowed(const QList& listAllowed) +{ + auto list = gLIBS(this); + auto it = list->begin(); + auto itEnd = list->end(); + + while (it != itEnd) { + if (listAllowed.contains(it.key())) { + it.value()->setProperty("elipseColor", QML::CORLOR_STAGE_ITEM_ELIPSE_AVALIBLE); + it.value()->setEnabled(true); + } else { + it.value()->setProperty("elipseColor", QML::CORLOR_STAGE_ITEM_ELIPSE_NOT_AVALIBLE); + it.value()->setEnabled(false); + } + ++it; + } + +} + +void WizardPageActivity::updateContent(WizardPageModel::Stages newStage) +{ + QString componentName; + QString contentBody = ""; + switch(newStage){ + case WizardPageModel::Stages::ChooseFiles: { + componentName = FIGMA_SelectFilesStage; + + break; + } + default: return; + } + + auto addedElement = QuickHelper::addContentToItem(fieldContentOfStage,componentName,contentBody); + if(addedElement) { + SelectFilesFragment * fragment = new SelectFilesFragment(addedElement,model); + } +} + +void WizardPageActivity::stageChanged() +{ + auto newStage = model->getStage(); + fieldLabelWizardStage->setProperty("text", WizardPageModel::getStageName(newStage)); + fieldLabelDescriptionWizardStage->setProperty("text", WizardPageModel::getStageDescription(newStage)); + + updateListStages(newStage); + updateContent(newStage); + +} + +bool WizardPageActivity::isAllElementsFound(){ + bool retCode = true; + + fieldLabelWizardStage = QuickHelper::getQuickItem(root, FIELD_LABEL_WIZARD_STAGE); + if (!fieldLabelWizardStage) { + qWarning() << "Failed to get fieldLabelWizardStage:" << FIELD_LABEL_WIZARD_STAGE; + retCode = false; + } + + fieldLabelDescriptionWizardStage = QuickHelper::getQuickItem(root, FIELD_LABEL_DESCRIPTION_WIZARD_STAGE); + if (!fieldLabelDescriptionWizardStage) { + qWarning() << "Failed to get fieldLabelDescriptionWizardStage:" << FIELD_LABEL_DESCRIPTION_WIZARD_STAGE; + retCode = false; + } + + fieldListStagesPanel = QuickHelper::getQuickItem(root, FIELD_LIST_STAGES_PANEL); + if (!fieldListStagesPanel) { + qWarning() << "Failed to get fieldListStagesPanel:" << FIELD_LIST_STAGES_PANEL; + retCode = false; + } + + fieldContentListStages = QuickHelper::getQuickItem(root, FIELD_CONTENT_LIST_STAGES); + if (!fieldContentListStages) { + qWarning() << "Failed to get fieldContentListStages:" << FIELD_CONTENT_LIST_STAGES; + retCode = false; + } + + fieldContentOfStage = QuickHelper::getQuickItem(root, FIELD_CONTENT_OF_STAGE); + if (!fieldContentOfStage) { + qWarning() << "Failed to get fieldContentOfStage:" << FIELD_CONTENT_OF_STAGE; + retCode = false; + } + + + return retCode; +} + +void WizardPageActivity::setModel(WizardPageModel *newModel) +{ + model = newModel; + connect(model, &WizardPageModel::stageChanged, this, &WizardPageActivity::stageChanged); + stageChanged(); +} diff --git a/Quartz/wizardpageactivity.h b/Quartz/wizardpageactivity.h new file mode 100644 index 0000000..97931f5 --- /dev/null +++ b/Quartz/wizardpageactivity.h @@ -0,0 +1,62 @@ +#ifndef WIZARDPAGEACTIVITY_H +#define WIZARDPAGEACTIVITY_H + +#include +#include "interfaces/IPageActivity.h" +#include "wizardpagemodel.h" + +class QQuickItem; +class DynamicLoader; +class QQmlEngine; + +class WizardPageActivity : public QObject, public IPageActivity +{ + Q_OBJECT +public: + explicit WizardPageActivity(QQuickItem * item, QObject *parent = nullptr); + + void pageChanged() override final; + void isAllowChangePage(const std::function &continueChange, const std::function &blockChange) override final; + bool isAllElementsFound(); + + // QMap + void * getListItemsByStage() const { + return listItemsByStage; + } + + void setListItemsByStage(void *ptr) { + listItemsByStage = ptr; + } + + void setModel(WizardPageModel * newModel); + +signals: + +private: + void init(); + void loadListStages(); + void stageClicked(WizardPageModel::Stages stage); + void updateListStages(WizardPageModel::Stages newStage); + void setListAllowed(const QList& listAllowed); + void updateContent(WizardPageModel::Stages newStage); + + QQuickItem * root; + + const QString FIELD_LABEL_WIZARD_STAGE = "LabelWizardStage"; + const QString FIELD_LABEL_DESCRIPTION_WIZARD_STAGE = "LabelDesciptionWizardStage"; + const QString FIELD_LIST_STAGES_PANEL = "ListStagesPanel"; + const QString FIELD_CONTENT_LIST_STAGES = "ContentListStages"; + const QString FIELD_CONTENT_OF_STAGE = "ContentOfStage"; + + QQuickItem * fieldLabelWizardStage = 0; + QQuickItem * fieldLabelDescriptionWizardStage = 0; + QQuickItem * fieldListStagesPanel = 0; + QQuickItem * fieldContentListStages = 0; + QQuickItem * fieldContentOfStage = 0; + void * listItemsByStage = 0; + WizardPageModel * model; +private slots: + void stageChanged(); +}; + +#endif // WIZARDPAGEACTIVITY_H diff --git a/Quartz/wizardpagemodel.cpp b/Quartz/wizardpagemodel.cpp new file mode 100644 index 0000000..141619c --- /dev/null +++ b/Quartz/wizardpagemodel.cpp @@ -0,0 +1,7 @@ +#include "wizardpagemodel.h" + +WizardPageModel::WizardPageModel(QObject *parent) + : QObject{parent} +{ + +} diff --git a/Quartz/wizardpagemodel.h b/Quartz/wizardpagemodel.h new file mode 100644 index 0000000..0ed05e8 --- /dev/null +++ b/Quartz/wizardpagemodel.h @@ -0,0 +1,126 @@ +#ifndef WIZARDPAGEMODEL_H +#define WIZARDPAGEMODEL_H + +#include +#include +#include + +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) + 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; + } + + 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; + } + + +signals: + void listSelectedFilesChanged(); + void projectNameChanged(); + void projectPathChanged(); + void percentCompeteChanged(); + void stageChanged(); + void listFilePathChanged(); + +private: + Stages currentStage = ChooseFiles; + QStringList listSelectedFiles; + QString projectName; + QString projectPath; + double percentCompete; + QVariant m_listFilePath; +}; + +#endif // WIZARDPAGEMODEL_H diff --git a/Quartz/wizardpagepresentor.cpp b/Quartz/wizardpagepresentor.cpp new file mode 100644 index 0000000..fb462f2 --- /dev/null +++ b/Quartz/wizardpagepresentor.cpp @@ -0,0 +1,23 @@ +#include "wizardpagepresentor.h" +#include "wizardpagemodel.h" +#include "wizardpageactivity.h" + +WizardPagePresentor::WizardPagePresentor( WizardPageActivity * activity,QObject *parent) + : QObject{parent}, activity(activity) +{ + model = new WizardPageModel(); + init(); +} + +void WizardPagePresentor::init() +{ + model->setStage(WizardPageModel::ChooseFiles); + activity->setModel(model); +} + + + + + + + diff --git a/Quartz/wizardpagepresentor.h b/Quartz/wizardpagepresentor.h new file mode 100644 index 0000000..8a9a41b --- /dev/null +++ b/Quartz/wizardpagepresentor.h @@ -0,0 +1,23 @@ +#ifndef PROJECTPAGEPRESENTOR_H +#define PROJECTPAGEPRESENTOR_H + +#include + +class WizardPageActivity; +class WizardPageModel; + +class WizardPagePresentor : public QObject +{ + Q_OBJECT +public: + explicit WizardPagePresentor(WizardPageActivity * activity, QObject *parent = nullptr); + +signals: + +private: + void init(); + WizardPageActivity *activity; + WizardPageModel *model = 0; +}; + +#endif // PROJECTPAGEPRESENTOR_H