diff options
| author | 2015-08-27 04:16:03 +0200 | |
|---|---|---|
| committer | 2015-08-27 04:16:03 +0200 | |
| commit | b59a43f57ecc290d6798a29402256c169f5b1bd2 (patch) | |
| tree | 33a115a647c2a8acdf38181026b141407dc12ffd /src/modules/theme/libkvitheme.cpp | |
| parent | Merge branch 'master' of https://github.com/kvirc/KVIrc (diff) | |
| download | KVIrc-b59a43f57ecc290d6798a29402256c169f5b1bd2.tar.gz KVIrc-b59a43f57ecc290d6798a29402256c169f5b1bd2.tar.bz2 KVIrc-b59a43f57ecc290d6798a29402256c169f5b1bd2.zip | |
More work on theme packing
Diffstat (limited to 'src/modules/theme/libkvitheme.cpp')
| -rw-r--r-- | src/modules/theme/libkvitheme.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/modules/theme/libkvitheme.cpp b/src/modules/theme/libkvitheme.cpp index 206846dbc..46b8d671c 100644 --- a/src/modules/theme/libkvitheme.cpp +++ b/src/modules/theme/libkvitheme.cpp @@ -25,6 +25,7 @@ #include "ThemeManagementDialog.h" #include "ThemeFunctions.h" +#include "KviKvsArrayCast.h" #include "KviMessageBox.h" #include "KviModule.h" #include "KviLocale.h" @@ -267,7 +268,7 @@ static bool theme_kvs_cmd_dialog(KviKvsModuleCommandCall *c) @short: Creates a kvt package containing a set of themes @syntax: - theme.pack <package_path> <package_name> <package_version> <package_description> <package_author> <package_image> <theme_path> [<theme_path> [<theme_path>... ]] + theme.pack <package_path> <package_name> <package_version> <package_description> <package_author> <package_image> <themes> @description: Creates a *.kvt package containing a set of KVIrc themes.[br] <package_path> is the absolute path and file name of the package that should be saved.[br] @@ -278,13 +279,14 @@ static bool theme_kvs_cmd_dialog(KviKvsModuleCommandCall *c) <package_image> is the path of an image to be used as package rappresentative image. If the package is going to contain a single theme you may specify the theme's screenshot here. Pass an empty string if you don't want an image to be stored in the package. - <theme_path> is a path to a directory containing a theme as it's exported by kvirc, - may be repeated more than once to pack multiple themes within a single package. + <theme> is a either a single path to a directory containing a theme as it's exported by kvirc, + or an array of such paths. */ static bool theme_kvs_cmd_pack(KviKvsModuleCommandCall * c) { QString szPath,szName,szVersion,szDescription,szAuthor,szImage; - QStringList lThemeList; + + KviKvsArrayCast aCast; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("package_path",KVS_PT_NONEMPTYSTRING,0,szPath) @@ -293,9 +295,31 @@ static bool theme_kvs_cmd_pack(KviKvsModuleCommandCall * c) KVSM_PARAMETER("package_description",KVS_PT_STRING,0,szDescription) KVSM_PARAMETER("package_author",KVS_PT_NONEMPTYSTRING,0,szAuthor) KVSM_PARAMETER("package_image",KVS_PT_STRING,0,szImage) - KVSM_PARAMETER("theme",KVS_PT_STRINGLIST,0,lThemeList) + KVSM_PARAMETER("theme",KVS_PT_ARRAYCAST,0,aCast) KVSM_PARAMETERS_END(c) + KviKvsArray * pArray = aCast.array(); + if((!pArray) || (pArray->size() < 1)) + { + c->error(__tr2qs_ctx("No themes specified","theme")); + return false; + } + + kvs_uint_t s = pArray->size(); + QStringList lThemeList; + + for(kvs_uint_t i=0;i<s;i++) + { + KviKvsVariant * v = pArray->at(i); + if(!v) + continue; // ? + QString szVal; + v->asString(szVal); + if(szVal.isEmpty()) + continue; + lThemeList.append(szVal); + } + KviPointerList<KviThemeInfo> lThemeInfoList; lThemeInfoList.setAutoDelete(true); |
