diff options
author | Mavridis Philippe <mavridisf@gmail.com> | 2024-08-07 19:13:02 +0300 |
---|---|---|
committer | Mavridis Philippe <mavridisf@gmail.com> | 2024-08-07 19:23:24 +0300 |
commit | 04b5a62b8d9f5ff8240f25361046f2a5d58e8262 (patch) | |
tree | 98b126454cdf68d544e138d7e8b31d5fd45b72c2 /kue/pluginloader.cpp | |
parent | 83ba00b7e569587d50383ff06a70148042ca780e (diff) | |
download | tdegames-feat/kue.tar.gz tdegames-feat/kue.zip |
Add Kue billiards gamefeat/kue
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'kue/pluginloader.cpp')
-rw-r--r-- | kue/pluginloader.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/kue/pluginloader.cpp b/kue/pluginloader.cpp new file mode 100644 index 00000000..39a64d63 --- /dev/null +++ b/kue/pluginloader.cpp @@ -0,0 +1,40 @@ +#include <tqstring.h> +#include <tqvaluelist.h> +#include <tdeglobal.h> +#include <kstandarddirs.h> +#include <tqfile.h> +#include <ksimpleconfig.h> +#include <limits.h> + +#include "pluginloader.h" + +TQValueList<KuePluginInfo> KuePluginLoader::available() { + TQValueList<KuePluginInfo> items; + + TQStringList files=TDEGlobal::dirs()->findAllResources("appdata", "*.plugin", false, true); + for (TQStringList::Iterator i=files.begin(); i!=files.end(); ++i) { + items.append(getInformation(*i)); + } + + return items; +} + +KuePluginInfo KuePluginLoader::getInformation(const TQString &filename) { + KuePluginInfo info; + + if (!TQFile::exists(filename)) + return info; + + KSimpleConfig file(filename); + + info.filename = file.readPathEntry("Filename"); + info.type = file.readEntry("Type"); + info.name = file.readEntry("Name"); + info.description = file.readEntry("Description"); + + info.minTeams = TQMAX(file.readUnsignedNumEntry("MinTeams", 1), 1); + info.maxTeams = TQMAX(file.readUnsignedNumEntry("MaxTeams", UINT_MAX), 1); + + return info; +} + |