diff options
Diffstat (limited to 'share/qtcreator/templates/wizards/projects')
40 files changed, 422 insertions, 15 deletions
diff --git a/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt index ce63061d75..d7eda0b02d 100644 --- a/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt @@ -11,7 +11,22 @@ set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) +@if %{HasTranslation} +find_package(Qt5 COMPONENTS Core LinguistTools REQUIRED) + +set(TS_FILES %{TsFileName}) +@else find_package(Qt5Core) +@endif -add_executable(%{ProjectName} %{CppFileName}) +add_executable(%{ProjectName} + %{CppFileName} +@if %{HasTranslation} + ${TS_FILES} +@endif +) target_link_libraries(%{ProjectName} Qt5::Core) +@if %{HasTranslation} + +qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) +@endif diff --git a/share/qtcreator/templates/wizards/projects/consoleapp/file.pro b/share/qtcreator/templates/wizards/projects/consoleapp/file.pro index d38289ce09..a8ed27c2ad 100644 --- a/share/qtcreator/templates/wizards/projects/consoleapp/file.pro +++ b/share/qtcreator/templates/wizards/projects/consoleapp/file.pro @@ -16,6 +16,11 @@ DEFINES += QT_DEPRECATED_WARNINGS SOURCES += \\ %{CppFileName} +@if %{HasTranslation} + +TRANSLATIONS += \\ + %{TsFileName} +@endif # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/share/qtcreator/templates/wizards/projects/consoleapp/file.qbs b/share/qtcreator/templates/wizards/projects/consoleapp/file.qbs index 3587027384..dfdd823780 100644 --- a/share/qtcreator/templates/wizards/projects/consoleapp/file.qbs +++ b/share/qtcreator/templates/wizards/projects/consoleapp/file.qbs @@ -17,7 +17,12 @@ QtApplication { ] consoleApplication: true - files: "%{CppFileName}" + files: [ + "%{CppFileName}", +@if %{HasTranslation} + "%{TsFileName}", +@endif + ] Group { // Properties for the produced executable fileTagsFilter: "application" diff --git a/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json b/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json index bee602c87d..b500c9edf4 100644 --- a/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json +++ b/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json @@ -16,6 +16,7 @@ { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, { "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" }, { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, + { "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" }, { "key": "CppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" } ], @@ -64,6 +65,11 @@ ] }, { + "trDisplayName": "Translation File", + "trShortTitle": "Translation", + "typeId": "QtTranslation" + }, + { "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", @@ -105,6 +111,11 @@ "openInEditor": true }, { + "source": "../translation.ts", + "target": "%{TsFileName}", + "condition": "%{HasTranslation}" + }, + { "source": "../git.ignore", "target": ".gitignore", "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/cpplibrary/CMakeLists.txt index 243280b657..b69799a442 100644 --- a/share/qtcreator/templates/wizards/projects/cpplibrary/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/cpplibrary/CMakeLists.txt @@ -12,8 +12,14 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) @if '%{QtModule}' != 'none' +@if %{HasTranslation} +find_package(Qt5 COMPONENTS %{QtModuleUpperCase} LinguistTools REQUIRED) + +set(TS_FILES %{TsFileName}) +@else find_package(Qt5 COMPONENTS %{QtModuleUpperCase} REQUIRED) @endif +@endif add_library(%{ProjectName} %{JS: %{IsStatic} ? 'STATIC' : 'SHARED'} @if '%{Type}' === 'shared' @@ -24,6 +30,9 @@ add_library(%{ProjectName} %{JS: %{IsStatic} ? 'STATIC' : 'SHARED'} @if %{IsQtPlugin} %{PluginJsonFile} @endif +@if %{HasTranslation} + ${TS_FILES} +@endif ) @if '%{QtModule}' != 'none' @@ -33,3 +42,7 @@ target_link_libraries(%{ProjectName} PRIVATE Qt5::%{QtModuleUpperCase}) target_compile_definitions(%{ProjectName} PRIVATE %{LibraryDefine}) @endif +@if %{HasTranslation} + +qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) +@endif diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/project.pro b/share/qtcreator/templates/wizards/projects/cpplibrary/project.pro index 431667ada5..8eba894fe5 100644 --- a/share/qtcreator/templates/wizards/projects/cpplibrary/project.pro +++ b/share/qtcreator/templates/wizards/projects/cpplibrary/project.pro @@ -36,6 +36,11 @@ HEADERS += \\ %{GlobalHdrFileName} \\ @endif %{HdrFileName} +@if %{HasTranslation} + +TRANSLATIONS += \\ + %{TsFileName} +@endif @if %{IsQtPlugin} DISTFILES += %{PluginJsonFile} diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/project.qbs b/share/qtcreator/templates/wizards/projects/cpplibrary/project.qbs index 0e5df73e84..2c51c9e116 100644 --- a/share/qtcreator/templates/wizards/projects/cpplibrary/project.qbs +++ b/share/qtcreator/templates/wizards/projects/cpplibrary/project.qbs @@ -41,6 +41,9 @@ DynamicLibrary { @if %{IsQtPlugin} "%{PluginJsonFile}", @endif +@if %{HasTranslation} + "%{TsFileName}", +@endif ] @if '%{TargetInstallPath}' != '' diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json b/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json index 8f4c264499..512ffdfe66 100644 --- a/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json +++ b/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json @@ -31,6 +31,7 @@ { "key": "TargetInstallPath", "value": "%{JS: value('IsShared') === 'true' ? '/usr/lib' : (value('IsQtPlugin') && value('PluginTargetPath') ? '$$[QT_INSTALL_PLUGINS]/' + value('PluginTargetPath') : '')}" }, { "key": "CN", "value": "%{JS: Cpp.className(value('Class'))}" }, { "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('Class'), Util.suffix(value('HdrFileName')))}" }, + { "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" }, { "key": "GLOBAL_GUARD", "value": "%{JS: Cpp.headerGuard(value('GlobalHdrFileName'))}" } ], @@ -272,6 +273,12 @@ ] }, { + "trDisplayName": "Translation File", + "trShortTitle": "Translation", + "data": { "enabled": "%{JS: value('QtModule') === 'none' ? 'no' : 'yes'}" }, + "typeId": "QtTranslation" + }, + { "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", @@ -327,6 +334,11 @@ "condition": "%{JS: value('Type') === 'qtplugin'}" }, { + "source": "../translation.ts", + "target": "%{TsFileName}", + "condition": "%{HasTranslation}" + }, + { "source": "../git.ignore", "target": ".gitignore", "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/empty/wizard.json b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/empty/wizard.json index 6d734cb0e8..87cc5c0979 100644 --- a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/empty/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/empty/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "Qt for Python - Empty", "trDisplayCategory": "Application", "icon": "icon.png", - "enabled": "%{JS: value('Plugins').indexOf('PythonEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('Python') >= 0}", "featuresRequired": [ "QtSupport.Wizards.FeatureQt.5.6" ], "options": diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/wizard.json b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/wizard.json index c8e397d0d8..eedad020e3 100644 --- a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "Qt for Python - Window", "trDisplayCategory": "Application", "icon": "icon.png", - "enabled": "%{JS: value('Plugins').indexOf('PythonEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('Python') >= 0}", "featuresRequired": [ "QtSupport.Wizards.FeatureQt.5.6" ], "options": diff --git a/share/qtcreator/templates/wizards/projects/qtquick2-extension/lib.png b/share/qtcreator/templates/wizards/projects/qtquick2-extension/lib.png Binary files differnew file mode 100644 index 0000000000..0566f1d5f1 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qtquick2-extension/lib.png diff --git a/share/qtcreator/templates/wizards/projects/qtquick2-extension/lib@2x.png b/share/qtcreator/templates/wizards/projects/qtquick2-extension/lib@2x.png Binary files differnew file mode 100644 index 0000000000..90a842d6e8 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qtquick2-extension/lib@2x.png diff --git a/share/qtcreator/templates/wizards/projects/qtquick2-extension/object.cpp b/share/qtcreator/templates/wizards/projects/qtquick2-extension/object.cpp new file mode 100644 index 0000000000..a2288c47c1 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qtquick2-extension/object.cpp @@ -0,0 +1,15 @@ +#include "%{ObjectHdr}" + +%{ObjectName}::%{ObjectName}(QQuickItem *parent) + : QQuickItem(parent) +{ + // By default, QQuickItem does not draw anything. If you subclass + // QQuickItem to create a visual item, you will need to uncomment the + // following line and re-implement updatePaintNode() + + // setFlag(ItemHasContents, true); +} + +%{ObjectName}::~%{ObjectName}() +{ +} diff --git a/share/qtcreator/templates/wizards/projects/qtquick2-extension/object.h b/share/qtcreator/templates/wizards/projects/qtquick2-extension/object.h new file mode 100644 index 0000000000..e74c4233e8 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qtquick2-extension/object.h @@ -0,0 +1,23 @@ +%{Cpp:LicenseTemplate}\ +@if '%{Cpp:PragmaOnce}' +#pragma once +@else +#ifndef %{OBJECTGUARD} +#define %{OBJECTGUARD} +@endif + +#include <QQuickItem> + +class %{ObjectName} : public QQuickItem +{ + Q_OBJECT + Q_DISABLE_COPY(%{ObjectName}) + +public: + explicit %{ObjectName}(QQuickItem *parent = nullptr); + ~%{ObjectName}() override; +}; + +@if ! '%{Cpp:PragmaOnce}' +#endif // %{OBJECTGUARD} +@endif diff --git a/share/qtcreator/templates/wizards/projects/qtquick2-extension/plugin.cpp b/share/qtcreator/templates/wizards/projects/qtquick2-extension/plugin.cpp new file mode 100644 index 0000000000..69afb9badd --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qtquick2-extension/plugin.cpp @@ -0,0 +1,12 @@ +#include "%{PluginHdr}" + +#include "%{ObjectHdr}" + +#include <qqml.h> + +void %{PluginName}::registerTypes(const char *uri) +{ + // @uri %{Uri} + qmlRegisterType<%{ObjectName}>(uri, 1, 0, "%{ObjectName}"); +} + diff --git a/share/qtcreator/templates/wizards/projects/qtquick2-extension/plugin.h b/share/qtcreator/templates/wizards/projects/qtquick2-extension/plugin.h new file mode 100644 index 0000000000..539aee0d5d --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qtquick2-extension/plugin.h @@ -0,0 +1,22 @@ +%{Cpp:LicenseTemplate}\ +@if '%{Cpp:PragmaOnce}' +#pragma once +@else +#ifndef %{PLUGINGUARD} +#define %{PLUGINGUARD} +@endif + +#include <QQmlExtensionPlugin> + +class %{PluginName} : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + void registerTypes(const char *uri) override; +}; + +@if ! '%{Cpp:PragmaOnce}' +#endif // %{PLUGINGUARD} +@endif diff --git a/share/qtcreator/templates/wizards/projects/qtquick2-extension/project.pro b/share/qtcreator/templates/wizards/projects/qtquick2-extension/project.pro new file mode 100644 index 0000000000..78d4325d32 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qtquick2-extension/project.pro @@ -0,0 +1,34 @@ +TEMPLATE = lib +TARGET = %{ProjectName} +QT += qml quick +CONFIG += plugin c++11 + +TARGET = $$qtLibraryTarget($$TARGET) +uri = %{Uri} + +# Input +SOURCES += \\ + %{PluginSrc} \\ + %{ObjectSrc} + +HEADERS += \\ + %{PluginHdr} \\ + %{ObjectHdr} + +DISTFILES = qmldir + +!equals(_PRO_FILE_PWD_, $$OUT_PWD) { + copy_qmldir.target = $$OUT_PWD/qmldir + copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir + copy_qmldir.commands = $(COPY_FILE) "$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)" "$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)" + QMAKE_EXTRA_TARGETS += copy_qmldir + PRE_TARGETDEPS += $$copy_qmldir.target +} + +qmldir.files = qmldir +unix { + installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /) + qmldir.path = $$installPath + target.path = $$installPath + INSTALLS += target qmldir +} diff --git a/share/qtcreator/templates/wizards/projects/qtquick2-extension/qmldir b/share/qtcreator/templates/wizards/projects/qtquick2-extension/qmldir new file mode 100644 index 0000000000..8a3038ae48 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qtquick2-extension/qmldir @@ -0,0 +1,2 @@ +module %{Uri} +plugin %{ProjectName} diff --git a/share/qtcreator/templates/wizards/projects/qtquick2-extension/wizard.json b/share/qtcreator/templates/wizards/projects/qtquick2-extension/wizard.json new file mode 100644 index 0000000000..b0f9e33ae3 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qtquick2-extension/wizard.json @@ -0,0 +1,109 @@ +{ + "version": 1, + "supportedProjectTypes": [ "Qt4ProjectManager.Qt4Project" ], + "id": "M.QtQuick2ExtensionPlugin", + "category": "G.Library", + "trDescription": "Creates a C++ plugin to load Qt Quick extensions dynamically into applications using the QQmlEngine class.", + "trDisplayName": "Qt Quick 2 Extension Plugin", + "trDisplayCategory": "Library", + "icon": "lib.png", + "featuresRequired": [ "QtSupport.Wizards.FeatureQtQuick", "QtSupport.Wizards.FeatureQtQuick.2" ], + "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}", + + "options": + [ + { "key": "ProjectFile", "value": "%{ProFile}" }, + { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, + { "key": "PluginBaseFileName", "value": "%{JS: value('ProjectName') + '_plugin'}" }, + { "key": "PluginSrc", "value": "%{JS: Cpp.classToFileName(value('PluginBaseFileName'), Util.preferredSuffix('text/x-c++src'))}" }, + { "key": "PluginHdr", "value": "%{JS: Cpp.classToFileName(value('PluginBaseFileName'), Util.preferredSuffix('text/x-c++hdr'))}" }, + { "key": "ObjectSrc", "value": "%{JS: Cpp.classToFileName(value('ObjectName'), Util.preferredSuffix('text/x-c++src'))}" }, + { "key": "ObjectHdr", "value": "%{JS: Cpp.classToFileName(value('ObjectName'), Util.preferredSuffix('text/x-c++hdr'))}" }, + { "key": "PluginName", "value": "%{JS: value('ProjectName').charAt(0).toUpperCase() + value('ProjectName').slice(1) + 'Plugin' }" }, + { "key": "PLUGINGUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('PluginBaseFileName'), Util.preferredSuffix('text/x-c++hdr'))}" }, + { "key": "OBJECTGUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('ObjectName'), Util.preferredSuffix('text/x-c++hdr'))}" } + ], + + "pages": + [ + { + "trDisplayName": "Project Location", + "trShortTitle": "Location", + "typeId": "Project" + }, + { + "trDisplayName": "Custom Parameters", + "trShortTitle": "Details", + "typeId": "Fields", + "data": + [ + { + "name": "ObjectName", + "trDisplayName": "Object class-name:", + "mandatory": true, + "type": "LineEdit", + "data": + { + "validator": "^[A-Za-z0-9_]+$", + "trText": "MyItem" + } + }, + { + "name": "Uri", + "trDisplayName": "URI:", + "mandatory": true, + "type": "LineEdit", + "data": + { + "validator": "^[A-Za-z0-9]+([A-Za-z0-9-]*[A-Za-z0-9]+)?(\\.[A-Za-z0-9]+([-A-Za-z0-9]*[A-Za-z0-9]+)?)*$", + "trText": "com.mycompany.qmlcomponents" + } + } + ] + }, + { + "trDisplayName": "Project Management", + "trShortTitle": "Summary", + "typeId": "Summary" + } + ], + "generators": + [ + { + "typeId": "File", + "data": + [ + { + "source": "project.pro", + "target": "%{ProFile}", + "openAsProject": true + }, + { + "source": "qmldir", + "target": "qmldir" + }, + { + "source": "plugin.cpp", + "target": "%{PluginSrc}" + }, + { + "source": "plugin.h", + "target": "%{PluginHdr}" + }, + { + "source": "object.cpp", + "target": "%{ObjectSrc}" + }, + { + "source": "object.h", + "target": "%{ObjectHdr}" + }, + { + "source": "../git.ignore", + "target": ".gitignore", + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" + } + ] + } + ] +} diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt index 165a32be3d..3678b3dcdb 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt @@ -11,18 +11,42 @@ set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) +@if %{HasTranslation} +find_package(Qt5 COMPONENTS Core Quick LinguistTools REQUIRED) + +set(TS_FILES %{TsFileName}) +@else find_package(Qt5 COMPONENTS Core Quick REQUIRED) +@endif if(ANDROID) - add_library(%{ProjectName} SHARED %{MainCppFileName} qml.qrc) + set(TARGET %{ProjectName}_${ANDROID_ABI}) + add_library(${TARGET} SHARED + %{MainCppFileName} + qml.qrc +@if %{HasTranslation} + ${TS_FILES} +@endif + ) else() - add_executable(%{ProjectName} %{MainCppFileName} qml.qrc) + set(TARGET %{ProjectName}) + add_executable(${TARGET} + %{MainCppFileName} + qml.qrc +@if %{HasTranslation} + ${TS_FILES} +@endif + ) endif() -target_compile_definitions(%{ProjectName} +target_compile_definitions(${TARGET} PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) -target_link_libraries(%{ProjectName} +target_link_libraries(${TARGET} PRIVATE Qt5::Core Qt5::Quick) +@if %{HasTranslation} + +qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) +@endif # QtCreator supports the following variables for Android, which are identical to qmake Android variables. # Check http://doc.qt.io/qt-5/deployment-android.html for more information. diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/app.pro b/share/qtcreator/templates/wizards/projects/qtquickapplication/app.pro index 0ac5682b11..908aaa3e07 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/app.pro +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/app.pro @@ -21,6 +21,11 @@ SOURCES += \\ %{MainCppFileName} RESOURCES += qml.qrc +@if %{HasTranslation} + +TRANSLATIONS += \\ + %{TsFileName} +@endif # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/app.qbs b/share/qtcreator/templates/wizards/projects/qtquickapplication/app.qbs index 27a8b66c3c..f06fb39824 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/app.qbs +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/app.qbs @@ -29,6 +29,9 @@ Application { "%{MainCppFileName}", "main.qml", "qml.qrc", +@if %{HasTranslation} + "%{TsFileName}", +@endif ] Group { // Properties for the produced executable diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json index fe284df679..412aa3f8f8 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json @@ -22,6 +22,7 @@ { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: value('QtVersion').QtQuickVirtualKeyboardImport}" }, { "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" }, { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" }, + { "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" }, { "key": "SetQPAPhysicalSize", "value": "%{UseVirtualKeyboardByDefault}" } ], @@ -170,6 +171,11 @@ ] }, { + "trDisplayName": "Translation File", + "trShortTitle": "Translation", + "typeId": "QtTranslation" + }, + { "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", @@ -222,6 +228,11 @@ "source": "qml.qrc" }, { + "source": "../../translation.ts", + "target": "%{TsFileName}", + "condition": "%{HasTranslation}" + }, + { "source": "../../git.ignore", "target": ".gitignore", "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json index f03b62635a..adfa7def75 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json @@ -24,6 +24,7 @@ { "key": "QtQuickControlsStyleTheme", "value": "%{JS: value('ControlsStyle').QtQuickControlsStyleTheme}" }, { "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" }, { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" }, + { "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" }, { "key": "SetQPAPhysicalSize", "value": "%{UseVirtualKeyboardByDefault}" } ], @@ -221,6 +222,11 @@ ] }, { + "trDisplayName": "Translation File", + "trShortTitle": "Translation", + "typeId": "QtTranslation" + }, + { "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", @@ -277,6 +283,11 @@ "source": "qml.qrc" }, { + "source": "../../translation.ts", + "target": "%{TsFileName}", + "condition": "%{HasTranslation}" + }, + { "source": "../../git.ignore", "target": ".gitignore", "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json index 6640901abe..a4593f8eb1 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json @@ -24,6 +24,7 @@ { "key": "QtQuickControlsStyleTheme", "value": "%{JS: value('ControlsStyle').QtQuickControlsStyleTheme}" }, { "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" }, { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" }, + { "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" }, { "key": "SetQPAPhysicalSize", "value": "%{UseVirtualKeyboardByDefault}" } ], @@ -239,6 +240,11 @@ ] }, { + "trDisplayName": "Translation File", + "trShortTitle": "Translation", + "typeId": "QtTranslation" + }, + { "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", @@ -307,6 +313,11 @@ "source": "qml.qrc" }, { + "source": "../../translation.ts", + "target": "%{TsFileName}", + "condition": "%{HasTranslation}" + }, + { "source": "../../git.ignore", "target": ".gitignore", "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json index 2b6ac53030..9f47b864e1 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json @@ -24,6 +24,7 @@ { "key": "QtQuickControlsStyleTheme", "value": "%{JS: value('ControlsStyle').QtQuickControlsStyleTheme}" }, { "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" }, { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" }, + { "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" }, { "key": "SetQPAPhysicalSize", "value": "%{UseVirtualKeyboardByDefault}" } ], @@ -239,6 +240,11 @@ ] }, { + "trDisplayName": "Translation File", + "trShortTitle": "Translation", + "typeId": "QtTranslation" + }, + { "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", @@ -303,6 +309,11 @@ "source": "qml.qrc" }, { + "source": "../../translation.ts", + "target": "%{TsFileName}", + "condition": "%{HasTranslation}" + }, + { "source": "../../git.ignore", "target": ".gitignore", "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt index 5fd51e9014..ea825062f4 100644 --- a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt @@ -11,7 +11,13 @@ set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) +@if %{HasTranslation} +find_package(Qt5 COMPONENTS Widgets LinguistTools REQUIRED) + +set(TS_FILES %{TsFileName}) +@else find_package(Qt5 COMPONENTS Widgets REQUIRED) +@endif add_executable(%{ProjectName} %{MainFileName} @@ -20,6 +26,13 @@ add_executable(%{ProjectName} @if %{GenerateForm} %{FormFileName} @endif +@if %{HasTranslation} + ${TS_FILES} +@endif ) target_link_libraries(%{ProjectName} PRIVATE Qt5::Widgets) +@if %{HasTranslation} + +qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) +@endif diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.pro b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.pro index a5362aa9bc..a0a237bf20 100644 --- a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.pro +++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.pro @@ -26,6 +26,11 @@ HEADERS += \\ FORMS += \\ %{FormFileName} @endif +@if %{HasTranslation} + +TRANSLATIONS += \\ + %{TsFileName} +@endif # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.qbs b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.qbs index 4a54380d6b..baa6326cb8 100644 --- a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.qbs +++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.qbs @@ -19,9 +19,12 @@ QtApplication { "%{MainFileName}", "%{SrcFileName}", "%{HdrFileName}", - @if %{GenerateForm} +@if %{GenerateForm} "%{FormFileName}", - @endif +@endif +@if %{HasTranslation} + "%{TsFileName}", +@endif ] install: true diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json index 9cce84a413..971ef3f88f 100644 --- a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json @@ -19,6 +19,7 @@ { "key": "MainFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" }, { "key": "UiHdrFileName", "value": "%{JS: (value('BuildSystem') === 'cmake' ? (Util.path(value('FormFileName')) + '/') : '') + 'ui_' + Util.completeBaseName(value('FormFileName')) + '.h'}" }, { "key": "CN", "value": "%{JS: Cpp.className(value('Class'))}" }, + { "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" }, { "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('Class'), Util.suffix(value('HdrFileName')))}" } ], @@ -140,6 +141,11 @@ ] }, { + "trDisplayName": "Translation File", + "trShortTitle": "Translation", + "typeId": "QtTranslation" + }, + { "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", @@ -194,6 +200,11 @@ "condition": "%{GenerateForm}" }, { + "source": "../translation.ts", + "target": "%{TsFileName}", + "condition": "%{HasTranslation}" + }, + { "source": "../git.ignore", "target": ".gitignore", "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" diff --git a/share/qtcreator/templates/wizards/projects/translation.ts b/share/qtcreator/templates/wizards/projects/translation.ts new file mode 100644 index 0000000000..ed21a4017e --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/translation.ts @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="%{TsLanguage}"></TS> diff --git a/share/qtcreator/templates/wizards/projects/vcs/bazaar/wizard.json b/share/qtcreator/templates/wizards/projects/vcs/bazaar/wizard.json index f81509c4ed..060b55944a 100644 --- a/share/qtcreator/templates/wizards/projects/vcs/bazaar/wizard.json +++ b/share/qtcreator/templates/wizards/projects/vcs/bazaar/wizard.json @@ -40,7 +40,9 @@ "name": "Repo", "trDisplayName": "Repository:", "mandatory": true, - "type": "LineEdit" + "type": "LineEdit", + "isComplete": "%{JS: Vcs.isValidRepoUrl('%{vcsId}', '%{Repo}')}", + "trIncompleteMessage": "Repository URL is not valid" }, { "name": "Sp1", diff --git a/share/qtcreator/templates/wizards/projects/vcs/cvs/icon.png b/share/qtcreator/templates/wizards/projects/vcs/cvs/icon.png Binary files differindex bc452165a7..bd925b2e98 100644 --- a/share/qtcreator/templates/wizards/projects/vcs/cvs/icon.png +++ b/share/qtcreator/templates/wizards/projects/vcs/cvs/icon.png diff --git a/share/qtcreator/templates/wizards/projects/vcs/cvs/icon@2x.png b/share/qtcreator/templates/wizards/projects/vcs/cvs/icon@2x.png Binary files differindex c29386c5e4..ec330c9f44 100644 --- a/share/qtcreator/templates/wizards/projects/vcs/cvs/icon@2x.png +++ b/share/qtcreator/templates/wizards/projects/vcs/cvs/icon@2x.png diff --git a/share/qtcreator/templates/wizards/projects/vcs/cvs/wizard.json b/share/qtcreator/templates/wizards/projects/vcs/cvs/wizard.json index 10969e3da8..075a69fdb1 100644 --- a/share/qtcreator/templates/wizards/projects/vcs/cvs/wizard.json +++ b/share/qtcreator/templates/wizards/projects/vcs/cvs/wizard.json @@ -38,7 +38,9 @@ "name": "Repo", "trDisplayName": "Module:", "mandatory": true, - "type": "LineEdit" + "type": "LineEdit", + "isComplete": "%{JS: Vcs.isValidRepoUrl('%{vcsId}', '%{Repo}')}", + "trIncompleteMessage": "Repository URL is not valid" }, { "name": "Sp1", diff --git a/share/qtcreator/templates/wizards/projects/vcs/git/icon.png b/share/qtcreator/templates/wizards/projects/vcs/git/icon.png Binary files differindex 46bcd4aab5..cfbd0c497f 100644 --- a/share/qtcreator/templates/wizards/projects/vcs/git/icon.png +++ b/share/qtcreator/templates/wizards/projects/vcs/git/icon.png diff --git a/share/qtcreator/templates/wizards/projects/vcs/git/icon@2x.png b/share/qtcreator/templates/wizards/projects/vcs/git/icon@2x.png Binary files differindex cca3e6ac0d..2edb04b5a0 100644 --- a/share/qtcreator/templates/wizards/projects/vcs/git/icon@2x.png +++ b/share/qtcreator/templates/wizards/projects/vcs/git/icon@2x.png diff --git a/share/qtcreator/templates/wizards/projects/vcs/git/wizard.json b/share/qtcreator/templates/wizards/projects/vcs/git/wizard.json index 0295468f6f..401be45a75 100644 --- a/share/qtcreator/templates/wizards/projects/vcs/git/wizard.json +++ b/share/qtcreator/templates/wizards/projects/vcs/git/wizard.json @@ -39,7 +39,9 @@ { "name": "Repo", "trDisplayName": "Repository:", - "type": "LineEdit" + "type": "LineEdit", + "isComplete": "%{JS: Vcs.isValidRepoUrl('%{vcsId}', '%{Repo}')}", + "trIncompleteMessage": "Repository URL is not valid" }, { "name": "Branch", diff --git a/share/qtcreator/templates/wizards/projects/vcs/mercurial/wizard.json b/share/qtcreator/templates/wizards/projects/vcs/mercurial/wizard.json index 8e655e1eb6..81fa26da04 100644 --- a/share/qtcreator/templates/wizards/projects/vcs/mercurial/wizard.json +++ b/share/qtcreator/templates/wizards/projects/vcs/mercurial/wizard.json @@ -39,7 +39,9 @@ "name": "Repo", "trDisplayName": "Repository:", "mandatory": true, - "type": "LineEdit" + "type": "LineEdit", + "isComplete": "%{JS: Vcs.isValidRepoUrl('%{vcsId}', '%{Repo}')}", + "trIncompleteMessage": "Repository URL is not valid" }, { "name": "Sp1", diff --git a/share/qtcreator/templates/wizards/projects/vcs/subversion/wizard.json b/share/qtcreator/templates/wizards/projects/vcs/subversion/wizard.json index cfeddbb532..2e63b12eb4 100644 --- a/share/qtcreator/templates/wizards/projects/vcs/subversion/wizard.json +++ b/share/qtcreator/templates/wizards/projects/vcs/subversion/wizard.json @@ -39,7 +39,9 @@ "name": "Repo", "trDisplayName": "Repository:", "mandatory": true, - "type": "LineEdit" + "type": "LineEdit", + "isComplete": "%{JS: Vcs.isValidRepoUrl('%{vcsId}', '%{Repo}')}", + "trIncompleteMessage": "Repository URL is not valid" }, { "name": "Sp1", |