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.

138 lines
4.1 KiB

import QtQuick 2.0
import QtQuick.Window 2.0
import QtQuick.Layouts 1.0
import QtQuick.Controls 1.0
import QtQuick.Dialogs 1.1
import Qt.labs.settings 1.0
import "js/ProjectModel.js" as ProjectModelCode
Item {
id: projectModel
signal projectClosed
10 years ago
signal projectLoading(var projectData)
signal projectLoaded()
signal documentOpened(var document)
signal documentRemoved(var documentId)
signal documentUpdated(var documentId) //renamed
signal documentAdded(var documentId)
signal projectSaving(var projectData)
signal projectSaved()
10 years ago
signal newProject(var projectData)
signal documentSaved(var documentId)
10 years ago
signal deploymentStarted()
signal deploymentStepChanged(string message)
10 years ago
signal deploymentComplete()
signal deploymentError(string error)
property bool isEmpty: (projectPath === "")
readonly property string projectFileName: ".mix"
property bool haveUnsavedChanges: false
property string projectPath: ""
property string projectTitle: ""
property string currentDocumentId: ""
property var deploymentAddresses: []
property string deploymentDir
property var listModel: projectListModel
10 years ago
property var stateListModel: projectStateListModel.model
property CodeEditorView codeEditor: null
//interface
function saveAll() { ProjectModelCode.saveAll(); }
function createProject() { ProjectModelCode.createProject(); }
function closeProject() { ProjectModelCode.closeProject(); }
function saveProject() { ProjectModelCode.saveProject(); }
function loadProject(path) { ProjectModelCode.loadProject(path); }
function newHtmlFile() { ProjectModelCode.newHtmlFile(); }
function newJsFile() { ProjectModelCode.newJsFile(); }
function newCssFile() { ProjectModelCode.newCssFile(); }
function newContract() { ProjectModelCode.newContract(); }
function openDocument(documentId) { ProjectModelCode.openDocument(documentId); }
function openNextDocument() { ProjectModelCode.openNextDocument(); }
function openPrevDocument() { ProjectModelCode.openPrevDocument(); }
function renameDocument(documentId, newName) { ProjectModelCode.renameDocument(documentId, newName); }
function removeDocument(documentId) { ProjectModelCode.removeDocument(documentId); }
function getDocument(documentId) { return ProjectModelCode.getDocument(documentId); }
function getDocumentIndex(documentId) { return ProjectModelCode.getDocumentIndex(documentId); }
10 years ago
function addExistingFiles(paths) { ProjectModelCode.doAddExistingFiles(paths); }
function deployProject() { ProjectModelCode.deployProject(false); }
function registerToUrlHint() { ProjectModelCode.registerToUrlHint(); }
function formatAppUrl() { ProjectModelCode.formatAppUrl(url); }
Connections {
target: appContext
onAppLoaded: {
if (projectSettings.lastProjectPath)
projectModel.loadProject(projectSettings.lastProjectPath)
}
}
NewProjectDialog {
id: newProjectDialog
visible: false
onAccepted: {
var title = newProjectDialog.projectTitle;
var path = newProjectDialog.projectPath;
ProjectModelCode.doCreateProject(title, path);
}
}
MessageDialog {
id: saveMessageDialog
title: qsTr("Project")
text: qsTr("Do you want to save changes?")
standardButtons: StandardButton.Ok | StandardButton.Cancel
icon: StandardIcon.Question
onAccepted: {
projectModel.saveAll();
ProjectModelCode.doCloseProject();
}
onRejected: {
ProjectModelCode.doCloseProject();
}
}
MessageDialog {
id: deployWarningDialog
title: qsTr("Project")
10 years ago
text:
{
if (Object.keys(projectModel.deploymentAddresses).length > 0)
10 years ago
return qsTr("This project has been already deployed to the network. Do you want to redeploy it? (Contract state will be reset)")
10 years ago
else
return qsTr("This action will deploy to the network. Do you want to deploy it?")
}
icon: StandardIcon.Question
standardButtons: StandardButton.Ok | StandardButton.Abort
onAccepted: {
10 years ago
ProjectModelCode.startDeployProject(true);
}
}
MessageDialog {
id: deployRessourcesDialog
title: qsTr("Project")
standardButtons: StandardButton.Ok
}
DeploymentDialog
{
id: deploymentDialog
}
ListModel {
id: projectListModel
}
10 years ago
StateListModel {
id: projectStateListModel
}
Settings {
id: projectSettings
property string lastProjectPath;
}
}