forked from qt-creator/qt-creator
External tools need a uid, e.g. for keyboard shortcuts.
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
-->
|
||||
<externaltool>
|
||||
<externaltool id="lrelease">
|
||||
<description>Creates qm translation files that can be used by an application from the translator's ts files</description>
|
||||
<description xml:lang="de">Erstellt die von Anwendungen nutzbaren qm-Dateien aus ts-Dateien von Übersetzern</description>
|
||||
<displayname>Release translations (lrelease)</displayname>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
-->
|
||||
<externaltool>
|
||||
<externaltool id="lupdate">
|
||||
<description>Synchronizes translator's ts files with the program code</description>
|
||||
<description xml:lang="de">Synchronisiert die ts-Übersetzungsdateien mit dem Programmcode</description>
|
||||
<displayname>Update translations (lupdate)</displayname>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
-->
|
||||
<externaltool>
|
||||
<externaltool id="sort">
|
||||
<description>Sorts the selected text</description>
|
||||
<description xml:lang="de">Sortiert den ausgewählten Text</description>
|
||||
<displayname>Sort</displayname>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
-->
|
||||
<externaltool>
|
||||
<externaltool id="vi">
|
||||
<description>Opens the current file in vi</description>
|
||||
<description xml:lang="de">Öffnet die aktuelle Datei in vi</description>
|
||||
<displayname>Edit with vi</displayname>
|
||||
|
||||
@@ -59,6 +59,11 @@ ExternalTool::ExternalTool() :
|
||||
{
|
||||
}
|
||||
|
||||
QString ExternalTool::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
QString ExternalTool::description() const
|
||||
{
|
||||
return m_description;
|
||||
@@ -153,6 +158,9 @@ ExternalTool * ExternalTool::createFromXml(const QString &xml, QString *errorMes
|
||||
|
||||
if (!reader.readNextStartElement() || reader.name() != QLatin1String(kExternalTool))
|
||||
reader.raiseError(QLatin1String("Missing start element <externaltool>"));
|
||||
tool->m_id = reader.attributes().value(QLatin1String("id")).toString();
|
||||
if (tool->m_id.isEmpty())
|
||||
reader.raiseError(QLatin1String("Missing or empty id attribute for <externaltool>"));
|
||||
while (reader.readNextStartElement()) {
|
||||
if (reader.name() == QLatin1String(kDescription)) {
|
||||
localizedText(locales, &reader, &descriptionLocale, &tool->m_description);
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
|
||||
ExternalTool();
|
||||
|
||||
QString id() const;
|
||||
QString description() const;
|
||||
QString displayName() const;
|
||||
QString displayCategory() const;
|
||||
@@ -60,6 +61,7 @@ public:
|
||||
static ExternalTool *createFromXml(const QString &xml, QString *errorMessage = 0, const QString &locale = QString());
|
||||
|
||||
private:
|
||||
QString m_id;
|
||||
QString m_description;
|
||||
QString m_displayName;
|
||||
QString m_displayCategory;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
using namespace Core::Internal;
|
||||
|
||||
static const char * const TEST_XML1 =
|
||||
"<externaltool>"
|
||||
"<externaltool id=\"lupdate\">"
|
||||
" <description>Synchronizes translator's ts files with the program code</description>"
|
||||
" <description xml:lang=\"de\">Synchronisiert die ts-Übersetzungsdateien mit dem Programmcode</description>"
|
||||
" <displayname>Update translations (lupdate)</displayname>"
|
||||
@@ -24,7 +24,7 @@ static const char * const TEST_XML1 =
|
||||
;
|
||||
|
||||
static const char * const TEST_XML2 =
|
||||
"<externaltool>"
|
||||
"<externaltool id=\"sort\">"
|
||||
" <description>Sorts the selected text</description>"
|
||||
" <description xml:lang=\"de\">Sortiert den ausgewählten Text</description>"
|
||||
" <displayname>Sort</displayname>"
|
||||
@@ -39,7 +39,7 @@ static const char * const TEST_XML2 =
|
||||
"</externaltool>";
|
||||
|
||||
static const char * const TEST_XML3 =
|
||||
"<externaltool>"
|
||||
"<externaltool id=\"vi\">"
|
||||
" <description>Opens the current file in vi</description>"
|
||||
" <description xml:lang=\"de\">Öffnet die aktuelle Datei in vi</description>"
|
||||
" <displayname>Edit with vi</displayname>"
|
||||
@@ -54,7 +54,7 @@ static const char * const TEST_XML3 =
|
||||
"</externaltool>";
|
||||
|
||||
static const char * const TEST_XML_LANG =
|
||||
"<externaltool>"
|
||||
"<externaltool id=\"temp\">"
|
||||
" <description>Hi</description>"
|
||||
" <description xml:lang=\"de\">Hallo</description>"
|
||||
" <description xml:lang=\"de_CH\">Grüezi</description>"
|
||||
@@ -86,6 +86,7 @@ void ExternaltoolTest::testRead1()
|
||||
ExternalTool *tool = ExternalTool::createFromXml(QLatin1String(TEST_XML1), &error);
|
||||
QVERIFY(tool != 0);
|
||||
QVERIFY(error.isEmpty());
|
||||
QCOMPARE(tool->id(), QString::fromLatin1("lupdate"));
|
||||
QVERIFY(tool->description().startsWith(QLatin1String("Synchronizes tran")));
|
||||
QCOMPARE(tool->displayName(), QString::fromLatin1("Update translations (lupdate)"));
|
||||
QCOMPARE(tool->displayCategory(), QString::fromLatin1("Linguist"));
|
||||
@@ -105,6 +106,7 @@ void ExternaltoolTest::testRead2()
|
||||
ExternalTool *tool = ExternalTool::createFromXml(QLatin1String(TEST_XML2), &error);
|
||||
QVERIFY(tool != 0);
|
||||
QVERIFY(error.isEmpty());
|
||||
QCOMPARE(tool->id(), QString::fromLatin1("sort"));
|
||||
QVERIFY(tool->description().startsWith(QLatin1String("Sorts the")));
|
||||
QCOMPARE(tool->displayName(), QString::fromLatin1("Sort"));
|
||||
QCOMPARE(tool->displayCategory(), QString::fromLatin1("Text"));
|
||||
@@ -123,6 +125,7 @@ void ExternaltoolTest::testRead3()
|
||||
ExternalTool *tool = ExternalTool::createFromXml(QLatin1String(TEST_XML3), &error);
|
||||
QVERIFY(tool != 0);
|
||||
QVERIFY(error.isEmpty());
|
||||
QCOMPARE(tool->id(), QString::fromLatin1("vi"));
|
||||
QVERIFY(tool->description().startsWith(QLatin1String("Opens the")));
|
||||
QCOMPARE(tool->displayName(), QString::fromLatin1("Edit with vi"));
|
||||
QCOMPARE(tool->displayCategory(), QString::fromLatin1("Text"));
|
||||
|
||||
Reference in New Issue
Block a user