Commit 18b038b7 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

filetemplate: add more UI context marker for strings, fix some style

GIT_SILENT
parent b812144e
......@@ -40,8 +40,8 @@ ClassIdentifierPage::ClassIdentifierPage(QWidget* parent)
{
d->classid = new Ui::NewClassDialog;
d->classid->setupUi(this);
d->classid->identifierLineEdit->setPlaceholderText(i18n("Class name, including any namespaces"));
d->classid->keditlistwidget->lineEdit()->setPlaceholderText(i18n("Inheritance type and base class name"));
d->classid->identifierLineEdit->setPlaceholderText(i18nc("@info:placeholder", "Class name, including any namespaces"));
d->classid->keditlistwidget->lineEdit()->setPlaceholderText(i18nc("@info:placeholder", "Inheritance type and base class name"));
d->classid->inheritanceLabel->setBuddy(d->classid->keditlistwidget->lineEdit());
......
......@@ -39,7 +39,7 @@ ClassMembersPage::ClassMembersPage(QWidget* parent)
, d(new ClassMembersPagePrivate)
{
d->editListWidget = new KEditListWidget(this);
d->editListWidget->lineEdit()->setPlaceholderText(i18n("Variable type and identifier"));
d->editListWidget->lineEdit()->setPlaceholderText(i18nc("@info:placeholder", "Variable type and identifier"));
auto* layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
......
......@@ -66,14 +66,14 @@ FileTemplatesPlugin::FileTemplatesPlugin(QObject* parent, const QVariantList& ar
setXMLFile(QStringLiteral("kdevfiletemplates.rc"));
QAction* action = actionCollection()->addAction(QStringLiteral("new_from_template"));
action->setText(i18n("New From Template..."));
action->setText(i18nc("@action", "New from Template..."));
action->setIcon( QIcon::fromTheme( QStringLiteral("code-class") ) );
action->setWhatsThis( i18n( "Allows you to create new source code files, such as classes or unit tests, using templates." ) );
action->setToolTip( i18n( "Create new files from a template" ) );
action->setWhatsThis(i18nc("@info:whatsthis", "Allows you to create new source code files, such as classes or unit tests, using templates." ) );
action->setToolTip( i18nc("@info:tooltip", "Create new files from a template" ) );
connect (action, &QAction::triggered, this, &FileTemplatesPlugin::createFromTemplate);
m_toolView = new TemplatePreviewFactory(this);
core()->uiController()->addToolView(i18n("Template Preview"), m_toolView);
core()->uiController()->addToolView(i18nc("@title:window", "Template Preview"), m_toolView);
}
FileTemplatesPlugin::~FileTemplatesPlugin()
......@@ -112,7 +112,7 @@ ContextMenuExtension FileTemplatesPlugin::contextMenuExtension(Context* context,
}
if (url.isValid())
{
auto* action = new QAction(i18n("Create From Template..."), parent);
auto* action = new QAction(i18nc("@action:inmenu", "Create from Template..."), parent);
action->setIcon(QIcon::fromTheme(QStringLiteral("code-class")));
action->setData(url);
connect(action, &QAction::triggered, this, &FileTemplatesPlugin::createFromTemplate);
......@@ -132,7 +132,7 @@ ContextMenuExtension FileTemplatesPlugin::contextMenuExtension(Context* context,
if (fileUrl.isValid() && determineTemplateType(fileUrl) != NoTemplate)
{
auto* action = new QAction(i18n("Show Template Preview"), parent);
auto* action = new QAction(i18nc("@action:inmenu", "Show Template Preview"), parent);
action->setIcon(QIcon::fromTheme(QStringLiteral("document-preview")));
action->setData(fileUrl);
connect(action, &QAction::triggered, this, &FileTemplatesPlugin::previewTemplate);
......@@ -305,7 +305,7 @@ void FileTemplatesPlugin::previewTemplate()
{
return;
}
auto* preview = qobject_cast<TemplatePreviewToolView*>(core()->uiController()->findToolView(i18n("Template Preview"), m_toolView));
auto* preview = qobject_cast<TemplatePreviewToolView*>(core()->uiController()->findToolView(i18nc("@title:window", "Template Preview"), m_toolView));
if (!preview)
{
return;
......
......@@ -94,7 +94,7 @@ void LicensePagePrivate::initializeLicenses()
//Finally add the option other for user specified licenses
LicenseInfo otherLicense;
availableLicenses.push_back(otherLicense);
license->licenseComboBox->addItem(i18n("Other"));
license->licenseComboBox->addItem(i18nc("@item:inlistbox other license", "Other"));
}
// Read a license index, if it is not loaded, open it from the file
......
......@@ -180,14 +180,14 @@ void OutputPage::prepareForm(const SourceFileTemplate& fileTemplate)
const auto outputFiles = fileTemplate.outputFiles();
const int outputFilesCount = outputFiles.count();
d->output->urlGroupBox->setTitle(i18np("Output file", "Output files", outputFilesCount));
d->output->positionGroupBox->setTitle(i18np("Location within existing file", "Location within existing files", outputFilesCount));
d->output->urlGroupBox->setTitle(i18ncp("@title:group", "Output File", "Output Files", outputFilesCount));
d->output->positionGroupBox->setTitle(i18ncp("@title:group", "Location within Existing File", "Location within Existing Files", outputFilesCount));
for (const SourceFileTemplate::OutputFile& file : outputFiles) {
const QString id = file.identifier;
d->fileIdentifiers << id;
const QString fileLabelText = i18n("%1:", file.label);
const QString fileLabelText = i18nc("@label:chooser file name arg", "%1:", file.label);
auto* label = new QLabel(fileLabelText, this);
d->labels << label;
auto* requester = new KUrlRequester(this);
......
......@@ -46,11 +46,11 @@ static QString accessPolicyToString(Declaration::AccessPolicy accessPolicy)
switch (accessPolicy) {
case Declaration::DefaultAccess:
case Declaration::Public:
return i18n("Public");
return i18nc("@item access policy", "Public");
case Declaration::Protected:
return i18n("Protected");
return i18nc("@item access policy", "Protected");
case Declaration::Private:
return i18n("Private");
return i18nc("@item access policy", "Private");
}
Q_UNREACHABLE();
}
......@@ -60,15 +60,15 @@ static QString functionPropertiesToString(ClassFunctionDeclaration* decl)
Q_ASSERT(decl);
QStringList properties;
if (decl->isConstructor()) {
properties << i18n("Constructor");
properties << i18nc("@item function property", "Constructor");
} else if (decl->isDestructor()) {
properties << i18n("Destructor");
properties << i18nc("@item function property", "Destructor");
} else if (decl->isSignal()) {
properties << i18n("Signal");
properties << i18nc("@item function property", "Signal");
} else if (decl->isSlot()) {
properties << i18n("Slot");
properties << i18nc("@item function property", "Slot");
} else if (decl->isAbstract()) {
properties << i18n("Abstract function");
properties << i18nc("@item function property", "Abstract function");
}
return properties.join(QLatin1String(", "));
}
......
......@@ -290,16 +290,16 @@ void TemplateClassAssistant::setup()
{
if (d->baseUrl.isValid())
{
setWindowTitle(xi18n("Create Files from Template in <filename>%1</filename>", d->baseUrl.toDisplayString(QUrl::PreferLocalFile)));
setWindowTitle(xi18nc("@title:window", "Create Files from Template in <filename>%1</filename>", d->baseUrl.toDisplayString(QUrl::PreferLocalFile)));
}
else
{
setWindowTitle(i18n("Create Files from Template"));
setWindowTitle(i18nc("@title:window", "Create Files from Template"));
}
d->templateSelectionPageWidget = new TemplateSelectionPage(this);
connect(this, &TemplateClassAssistant::accepted, d->templateSelectionPageWidget, &TemplateSelectionPage::saveConfig);
d->templateSelectionPage = addPage(d->templateSelectionPageWidget, i18n("Language and Template"));
d->templateSelectionPage = addPage(d->templateSelectionPageWidget, i18nc("@title:tab", "Language and Template"));
d->templateSelectionPage->setIcon(QIcon::fromTheme(QStringLiteral("project-development-new-template")));
d->dummyPage = addPage(new QWidget(this), QStringLiteral("Dummy Page"));
......@@ -329,30 +329,30 @@ void TemplateClassAssistant::templateChosen(const QString& templateDescription)
if (d->baseUrl.isValid())
{
setWindowTitle(xi18n("Create Files from Template <filename>%1</filename> in <filename>%2</filename>",
setWindowTitle(xi18nc("@title:window", "Create Files from Template <filename>%1</filename> in <filename>%2</filename>",
d->fileTemplate.name(),
d->baseUrl.toDisplayString(QUrl::PreferLocalFile)));
}
else
{
setWindowTitle(xi18n("Create Files from Template <filename>%1</filename>", d->fileTemplate.name()));
setWindowTitle(xi18nc("@title:window", "Create Files from Template <filename>%1</filename>", d->fileTemplate.name()));
}
if (type == QLatin1String("Class"))
{
d->classIdentifierPageWidget = new ClassIdentifierPage(this);
d->classIdentifierPage = addPage(d->classIdentifierPageWidget, i18n("Class Basics"));
d->classIdentifierPage = addPage(d->classIdentifierPageWidget, i18nc("@title:tab", "Class Basics"));
d->classIdentifierPage->setIcon(QIcon::fromTheme(QStringLiteral("classnew")));
connect(d->classIdentifierPageWidget, &ClassIdentifierPage::isValid, this, &TemplateClassAssistant::setCurrentPageValid);
setValid(d->classIdentifierPage, false);
d->overridesPageWidget = new OverridesPage(this);
d->overridesPage = addPage(d->overridesPageWidget, i18n("Override Methods"));
d->overridesPage = addPage(d->overridesPageWidget, i18nc("@title:tab", "Override Methods"));
d->overridesPage->setIcon(QIcon::fromTheme(QStringLiteral("code-class")));
setValid(d->overridesPage, true);
d->membersPageWidget = new ClassMembersPage(this);
d->membersPage = addPage(d->membersPageWidget, i18n("Class Members"));
d->membersPage = addPage(d->membersPageWidget, i18nc("@title:tab", "Class Members"));
d->membersPage->setIcon(QIcon::fromTheme(QStringLiteral("field")));
setValid(d->membersPage, true);
......@@ -380,7 +380,7 @@ void TemplateClassAssistant::templateChosen(const QString& templateDescription)
if (type == QLatin1String("Test"))
{
d->testCasesPageWidget = new TestCasesPage(this);
d->testCasesPage = addPage(d->testCasesPageWidget, i18n("Test Cases"));
d->testCasesPage = addPage(d->testCasesPageWidget, i18nc("@title:tab", "Test Cases"));
connect(d->testCasesPageWidget, &TestCasesPage::isValid, this, &TemplateClassAssistant::setCurrentPageValid);
setValid(d->testCasesPage, false);
}
......@@ -390,13 +390,13 @@ void TemplateClassAssistant::templateChosen(const QString& templateDescription)
}
d->licensePageWidget = new LicensePage(this);
d->licensePage = addPage(d->licensePageWidget, i18n("License"));
d->licensePage = addPage(d->licensePageWidget, i18nc("@title:tab", "License"));
d->licensePage->setIcon(QIcon::fromTheme(QStringLiteral("text-x-copying")));
setValid(d->licensePage, true);
d->outputPageWidget = new OutputPage(this);
d->outputPageWidget->prepareForm(d->fileTemplate);
d->outputPage = addPage(d->outputPageWidget, i18n("Output"));
d->outputPage = addPage(d->outputPageWidget, i18nc("@title:tab", "Output"));
d->outputPage->setIcon(QIcon::fromTheme(QStringLiteral("document-save")));
connect(d->outputPageWidget, &OutputPage::isValid, this, &TemplateClassAssistant::setCurrentPageValid);
setValid(d->outputPage, false);
......@@ -406,7 +406,7 @@ void TemplateClassAssistant::templateChosen(const QString& templateDescription)
qCDebug(PLUGIN_FILETEMPLATES) << "Class generator has custom options";
d->templateOptionsPageWidget = new TemplateOptionsPage(this);
d->templateOptionsPage = insertPage(d->outputPage, d->templateOptionsPageWidget,
i18n("Template Options"));
i18nc("@title:tab", "Template Options"));
}
setCurrentPage(d->templateSelectionPage);
......@@ -489,7 +489,7 @@ void TemplateClassAssistant::next()
else if (currentPage() == d->overridesPage)
{
d->overridesPageWidget->clear();
d->overridesPageWidget->addCustomDeclarations(i18n("Default"),
d->overridesPageWidget->addCustomDeclarations(i18nc("@item default declarations", "Default"),
d->helper->defaultMethods(d->generator->name()));
d->overridesPageWidget->addBaseClasses(d->generator->directBaseClasses(),
d->generator->allBaseClasses());
......@@ -537,11 +537,11 @@ void TemplateClassAssistant::back()
if (d->baseUrl.isValid())
{
setWindowTitle(xi18n("Create Files from Template in <filename>%1</filename>", d->baseUrl.toDisplayString(QUrl::PreferLocalFile)));
setWindowTitle(xi18nc("@title:window", "Create Files from Template in <filename>%1</filename>", d->baseUrl.toDisplayString(QUrl::PreferLocalFile)));
}
else
{
setWindowTitle(i18n("Create Files from Template"));
setWindowTitle(i18nc("@title:window", "Create Files from Template"));
}
d->dummyPage = addPage(new QWidget(this), QStringLiteral("Dummy Page"));
}
......
......@@ -134,7 +134,7 @@ void TemplateOptionsPage::load(const SourceFileTemplate& fileTemplate, TemplateR
}
if (control)
{
const QString entryLabelText = i18n("%1:", entry.label);
const QString entryLabelText = i18nc("@label", "%1:", entry.label);
auto* label = new QLabel(entryLabelText, box);
if (!entry.context.isEmpty()) {
label->setToolTip(entry.context);
......
......@@ -27,7 +27,7 @@
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Template type</string>
<string comment="@title:group">Template Type</string>
</property>
<property name="flat">
<bool>true</bool>
......@@ -36,7 +36,7 @@
<item>
<widget class="QRadioButton" name="projectRadioButton">
<property name="text">
<string>Project template</string>
<string comment="@option:radio">Project template</string>
</property>
<property name="checked">
<bool>true</bool>
......@@ -46,7 +46,7 @@
<item>
<widget class="QRadioButton" name="classRadioButton">
<property name="text">
<string>Class template</string>
<string comment="@option:radio">Class template</string>
</property>
</widget>
</item>
......@@ -58,7 +58,7 @@
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Empty lines policy</string>
<string comment="@label:listbox">&amp;Empty lines policy:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
......@@ -75,17 +75,17 @@
</property>
<item>
<property name="text">
<string>Keep empty lines</string>
<string comment="@item:inlistbox empty line policy">Keep Empty Lines</string>
</property>
</item>
<item>
<property name="text">
<string>Remove repeated empty lines</string>
<string comment="@item:inlistbox empty line policy">Remove Repeated Empty Lines</string>
</property>
</item>
<item>
<property name="text">
<string>Remove all empty lines</string>
<string comment="@item:inlistbox empty line policy">Remove All Empty Lines</string>
</property>
</item>
</widget>
......
......@@ -212,7 +212,11 @@ TemplateSelectionPage::TemplateSelectionPage(TemplateClassAssistant* parent)
d->model->refresh();
d->ui->view->setLevels(3);
d->ui->view->setHeaderLabels(QStringList{i18n("Language"), i18n("Framework"), i18n("Template")});
d->ui->view->setHeaderLabels(QStringList{
i18nc("@title:column", "Language"),
i18nc("@title:column", "Framework"),
i18nc("@title:column", "Template")
});
d->ui->view->setModel(d->model);
connect(d->ui->view, &MultiLevelListView::currentIndexChanged,
......@@ -246,12 +250,12 @@ TemplateSelectionPage::TemplateSelectionPage(TemplateClassAssistant* parent)
d->ui->view->setCurrentIndex(templateIndex);
auto* getMoreButton = new QPushButton(i18n("Get More Templates..."), d->ui->view);
auto* getMoreButton = new QPushButton(i18nc("@action:button", "Get More Templates..."), d->ui->view);
getMoreButton->setIcon(QIcon::fromTheme(QStringLiteral("get-hot-new-stuff")));
connect (getMoreButton, &QPushButton::clicked, this, [&] { d->getMoreClicked(); });
d->ui->view->addWidget(0, getMoreButton);
auto* loadButton = new QPushButton(QIcon::fromTheme(QStringLiteral("application-x-archive")), i18n("Load Template From File"), d->ui->view);
auto* loadButton = new QPushButton(QIcon::fromTheme(QStringLiteral("application-x-archive")), i18nc("@action:button", "Load Template from File"), d->ui->view);
connect (loadButton, &QPushButton::clicked, this, [&] { d->loadFileClicked(); });
d->ui->view->addWidget(0, loadButton);
......
......@@ -41,7 +41,7 @@
</sizepolicy>
</property>
<property name="text">
<string>License type:</string>
<string comment="@label:listbox">License type:</string>
</property>
</widget>
</item>
......@@ -61,10 +61,10 @@
<bool>false</bool>
</property>
<property name="toolTip">
<string>Click here if you want to save this license for future use</string>
<string comment="@info:tooltip">Enable if you want to save this license for future use</string>
</property>
<property name="text">
<string>Save license</string>
<string comment="@option:check">Save license</string>
</property>
<property name="checkable">
<bool>true</bool>
......
......@@ -32,7 +32,7 @@
<item row="0" column="0">
<widget class="QLabel" name="identifierLabel">
<property name="text">
<string>&amp;Identifier:</string>
<string comment="@label:textbox">&amp;Identifier:</string>
</property>
<property name="buddy">
<cstring>identifierLineEdit</cstring>
......@@ -45,7 +45,7 @@
<item row="1" column="0">
<widget class="QLabel" name="inheritanceLabel">
<property name="text">
<string>In&amp;heritance:</string>
<string comment="@label:listbox">In&amp;heritance:</string>
</property>
</widget>
</item>
......
......@@ -56,7 +56,7 @@
<item>
<widget class="QCheckBox" name="lowerFilenameCheckBox">
<property name="text">
<string>Lower case file names</string>
<string comment="@option:check">Lower case file names</string>
</property>
<property name="checked">
<bool>true</bool>
......
......@@ -39,17 +39,17 @@
</property>
<column>
<property name="text">
<string>Superclass -&gt; Function</string>
<string comment="@title:column">Superclass -&gt; Function</string>
</property>
</column>
<column>
<property name="text">
<string>Access</string>
<string comment="@title:column">Access</string>
</property>
</column>
<column>
<property name="text">
<string>Properties</string>
<string comment="@title:column">Properties</string>
</property>
</column>
</widget>
......@@ -59,14 +59,14 @@
<item>
<widget class="QPushButton" name="selectAllPushButton">
<property name="text">
<string>Select &amp;All</string>
<string comment="@action:button">Select &amp;All</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="deselectAllPushButton">
<property name="text">
<string>&amp;Deselect All</string>
<string comment="@action:button">&amp;Deselect All</string>
</property>
</widget>
</item>
......
......@@ -32,7 +32,7 @@
<item row="0" column="0">
<widget class="QLabel" name="identifierLabel">
<property name="text">
<string>&amp;Identifier:</string>
<string comment="@label:textbox">&amp;Identifier:</string>
</property>
<property name="buddy">
<cstring>identifierLineEdit</cstring>
......@@ -45,7 +45,7 @@
<item row="1" column="0">
<widget class="QLabel" name="testCasesLabel">
<property name="text">
<string>&amp;Test cases:</string>
<string comment="@label:listbox">&amp;Test cases:</string>
</property>
</widget>
</item>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment