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:
		@@ -31,8 +31,8 @@
 | 
			
		||||
 | 
			
		||||
#include <coreplugin/icore.h>
 | 
			
		||||
#include <coreplugin/mimedatabase.h>
 | 
			
		||||
#include <projectexplorer/projectexplorer.h>
 | 
			
		||||
#include <projectexplorer/projectexplorerconstants.h>
 | 
			
		||||
#include <projectexplorer/customwizard/customwizard.h>
 | 
			
		||||
 | 
			
		||||
#include <utils/filewizardpage.h>
 | 
			
		||||
 | 
			
		||||
@@ -198,6 +198,7 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w,
 | 
			
		||||
 | 
			
		||||
    Core::GeneratedFile generatedCreatorFile(creatorFileName);
 | 
			
		||||
    generatedCreatorFile.setContents(QLatin1String("[General]\n"));
 | 
			
		||||
    generatedCreatorFile.setAttributes(Core::GeneratedFile::OpenProjectAttribute);
 | 
			
		||||
 | 
			
		||||
    Core::GeneratedFile generatedFilesFile(filesFileName);
 | 
			
		||||
    generatedFilesFile.setContents(sources.join(QLatin1String("\n")));
 | 
			
		||||
@@ -220,12 +221,5 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w,
 | 
			
		||||
bool GenericProjectWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage)
 | 
			
		||||
{
 | 
			
		||||
    Q_UNUSED(w);
 | 
			
		||||
    // Post-Generate: Open the project
 | 
			
		||||
    const QString proFileName = l.back().path();
 | 
			
		||||
    if (!ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(proFileName)) {
 | 
			
		||||
        *errorMessage = tr("The project %1 could not be opened.").arg(proFileName);
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    return true;
 | 
			
		||||
    return ProjectExplorer::CustomProjectWizard::postGenerateOpen(l, errorMessage);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user