From b59a43f57ecc290d6798a29402256c169f5b1bd2 Mon Sep 17 00:00:00 2001 From: Szymon Tomasz Stefanek Date: Thu, 27 Aug 2015 04:16:03 +0200 Subject: More work on theme packing --- src/modules/theme/libkvitheme.cpp | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'src/modules/theme/libkvitheme.cpp') 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 [ [... ]] + theme.pack @description: Creates a *.kvt package containing a set of KVIrc themes.[br] 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) 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. - 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. + 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;iat(i); + if(!v) + continue; // ? + QString szVal; + v->asString(szVal); + if(szVal.isEmpty()) + continue; + lThemeList.append(szVal); + } + KviPointerList lThemeInfoList; lThemeInfoList.setAutoDelete(true); -- cgit v1.3.1-10-gc9f91