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:
@@ -65,6 +65,9 @@ class GeneratedFilePrivate;
|
||||
class CORE_EXPORT GeneratedFile
|
||||
{
|
||||
public:
|
||||
enum Attribute { OpenEditorAttribute = 0x01, OpenProjectAttribute = 0x02 };
|
||||
Q_DECLARE_FLAGS(Attributes, Attribute)
|
||||
|
||||
GeneratedFile();
|
||||
explicit GeneratedFile(const QString &path);
|
||||
GeneratedFile(const GeneratedFile &);
|
||||
@@ -92,6 +95,9 @@ public:
|
||||
|
||||
bool write(QString *errorMessage) const;
|
||||
|
||||
Attributes attributes() const;
|
||||
void setAttributes(Attributes a);
|
||||
|
||||
private:
|
||||
QSharedDataPointer<GeneratedFilePrivate> m_d;
|
||||
};
|
||||
@@ -207,6 +213,10 @@ protected:
|
||||
OverwriteResult promptOverwrite(const QString &location,
|
||||
const QStringList &files,
|
||||
QString *errorMessage) const;
|
||||
|
||||
// Utility to open the editors for the files whose attribute is set accordingly.
|
||||
static bool postGenerateOpenEditors(const GeneratedFiles &l, QString *errorMessage = 0);
|
||||
|
||||
private:
|
||||
BaseFileWizardPrivate *m_d;
|
||||
};
|
||||
@@ -239,4 +249,6 @@ protected:
|
||||
|
||||
} // namespace Core
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Core::GeneratedFile::Attributes)
|
||||
|
||||
#endif // BASEFILEWIZARD_H
|
||||
|
||||
Reference in New Issue
Block a user