Browse Source

add generator qbs mod

pull/2/head
Skycoder42 6 years ago
parent
commit
43ffeb8549
No known key found for this signature in database GPG Key ID: 8E01AD9EF0578D2B
  1. 3
      deploy.json
  2. 2
      mkspecs/features/qsettingstranslator.prf
  3. 42
      qbs/Qt/settingsgenerator/module.qbs
  4. 3
      qtmvvm.pro

3
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"
}
}

2
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)}

42
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;
}
}
}

3
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/*

Loading…
Cancel
Save