├── ActivatorFile.cpp ├── ActivatorFile.h ├── File.pro ├── ImplFile.cpp ├── ImplFile.h ├── MANIFEST.MF ├── README.md ├── lib.png ├── resource.qrc ├── screentshot ├── 20181225154952.png ├── 20181225155111.png ├── 20181225155133.png ├── 20181225155347.png ├── 20181225155518.png ├── 20181225155650.png ├── 20181225155702.png ├── 20181225155733.png ├── 20181225162305.png └── 20181225162837.png └── wizard.json /ActivatorFile.cpp: -------------------------------------------------------------------------------- 1 | %{Cpp:LicenseTemplate}\ 2 | #include "%{ActivatorHdrFileName}" 3 | #include "%{ImplHdrFileName}" 4 | 5 | void %{ActivatorCN}::start(ctkPluginContext *context) 6 | { 7 | @if '%{ImplBN}' 8 | s.reset(new %{ImplCN}(context)); 9 | @endif 10 | 11 | } 12 | 13 | void %{ActivatorCN}::stop(ctkPluginContext *context) 14 | { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /ActivatorFile.h: -------------------------------------------------------------------------------- 1 | %{Cpp:LicenseTemplate}\ 2 | #ifndef %{JS: Cpp.headerGuard('%{ActivatorHdrFileName}')} 3 | #define %{JS: Cpp.headerGuard('%{ActivatorHdrFileName}')} 4 | 5 | #include 6 | #include 7 | 8 | @if '%{ImplBN}' 9 | #include "%{ImplBN}.h" 10 | @endif 11 | 12 | class %{ActivatorCN} : public QObject,public ctkPluginActivator 13 | { 14 | Q_OBJECT 15 | Q_INTERFACES(ctkPluginActivator) 16 | Q_PLUGIN_METADATA(IID "%{Plugin_Name}") 17 | public: 18 | void start(ctkPluginContext* context); 19 | void stop(ctkPluginContext* context); 20 | 21 | private: 22 | @if '%{ImplBN}' 23 | QScopedPointer<%{ImplBN}> s; 24 | @endif 25 | 26 | }; 27 | 28 | #endif // %{JS: Cpp.headerGuard('%{ActivatorHdrFileName}')} 29 | -------------------------------------------------------------------------------- /File.pro: -------------------------------------------------------------------------------- 1 | QT += core 2 | QT -= gui 3 | 4 | TARGET = %{Plugin_Name} 5 | CONFIG += plugin 6 | TEMPLATE = lib 7 | 8 | DESTDIR = $$PWD/../bin/plugins 9 | 10 | HEADERS += \\ 11 | %{ImplHdrFileName} \\ 12 | %{ActivatorHdrFileName} \\ 13 | 14 | 15 | SOURCES += \\ 16 | %{ImplSrcFileName} \\ 17 | %{ActivatorSrcFileName} \\ 18 | 19 | 20 | 21 | #-------------------------CTK-------------------------------# 22 | #CTK 安装路径 23 | CTK_INSTALL_PATH = $$PWD/../../../CTKInstall 24 | 25 | #CTK 相关库所在路径(例如:CTKCore.lib,CTKWidgets.lib) 26 | CTK_LIB_PATH = $$CTK_INSTALL_PATH/lib/ctk-0.1 27 | 28 | #CTK 相关头文件所在路径(例如:ctkPluginFramework.h) 29 | CTK_INCLUDE_PATH = $$CTK_INSTALL_PATH/include/ctk-0.1 30 | 31 | #CTK 插件相关头文件所在路径(主要因为用到了service 相关东西) 32 | CTK_INCLUDE_FRAMEWORK_PATH = $$PWD/../../../CTK/Libs/PluginFramework 33 | 34 | #相关库文件(CTKCore.lib、CTKWidgets.lib) 35 | LIBS += -L$$CTK_LIB_PATH -lCTKCore -lCTKWidgets -lCTKPluginFramework 36 | 37 | INCLUDEPATH += $$CTK_INCLUDE_PATH \ 38 | $$CTK_INCLUDE_FRAMEWORK_PATH 39 | #-------------------------CTK-------------------------------# 40 | 41 | RESOURCES += \\ 42 | resource.qrc 43 | 44 | -------------------------------------------------------------------------------- /ImplFile.cpp: -------------------------------------------------------------------------------- 1 | %{Cpp:LicenseTemplate}\ 2 | #include "%{ImplHdrFileName}" 3 | #include 4 | 5 | @if '%{ImplBN}' 6 | #include 7 | #include "%{ImplBN}.h" 8 | @endif 9 | 10 | 11 | %{ImplCN}::%{ImplCN}(ctkPluginContext *context) 12 | { 13 | @if '%{ImplBN}' 14 | context->registerService<%{ImplBN}>(this); 15 | @endif 16 | 17 | } 18 | @if '%{ImplBN}' 19 | void %{ImplCN}::sayHello() 20 | { 21 | qDebug()<<"test"; 22 | } 23 | @endif -------------------------------------------------------------------------------- /ImplFile.h: -------------------------------------------------------------------------------- 1 | %{Cpp:LicenseTemplate}\ 2 | #ifndef %{JS: Cpp.headerGuard('%{ImplHdrFileName}')} 3 | #define %{JS: Cpp.headerGuard('%{ImplHdrFileName}')} 4 | 5 | #include 6 | 7 | @if '%{ImplBN}' 8 | #include "%{ImplBN}.h" 9 | @endif 10 | 11 | class ctkPluginContext; 12 | 13 | @if '%{ImplBN}' 14 | class %{ImplCN} : public QObject, public %{ImplBN} 15 | @else 16 | class %{ImplCN} : public QObject 17 | @endif 18 | { 19 | Q_OBJECT 20 | @if '%{ImplBN}' 21 | Q_INTERFACES(%{ImplBN}) 22 | @endif 23 | public: 24 | %{ImplCN}(ctkPluginContext* context); 25 | @if '%{ImplBN}' 26 | void sayHello() Q_DECL_OVERRIDE; 27 | @endif 28 | }; 29 | 30 | #endif // %{JS: Cpp.headerGuard('%{ImplHdrFileName}')} 31 | -------------------------------------------------------------------------------- /MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Plugin-SymbolicName: %{Plugin_Name} 2 | Plugin-Name: %{Plugin_Name} 3 | Plugin-ActivationPolicy: %{Plugin_ActivationPolicy} 4 | Plugin-Version: %{Plugin_Version} 5 | Plugin-Description: %{Plugin_Description} 6 | Plugin-Vendor: %{Plugin_Vendor} 7 | Plugin-ContactAddress: %{Plugin_ContactAddress} 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CTK-Plugin-Wizards 2 | 3 | ### Wizards screenshot: 4 | 5 | 创建CTK Plugin 6 | ![](https://github.com/Caprey/CTK-Plugin-Wizards/blob/master/screentshot/20181225154952.png) 7 | ![](https://github.com/Caprey/CTK-Plugin-Wizards/blob/master/screentshot/20181225155111.png) 8 | ![](https://github.com/Caprey/CTK-Plugin-Wizards/blob/master/screentshot/20181225155133.png) 9 | 10 | 设置项目路径和kit后,填写插件相关信息: 11 | ![](https://github.com/Caprey/CTK-Plugin-Wizards/blob/master/screentshot/20181225155347.png) 12 | ![](https://github.com/Caprey/CTK-Plugin-Wizards/blob/master/screentshot/20181225155518.png) 13 | 14 | 创建完成后,项目结构如下: 15 | ![](https://github.com/Caprey/CTK-Plugin-Wizards/blob/master/screentshot/20181225155650.png) 16 | 17 | 插件元数据信息和插件实例类和激活类 18 | ![](https://github.com/Caprey/CTK-Plugin-Wizards/blob/master/screentshot/20181225155702.png) 19 | ![](https://github.com/Caprey/CTK-Plugin-Wizards/blob/master/screentshot/20181225155733.png) 20 | 21 | 22 | 23 | ###如何安装使用: 24 | 25 | 下载后放到qt的wizards目录下即可 26 | 例如: 27 | ![](https://github.com/Caprey/CTK-Plugin-Wizards/blob/master/screentshot/20181225162305.png) 28 | 29 | 当然可以根据自己的需要,修改相关信息 30 | 例如:修改插件Vendor信息 31 | 打开wizard.json,修改相关信息即可 32 | ![](https://github.com/Caprey/CTK-Plugin-Wizards/blob/master/screentshot/20181225162837.png) 33 | -------------------------------------------------------------------------------- /lib.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caprey/CTK-Plugin-Wizards/e95ce538cf8a3c2dbe0875ac839f31d1d3bef020/lib.png -------------------------------------------------------------------------------- /resource.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | MANIFEST.MF 4 | 5 | 6 | -------------------------------------------------------------------------------- /screentshot/20181225154952.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caprey/CTK-Plugin-Wizards/e95ce538cf8a3c2dbe0875ac839f31d1d3bef020/screentshot/20181225154952.png -------------------------------------------------------------------------------- /screentshot/20181225155111.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caprey/CTK-Plugin-Wizards/e95ce538cf8a3c2dbe0875ac839f31d1d3bef020/screentshot/20181225155111.png -------------------------------------------------------------------------------- /screentshot/20181225155133.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caprey/CTK-Plugin-Wizards/e95ce538cf8a3c2dbe0875ac839f31d1d3bef020/screentshot/20181225155133.png -------------------------------------------------------------------------------- /screentshot/20181225155347.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caprey/CTK-Plugin-Wizards/e95ce538cf8a3c2dbe0875ac839f31d1d3bef020/screentshot/20181225155347.png -------------------------------------------------------------------------------- /screentshot/20181225155518.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caprey/CTK-Plugin-Wizards/e95ce538cf8a3c2dbe0875ac839f31d1d3bef020/screentshot/20181225155518.png -------------------------------------------------------------------------------- /screentshot/20181225155650.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caprey/CTK-Plugin-Wizards/e95ce538cf8a3c2dbe0875ac839f31d1d3bef020/screentshot/20181225155650.png -------------------------------------------------------------------------------- /screentshot/20181225155702.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caprey/CTK-Plugin-Wizards/e95ce538cf8a3c2dbe0875ac839f31d1d3bef020/screentshot/20181225155702.png -------------------------------------------------------------------------------- /screentshot/20181225155733.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caprey/CTK-Plugin-Wizards/e95ce538cf8a3c2dbe0875ac839f31d1d3bef020/screentshot/20181225155733.png -------------------------------------------------------------------------------- /screentshot/20181225162305.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caprey/CTK-Plugin-Wizards/e95ce538cf8a3c2dbe0875ac839f31d1d3bef020/screentshot/20181225162305.png -------------------------------------------------------------------------------- /screentshot/20181225162837.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Caprey/CTK-Plugin-Wizards/e95ce538cf8a3c2dbe0875ac839f31d1d3bef020/screentshot/20181225162837.png -------------------------------------------------------------------------------- /wizard.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qbs.QbsProject", "Qt4ProjectManager.Qt4Project" ], 4 | "id": "R.CTK Plugin", 5 | "category": "G.Library", 6 | "trDescription": "Creates a ctk plugin for ctk plugin framework.", 7 | "trDisplayName": "CTK Plugin", 8 | "trDisplayCategory": "Library", 9 | "icon": "lib.png", 10 | "enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0 && ([ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0)}", 11 | 12 | "options": 13 | [ 14 | { "key": "ProjectFile", "value": "%{ProFile}" }, 15 | { "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, 16 | 17 | { "key": "IsTopLevelProject", "value": "%{JS: !'%{Exists:ProjectExplorer.Profile.Ids}'}" }, 18 | 19 | { "key": "Plugin_Name","value": "%{PluginName}"}, 20 | { "key": "Plugin_Version","value": "%{PluginVersion}"}, 21 | { "key": "Plugin_Description","value": "%{PluginDescription}"}, 22 | { "key": "Plugin_ActivationPolicy","value": "%{PluginActivationPolicy}"}, 23 | { "key": "Plugin_Vendor","value": "%{PluginVendor}"}, 24 | { "key": "Plugin_ContactAddress","value": "%{PluginContactAddress}"}, 25 | 26 | { "key": "ImplClass","value": "%{PluginName}Impl" }, 27 | { "key": "ActivatorClass","value": "%{PluginName}Activator" }, 28 | 29 | { "key": "ImplHdrFileName","value": "%{JS: Cpp.classToFileName('%{ImplClass}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}"}, 30 | { "key": "ImplSrcFileName","value": "%{JS: Cpp.classToFileName('%{ImplClass}', '%{JS: Util.preferredSuffix('text/x-c++src')}')}"}, 31 | 32 | { "key": "ActivatorHdrFileName","value": "%{JS: Cpp.classToFileName('%{ActivatorClass}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}"}, 33 | { "key": "ActivatorSrcFileName","value": "%{JS: Cpp.classToFileName('%{ActivatorClass}', '%{JS: Util.preferredSuffix('text/x-c++src')}')}"}, 34 | 35 | { "key": "ImplHdrPath", "value": "%{ProjectDirectory}/%{ImplHdrFileName}" }, 36 | { "key": "ImplSrcPath", "value": "%{ProjectDirectory}/%{ImplSrcFileName}" }, 37 | { "key": "ImplCN", "value": "%{JS: Cpp.className('%{ImplClass}')}" }, 38 | { "key": "ImplBN", "value": "%{JS: Cpp.className('%{ServiceName}')}"}, 39 | 40 | { "key": "ActivatorHdrPath", "value": "%{ProjectDirectory}/%{ActivatorHdrFileName}" }, 41 | { "key": "ActivatorSrcPath", "value": "%{ProjectDirectory}/%{ActivatorSrcFileName}" }, 42 | { "key": "ActivatorCN", "value": "%{JS: Cpp.className('%{ActivatorClass}')}" } 43 | 44 | ], 45 | 46 | "pages": 47 | [ 48 | { 49 | "trDisplayName": "Project Location", 50 | "trShortTitle": "Location", 51 | "typeId": "Project" 52 | }, 53 | { 54 | "trDisplayName": "Kit Selection", 55 | "trShortTitle": "Kits", 56 | "typeId": "Kits", 57 | "enabled": "%{IsTopLevelProject}", 58 | "data": { "projectFilePath": "%{ProFile}" } 59 | }, 60 | { 61 | "trDisplayName": "Plugin Information", 62 | "trShortTitle": "Information", 63 | "typeId": "Fields", 64 | "data" : 65 | [ 66 | { 67 | "name": "ServiceName", 68 | "trDisplayName": "Service name:", 69 | "mandatory": false, 70 | "type": "LineEdit", 71 | "data": { "validator": "(?:(?:[a-zA-Z][a-zA-Z0-9]*::)*[a-zA-Z][a-zA-Z0-9]*|)" } 72 | }, 73 | { 74 | "name": "PluginName", 75 | "trDisplayName": "Plugin name:", 76 | "mandatory": true, 77 | "type": "LineEdit", 78 | "data": { "validator": "(?:(?:[a-zA-Z][a-zA-Z0-9]*::)*[a-zA-Z][a-zA-Z0-9]*|)" } 79 | }, 80 | { 81 | "name": "PluginVersion", 82 | "trDisplayName": "Plugin Version:", 83 | "mandatory": true, 84 | "type": "LineEdit", 85 | "data": 86 | { 87 | "trText": "1.0.0", 88 | "validator": "^[0-9a-zA-Z\.]+$" 89 | } 90 | }, 91 | { 92 | "name": "PluginDescription", 93 | "trDisplayName": "Plugin Description:", 94 | "type": "TextEdit", 95 | "data" : 96 | { 97 | "trText": "This is Plugin" , 98 | "richText": true 99 | } 100 | }, 101 | { 102 | "name": "PluginActivationPolicy", 103 | "trDisplayName": "Plugin Activation Policy:", 104 | "mandatory": true, 105 | "type": "ComboBox", 106 | "data": 107 | { 108 | "items": [ "lazy", "eager"] 109 | } 110 | }, 111 | { 112 | "name": "PluginVendor", 113 | "trDisplayName": "Plugin Vendor:", 114 | "mandatory": true, 115 | "type": "LineEdit", 116 | "data": 117 | { 118 | "trText":"LR" 119 | } 120 | }, 121 | { 122 | "name": "PluginContactAddress", 123 | "trDisplayName": "Plugin Contact Address:", 124 | "mandatory": true, 125 | "type": "LineEdit", 126 | "data": 127 | { 128 | "trText": "www.260487189@qq.com" 129 | } 130 | } 131 | ] 132 | }, 133 | 134 | 135 | { 136 | "trDisplayName": "Project Management", 137 | "trShortTitle": "Summary", 138 | "typeId": "Summary" 139 | } 140 | ], 141 | "generators": 142 | [ 143 | { 144 | "typeId": "File", 145 | "data": 146 | [ 147 | { 148 | "source": "File.pro", 149 | "target": "%{ProFile}", 150 | "openAsProject": true 151 | }, 152 | { 153 | "source": "ImplFile.h", 154 | "target": "%{ImplHdrPath}", 155 | "openInEditor": true, 156 | "options": [ 157 | { "key": "Cpp:License:FileName", "value": "%{ImplHdrFileName}" }, 158 | { "key": "Cpp:License:ClassName", "value": "%{ImplCN}" } 159 | ] 160 | }, 161 | { 162 | "source": "ImplFile.cpp", 163 | "target": "%{ImplSrcPath}", 164 | "openInEditor": true, 165 | "options": [ 166 | { "key": "Cpp:License:FileName", "value": "%{ImplSrcFileName}" }, 167 | { "key": "Cpp:License:ClassName", "value": "%{ImplCN}" } 168 | ] 169 | }, 170 | { 171 | "source": "ActivatorFile.h", 172 | "target": "%{ActivatorHdrPath}", 173 | "openInEditor": true, 174 | "options": [ 175 | { "key": "Cpp:License:FileName", "value": "%{ActivatorHdrFileName}" }, 176 | { "key": "Cpp:License:ClassName", "value": "%{ActivatorCN}" } 177 | ] 178 | }, 179 | { 180 | "source": "ActivatorFile.cpp", 181 | "target": "%{ActivatorSrcPath}", 182 | "openInEditor": true, 183 | "options": [ 184 | { "key": "Cpp:License:FileName", "value": "%{ActivatorSrcFileName}" }, 185 | { "key": "Cpp:License:ClassName", "value": "%{ActivatorCN}" } 186 | ] 187 | }, 188 | { 189 | "source": "MANIFEST.MF", 190 | "target": "MANIFEST.MF" 191 | }, 192 | { 193 | "source": "resource.qrc", 194 | "target": "resource.qrc" 195 | }, 196 | { 197 | "source": "../git.ignore", 198 | "target": ".gitignore", 199 | "condition": "%{JS: ! %{IsSubproject} && '%{VersionControl}' === 'G.Git'}" 200 | } 201 | ] 202 | } 203 | ] 204 | } 205 | --------------------------------------------------------------------------------