From 43ffeb85494e24822accb24b9350d77083f635ce Mon Sep 17 00:00:00 2001 From: Skycoder42 Date: Sat, 4 Aug 2018 00:26:28 +0200 Subject: [PATCH] add generator qbs mod --- deploy.json | 3 +- mkspecs/features/qsettingstranslator.prf | 2 +- qbs/Qt/settingsgenerator/module.qbs | 42 ++++++++++++++++++++++++ qtmvvm.pro | 3 +- 4 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 qbs/Qt/settingsgenerator/module.qbs diff --git a/deploy.json b/deploy.json index 0eedd57..fa7d357 100644 --- a/deploy.json +++ b/deploy.json @@ -18,6 +18,7 @@ "path": "LICENSE" }, "installs": { - "ProjectTemplate": "Tools/QtCreator/share/qtcreator/templates/wizards/projects/qtmvvm" + "ProjectTemplate": "Tools/QtCreator/share/qtcreator/templates/wizards/projects/qtmvvm", + "qbs/Qt/settingsgenerator": "Tools/QtCreator/share/qtcreator/qbs/share/qbs/modules/Qt/settingsgenerator" } } diff --git a/mkspecs/features/qsettingstranslator.prf b/mkspecs/features/qsettingstranslator.prf index 478bc86..9cddcc5 100644 --- a/mkspecs/features/qsettingstranslator.prf +++ b/mkspecs/features/qsettingstranslator.prf @@ -11,7 +11,7 @@ QSETTINGSTRANSLATOR_DIR = $$QSETTINGSTRANSLATOR_DIR$$SUFFIX !ReleaseBuild: { qsettingstranslator_c.name = qsettingsgenerator --translate ${QMAKE_FILE_IN} - qsettingstranslator_c.input = SETTINGS_TRANSLATIONS #TODO compability + qsettingstranslator_c.input = SETTINGS_TRANSLATIONS qsettingstranslator_c.variable_out = CPP_DUMMIES qsettingstranslator_c.commands = $$QMAKE_QSETTINGSGENERATOR --translate --in ${QMAKE_FILE_IN} --impl ${QMAKE_FILE_OUT} qsettingstranslator_c.output = $$QSETTINGSTRANSLATOR_DIR/${QMAKE_FILE_BASE}.tsdummy$${first(QMAKE_EXT_CPP)} diff --git a/qbs/Qt/settingsgenerator/module.qbs b/qbs/Qt/settingsgenerator/module.qbs new file mode 100644 index 0000000..2e105c9 --- /dev/null +++ b/qbs/Qt/settingsgenerator/module.qbs @@ -0,0 +1,42 @@ +import qbs +import qbs.FileInfo + +Module { + Depends { name: "Qt.mvvmcore" } + + property string qsettingsgeneratorName: "qsettingsgenerator" + + version: Qt.mvvmcore.version + + FileTagger { + fileTags: ["settings-xml"] + patterns: ["*.settings.xml"] + } + + Rule { + inputs: ["settings-xml"] + + Artifact { + filePath: input.baseName + ".h" + fileTags: ["hpp"] + } + Artifact { + filePath: input.baseName + ".cpp" + fileTags: ["cpp"] + } + + prepare: { + var cmd = new Command(); + cmd.description = "generating settings class" + input.fileName; + cmd.highlight = "codegen"; + cmd.program = FileInfo.joinPaths(product.moduleProperty("Qt.core", "binPath"), + product.moduleProperty("Qt.restbuilder", "qsettingsgeneratorName")); + cmd.arguments = [ + "--in", input.filePath, + "--header", outputs["hpp"][0].filePath, + "--impl", outputs["cpp"][0].filePath + ]; + return cmd; + } + } +} diff --git a/qtmvvm.pro b/qtmvvm.pro index deb8d67..a1b453f 100644 --- a/qtmvvm.pro +++ b/qtmvvm.pro @@ -23,4 +23,5 @@ sub_runtest.depends += sub-tests QMAKE_EXTRA_TARGETS += sub_runtest runtests DISTFILES += .qmake.conf \ - sync.profile + sync.profile \ + qbs/Qt/settingsgenerator/*