diff --git a/assets/templates/projects/qtconsoleapp/CMakeLists.txt b/assets/templates/projects/qtconsoleapp/CMakeLists.txt new file mode 100644 index 000000000..a7967bc84 --- /dev/null +++ b/assets/templates/projects/qtconsoleapp/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.0.0) + +project(%{ProjectName} VERSION 0.1 LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC ON) + +find_package(Qt5Core) + +add_executable(${PROJECT_NAME} main.cpp) + +target_link_libraries(${PROJECT_NAME} Qt5::Core) diff --git a/assets/templates/projects/qtconsoleapp/main.cpp b/assets/templates/projects/qtconsoleapp/main.cpp new file mode 100644 index 000000000..63096ebcf --- /dev/null +++ b/assets/templates/projects/qtconsoleapp/main.cpp @@ -0,0 +1,11 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + + qInfo() << "hello world"; + + return a.exec(); +} diff --git a/assets/templates/projects/qtconsoleapp/wizard.json b/assets/templates/projects/qtconsoleapp/wizard.json new file mode 100644 index 000000000..5b5b1880f --- /dev/null +++ b/assets/templates/projects/qtconsoleapp/wizard.json @@ -0,0 +1,92 @@ +{ + "version": 1, + "type":"project", + "wizardType":"QTCtype", + "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qbs.QbsProject", "Qt4ProjectManager.Qt4Project" ], + "id": "E.QtCore", + "category": "F.Application", + "trDescription": "Creates a project containing a single main.cpp file with a stub implementation.\n\nPreselects a desktop Qt for building the application if available.", + "trDisplayName": "Qt Console Application", + "trDisplayCategory": "Application", + "icon": "../../global/consoleapplication.png", + "featuresRequired": [ "QtSupport.Wizards.FeatureQt" ], + "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}", + + "options": + [ + { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : ('%{BuildSystem}' === 'cmake' ? '%{CMakeFile}' : '%{QbsFile}')}" }, + { "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, + { "key": "QbsFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" }, + { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, + { "key": "CppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" } + ], + + "pages": + [ + { + "trDisplayName": "Project Location", + "trShortTitle": "Location", + "typeId": "Project", + "data": { "trDescription": "This wizard creates a simple Qt-based console application." } + }, + { + "trDisplayName": "Define Build System", + "trShortTitle": "Build System", + "typeId": "Fields", + "enabled": "%{JS: ! %{IsSubproject}}", + "data": + [ + { + "name": "BuildSystem", + "trDisplayName": "Build system:", + "type": "ComboBox", + "data": + { + "index": 0, + "items": + [ + { + "trKey": "CMake", + "value": "cmake", + "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + } + ] + } + } + ] + }, + { + "trDisplayName": "Kit Selection", + "trShortTitle": "Kits", + "typeId": "Kits", + "enabled": "%{JS: ! %{IsSubproject}}", + "data": { "projectFilePath": "%{ProjectFile}" } + }, + { + "trDisplayName": "Project Management", + "trShortTitle": "Summary", + "typeId": "Summary" + } + ], + "generators": + [ + { + "typeId": "File", + "data": + [ + { + "source": "CMakeLists.txt", + "openAsProject": true, + "replaceKeys": ["%{ProjectName}"], + "condition": "%{JS: '%{BuildSystem}' === 'cmake'}" + }, + + { + "source": "main.cpp", + "target": "%{CppFileName}", + "openInEditor": true + } + ] + } + ] +} diff --git a/assets/templates/templates.json b/assets/templates/templates.json index 2290cdde8..fd6ef5dbc 100644 --- a/assets/templates/templates.json +++ b/assets/templates/templates.json @@ -62,7 +62,15 @@ "leafNode":true } ] - } + }, + { + "type": "Qt", + "templates":[{ + "name": "QtConsoleApplication", + "path": "projects/qtconsoleapp", + "leafNode": true + }] + } ], "Files": [{ "type": "C++",