mirror of https://github.com/buggins/dlangide.git
new project dialog
This commit is contained in:
parent
3cf0e9da49
commit
d6c7aa05d6
|
@ -93,21 +93,15 @@ class NewProjectDlg : Dialog {
|
||||||
TextWidget { text: "" }
|
TextWidget { text: "" }
|
||||||
CheckBox { id: cbCreateWorkspace; text: "Create new solution"; checked: true }
|
CheckBox { id: cbCreateWorkspace; text: "Create new solution"; checked: true }
|
||||||
TextWidget { text: "Workspace name" }
|
TextWidget { text: "Workspace name" }
|
||||||
EditLine {
|
EditLine { id: edWorkspaceName; text: "newworkspace"; layoutWidth: fill }
|
||||||
id: edWorkspaceName; text: "newworkspace"
|
|
||||||
}
|
|
||||||
TextWidget { text: "Project name" }
|
TextWidget { text: "Project name" }
|
||||||
EditLine {
|
EditLine { id: edProjectName; text: "newproject"; layoutWidth: fill }
|
||||||
id: edProjectName; text: "newproject"
|
|
||||||
}
|
|
||||||
TextWidget { text: "" }
|
TextWidget { text: "" }
|
||||||
CheckBox { id: cbCreateSubdir; text: "Create subdirectory for project"; checked: true }
|
CheckBox { id: cbCreateSubdir; text: "Create subdirectory for project"; checked: true }
|
||||||
TextWidget { text: "Location" }
|
TextWidget { text: "Location" }
|
||||||
DirEditLine {
|
DirEditLine { id: edLocation; layoutWidth: fill }
|
||||||
id: edLocation
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
TextWidget { id: statusText; text: "" }
|
TextWidget { id: statusText; text: ""; layoutWidth: fill }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -115,6 +109,7 @@ class NewProjectDlg : Dialog {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_projectTemplateList = content.childById!StringListWidget("projectTemplateList");
|
_projectTemplateList = content.childById!StringListWidget("projectTemplateList");
|
||||||
_templateDescription = content.childById!EditBox("templateDescription");
|
_templateDescription = content.childById!EditBox("templateDescription");
|
||||||
_directoryLayout = content.childById!EditBox("directoryLayout");
|
_directoryLayout = content.childById!EditBox("directoryLayout");
|
||||||
|
@ -129,6 +124,9 @@ class NewProjectDlg : Dialog {
|
||||||
if (_currentWorkspace) {
|
if (_currentWorkspace) {
|
||||||
_workspaceName = toUTF8(_currentWorkspace.name);
|
_workspaceName = toUTF8(_currentWorkspace.name);
|
||||||
_edWorkspaceName.text = toUTF32(_workspaceName);
|
_edWorkspaceName.text = toUTF32(_workspaceName);
|
||||||
|
} else {
|
||||||
|
_cbCreateWorkspace.checked = true;
|
||||||
|
_cbCreateWorkspace.enabled = false;
|
||||||
}
|
}
|
||||||
if (!_newWorkspace) {
|
if (!_newWorkspace) {
|
||||||
_cbCreateWorkspace.checked = false;
|
_cbCreateWorkspace.checked = false;
|
||||||
|
@ -180,7 +178,6 @@ class NewProjectDlg : Dialog {
|
||||||
|
|
||||||
addChild(content);
|
addChild(content);
|
||||||
addChild(createButtonsPanel([_newWorkspace ? ACTION_FILE_NEW_WORKSPACE : ACTION_FILE_NEW_PROJECT, ACTION_CANCEL], 0, 0));
|
addChild(createButtonsPanel([_newWorkspace ? ACTION_FILE_NEW_WORKSPACE : ACTION_FILE_NEW_PROJECT, ACTION_CANCEL], 0, 0));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _newWorkspace;
|
bool _newWorkspace;
|
||||||
|
@ -257,7 +254,7 @@ class NewProjectDlg : Dialog {
|
||||||
|
|
||||||
override void close(const Action action) {
|
override void close(const Action action) {
|
||||||
Action newaction = action.clone();
|
Action newaction = action.clone();
|
||||||
if (action == ACTION_FILE_NEW_WORKSPACE || action == ACTION_FILE_NEW_PROJECT) {
|
if (action.id == IDEActions.FileNewWorkspace || action.id == IDEActions.FileNewProject) {
|
||||||
if (!validate()) {
|
if (!validate()) {
|
||||||
window.showMessageBox(UIString("Cannot create project"d), UIString("Invalid parameters"));
|
window.showMessageBox(UIString("Cannot create project"d), UIString("Invalid parameters"));
|
||||||
return;
|
return;
|
||||||
|
@ -306,6 +303,8 @@ class NewProjectDlg : Dialog {
|
||||||
string pfile = buildNormalizedPath(pdir, "dub.json");
|
string pfile = buildNormalizedPath(pdir, "dub.json");
|
||||||
Project project = new Project(ws, pfile);
|
Project project = new Project(ws, pfile);
|
||||||
project.name = toUTF32(_projectName);
|
project.name = toUTF32(_projectName);
|
||||||
|
if (!project.save())
|
||||||
|
return setError("Cannot save project");
|
||||||
project.content.setString("targetName", _projectName);
|
project.content.setString("targetName", _projectName);
|
||||||
if (_currentTemplate.isLibrary) {
|
if (_currentTemplate.isLibrary) {
|
||||||
project.content.setString("targetType", "staticLibrary");
|
project.content.setString("targetType", "staticLibrary");
|
||||||
|
|
Loading…
Reference in New Issue