forked from qt-creator/qt-creator
Wizards: Open a relevant file in editor after the wizard run
Remove all hacks/conventions of considering the last generated file as project file, etc. and instead add attributes flags to Core::GeneratedFile, giving fine-grained control of what to do with the file. Implement static utility functions in wizards that handle it. Add boolean XML-attributes "openeditor"/"openproject" to the file elements used by the CustomWizard XML-specification. Manually set the attributes in all wizards. Task-number: QTCREATORBUG-1166
This commit is contained in:
@@ -68,6 +68,9 @@ static const char filesElementC[] = "files";
|
||||
static const char fileElementC[] = "file";
|
||||
static const char fileNameSourceAttributeC[] = "source";
|
||||
static const char fileNameTargetAttributeC[] = "target";
|
||||
static const char fileNameOpenEditorAttributeC[] = "openeditor";
|
||||
static const char fileNameOpenProjectAttributeC[] = "openproject";
|
||||
|
||||
|
||||
enum ParseState {
|
||||
ParseBeginning,
|
||||
@@ -95,6 +98,11 @@ void CustomWizardField::clear()
|
||||
controlAttributes.clear();
|
||||
}
|
||||
|
||||
CustomWizardFile::CustomWizardFile() :
|
||||
openEditor(false), openProject(false)
|
||||
{
|
||||
}
|
||||
|
||||
CustomWizardParameters::CustomWizardParameters() :
|
||||
firstPageId(-1)
|
||||
{
|
||||
@@ -409,6 +417,8 @@ bool CustomWizardParameters::parse(QIODevice &device,
|
||||
CustomWizardFile file;
|
||||
file.source = attributeValue(reader, fileNameSourceAttributeC);
|
||||
file.target = attributeValue(reader, fileNameTargetAttributeC);
|
||||
file.openEditor = booleanAttributeValue(reader, fileNameOpenEditorAttributeC);
|
||||
file.openProject = booleanAttributeValue(reader, fileNameOpenProjectAttributeC);
|
||||
if (file.target.isEmpty())
|
||||
file.target = file.source;
|
||||
if (file.source.isEmpty()) {
|
||||
@@ -460,7 +470,12 @@ QString CustomWizardParameters::toString() const
|
||||
QTextStream str(&rc);
|
||||
str << "Directory: " << directory << " Klass: '" << klass << "'\n";
|
||||
foreach(const CustomWizardFile &f, files) {
|
||||
str << " File source: " << f.source << " Target: " << f.target << '\n';
|
||||
str << " File source: " << f.source << " Target: " << f.target;
|
||||
if (f.openEditor)
|
||||
str << " [editor]";
|
||||
if (f.openProject)
|
||||
str << " [project]";
|
||||
str << '\n';
|
||||
}
|
||||
foreach(const CustomWizardField &f, fields) {
|
||||
str << " Field name: " << f.name;
|
||||
|
||||
Reference in New Issue
Block a user