forked from qt-creator/qt-creator
QmlJS: fix wrong wording in JsFileWizard
A JavaScript file with .pragma library is everything else but "stateless". Just call it a "JavaScript library". Also see commit 7ee8156116581e08466ebc23b31e2b76c127e742 in qtdeclarative. Change-Id: Ia1a4ff7ba5661af4c29592b956f8219cfa745c88 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
@@ -53,24 +53,24 @@ public:
|
|||||||
setTitle(tr("Options"));
|
setTitle(tr("Options"));
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout;
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
m_statelessLibrary = new QCheckBox(tr("Stateless library"));
|
m_library = new QCheckBox(tr("JavaScript library"));
|
||||||
m_statelessLibrary->setToolTip(
|
m_library->setToolTip(
|
||||||
tr("Usually each QML component instance has a unique copy of\n"
|
tr("Usually each QML component instance has a unique copy of\n"
|
||||||
"imported JavaScript libraries. Indicating that a library is\n"
|
"imported JavaScript libraries. Indicating that a JavaScript file is\n"
|
||||||
"stateless means that a single instance will be shared among\n"
|
"a library means that a single instance will be shared among\n"
|
||||||
"all components. Stateless libraries will not be able to access\n"
|
"all components. JavaScript libraries will not be able to access\n"
|
||||||
"QML component instance objects and properties directly."));
|
"QML component instance objects and properties directly."));
|
||||||
layout->addWidget(m_statelessLibrary);
|
layout->addWidget(m_library);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool statelessLibrary() const
|
bool isLibrary() const
|
||||||
{
|
{
|
||||||
return m_statelessLibrary->isChecked();
|
return m_library->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QCheckBox *m_statelessLibrary;
|
QCheckBox *m_library;
|
||||||
};
|
};
|
||||||
|
|
||||||
class JsFileWizardDialog : public Core::BaseFileWizard
|
class JsFileWizardDialog : public Core::BaseFileWizard
|
||||||
@@ -109,17 +109,17 @@ Core::GeneratedFiles JsFileWizard::generateFiles(const QWizard *w,
|
|||||||
const QString fileName = Core::BaseFileWizardFactory::buildFileName(path, name, preferredSuffix(mimeType));
|
const QString fileName = Core::BaseFileWizardFactory::buildFileName(path, name, preferredSuffix(mimeType));
|
||||||
|
|
||||||
Core::GeneratedFile file(fileName);
|
Core::GeneratedFile file(fileName);
|
||||||
file.setContents(fileContents(fileName, optionPage->statelessLibrary()));
|
file.setContents(fileContents(fileName, optionPage->isLibrary()));
|
||||||
file.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
|
file.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
|
||||||
return Core::GeneratedFiles() << file;
|
return Core::GeneratedFiles() << file;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString JsFileWizard::fileContents(const QString &, bool statelessLibrary) const
|
QString JsFileWizard::fileContents(const QString &, bool isLibrary) const
|
||||||
{
|
{
|
||||||
QString contents;
|
QString contents;
|
||||||
QTextStream str(&contents);
|
QTextStream str(&contents);
|
||||||
|
|
||||||
if (statelessLibrary)
|
if (isLibrary)
|
||||||
str << QLatin1String(".pragma library\n\n");
|
str << QLatin1String(".pragma library\n\n");
|
||||||
str << QLatin1String("function func() {\n")
|
str << QLatin1String("function func() {\n")
|
||||||
<< QLatin1String("\n")
|
<< QLatin1String("\n")
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public:
|
|||||||
JsFileWizard();
|
JsFileWizard();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString fileContents(const QString &baseName, bool statelessLibrary) const;
|
QString fileContents(const QString &baseName, bool isLibrary) const;
|
||||||
|
|
||||||
Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const;
|
Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user